Move shaders into glsl and hlsl directories
Move `data/shaders` to `data/shaders/glsl` Move `data/hlsl` to `data/shaders/hlsl` Fix up shader paths in the cpp files to point to the new glsl location. `data/shaders/hlsl/compile.py` still overwrites the glsl .spv files (for now). Issue: #723
This commit is contained in:
parent
cac1d2e850
commit
ca884587a4
1043 changed files with 1207 additions and 1201 deletions
33
data/shaders/glsl/inputattachments/attachmentread.frag
Normal file
33
data/shaders/glsl/inputattachments/attachmentread.frag
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#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 brightnessContrast;
|
||||
vec2 range;
|
||||
int attachmentIndex;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
vec3 brightnessContrast(vec3 color, float brightness, float contrast) {
|
||||
return (color - 0.5) * contrast + 0.5 + brightness;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// Apply brightness and contrast filer to color input
|
||||
if (ubo.attachmentIndex == 0) {
|
||||
// Read color from previous color input attachment
|
||||
vec3 color = subpassLoad(inputColor).rgb;
|
||||
outColor.rgb = brightnessContrast(color, ubo.brightnessContrast[0], ubo.brightnessContrast[1]);
|
||||
}
|
||||
|
||||
// Visualize depth input range
|
||||
if (ubo.attachmentIndex == 1) {
|
||||
// Read depth from previous depth input attachment
|
||||
float depth = subpassLoad(inputDepth).r;
|
||||
outColor.rgb = vec3((depth - ubo.range[0]) * 1.0 / (ubo.range[1] - ubo.range[0]));
|
||||
}
|
||||
}
|
||||
BIN
data/shaders/glsl/inputattachments/attachmentread.frag.spv
Normal file
BIN
data/shaders/glsl/inputattachments/attachmentread.frag.spv
Normal file
Binary file not shown.
10
data/shaders/glsl/inputattachments/attachmentread.vert
Normal file
10
data/shaders/glsl/inputattachments/attachmentread.vert
Normal 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);
|
||||
}
|
||||
BIN
data/shaders/glsl/inputattachments/attachmentread.vert.spv
Normal file
BIN
data/shaders/glsl/inputattachments/attachmentread.vert.spv
Normal file
Binary file not shown.
23
data/shaders/glsl/inputattachments/attachmentwrite.frag
Normal file
23
data/shaders/glsl/inputattachments/attachmentwrite.frag
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inColor;
|
||||
layout (location = 1) in vec3 inNormal;
|
||||
layout (location = 2) in vec3 inViewVec;
|
||||
layout (location = 3) in vec3 inLightVec;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Toon shading color attachment output
|
||||
float intensity = dot(normalize(inNormal), normalize(inLightVec));
|
||||
float shade = 1.0;
|
||||
shade = intensity < 0.5 ? 0.75 : shade;
|
||||
shade = intensity < 0.35 ? 0.6 : shade;
|
||||
shade = intensity < 0.25 ? 0.5 : shade;
|
||||
shade = intensity < 0.1 ? 0.25 : shade;
|
||||
|
||||
outColor.rgb = inColor * 3.0 * shade;
|
||||
|
||||
// Depth attachment does not need to be explicitly written
|
||||
}
|
||||
BIN
data/shaders/glsl/inputattachments/attachmentwrite.frag.spv
Normal file
BIN
data/shaders/glsl/inputattachments/attachmentwrite.frag.spv
Normal file
Binary file not shown.
29
data/shaders/glsl/inputattachments/attachmentwrite.vert
Normal file
29
data/shaders/glsl/inputattachments/attachmentwrite.vert
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 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;
|
||||
layout (location = 1) out vec3 outNormal;
|
||||
layout (location = 2) out vec3 outViewVec;
|
||||
layout (location = 3) out vec3 outLightVec;
|
||||
|
||||
out gl_PerVertex {
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos, 1.0);
|
||||
outColor = inColor;
|
||||
outNormal = inNormal;
|
||||
outLightVec = vec3(0.0f, 5.0f, 15.0f) - inPos;
|
||||
outViewVec = -inPos.xyz;
|
||||
}
|
||||
BIN
data/shaders/glsl/inputattachments/attachmentwrite.vert.spv
Normal file
BIN
data/shaders/glsl/inputattachments/attachmentwrite.vert.spv
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue