testss
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
||||
|
||||
#if SRC_TEXTURE2D_X_ARRAY
|
||||
TEXTURE2D_ARRAY(_SourceTex);
|
||||
#else
|
||||
TEXTURE2D(_SourceTex);
|
||||
#endif
|
||||
|
||||
SamplerState sampler_LinearClamp;
|
||||
uniform uint _SourceTexArraySlice;
|
||||
uniform uint _SRGBRead;
|
||||
uniform uint _SRGBWrite;
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
uint vertexID : SV_VertexID;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
Varyings VertQuad(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
output.positionCS = GetQuadVertexPosition(input.vertexID) * float4(_ScaleBiasRt.x, _ScaleBiasRt.y, 1, 1) + float4(_ScaleBiasRt.z, _ScaleBiasRt.w, 0, 0);
|
||||
output.positionCS.xy = output.positionCS.xy * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f); //convert to -1..1
|
||||
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
// Unity viewport convention is bottom left as origin. Adjust Scalebias to read the correct region.
|
||||
_ScaleBias.w = 1 - _ScaleBias.w - _ScaleBias.y;
|
||||
#endif
|
||||
output.texcoord = GetQuadTexCoord(input.vertexID) * _ScaleBias.xy + _ScaleBias.zw;
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 FragBilinear(Varyings input) : SV_Target
|
||||
{
|
||||
float4 outColor;
|
||||
|
||||
#if SRC_TEXTURE2D_X_ARRAY
|
||||
outColor = SAMPLE_TEXTURE2D_ARRAY(_SourceTex, sampler_LinearClamp, input.texcoord.xy, _SourceTexArraySlice);
|
||||
#else
|
||||
outColor = SAMPLE_TEXTURE2D(_SourceTex, sampler_LinearClamp, input.texcoord.xy);
|
||||
#endif
|
||||
|
||||
if (_SRGBRead && _SRGBWrite)
|
||||
return outColor;
|
||||
|
||||
if (_SRGBRead)
|
||||
outColor = SRGBToLinear(outColor);
|
||||
|
||||
if (_SRGBWrite)
|
||||
outColor = LinearToSRGB(outColor);
|
||||
|
||||
return outColor;
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
Shader "Hidden/Universal Render Pipeline/XR/XRMirrorView"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderPipeline" = "UniversalPipeline" }
|
||||
|
||||
HLSLINCLUDE
|
||||
#pragma exclude_renderers gles
|
||||
ENDHLSL
|
||||
|
||||
// 0: TEXTURE2D
|
||||
Pass
|
||||
{
|
||||
ZWrite Off ZTest Always Blend Off Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex VertQuad
|
||||
#pragma fragment FragBilinear
|
||||
|
||||
#define SRC_TEXTURE2D_X_ARRAY 0
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/XR/XRMirrorView.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
// 1: TEXTURE2D_ARRAY
|
||||
Pass
|
||||
{
|
||||
ZWrite Off ZTest Always Blend Off Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex VertQuad
|
||||
#pragma fragment FragBilinear
|
||||
|
||||
#define SRC_TEXTURE2D_X_ARRAY 1
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/XR/XRMirrorView.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
Fallback Off
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
Shader "Hidden/Universal Render Pipeline/XR/XROcclusionMesh"
|
||||
{
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
#pragma exclude_renderers d3d11_9x gles
|
||||
#pragma multi_compile _ XR_OCCLUSION_MESH_COMBINED
|
||||
|
||||
// Not all platforms properly support SV_RenderTargetArrayIndex
|
||||
#if defined(SHADER_API_D3D11) || defined(SHADER_API_VULKAN) || defined(SHADER_API_GLCORE) || defined(SHADER_API_GLES3) || defined(SHADER_API_PSSL)
|
||||
#define USE_XR_OCCLUSION_MESH_COMBINED XR_OCCLUSION_MESH_COMBINED
|
||||
#endif
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
|
||||
#if USE_XR_OCCLUSION_MESH_COMBINED
|
||||
uint rtArrayIndex : SV_RenderTargetArrayIndex;
|
||||
#endif
|
||||
};
|
||||
|
||||
Varyings Vert(Attributes input)
|
||||
{
|
||||
Varyings output;
|
||||
output.vertex = float4(input.vertex.xy * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), UNITY_NEAR_CLIP_VALUE, 1.0f);
|
||||
|
||||
#if USE_XR_OCCLUSION_MESH_COMBINED
|
||||
output.rtArrayIndex = input.vertex.z;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 Frag() : SV_Target
|
||||
{
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
ENDHLSL
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderPipeline" = "UniversalPipeline" }
|
||||
|
||||
Pass
|
||||
{
|
||||
ZWrite On ZTest Always Blend Off Cull Off
|
||||
ColorMask 0
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
Fallback Off
|
||||
}
|
Reference in New Issue
Block a user