Uniforms.hlsl 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. #ifndef D3D11
  2. // D3D9 uniforms (no constant buffers)
  3. #ifdef COMPILEVS
  4. // Vertex shader uniforms
  5. uniform float3 cAmbientStartColor;
  6. uniform float3 cAmbientEndColor;
  7. #ifdef BILLBOARD
  8. uniform float3x3 cBillboardRot;
  9. #endif
  10. uniform float3 cCameraPos;
  11. uniform float cNearClip;
  12. uniform float cFarClip;
  13. uniform float4 cDepthMode;
  14. uniform float cDeltaTime;
  15. uniform float cElapsedTime;
  16. uniform float3 cFrustumSize;
  17. uniform float4 cGBufferOffsets;
  18. uniform float4 cLightPos;
  19. uniform float3 cLightDir;
  20. uniform float4 cNormalOffsetScale;
  21. uniform float4x3 cModel;
  22. uniform float4x3 cView;
  23. uniform float4x3 cViewInv;
  24. uniform float4x4 cViewProj;
  25. uniform float4 cUOffset;
  26. uniform float4 cVOffset;
  27. uniform float4x3 cZone;
  28. #ifdef SKINNED
  29. uniform float4x3 cSkinMatrices[MAXBONES];
  30. #endif
  31. #ifdef NUMVERTEXLIGHTS
  32. uniform float4 cVertexLights[4*3];
  33. #else
  34. uniform float4x4 cLightMatrices[4];
  35. #endif
  36. #endif
  37. #ifdef COMPILEPS
  38. // Pixel shader uniforms
  39. uniform float4 cAmbientColor;
  40. uniform float3 cCameraPosPS;
  41. uniform float cDeltaTimePS;
  42. uniform float4 cDepthReconstruct;
  43. uniform float cElapsedTimePS;
  44. uniform float4 cFogParams;
  45. uniform float3 cFogColor;
  46. uniform float2 cGBufferInvSize;
  47. uniform float4 cLightColor;
  48. uniform float4 cLightPosPS;
  49. uniform float3 cLightDirPS;
  50. uniform float4 cNormalOffsetScalePS;
  51. uniform float4 cMatDiffColor;
  52. uniform float3 cMatEmissiveColor;
  53. uniform float3 cMatEnvMapColor;
  54. uniform float4 cMatSpecColor;
  55. #ifdef PBR
  56. uniform float cRoughness;
  57. uniform float cMetallic;
  58. #endif
  59. uniform float cNearClipPS;
  60. uniform float cFarClipPS;
  61. uniform float4 cShadowCubeAdjust;
  62. uniform float4 cShadowDepthFade;
  63. uniform float2 cShadowIntensity;
  64. uniform float2 cShadowMapInvSize;
  65. uniform float4 cShadowSplits;
  66. uniform float4x4 cLightMatricesPS[4];
  67. #ifdef VSM_SHADOW
  68. uniform float2 cVSMShadowParams;
  69. #endif
  70. #endif
  71. #else
  72. // D3D11 uniforms (using constant buffers)
  73. #ifdef COMPILEVS
  74. // Vertex shader uniforms
  75. cbuffer FrameVS : register(b0)
  76. {
  77. float cDeltaTime;
  78. float cElapsedTime;
  79. }
  80. cbuffer CameraVS : register(b1)
  81. {
  82. float3 cCameraPos;
  83. float cNearClip;
  84. float cFarClip;
  85. float4 cDepthMode;
  86. float3 cFrustumSize;
  87. float4 cGBufferOffsets;
  88. float4x3 cView;
  89. float4x3 cViewInv;
  90. float4x4 cViewProj;
  91. float4 cClipPlane;
  92. }
  93. cbuffer ZoneVS : register(b2)
  94. {
  95. float3 cAmbientStartColor;
  96. float3 cAmbientEndColor;
  97. float4x3 cZone;
  98. }
  99. cbuffer LightVS : register(b3)
  100. {
  101. float4 cLightPos;
  102. float3 cLightDir;
  103. float4 cNormalOffsetScale;
  104. #ifdef NUMVERTEXLIGHTS
  105. float4 cVertexLights[4 * 3];
  106. #else
  107. float4x4 cLightMatrices[4];
  108. #endif
  109. }
  110. #ifndef CUSTOM_MATERIAL_CBUFFER
  111. cbuffer MaterialVS : register(b4)
  112. {
  113. float4 cUOffset;
  114. float4 cVOffset;
  115. }
  116. #endif
  117. cbuffer ObjectVS : register(b5)
  118. {
  119. float4x3 cModel;
  120. #ifdef BILLBOARD
  121. float3x3 cBillboardRot;
  122. #endif
  123. #ifdef SKINNED
  124. uniform float4x3 cSkinMatrices[MAXBONES];
  125. #endif
  126. }
  127. #endif
  128. #ifdef COMPILEPS
  129. // Pixel shader uniforms
  130. cbuffer FramePS : register(b0)
  131. {
  132. float cDeltaTimePS;
  133. float cElapsedTimePS;
  134. }
  135. cbuffer CameraPS : register(b1)
  136. {
  137. float3 cCameraPosPS;
  138. float4 cDepthReconstruct;
  139. float2 cGBufferInvSize;
  140. float cNearClipPS;
  141. float cFarClipPS;
  142. }
  143. cbuffer ZonePS : register(b2)
  144. {
  145. float4 cAmbientColor;
  146. float4 cFogParams;
  147. float3 cFogColor;
  148. }
  149. cbuffer LightPS : register(b3)
  150. {
  151. float4 cLightColor;
  152. float4 cLightPosPS;
  153. float3 cLightDirPS;
  154. float4 cNormalOffsetScalePS;
  155. float4 cShadowCubeAdjust;
  156. float4 cShadowDepthFade;
  157. float2 cShadowIntensity;
  158. float2 cShadowMapInvSize;
  159. float4 cShadowSplits;
  160. float2 cVSMShadowParams;
  161. float4x4 cLightMatricesPS[4];
  162. }
  163. #ifndef CUSTOM_MATERIAL_CBUFFER
  164. cbuffer MaterialPS : register(b4)
  165. {
  166. float4 cMatDiffColor;
  167. float3 cMatEmissiveColor;
  168. float3 cMatEnvMapColor;
  169. float4 cMatSpecColor;
  170. #ifdef PBR
  171. float cRoughness;
  172. float cMetallic;
  173. #endif
  174. }
  175. #endif
  176. #endif
  177. #endif