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.

229 lines
8.0 KiB

  1. // Copyright (C) Microsoft Corporation. All Rights Reserved.
  2. #ifndef _D3DDM_HPP
  3. #define _D3DDM_HPP
  4. #define D3DDM_VERSION 0xDBDB0003 // version tag
  5. // base names for shared memory segments
  6. #define D3DDM_TGTCTX_SM "D3DDM_DTC_" // tgt pid
  7. #define D3DDM_MONCTX_SM "D3DDM_DMC_" // mon id
  8. #define D3DDM_CMDDATA_SM "D3DDM_CD_" // mon id
  9. #define D3DDM_TSHFILE_SM "D3DDM_TSF_" // tgt pid; target shader -> file association
  10. #define D3DDM_IMAGE_SM "D3DDM_I_" // 0..n
  11. // base names for events
  12. #define D3DDM_TGT_EVENTBP "D3DDM_TEBP_" // tgt pid
  13. #define D3DDM_TGT_EVENTACK "D3DDM_TEACK_" // tgt pid
  14. #define D3DDM_MON_EVENTCMD "D3DDM_MECMD_" // mon id
  15. #define D3DDM_MAX_BP 32 // max number of breakpoints for all types
  16. // event definitions - can set more than one in single word so they
  17. // can be used as breakpoint enables
  18. #define D3DDM_EVENT_RSTOKEN (1<<0)
  19. #define D3DDM_EVENT_BEGINSCENE (1<<1)
  20. #define D3DDM_EVENT_ENDSCENE (1<<2)
  21. #define D3DDM_EVENT_VERTEX (1<<8)
  22. #define D3DDM_EVENT_VERTEXSHADERINST (2<<8)
  23. #define D3DDM_EVENT_VERTEXSHADER (3<<8)
  24. #define D3DDM_EVENT_PRIMITIVE (1<<15)
  25. #define D3DDM_EVENT_PIXEL (1<<16)
  26. #define D3DDM_EVENT_PIXELSHADERINST (1<<17)
  27. #define D3DDM_EVENT_PIXELSHADER (1<<18)
  28. #define D3DDM_EVENT_TARGETDISCONNECT (1<<30)
  29. #define D3DDM_EVENT_TARGETEXIT (1<<31)
  30. // command definitions - command enum is in upper 16 bits so lower 16
  31. // can be used to send command specific parameter information
  32. #define D3DDM_CMD_MASK (0xffff<<16)
  33. #define D3DDM_CMD_GO (1<<16)
  34. #define D3DDM_CMD_GETDEVICESTATE (2<<16)
  35. #define D3DDM_CMD_GETTEXTURESTATE (3<<16)
  36. #define D3DDM_CMD_GETPRIMITIVESTATE (4<<16)
  37. #define D3DDM_CMD_GETVERTEXSHADER (5<<16)
  38. #define D3DDM_CMD_GETVERTEXSTATE (8<<16)
  39. #define D3DDM_CMD_GETVERTEXSHADERCONST (9<<16)
  40. #define D3DDM_CMD_GETVERTEXSHADERINST (10<<16) // 15:00 shader instruction
  41. #define D3DDM_CMD_GETVERTEXSHADERSTATE (11<<16)
  42. #define D3DDM_CMD_GETPIXELSTATE (16<<16) // 01:00 pixel selection from 2x2 grid
  43. #define D3DDM_CMD_GETPIXELSHADERCONST (17<<16)
  44. #define D3DDM_CMD_GETPIXELSHADERINST (18<<16) // 15:00 shader instruction
  45. #define D3DDM_CMD_GETPIXELSHADERSTATE (19<<16)
  46. #define D3DDM_CMD_DUMPTEXTURE (32<<16) // 03:00 SM selection (up to 16)
  47. // 06:04 texture stage (0..7)
  48. // 10:07 LOD (0..15)
  49. // 15:11 cubemap or volume slice (0..31)
  50. #define D3DDM_CMD_DUMPRENDERTARGET (33<<16) // 03:00 SM selection (up to 16)
  51. const UINT D3DDM_MAX_TSSSTAGES = 8;
  52. const UINT D3DDM_MAX_TSSVALUE = 32;
  53. const UINT D3DDM_MAX_RS = 256;
  54. const UINT D3DDM_MAX_VSDECL = 128;
  55. const UINT D3DDM_MAX_VSINPUTREG = 16;
  56. const UINT D3DDM_MAX_VSCONSTREG = 128;
  57. const UINT D3DDM_MAX_VSTEMPREG = 12;
  58. const UINT D3DDM_MAX_VSRASTOUTREG = 3;
  59. const UINT D3DDM_MAX_VSATTROUTREG = 2;
  60. const UINT D3DDM_MAX_VSTEXCRDOUTREG = 8;
  61. const UINT D3DDM_MAX_VSINSTDWORD = 32;
  62. const UINT D3DDM_MAX_VSINSTSTRING = 128;
  63. const UINT D3DDM_MAX_PSINPUTREG = 2;
  64. const UINT D3DDM_MAX_PSCONSTREG = 8;
  65. const UINT D3DDM_MAX_PSTEMPREG = 2;
  66. const UINT D3DDM_MAX_PSTEXTREG = 8;
  67. const UINT D3DDM_MAX_PSINSTDWORD = 32;
  68. const UINT D3DDM_MAX_PSINSTSTRING = 128;
  69. // structs for command data
  70. typedef struct _D3DDMDeviceState
  71. {
  72. UINT32 TextureStageState[D3DDM_MAX_TSSSTAGES][D3DDM_MAX_TSSVALUE];
  73. UINT32 RenderState[D3DDM_MAX_RS];
  74. UINT32 VertexShaderHandle;
  75. UINT32 PixelShaderHandle;
  76. UINT MaxVShaderHandle;
  77. UINT MaxPShaderHandle;
  78. } D3DDMDeviceState;
  79. typedef struct _D3DDMTextureState
  80. {
  81. } D3DDMTextureState;
  82. typedef struct _D3DDMVertexShader
  83. {
  84. UINT32 Decl[D3DDM_MAX_VSDECL];
  85. // followed by user data
  86. } D3DDMVertexShader;
  87. typedef struct _D3DDMVertexState
  88. {
  89. FLOAT InputRegs[D3DDM_MAX_VSINPUTREG][4];
  90. } D3DDMVertexState;
  91. typedef struct _D3DDMVertexShaderConst
  92. {
  93. FLOAT ConstRegs[D3DDM_MAX_VSCONSTREG][4];
  94. } D3DDMVertexShaderConst;
  95. typedef struct _D3DDMVertexShaderInst
  96. {
  97. DWORD Inst[D3DDM_MAX_VSINSTDWORD];
  98. char InstString[D3DDM_MAX_VSINSTSTRING];
  99. } D3DDMVertexShaderInst;
  100. typedef struct _D3DDMVertexShaderState
  101. {
  102. UINT CurrentInst;
  103. FLOAT TempRegs[D3DDM_MAX_VSTEMPREG][4];
  104. FLOAT AddressReg[4];
  105. FLOAT RastOutRegs[D3DDM_MAX_VSRASTOUTREG][4];
  106. FLOAT AttrOutRegs[D3DDM_MAX_VSATTROUTREG][4];
  107. FLOAT TexCrdOutRegs[D3DDM_MAX_VSTEXCRDOUTREG][4];
  108. } D3DDMVertexShaderState;
  109. typedef struct _D3DDMPrimState
  110. {
  111. } D3DDMPrimState;
  112. typedef struct _D3DDMPixelState
  113. {
  114. UINT Location[2];
  115. FLOAT Depth;
  116. FLOAT FogIntensity;
  117. FLOAT InputRegs[D3DDM_MAX_PSINPUTREG][4];
  118. } D3DDMPixelState;
  119. typedef struct _D3DDMPixelShaderConst
  120. {
  121. FLOAT ConstRegs[D3DDM_MAX_PSCONSTREG][4];
  122. } D3DDMPixelShaderConst;
  123. typedef struct _D3DDMPixelShaderInst
  124. {
  125. DWORD Inst[D3DDM_MAX_PSINSTDWORD];
  126. char InstString[D3DDM_MAX_PSINSTSTRING];
  127. } D3DDMPixelShaderInst;
  128. typedef struct _D3DDMPixelShaderState
  129. {
  130. UINT CurrentInst;
  131. FLOAT TempRegs[D3DDM_MAX_PSTEMPREG][4];
  132. FLOAT TextRegs[D3DDM_MAX_PSTEXTREG][4];
  133. BOOL Discard;
  134. } D3DDMPixelShaderState;
  135. // size of command data buffer - large enough for any (single) command,
  136. // the largest of which is the instruction + instruction comment (128KB)
  137. #define D3DDM_CMDDATA_SIZE 0x28000
  138. //
  139. // DebugMonitorContext & DebugTargetContext - Contexts for each side of the
  140. // target/monitor processes.
  141. //
  142. // DebugMonitorContext is R/W to monitor and RO to debug target. The only
  143. // exception is the TargetIDRequest, which is written by a target when
  144. // requesting to be connected to that monitor.
  145. //
  146. // The TargetBP (BreakPoint) event is signaled by the target whenever a
  147. // breakpoint is hit.
  148. //
  149. // The MonitorCmd (Command) event is signaled by the monitor when a command
  150. // is ready to be processed by the target, and the TargetAck is signaled
  151. // when the target is done processing the command. This is reversed during
  152. // target attachment, where the target signals (via MonitorCmd) the monitor
  153. // to look at it's TargetIDRequest and connect to that target, sending an
  154. // acknowledge to the target via TargetAck.
  155. //
  156. typedef struct _DebugMonitorContext
  157. {
  158. int MonitorID; // 1..X ID of monitor
  159. int TargetIDRequest; // pid of CMDing target; writeable by target
  160. int TargetID; // pid of attached target; zero if not connected
  161. UINT32 Command; // D3DDM_CMD_* token
  162. // breakpoint settings
  163. UINT32 EventBP;
  164. UINT64 VertexCountBP;
  165. UINT64 PrimitiveCountBP;
  166. UINT64 PixelCountBP;
  167. DWORD VertexShaderHandleBP;
  168. DWORD PixelShaderHandleBP;
  169. UINT32 RastVertexBPEnable;
  170. UINT32 PixelBPEnable;
  171. INT32 RastVertexBP[D3DDM_MAX_BP][2];
  172. UINT PixelBP[D3DDM_MAX_BP][2];
  173. } DebugMonitorContext;
  174. typedef struct _DebugTargetContext
  175. {
  176. DWORD Version; // version
  177. int ProcessID; // pid of this target
  178. int MonitorID; // ID of monitor; zero if not connected
  179. UINT32 CommandBufferSize; // size of data in command buffer
  180. // status/state
  181. UINT32 EventStatus;
  182. UINT32 SceneCount;
  183. UINT64 PrimitiveCount;
  184. UINT64 PixelCount;
  185. // The target side maintains dirty flags so the monitor side knows when to
  186. // requery target-side state.
  187. #define D3DDM_SC_DEVICESTATE (1<<0)
  188. #define D3DDM_SC_TEXTURE (1<<1)
  189. #define D3DDM_SC_PSSETSHADER (1<<2)
  190. #define D3DDM_SC_PSCONSTANTS (1<<3)
  191. #define D3DDM_SC_VSSETSHADER (1<<4)
  192. #define D3DDM_SC_VSCONSTANTS (1<<5)
  193. #define D3DDM_SC_VSMODIFYSHADERS (1<<6)
  194. #define D3DDM_SC_PSMODIFYSHADERS (1<<7)
  195. UINT32 StateChanged;
  196. } DebugTargetContext;
  197. #endif // _D3DDM_HPP