Advertisement
Guest User

Untitled

a guest
Mar 14th, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. //-----------------------------------------------------------------------------
  2. // Macros.fxh
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7.  
  8. #ifdef SM4
  9.  
  10. // Macros for targetting shader model 4.0 (DX11)
  11.  
  12. #define TECHNIQUE(name, vsname, psname ) \
  13. technique name { pass { VertexShader = compile vs_4_0_level_9_1 vsname (); PixelShader = compile ps_4_0_level_9_1 psname(); } }
  14.  
  15. #define BEGIN_CONSTANTS cbuffer Parameters : register(b0) {
  16. #define MATRIX_CONSTANTS
  17. #define END_CONSTANTS };
  18.  
  19. #define _vs(r)
  20. #define _ps(r)
  21. #define _cb(r)
  22.  
  23. #define DECLARE_TEXTURE(Name, index) \
  24. Texture2D<float4> Name : register(t##index); \
  25. sampler Name##Sampler : register(s##index)
  26.  
  27. #define DECLARE_CUBEMAP(Name, index) \
  28. TextureCube<float4> Name : register(t##index); \
  29. sampler Name##Sampler : register(s##index)
  30.  
  31. #define SAMPLE_TEXTURE(Name, texCoord) Name.Sample(Name##Sampler, texCoord)
  32. #define SAMPLE_CUBEMAP(Name, texCoord) Name.Sample(Name##Sampler, texCoord)
  33.  
  34.  
  35. #else
  36.  
  37.  
  38. // Macros for targetting shader model 2.0 (DX9)
  39.  
  40. #define TECHNIQUE(name, vsname, psname ) \
  41. technique name { pass { VertexShader = compile vs_2_0 vsname (); PixelShader = compile ps_2_0 psname(); } }
  42.  
  43. #define BEGIN_CONSTANTS
  44. #define MATRIX_CONSTANTS
  45. #define END_CONSTANTS
  46.  
  47. #define _vs(r) : register(vs, r)
  48. #define _ps(r) : register(ps, r)
  49. #define _cb(r)
  50.  
  51. #define DECLARE_TEXTURE(Name, index) \
  52. sampler2D Name : register(s##index);
  53.  
  54. #define DECLARE_CUBEMAP(Name, index) \
  55. samplerCUBE Name : register(s##index);
  56.  
  57. #define SAMPLE_TEXTURE(Name, texCoord) tex2D(Name, texCoord)
  58. #define SAMPLE_CUBEMAP(Name, texCoord) texCUBE(Name, texCoord)
  59.  
  60.  
  61. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement