XROcclusionMesh.shader 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Shader "Hidden/Universal Render Pipeline/XR/XROcclusionMesh"
  2. {
  3. HLSLINCLUDE
  4. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  5. #pragma exclude_renderers d3d11_9x gles
  6. #pragma multi_compile _ XR_OCCLUSION_MESH_COMBINED
  7. // Not all platforms properly support SV_RenderTargetArrayIndex
  8. #if defined(SHADER_API_D3D11) || defined(SHADER_API_VULKAN) || defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3) || defined(SHADER_API_PSSL)
  9. #define USE_XR_OCCLUSION_MESH_COMBINED XR_OCCLUSION_MESH_COMBINED
  10. #endif
  11. struct Attributes
  12. {
  13. float4 vertex : POSITION;
  14. };
  15. struct Varyings
  16. {
  17. float4 vertex : SV_POSITION;
  18. #if USE_XR_OCCLUSION_MESH_COMBINED
  19. uint rtArrayIndex : SV_RenderTargetArrayIndex;
  20. #endif
  21. };
  22. Varyings Vert(Attributes input)
  23. {
  24. Varyings output;
  25. output.vertex = float4(input.vertex.xy * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), UNITY_NEAR_CLIP_VALUE, 1.0f);
  26. #if USE_XR_OCCLUSION_MESH_COMBINED
  27. output.rtArrayIndex = input.vertex.z;
  28. #endif
  29. return output;
  30. }
  31. float4 Frag() : SV_Target
  32. {
  33. return (0.0f).xxxx;
  34. }
  35. ENDHLSL
  36. SubShader
  37. {
  38. Tags{ "RenderPipeline" = "UniversalPipeline" }
  39. Pass
  40. {
  41. ZWrite On ZTest Always Blend Off Cull Off
  42. ColorMask 0
  43. HLSLPROGRAM
  44. #pragma vertex Vert
  45. #pragma fragment Frag
  46. ENDHLSL
  47. }
  48. }
  49. Fallback Off
  50. }