DxbcSignatures.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // DxbcSignatures.h //
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. // This file is distributed under the University of Illinois Open Source //
  6. // License. See LICENSE.TXT for details. //
  7. // //
  8. // Declaration of shader parameter structs in DXBC container. //
  9. // //
  10. ///////////////////////////////////////////////////////////////////////////////
  11. #pragma once
  12. typedef D3D_NAME D3D10_NAME;
  13. typedef D3D_REGISTER_COMPONENT_TYPE D3D10_REGISTER_COMPONENT_TYPE;
  14. typedef struct _D3D11_INTERNALSHADER_PARAMETER_FOR_GS
  15. {
  16. UINT Stream; // Stream index (parameters must appear in non-decreasing stream order)
  17. UINT SemanticName; // Offset to LPCSTR
  18. UINT SemanticIndex; // Semantic Index
  19. D3D10_NAME SystemValue; // Internally defined enumeration
  20. D3D10_REGISTER_COMPONENT_TYPE ComponentType; // Type of of bits
  21. UINT Register; // Register Index
  22. BYTE Mask; // Combination of D3D10_COMPONENT_MASK values
  23. // The following unioned fields, NeverWrites_Mask and AlwaysReads_Mask, are exclusively used for
  24. // output signatures or input signatures, respectively.
  25. //
  26. // For an output signature, NeverWrites_Mask indicates that the shader the signature belongs to never
  27. // writes to the masked components of the output register. Meaningful bits are the ones set in Mask above.
  28. //
  29. // For an input signature, AlwaysReads_Mask indicates that the shader the signature belongs to always
  30. // reads the masked components of the input register. Meaningful bits are the ones set in the Mask above.
  31. //
  32. // This allows many shaders to share similar signatures even though some of them may not happen to use
  33. // all of the inputs/outputs - something which may not be obvious when authored. The NeverWrites_Mask
  34. // and AlwaysReads_Mask can be checked in a debug layer at runtime for the one interesting case: that a
  35. // shader that always reads a value is fed by a shader that always writes it. Cases where shaders may
  36. // read values or may not cannot be validated unfortunately.
  37. //
  38. // In scenarios where a signature is being passed around standalone (so it isn't tied to input or output
  39. // of a given shader), this union can be zeroed out in the absence of more information. This effectively
  40. // forces off linkage validation errors with the signature, since if interpreted as a input or output signature
  41. // somehow, since the meaning on output would be "everything is always written" and on input it would be
  42. // "nothing is always read".
  43. union
  44. {
  45. BYTE NeverWrites_Mask; // For an output signature, the shader the signature belongs to never
  46. // writes the masked components of the output register.
  47. BYTE AlwaysReads_Mask; // For an input signature, the shader the signature belongs to always
  48. // reads the masked components of the input register.
  49. };
  50. } D3D11_INTERNALSHADER_PARAMETER_FOR_GS, *LPD3D11_INTERNALSHADER_PARAMETER_FOR_GS;
  51. typedef struct _D3D11_INTERNALSHADER_PARAMETER_11_1
  52. {
  53. UINT Stream; // Stream index (parameters must appear in non-decreasing stream order)
  54. UINT SemanticName; // Offset to LPCSTR
  55. UINT SemanticIndex; // Semantic Index
  56. D3D10_NAME SystemValue; // Internally defined enumeration
  57. D3D10_REGISTER_COMPONENT_TYPE ComponentType; // Type of of bits
  58. UINT Register; // Register Index
  59. BYTE Mask; // Combination of D3D10_COMPONENT_MASK values
  60. // The following unioned fields, NeverWrites_Mask and AlwaysReads_Mask, are exclusively used for
  61. // output signatures or input signatures, respectively.
  62. //
  63. // For an output signature, NeverWrites_Mask indicates that the shader the signature belongs to never
  64. // writes to the masked components of the output register. Meaningful bits are the ones set in Mask above.
  65. //
  66. // For an input signature, AlwaysReads_Mask indicates that the shader the signature belongs to always
  67. // reads the masked components of the input register. Meaningful bits are the ones set in the Mask above.
  68. //
  69. // This allows many shaders to share similar signatures even though some of them may not happen to use
  70. // all of the inputs/outputs - something which may not be obvious when authored. The NeverWrites_Mask
  71. // and AlwaysReads_Mask can be checked in a debug layer at runtime for the one interesting case: that a
  72. // shader that always reads a value is fed by a shader that always writes it. Cases where shaders may
  73. // read values or may not cannot be validated unfortunately.
  74. //
  75. // In scenarios where a signature is being passed around standalone (so it isn't tied to input or output
  76. // of a given shader), this union can be zeroed out in the absence of more information. This effectively
  77. // forces off linkage validation errors with the signature, since if interpreted as a input or output signature
  78. // somehow, since the meaning on output would be "everything is always written" and on input it would be
  79. // "nothing is always read".
  80. union
  81. {
  82. BYTE NeverWrites_Mask; // For an output signature, the shader the signature belongs to never
  83. // writes the masked components of the output register.
  84. BYTE AlwaysReads_Mask; // For an input signature, the shader the signature belongs to always
  85. // reads the masked components of the input register.
  86. };
  87. D3D_MIN_PRECISION MinPrecision; // Minimum precision of input/output data
  88. } D3D11_INTERNALSHADER_PARAMETER_11_1, *LPD3D11_INTERNALSHADER_PARAMETER_11_1;
  89. typedef struct _D3D10_INTERNALSHADER_SIGNATURE
  90. {
  91. UINT Parameters; // Number of parameters
  92. UINT ParameterInfo; // Offset to D3D10_INTERNALSHADER_PARAMETER[Parameters]
  93. } D3D10_INTERNALSHADER_SIGNATURE, *LPD3D10_INTERNALSHADER_SIGNATURE;
  94. typedef struct _D3D10_INTERNALSHADER_PARAMETER
  95. {
  96. UINT SemanticName; // Offset to LPCSTR
  97. UINT SemanticIndex; // Semantic Index
  98. D3D10_NAME SystemValue; // Internally defined enumeration
  99. D3D10_REGISTER_COMPONENT_TYPE ComponentType; // Type of of bits
  100. UINT Register; // Register Index
  101. BYTE Mask; // Combination of D3D10_COMPONENT_MASK values
  102. // The following unioned fields, NeverWrites_Mask and AlwaysReads_Mask, are exclusively used for
  103. // output signatures or input signatures, respectively.
  104. //
  105. // For an output signature, NeverWrites_Mask indicates that the shader the signature belongs to never
  106. // writes to the masked components of the output register. Meaningful bits are the ones set in Mask above.
  107. //
  108. // For an input signature, AlwaysReads_Mask indicates that the shader the signature belongs to always
  109. // reads the masked components of the input register. Meaningful bits are the ones set in the Mask above.
  110. //
  111. // This allows many shaders to share similar signatures even though some of them may not happen to use
  112. // all of the inputs/outputs - something which may not be obvious when authored. The NeverWrites_Mask
  113. // and AlwaysReads_Mask can be checked in a debug layer at runtime for the one interesting case: that a
  114. // shader that always reads a value is fed by a shader that always writes it. Cases where shaders may
  115. // read values or may not cannot be validated unfortunately.
  116. //
  117. // In scenarios where a signature is being passed around standalone (so it isn't tied to input or output
  118. // of a given shader), this union can be zeroed out in the absence of more information. This effectively
  119. // forces off linkage validation errors with the signature, since if interpreted as a input or output signature
  120. // somehow, since the meaning on output would be "everything is always written" and on input it would be
  121. // "nothing is always read".
  122. union
  123. {
  124. BYTE NeverWrites_Mask; // For an output signature, the shader the signature belongs to never
  125. // writes the masked components of the output register.
  126. BYTE AlwaysReads_Mask; // For an input signature, the shader the signature belongs to always
  127. // reads the masked components of the input register.
  128. };
  129. } D3D10_INTERNALSHADER_PARAMETER, *LPD3D10_INTERNALSHADER_PARAMETER;