245 lines
7.7 KiB
GLSL
245 lines
7.7 KiB
GLSL
Shader "Hidden/Core/VrsVisualization"
|
|
{
|
|
Properties
|
|
{
|
|
}
|
|
SubShader
|
|
{
|
|
Pass
|
|
{
|
|
Name "VrsVisualization"
|
|
ZTest Always
|
|
ZWrite Off
|
|
Cull Off
|
|
GpuProgramID 5430
|
|
|
|
HLSLPROGRAM
|
|
|
|
// https://docs.unity3d.com/Manual/SL-PragmaDirectives.html
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma target 4.0
|
|
#pragma multi_compile _ STEREO_INSTANCING_ON
|
|
|
|
|
|
#ifndef STEREO_INSTANCING_ON
|
|
#define ANY_SHADER_VARIANT_ACTIVE
|
|
|
|
float4 _BlitScaleBias;
|
|
|
|
static float4 vertex_uniform_buffer_0[1];
|
|
static float4 gl_Position;
|
|
static int gl_VertexIndex;
|
|
static int gl_BaseVertexARB;
|
|
static float2 vertex_output_1;
|
|
|
|
struct Vertex_Stage_Input
|
|
{
|
|
uint gl_VertexIndex : SV_VertexID;
|
|
uint gl_BaseVertexARB : SV_StartVertexLocation;
|
|
};
|
|
|
|
struct Vertex_Stage_Output
|
|
{
|
|
float2 vertex_output_1 : TEXCOORD; // TEXCOORD
|
|
float4 gl_Position : SV_Position;
|
|
};
|
|
|
|
void vert_main()
|
|
{
|
|
float vertex_unnamed_31 = float(((uint(gl_VertexIndex) - uint(gl_BaseVertexARB)) << 1u) & 2u);
|
|
float vertex_unnamed_32 = float((uint(gl_VertexIndex) - uint(gl_BaseVertexARB)) & 2u);
|
|
gl_Position.x = mad(vertex_unnamed_31, 2.0f, -1.0f);
|
|
gl_Position.y = mad(vertex_unnamed_32, 2.0f, -1.0f);
|
|
precise float vertex_unnamed_42 = (-0.0f) - vertex_unnamed_32;
|
|
precise float vertex_unnamed_44 = vertex_unnamed_42 + 1.0f;
|
|
vertex_output_1.x = mad(vertex_unnamed_31, vertex_uniform_buffer_0[0u].x, vertex_uniform_buffer_0[0u].z);
|
|
vertex_output_1.y = mad(vertex_unnamed_44, vertex_uniform_buffer_0[0u].y, vertex_uniform_buffer_0[0u].w);
|
|
gl_Position.z = 1.0f;
|
|
gl_Position.w = 1.0f;
|
|
}
|
|
|
|
Vertex_Stage_Output vert(Vertex_Stage_Input stage_input)
|
|
{
|
|
vertex_uniform_buffer_0[0] = float4(_BlitScaleBias[0], _BlitScaleBias[1], _BlitScaleBias[2], _BlitScaleBias[3]);
|
|
|
|
gl_VertexIndex = int(stage_input.gl_VertexIndex + stage_input.gl_BaseVertexARB);
|
|
gl_BaseVertexARB = stage_input.gl_BaseVertexARB;
|
|
vert_main();
|
|
Vertex_Stage_Output stage_output;
|
|
stage_output.gl_Position = gl_Position;
|
|
stage_output.vertex_output_1 = vertex_output_1;
|
|
return stage_output;
|
|
}
|
|
|
|
#endif // !STEREO_INSTANCING_ON
|
|
|
|
|
|
#ifdef STEREO_INSTANCING_ON
|
|
#define ANY_SHADER_VARIANT_ACTIVE
|
|
|
|
float4 _BlitScaleBias;
|
|
|
|
static float4 vertex_uniform_buffer_0[1];
|
|
static float4 gl_Position;
|
|
static uint gl_Layer;
|
|
static int gl_VertexIndex;
|
|
static int gl_InstanceIndex;
|
|
static int gl_BaseVertexARB;
|
|
static int gl_BaseInstanceARB;
|
|
static float2 vertex_output_1;
|
|
|
|
struct Vertex_Stage_Input
|
|
{
|
|
uint gl_VertexIndex : SV_VertexID;
|
|
uint gl_InstanceIndex : SV_InstanceID;
|
|
uint gl_BaseVertexARB : SV_StartVertexLocation;
|
|
uint gl_BaseInstanceARB : SV_StartInstanceLocation;
|
|
};
|
|
|
|
struct Vertex_Stage_Output
|
|
{
|
|
float2 vertex_output_1 : TEXCOORD; // TEXCOORD
|
|
float4 gl_Position : SV_Position;
|
|
uint gl_Layer : SV_RenderTargetArrayIndex;
|
|
};
|
|
|
|
void vert_main()
|
|
{
|
|
float vertex_unnamed_34 = float(((uint(gl_VertexIndex) - uint(gl_BaseVertexARB)) << 1u) & 2u);
|
|
float vertex_unnamed_35 = float((uint(gl_VertexIndex) - uint(gl_BaseVertexARB)) & 2u);
|
|
gl_Position.x = mad(vertex_unnamed_34, 2.0f, -1.0f);
|
|
gl_Position.y = mad(vertex_unnamed_35, 2.0f, -1.0f);
|
|
precise float vertex_unnamed_45 = (-0.0f) - vertex_unnamed_35;
|
|
precise float vertex_unnamed_47 = vertex_unnamed_45 + 1.0f;
|
|
vertex_output_1.x = mad(vertex_unnamed_34, vertex_uniform_buffer_0[0u].x, vertex_uniform_buffer_0[0u].z);
|
|
vertex_output_1.y = mad(vertex_unnamed_47, vertex_uniform_buffer_0[0u].y, vertex_uniform_buffer_0[0u].w);
|
|
gl_Position.z = 1.0f;
|
|
gl_Position.w = 1.0f;
|
|
gl_Layer = int((uint(gl_InstanceIndex) - uint(gl_BaseInstanceARB)) & 1u);
|
|
}
|
|
|
|
Vertex_Stage_Output vert(Vertex_Stage_Input stage_input)
|
|
{
|
|
vertex_uniform_buffer_0[0] = float4(_BlitScaleBias[0], _BlitScaleBias[1], _BlitScaleBias[2], _BlitScaleBias[3]);
|
|
|
|
gl_VertexIndex = int(stage_input.gl_VertexIndex + stage_input.gl_BaseVertexARB);
|
|
gl_InstanceIndex = int(stage_input.gl_InstanceIndex + stage_input.gl_BaseInstanceARB);
|
|
gl_BaseVertexARB = stage_input.gl_BaseVertexARB;
|
|
gl_BaseInstanceARB = stage_input.gl_BaseInstanceARB;
|
|
vert_main();
|
|
Vertex_Stage_Output stage_output;
|
|
stage_output.gl_Position = gl_Position;
|
|
stage_output.gl_Layer = gl_Layer;
|
|
stage_output.vertex_output_1 = vertex_output_1;
|
|
return stage_output;
|
|
}
|
|
|
|
#endif // STEREO_INSTANCING_ON
|
|
|
|
|
|
#ifndef STEREO_INSTANCING_ON
|
|
#define ANY_SHADER_VARIANT_ACTIVE
|
|
|
|
float4 _VisualizationParams;
|
|
|
|
static float4 fragment_uniform_buffer_0[7];
|
|
Texture2D<uint4> _ShadingRateImage;
|
|
Buffer<uint4> T1;
|
|
|
|
static float4 gl_FragCoord;
|
|
static float2 fragment_input_1;
|
|
static float4 fragment_output_0;
|
|
|
|
struct Fragment_Stage_Input
|
|
{
|
|
float2 fragment_input_1 : TEXCOORD; // TEXCOORD
|
|
float4 gl_FragCoord : SV_Position;
|
|
};
|
|
|
|
struct Fragment_Stage_Output
|
|
{
|
|
float4 fragment_output_0 : SV_Target0;
|
|
};
|
|
|
|
void frag_main()
|
|
{
|
|
uint fragment_unnamed_50 = _ShadingRateImage.Load(int3(uint2(uint(gl_FragCoord.x * fragment_uniform_buffer_0[6u].x), uint(gl_FragCoord.y * fragment_uniform_buffer_0[6u].y)), 0u)).x * 4u;
|
|
uint4 fragment_unnamed_65 = uint4(T1.Load(fragment_unnamed_50).x, T1.Load(fragment_unnamed_50 + 1u).x, T1.Load(fragment_unnamed_50 + 2u).x, T1.Load(fragment_unnamed_50 + 3u).x);
|
|
fragment_output_0.x = asfloat(fragment_unnamed_65.x);
|
|
fragment_output_0.y = asfloat(fragment_unnamed_65.y);
|
|
fragment_output_0.z = asfloat(fragment_unnamed_65.z);
|
|
fragment_output_0.w = asfloat(fragment_unnamed_65.w);
|
|
}
|
|
|
|
Fragment_Stage_Output frag(Fragment_Stage_Input stage_input)
|
|
{
|
|
fragment_uniform_buffer_0[6] = float4(_VisualizationParams[0], _VisualizationParams[1], _VisualizationParams[2], _VisualizationParams[3]);
|
|
|
|
gl_FragCoord = stage_input.gl_FragCoord;
|
|
gl_FragCoord.w = 1.0 / gl_FragCoord.w;
|
|
fragment_input_1 = stage_input.fragment_input_1;
|
|
frag_main();
|
|
Fragment_Stage_Output stage_output;
|
|
stage_output.fragment_output_0 = fragment_output_0;
|
|
return stage_output;
|
|
}
|
|
|
|
#endif // !STEREO_INSTANCING_ON
|
|
|
|
|
|
#ifdef STEREO_INSTANCING_ON
|
|
#define ANY_SHADER_VARIANT_ACTIVE
|
|
|
|
float4 _VisualizationParams;
|
|
|
|
static float4 fragment_uniform_buffer_0[7];
|
|
Texture2D<uint4> _ShadingRateImage;
|
|
Buffer<uint4> T1;
|
|
|
|
static float4 gl_FragCoord;
|
|
static float2 fragment_input_1;
|
|
static float4 fragment_output_0;
|
|
|
|
struct Fragment_Stage_Input
|
|
{
|
|
float2 fragment_input_1 : TEXCOORD; // TEXCOORD
|
|
float4 gl_FragCoord : SV_Position;
|
|
};
|
|
|
|
struct Fragment_Stage_Output
|
|
{
|
|
float4 fragment_output_0 : SV_Target0;
|
|
};
|
|
|
|
void frag_main()
|
|
{
|
|
uint fragment_unnamed_52 = _ShadingRateImage.Load(int3(uint2(uint(gl_FragCoord.x * fragment_uniform_buffer_0[6u].x), uint(gl_FragCoord.y * fragment_uniform_buffer_0[6u].y)), 0u)).x * 4u;
|
|
uint4 fragment_unnamed_67 = uint4(T1.Load(fragment_unnamed_52).x, T1.Load(fragment_unnamed_52 + 1u).x, T1.Load(fragment_unnamed_52 + 2u).x, T1.Load(fragment_unnamed_52 + 3u).x);
|
|
fragment_output_0.x = asfloat(fragment_unnamed_67.x);
|
|
fragment_output_0.y = asfloat(fragment_unnamed_67.y);
|
|
fragment_output_0.z = asfloat(fragment_unnamed_67.z);
|
|
fragment_output_0.w = asfloat(fragment_unnamed_67.w);
|
|
}
|
|
|
|
Fragment_Stage_Output frag(Fragment_Stage_Input stage_input)
|
|
{
|
|
fragment_uniform_buffer_0[6] = float4(_VisualizationParams[0], _VisualizationParams[1], _VisualizationParams[2], _VisualizationParams[3]);
|
|
|
|
gl_FragCoord = stage_input.gl_FragCoord;
|
|
gl_FragCoord.w = 1.0 / gl_FragCoord.w;
|
|
fragment_input_1 = stage_input.fragment_input_1;
|
|
frag_main();
|
|
Fragment_Stage_Output stage_output;
|
|
stage_output.fragment_output_0 = fragment_output_0;
|
|
return stage_output;
|
|
}
|
|
|
|
#endif // STEREO_INSTANCING_ON
|
|
|
|
|
|
ENDHLSL
|
|
}
|
|
}
|
|
}
|