Advertisement
snake5

uniform variable definitions

Sep 30th, 2015
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. d3d9:
  2. float4x4 mView : register(c0);
  3. float4x4 mProj : register(c4);
  4. float4x4 mInvView : register(c8);
  5. float3 cameraPos : register(c12);
  6. float4 timeVals : register(c13);
  7. float3 gAmbLightColor : register(c14);
  8. float3 gDirLightDir : register(c15);
  9. float3 gDirLightColor : register(c16);
  10.  
  11. d3d11:
  12. cbuffer core_data : register(b0)
  13. {
  14.     matrix mView;
  15.     matrix mProj;
  16.     matrix mInvView;
  17.     float3 cameraPos;
  18.     float4 timeVals;
  19.     float3 gAmbLightColor;
  20.     float3 gDirLightDir;
  21.     float3 gDirLightColor;
  22. }
  23.  
  24. gles2:
  25. mat4 mView;
  26. mat4 mProj;
  27. mat4 mInvView;
  28. vec3 cameraPos;
  29. vec4 timeVals;
  30. vec3 gAmbLightColor;
  31. vec3 gDirLightDir;
  32. vec3 gDirLightColor;
  33.  
  34. gl4.2+ (3.1-4.2 without binding=0):
  35. layout(std140, binding = 0) uniform core_data
  36. {
  37.     mat4 mView;
  38.     mat4 mProj;
  39.     mat4 mInvView;
  40.     vec3 cameraPos;
  41.     vec4 timeVals;
  42.     vec3 gAmbLightColor;
  43.     vec3 gDirLightDir;
  44.     vec3 gDirLightColor;
  45. }
  46.  
  47. macros: (ignore typenames, they can be re#defined)
  48. UNIFORM_BLOCK(core_data, 0)
  49. {
  50.     UNIFORM_VAR(matrix mView, 0);
  51.     UNIFORM_VAR(matrix mProj, 4);
  52.     UNIFORM_VAR(matrix mInvView, 8);
  53.     UNIFORM_VAR(float3 cameraPos, 12);
  54.     UNIFORM_VAR(float4 timeVals, 13);
  55.     UNIFORM_VAR(float3 gAmbLightColor, 14);
  56.     UNIFORM_VAR(float3 gDirLightDir, 15);
  57.     UNIFORM_VAR(float3 gDirLightColor, 16);
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement