Added basic input attachment sample

This commit is contained in:
saschawillems 2018-07-15 18:18:41 +02:00
parent 8a6184dc81
commit a1f166e001
11 changed files with 731 additions and 0 deletions

View file

@ -0,0 +1,19 @@
#version 450
layout (input_attachment_index = 0, binding = 0) uniform subpassInput inputColor;
layout (input_attachment_index = 1, binding = 1) uniform subpassInput inputDepth;
layout (binding = 2) uniform UBO {
vec2 range;
int attachmentIndex;
} ubo;
layout (location = 0) out vec4 outColor;
void main()
{
// Read values from previous sub pass
vec3 col = ubo.attachmentIndex == 0 ? subpassLoad(inputColor).rgb : subpassLoad(inputDepth).rrr;
outColor.rgb = ((col - ubo.range[0]) * 1.0 / (ubo.range[1] - ubo.range[0]));
}

Binary file not shown.

View file

@ -0,0 +1,10 @@
#version 450
out gl_PerVertex {
vec4 gl_Position;
};
void main()
{
gl_Position = vec4(vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2) * 2.0f - 1.0f, 0.0f, 1.0f);
}

Binary file not shown.

View file

@ -0,0 +1,14 @@
#version 450
layout (location = 0) in vec3 inColor;
layout (location = 0) out vec4 outSwapChainColor;
layout (location = 1) out vec4 outColor;
layout (location = 2) out float outDepth;
void main()
{
outSwapChainColor = vec4(0.0);
outColor = vec4(inColor, 0.0);
outDepth = gl_FragDepth;
}

Binary file not shown.

View file

@ -0,0 +1,26 @@
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
layout (location = 0) in vec4 inPos;
layout (location = 1) in vec3 inColor;
layout (location = 2) in vec3 inNormal;
layout (binding = 0) uniform UBO {
mat4 projection;
mat4 model;
mat4 view;
} ubo;
layout (location = 0) out vec3 outColor;
out gl_PerVertex {
vec4 gl_Position;
};
void main()
{
gl_Position = ubo.projection * ubo.view * ubo.model * inPos;
outColor = inColor;
}

Binary file not shown.