Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
6.8 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1995-2000 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: ddi.h
  6. * Content: Direct3D DDI encapsulation implementations
  7. *
  8. *
  9. ***************************************************************************/
  10. #ifndef _DDIBASE_H
  11. #define _DDIBASE_H
  12. #include "d3ditype.h"
  13. #include "d3dhalp.h"
  14. extern char *HrToStr(HRESULT hr);
  15. class CD3DBase;
  16. struct _D3D8_DEVICEDATA;
  17. typedef struct _D3D8_DEVICEDATA D3D8_DEVICEDATA;
  18. class CSurface;
  19. class D3DFE_PROCESSVERTICES;
  20. class CBaseTexture;
  21. class CDriverVertexBuffer;
  22. struct CVStream;
  23. struct CVIndexStream;
  24. class CBaseSurface;
  25. class CResource;
  26. class CBuffer;
  27. /////////////////////////////////////////////////////////////////////////////
  28. // //
  29. // CD3DDDI //
  30. // //
  31. /////////////////////////////////////////////////////////////////////////////
  32. class CD3DDDI
  33. {
  34. protected:
  35. // DrawIndexedStream params
  36. UINT m_StartIndex;
  37. UINT m_MinVertexIndex;
  38. UINT m_NumVertices;
  39. int m_BaseVertexIndex;
  40. public:
  41. CD3DDDI();
  42. virtual ~CD3DDDI();
  43. //++++++++++++++ Interface which the PSGP is using ++++++++++++++++++++++++
  44. //
  45. // These functions are used when vertices are processed by D3D pipeline.
  46. // Internal driver buffers
  47. // D3D has three driver buffers: TL buffer, which contains primitive
  48. // vertices, command buffer, where drawing commands are recorded, and clip
  49. // buffer, where vertices, generated by clipper, are recorded. D3D maintains
  50. // count of vertices in the TL buffer (TL buffer vertex count) and an index
  51. // of the first vertex of the current primitive (primitive base). When a
  52. // drawing command is recorded, D3D records the current primitive base.
  53. // All drawing commands expect that vertices have already been copied to the
  54. // TL buffer (excluding DrawClippedPrim).
  55. //
  56. // If a flush occurs during recording a command, vertex buffer is not
  57. // flushed, because m_bWithinPrimitive is set to TRUE. So primitive base
  58. // and TL vertex count stay the same.
  59. //
  60. // When PSGP processes and clip a non-indexed primitive, it should update
  61. // primitive base and TL vertex count, using SkipVertices and
  62. // MovePrimitiveBase functions. AddVertices is not used, because DrawPrim()
  63. // functions calls AddVertices and MovePrimitiveBase inself.
  64. // Draw unclipped part of non-indexed primitive
  65. //
  66. // Parameters:
  67. // pv->lpvOut - pointer to the first vertex
  68. // pv->primType - primitiveType;
  69. // pv->dwNumVertices - vertexCount
  70. // pv->dwNumPrimitives - number of primitives
  71. // Remarks:
  72. // This function is used when vertices are processed by D3D pipeline.
  73. // The function inserts a new command to the command buffer.
  74. // Primitive base is increased by the number of vertices.
  75. // TL buffer vertex count is increased by the number of vertices.
  76. //
  77. virtual void DrawPrim(D3DFE_PROCESSVERTICES* pv) = 0;
  78. // Draw unclipped part of an indexed primitive
  79. //
  80. // Parameters:
  81. // pv->lpvOut - pointer to the first vertex of the whole
  82. // primitive
  83. // pv->primType - primitiveType
  84. // pv->dwNumPrimitives - number of primitives
  85. // pv->lpwIndices - pointer to the first index
  86. // pv->dwNumIndices - number of indices
  87. // pv->dwIndexSize - size of an index in bytes (2 or 4)
  88. // Remarks:
  89. // Vertices must be already copied to the TL buffer.
  90. // The function inserts a new command to the command buffer.
  91. // Indices are copied to the index buffer. Vertices must be in the TL
  92. // buffer already.
  93. // Primitive base and TL buffer vertex count are not changed.
  94. //
  95. virtual void DrawIndexPrim(D3DFE_PROCESSVERTICES* pv) = 0;
  96. // Draw a primitive, generated by clipper
  97. //
  98. // Parameters:
  99. // pv->lpvOut - pointer to the first vertex of the primitive
  100. // pv->primType - primitiveType
  101. // pv->dwNumVertices - vertex count
  102. // pv->dwNumPrimitives - number of primitives
  103. // Remarks:
  104. // Vertices are copied to the clipping buffer
  105. // The function inserts a new command to the command buffer.
  106. // Primitive base and TL buffer vertex count are not changed.
  107. //
  108. virtual void DrawClippedPrim(D3DFE_PROCESSVERTICES* pv) = 0;
  109. // Increase TL buffer vertex count
  110. //
  111. // The function addes the number of vertices to the current primitive
  112. // base. So when it is called several times without moving the primitive
  113. // base, only the last call will have effect.
  114. // This function should be called after vertices are added to the
  115. // TL buffer, but before a drawing function is called.
  116. //
  117. virtual void AddVertices(UINT NumVertices) = 0;
  118. // Decrease TL buffer vertex count
  119. //
  120. // This function should be called after vertices are added to the
  121. // TL buffer, but before a drawing function is called.
  122. //
  123. virtual void SubVertices(UINT NumVertices) = 0;
  124. // Update primitive base
  125. //
  126. // It should be called when some vertices are skipped because of clipping.
  127. // NumVertices could be negative,
  128. //
  129. virtual void MovePrimitiveBase(int NumVertices) = 0;
  130. // Update primitive base and TL buffer vertex count
  131. //
  132. // Call this function when some vertices in the vertex buffer are used
  133. // for clipping and should be skipped
  134. //
  135. virtual void SkipVertices(DWORD NumVertices) = 0;
  136. void SetIndexedPrimParams(UINT StartIndex, UINT MinIndex, UINT NumVertices,
  137. UINT BaseVertexIndex)
  138. {
  139. m_StartIndex = StartIndex;
  140. m_MinVertexIndex = MinIndex;
  141. m_NumVertices = NumVertices;
  142. m_BaseVertexIndex = BaseVertexIndex;
  143. }
  144. // Returns offset in bytes of the start vertex of the current primitive in
  145. // the current TL stream
  146. virtual DWORD GetCurrentPrimBase() {return 0;}
  147. //-------------------- End PSGP functions ---------------------------------
  148. };
  149. typedef CD3DDDI *LPD3DDDI;
  150. #endif /* _D3DIBASE_H */