Files
BlockSpace-v1.5.0b/Assets/Shader/Hidden_Universal Render Pipeline_Sampling.shader
2026-06-01 17:19:55 +02:00

295 lines
13 KiB
GLSL

Shader "Hidden/Universal Render Pipeline/Sampling"
{
Properties
{
}
SubShader
{
LOD 100
Tags { "RenderPipeline" = "UniversalPipeline" "RenderType" = "Opaque" }
Pass
{
Name "BoxDownsample"
LOD 100
Tags { "RenderPipeline" = "UniversalPipeline" "RenderType" = "Opaque" }
ZTest Always
ZWrite Off
Cull Off
GpuProgramID 23860
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[131];
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_32 = float(((uint(gl_VertexIndex) - uint(gl_BaseVertexARB)) << 1u) & 2u);
float vertex_unnamed_33 = float((uint(gl_VertexIndex) - uint(gl_BaseVertexARB)) & 2u);
gl_Position.x = mad(vertex_unnamed_32, 2.0f, -1.0f);
gl_Position.y = mad(vertex_unnamed_33, 2.0f, -1.0f);
precise float vertex_unnamed_43 = (-0.0f) - vertex_unnamed_33;
precise float vertex_unnamed_45 = vertex_unnamed_43 + 1.0f;
vertex_output_1.x = mad(vertex_unnamed_32, vertex_uniform_buffer_0[130u].x, vertex_uniform_buffer_0[130u].z);
vertex_output_1.y = mad(vertex_unnamed_45, vertex_uniform_buffer_0[130u].y, vertex_uniform_buffer_0[130u].w);
gl_Position.z = 1.0f;
gl_Position.w = 1.0f;
}
Vertex_Stage_Output vert(Vertex_Stage_Input stage_input)
{
vertex_uniform_buffer_0[130] = 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[100];
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_35 = float(((uint(gl_VertexIndex) - uint(gl_BaseVertexARB)) << 1u) & 2u);
float vertex_unnamed_36 = float((uint(gl_VertexIndex) - uint(gl_BaseVertexARB)) & 2u);
gl_Position.x = mad(vertex_unnamed_35, 2.0f, -1.0f);
gl_Position.y = mad(vertex_unnamed_36, 2.0f, -1.0f);
precise float vertex_unnamed_46 = (-0.0f) - vertex_unnamed_36;
precise float vertex_unnamed_48 = vertex_unnamed_46 + 1.0f;
vertex_output_1.x = mad(vertex_unnamed_35, vertex_uniform_buffer_0[99u].x, vertex_uniform_buffer_0[99u].z);
vertex_output_1.y = mad(vertex_unnamed_48, vertex_uniform_buffer_0[99u].y, vertex_uniform_buffer_0[99u].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[99] = 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 _BlitTexture_TexelSize;
float _SampleOffset;
static float4 fragment_uniform_buffer_0[137];
Texture2D<float4> _BlitTexture;
SamplerState sampler_BlitTexture;
static float2 fragment_input_1;
static float4 fragment_output_0;
struct Fragment_Stage_Input
{
float2 fragment_input_1 : TEXCOORD; // TEXCOORD
};
struct Fragment_Stage_Output
{
float4 fragment_output_0 : SV_Target0;
};
void frag_main()
{
precise float fragment_unnamed_34 = fragment_uniform_buffer_0[136u].x * (-1.0f);
precise float fragment_unnamed_36 = fragment_uniform_buffer_0[136u].x * (-1.0f);
precise float fragment_unnamed_37 = fragment_uniform_buffer_0[136u].x * 1.0f;
precise float fragment_unnamed_39 = fragment_uniform_buffer_0[136u].x * 1.0f;
float4 fragment_unnamed_74 = _BlitTexture.SampleBias(sampler_BlitTexture, float2(mad(fragment_uniform_buffer_0[132u].x, fragment_unnamed_34, fragment_input_1.x), mad(fragment_uniform_buffer_0[132u].y, fragment_unnamed_36, fragment_input_1.y)), fragment_uniform_buffer_0[4u].x);
float4 fragment_unnamed_83 = _BlitTexture.SampleBias(sampler_BlitTexture, float2(mad(fragment_uniform_buffer_0[132u].x, fragment_unnamed_37, fragment_input_1.x), mad(fragment_uniform_buffer_0[132u].y, fragment_unnamed_36, fragment_input_1.y)), fragment_uniform_buffer_0[4u].x);
precise float fragment_unnamed_89 = fragment_unnamed_83.x + fragment_unnamed_74.x;
precise float fragment_unnamed_90 = fragment_unnamed_83.y + fragment_unnamed_74.y;
precise float fragment_unnamed_91 = fragment_unnamed_83.z + fragment_unnamed_74.z;
precise float fragment_unnamed_92 = fragment_unnamed_83.w + fragment_unnamed_74.w;
float4 fragment_unnamed_96 = _BlitTexture.SampleBias(sampler_BlitTexture, float2(mad(fragment_uniform_buffer_0[132u].x, fragment_unnamed_34, fragment_input_1.x), mad(fragment_uniform_buffer_0[132u].y, fragment_unnamed_39, fragment_input_1.y)), fragment_uniform_buffer_0[4u].x);
float4 fragment_unnamed_105 = _BlitTexture.SampleBias(sampler_BlitTexture, float2(mad(fragment_uniform_buffer_0[132u].x, fragment_unnamed_37, fragment_input_1.x), mad(fragment_uniform_buffer_0[132u].y, fragment_unnamed_39, fragment_input_1.y)), fragment_uniform_buffer_0[4u].x);
precise float fragment_unnamed_111 = fragment_unnamed_89 + fragment_unnamed_96.x;
precise float fragment_unnamed_112 = fragment_unnamed_90 + fragment_unnamed_96.y;
precise float fragment_unnamed_113 = fragment_unnamed_91 + fragment_unnamed_96.z;
precise float fragment_unnamed_114 = fragment_unnamed_92 + fragment_unnamed_96.w;
precise float fragment_unnamed_115 = fragment_unnamed_105.x + fragment_unnamed_111;
precise float fragment_unnamed_116 = fragment_unnamed_105.y + fragment_unnamed_112;
precise float fragment_unnamed_117 = fragment_unnamed_105.z + fragment_unnamed_113;
precise float fragment_unnamed_118 = fragment_unnamed_105.w + fragment_unnamed_114;
precise float fragment_unnamed_119 = fragment_unnamed_115 * 0.25f;
precise float fragment_unnamed_121 = fragment_unnamed_116 * 0.25f;
precise float fragment_unnamed_122 = fragment_unnamed_117 * 0.25f;
precise float fragment_unnamed_123 = fragment_unnamed_118 * 0.25f;
fragment_output_0.x = fragment_unnamed_119;
fragment_output_0.y = fragment_unnamed_121;
fragment_output_0.z = fragment_unnamed_122;
fragment_output_0.w = fragment_unnamed_123;
}
Fragment_Stage_Output frag(Fragment_Stage_Input stage_input)
{
fragment_uniform_buffer_0[132] = float4(_BlitTexture_TexelSize[0], _BlitTexture_TexelSize[1], _BlitTexture_TexelSize[2], _BlitTexture_TexelSize[3]);
fragment_uniform_buffer_0[136] = float4(_SampleOffset, fragment_uniform_buffer_0[136][1], fragment_uniform_buffer_0[136][2], fragment_uniform_buffer_0[136][3]);
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 _BlitTexture_TexelSize;
float _SampleOffset;
static float4 fragment_uniform_buffer_0[106];
Texture2DArray<float4> _BlitTexture;
SamplerState sampler_BlitTexture;
static uint gl_Layer;
static float2 fragment_input_1;
static float4 fragment_output_0;
struct Fragment_Stage_Input
{
float2 fragment_input_1 : TEXCOORD; // TEXCOORD
uint gl_Layer : SV_RenderTargetArrayIndex;
};
struct Fragment_Stage_Output
{
float4 fragment_output_0 : SV_Target0;
};
void frag_main()
{
precise float fragment_unnamed_36 = fragment_uniform_buffer_0[105u].x * (-1.0f);
precise float fragment_unnamed_38 = fragment_uniform_buffer_0[105u].x * (-1.0f);
precise float fragment_unnamed_39 = fragment_uniform_buffer_0[105u].x * 1.0f;
precise float fragment_unnamed_41 = fragment_uniform_buffer_0[105u].x * 1.0f;
float fragment_unnamed_71 = float(uint(gl_Layer));
float4 fragment_unnamed_78 = _BlitTexture.SampleBias(sampler_BlitTexture, float3(mad(fragment_uniform_buffer_0[101u].x, fragment_unnamed_36, fragment_input_1.x), mad(fragment_uniform_buffer_0[101u].y, fragment_unnamed_38, fragment_input_1.y), fragment_unnamed_71), fragment_uniform_buffer_0[4u].x);
float4 fragment_unnamed_88 = _BlitTexture.SampleBias(sampler_BlitTexture, float3(mad(fragment_uniform_buffer_0[101u].x, fragment_unnamed_39, fragment_input_1.x), mad(fragment_uniform_buffer_0[101u].y, fragment_unnamed_38, fragment_input_1.y), fragment_unnamed_71), fragment_uniform_buffer_0[4u].x);
precise float fragment_unnamed_94 = fragment_unnamed_88.x + fragment_unnamed_78.x;
precise float fragment_unnamed_95 = fragment_unnamed_88.y + fragment_unnamed_78.y;
precise float fragment_unnamed_96 = fragment_unnamed_88.z + fragment_unnamed_78.z;
precise float fragment_unnamed_97 = fragment_unnamed_88.w + fragment_unnamed_78.w;
float4 fragment_unnamed_101 = _BlitTexture.SampleBias(sampler_BlitTexture, float3(mad(fragment_uniform_buffer_0[101u].x, fragment_unnamed_36, fragment_input_1.x), mad(fragment_uniform_buffer_0[101u].y, fragment_unnamed_41, fragment_input_1.y), fragment_unnamed_71), fragment_uniform_buffer_0[4u].x);
float4 fragment_unnamed_110 = _BlitTexture.SampleBias(sampler_BlitTexture, float3(mad(fragment_uniform_buffer_0[101u].x, fragment_unnamed_39, fragment_input_1.x), mad(fragment_uniform_buffer_0[101u].y, fragment_unnamed_41, fragment_input_1.y), fragment_unnamed_71), fragment_uniform_buffer_0[4u].x);
precise float fragment_unnamed_116 = fragment_unnamed_94 + fragment_unnamed_101.x;
precise float fragment_unnamed_117 = fragment_unnamed_95 + fragment_unnamed_101.y;
precise float fragment_unnamed_118 = fragment_unnamed_96 + fragment_unnamed_101.z;
precise float fragment_unnamed_119 = fragment_unnamed_97 + fragment_unnamed_101.w;
precise float fragment_unnamed_120 = fragment_unnamed_110.x + fragment_unnamed_116;
precise float fragment_unnamed_121 = fragment_unnamed_110.y + fragment_unnamed_117;
precise float fragment_unnamed_122 = fragment_unnamed_110.z + fragment_unnamed_118;
precise float fragment_unnamed_123 = fragment_unnamed_110.w + fragment_unnamed_119;
precise float fragment_unnamed_124 = fragment_unnamed_120 * 0.25f;
precise float fragment_unnamed_126 = fragment_unnamed_121 * 0.25f;
precise float fragment_unnamed_127 = fragment_unnamed_122 * 0.25f;
precise float fragment_unnamed_128 = fragment_unnamed_123 * 0.25f;
fragment_output_0.x = fragment_unnamed_124;
fragment_output_0.y = fragment_unnamed_126;
fragment_output_0.z = fragment_unnamed_127;
fragment_output_0.w = fragment_unnamed_128;
}
Fragment_Stage_Output frag(Fragment_Stage_Input stage_input)
{
fragment_uniform_buffer_0[101] = float4(_BlitTexture_TexelSize[0], _BlitTexture_TexelSize[1], _BlitTexture_TexelSize[2], _BlitTexture_TexelSize[3]);
fragment_uniform_buffer_0[105] = float4(_SampleOffset, fragment_uniform_buffer_0[105][1], fragment_uniform_buffer_0[105][2], fragment_uniform_buffer_0[105][3]);
gl_Layer = stage_input.gl_Layer;
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
}
}
}