OpenGL.hlsl 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // For now OpenGL is considered at GLES2 level
  2. #define UNITY_UV_STARTS_AT_TOP 0
  3. #define UNITY_REVERSED_Z 0
  4. #define UNITY_GATHER_SUPPORTED 0
  5. #define UNITY_CAN_READ_POSITION_IN_FRAGMENT_PROGRAM 1
  6. #define TEXTURE2D_SAMPLER2D(textureName, samplerName) sampler2D textureName
  7. #define TEXTURE3D_SAMPLER3D(textureName, samplerName) sampler3D textureName
  8. #define TEXTURE2D(textureName) sampler2D textureName
  9. #define SAMPLER2D(samplerName)
  10. #define TEXTURE3D(textureName) sampler3D textureName
  11. #define SAMPLER3D(samplerName)
  12. #define TEXTURE2D_ARGS(textureName, samplerName) sampler2D textureName
  13. #define TEXTURE2D_PARAM(textureName, samplerName) textureName
  14. #define TEXTURE3D_ARGS(textureName, samplerName) sampler3D textureName
  15. #define TEXTURE3D_PARAM(textureName, samplerName) textureName
  16. #define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) tex2D(textureName, coord2)
  17. #define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) tex2Dlod(textureName, float4(coord2, 0.0, lod))
  18. #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) tex3D(textureName, coord3)
  19. #define LOAD_TEXTURE2D(textureName, texelSize, icoord2) tex2D(textureName, icoord2 / texelSize)
  20. #define LOAD_TEXTURE2D_LOD(textureName, texelSize, icoord2) tex2Dlod(textureName, float4(icoord2 / texelSize, 0.0, lod))
  21. #define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r
  22. #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r
  23. #if SHADER_API_GLES
  24. # define UNITY_BRANCH
  25. # define UNITY_FLATTEN
  26. # define UNITY_UNROLL
  27. # define UNITY_LOOP
  28. # define UNITY_FASTOPT
  29. #else
  30. # define UNITY_BRANCH [branch]
  31. # define UNITY_FLATTEN [flatten]
  32. # define UNITY_UNROLL [unroll]
  33. # define UNITY_LOOP [loop]
  34. # define UNITY_FASTOPT [fastopt]
  35. #endif
  36. #define CBUFFER_START(name)
  37. #define CBUFFER_END
  38. #define FXAA_HLSL_3 1
  39. #define SMAA_HLSL_3 1
  40. // pragma exclude_renderers is only supported since Unity 2018.1 for compute shaders
  41. #if UNITY_VERSION < 201810 && !defined(SHADER_API_GLCORE)
  42. # define DISABLE_COMPUTE_SHADERS 1
  43. # define TRIVIAL_COMPUTE_KERNEL(name) [numthreads(1, 1, 1)] void name() {}
  44. #endif