Uniforms.hlsl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. uniform float cLightRad;
  59. uniform float cLightLength;
  60. #endif
  61. uniform float3 cZoneMin;
  62. uniform float3 cZoneMax;
  63. uniform float cNearClipPS;
  64. uniform float cFarClipPS;
  65. uniform float4 cShadowCubeAdjust;
  66. uniform float4 cShadowDepthFade;
  67. uniform float2 cShadowIntensity;
  68. uniform float2 cShadowMapInvSize;
  69. uniform float4 cShadowSplits;
  70. uniform float4x4 cLightMatricesPS[4];
  71. #ifdef VSM_SHADOW
  72. uniform float2 cVSMShadowParams;
  73. #endif
  74. #endif
  75. #else
  76. // D3D11 uniforms (using constant buffers)
  77. #ifdef COMPILEVS
  78. // Vertex shader uniforms
  79. cbuffer FrameVS : register(b0)
  80. {
  81. float cDeltaTime;
  82. float cElapsedTime;
  83. }
  84. cbuffer CameraVS : register(b1)
  85. {
  86. float3 cCameraPos;
  87. float cNearClip;
  88. float cFarClip;
  89. float4 cDepthMode;
  90. float3 cFrustumSize;
  91. float4 cGBufferOffsets;
  92. float4x3 cView;
  93. float4x3 cViewInv;
  94. float4x4 cViewProj;
  95. float4 cClipPlane;
  96. }
  97. cbuffer ZoneVS : register(b2)
  98. {
  99. float3 cAmbientStartColor;
  100. float3 cAmbientEndColor;
  101. float4x3 cZone;
  102. }
  103. cbuffer LightVS : register(b3)
  104. {
  105. float4 cLightPos;
  106. float3 cLightDir;
  107. float4 cNormalOffsetScale;
  108. #ifdef NUMVERTEXLIGHTS
  109. float4 cVertexLights[4 * 3];
  110. #else
  111. float4x4 cLightMatrices[4];
  112. #endif
  113. }
  114. #ifndef CUSTOM_MATERIAL_CBUFFER
  115. cbuffer MaterialVS : register(b4)
  116. {
  117. float4 cUOffset;
  118. float4 cVOffset;
  119. }
  120. #endif
  121. cbuffer ObjectVS : register(b5)
  122. {
  123. float4x3 cModel;
  124. #ifdef BILLBOARD
  125. float3x3 cBillboardRot;
  126. #endif
  127. #ifdef SKINNED
  128. uniform float4x3 cSkinMatrices[MAXBONES];
  129. #endif
  130. }
  131. #endif
  132. #ifdef COMPILEPS
  133. // Pixel shader uniforms
  134. cbuffer FramePS : register(b0)
  135. {
  136. float cDeltaTimePS;
  137. float cElapsedTimePS;
  138. }
  139. cbuffer CameraPS : register(b1)
  140. {
  141. float3 cCameraPosPS;
  142. float4 cDepthReconstruct;
  143. float2 cGBufferInvSize;
  144. float cNearClipPS;
  145. float cFarClipPS;
  146. }
  147. cbuffer ZonePS : register(b2)
  148. {
  149. float4 cAmbientColor;
  150. float4 cFogParams;
  151. float3 cFogColor;
  152. float3 cZoneMin;
  153. float3 cZoneMax;
  154. }
  155. cbuffer LightPS : register(b3)
  156. {
  157. float4 cLightColor;
  158. float4 cLightPosPS;
  159. float3 cLightDirPS;
  160. float4 cNormalOffsetScalePS;
  161. float4 cShadowCubeAdjust;
  162. float4 cShadowDepthFade;
  163. float2 cShadowIntensity;
  164. float2 cShadowMapInvSize;
  165. float4 cShadowSplits;
  166. float2 cVSMShadowParams;
  167. float4x4 cLightMatricesPS[4];
  168. #ifdef PBR
  169. float cLightRad;
  170. float cLightLength;
  171. #endif
  172. }
  173. #ifndef CUSTOM_MATERIAL_CBUFFER
  174. cbuffer MaterialPS : register(b4)
  175. {
  176. float4 cMatDiffColor;
  177. float3 cMatEmissiveColor;
  178. float3 cMatEnvMapColor;
  179. float4 cMatSpecColor;
  180. #ifdef PBR
  181. float cRoughness;
  182. float cMetallic;
  183. #endif
  184. }
  185. #endif
  186. #endif
  187. #endif