Add rendering post-process scene integration test
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// XC_BUILTIN_COLOR_SCALE_POST_PROCESS_OPENGL_PS
|
||||
#version 430
|
||||
|
||||
layout(binding = 0) uniform sampler2D uSourceColorTexture;
|
||||
|
||||
layout(std140, binding = 0) uniform PostProcessConstants {
|
||||
vec4 gColorScale;
|
||||
};
|
||||
|
||||
in vec2 vTexCoord;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = texture(uSourceColorTexture, vTexCoord) * gColorScale;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// XC_BUILTIN_COLOR_SCALE_POST_PROCESS_VULKAN_PS
|
||||
#version 450
|
||||
|
||||
layout(set = 0, binding = 0, std140) uniform PostProcessConstants {
|
||||
vec4 gColorScale;
|
||||
};
|
||||
|
||||
layout(set = 1, binding = 0) uniform texture2D uSourceColorTexture;
|
||||
layout(set = 2, binding = 0) uniform sampler uLinearClampSampler;
|
||||
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = texture(sampler2D(uSourceColorTexture, uLinearClampSampler), vTexCoord) * gColorScale;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// XC_BUILTIN_COLOR_SCALE_POST_PROCESS_D3D12_PS
|
||||
Texture2D gSourceColorTexture : register(t0);
|
||||
SamplerState gLinearClampSampler : register(s0);
|
||||
|
||||
cbuffer PostProcessConstants : register(b0) {
|
||||
float4 gColorScale;
|
||||
};
|
||||
|
||||
struct PSInput {
|
||||
float4 position : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 MainPS(PSInput input) : SV_TARGET {
|
||||
return gSourceColorTexture.Sample(gLinearClampSampler, input.texcoord) * gColorScale;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
Shader "Builtin Color Scale Post Process"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_ColorScale ("Color Scale", Color) = (0.65,0.80,1.00,1.0)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Name "ColorScale"
|
||||
Tags { "LightMode" = "PostProcess" }
|
||||
Resources
|
||||
{
|
||||
PostProcessConstants (ConstantBuffer, 0, 0)
|
||||
SourceColorTexture (Texture2D, 1, 0)
|
||||
LinearClampSampler (Sampler, 2, 0)
|
||||
}
|
||||
HLSLPROGRAM
|
||||
#pragma vertex MainVS
|
||||
#pragma fragment MainPS
|
||||
#pragma backend D3D12 HLSL "color-scale-post-process.vs.hlsl" "color-scale-post-process.ps.hlsl" vs_5_0 ps_5_0
|
||||
#pragma backend OpenGL GLSL "color-scale-post-process.vert.glsl" "color-scale-post-process.frag.glsl"
|
||||
#pragma backend Vulkan GLSL "color-scale-post-process.vert.vk.glsl" "color-scale-post-process.frag.vk.glsl"
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// XC_BUILTIN_COLOR_SCALE_POST_PROCESS_OPENGL_VS
|
||||
#version 430
|
||||
|
||||
out vec2 vTexCoord;
|
||||
|
||||
void main() {
|
||||
const vec2 positions[3] = vec2[3](
|
||||
vec2(-1.0, -1.0),
|
||||
vec2(-1.0, 3.0),
|
||||
vec2( 3.0, -1.0)
|
||||
);
|
||||
|
||||
vec2 position = positions[gl_VertexID];
|
||||
gl_Position = vec4(position, 1.0, 1.0);
|
||||
vTexCoord = position * 0.5 + 0.5;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// XC_BUILTIN_COLOR_SCALE_POST_PROCESS_VULKAN_VS
|
||||
#version 450
|
||||
|
||||
layout(location = 0) out vec2 vTexCoord;
|
||||
|
||||
void main() {
|
||||
const vec2 positions[3] = vec2[3](
|
||||
vec2(-1.0, -1.0),
|
||||
vec2(-1.0, 3.0),
|
||||
vec2( 3.0, -1.0)
|
||||
);
|
||||
|
||||
vec2 position = positions[gl_VertexIndex];
|
||||
gl_Position = vec4(position, 1.0, 1.0);
|
||||
vTexCoord = vec2(
|
||||
position.x * 0.5 + 0.5,
|
||||
1.0 - (position.y * 0.5 + 0.5));
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// XC_BUILTIN_COLOR_SCALE_POST_PROCESS_D3D12_VS
|
||||
struct VSOutput {
|
||||
float4 position : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
VSOutput MainVS(uint vertexId : SV_VertexID) {
|
||||
const float2 positions[3] = {
|
||||
float2(-1.0f, -1.0f),
|
||||
float2(-1.0f, 3.0f),
|
||||
float2( 3.0f, -1.0f)
|
||||
};
|
||||
|
||||
const float2 position = positions[vertexId];
|
||||
|
||||
VSOutput output;
|
||||
output.position = float4(position, 1.0f, 1.0f);
|
||||
output.texcoord = float2(
|
||||
position.x * 0.5f + 0.5f,
|
||||
1.0f - (position.y * 0.5f + 0.5f));
|
||||
return output;
|
||||
}
|
||||
Reference in New Issue
Block a user