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
14
data/shaders/glsl/bloom/colorpass.frag
Normal file
14
data/shaders/glsl/bloom/colorpass.frag
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform sampler2D colorMap;
|
||||
|
||||
layout (location = 0) in vec3 inColor;
|
||||
layout (location = 1) in vec2 inUV;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outFragColor.rgb = inColor;
|
||||
// outFragColor = texture(colorMap, inUV);// * vec4(inColor, 1.0);
|
||||
}
|
||||
BIN
data/shaders/glsl/bloom/colorpass.frag.spv
Normal file
BIN
data/shaders/glsl/bloom/colorpass.frag.spv
Normal file
Binary file not shown.
27
data/shaders/glsl/bloom/colorpass.vert
Normal file
27
data/shaders/glsl/bloom/colorpass.vert
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inPos;
|
||||
layout (location = 1) in vec2 inUV;
|
||||
layout (location = 2) in vec3 inColor;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 model;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec3 outColor;
|
||||
layout (location = 1) out vec2 outUV;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outUV = inUV;
|
||||
outColor = inColor;
|
||||
gl_Position = ubo.projection * ubo.view * ubo.model * inPos;
|
||||
}
|
||||
BIN
data/shaders/glsl/bloom/colorpass.vert.spv
Normal file
BIN
data/shaders/glsl/bloom/colorpass.vert.spv
Normal file
Binary file not shown.
44
data/shaders/glsl/bloom/gaussblur.frag
Normal file
44
data/shaders/glsl/bloom/gaussblur.frag
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColor;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
float blurScale;
|
||||
float blurStrength;
|
||||
} ubo;
|
||||
|
||||
layout (constant_id = 0) const int blurdirection = 0;
|
||||
|
||||
layout (location = 0) in vec2 inUV;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float weight[5];
|
||||
weight[0] = 0.227027;
|
||||
weight[1] = 0.1945946;
|
||||
weight[2] = 0.1216216;
|
||||
weight[3] = 0.054054;
|
||||
weight[4] = 0.016216;
|
||||
|
||||
vec2 tex_offset = 1.0 / textureSize(samplerColor, 0) * ubo.blurScale; // gets size of single texel
|
||||
vec3 result = texture(samplerColor, inUV).rgb * weight[0]; // current fragment's contribution
|
||||
for(int i = 1; i < 5; ++i)
|
||||
{
|
||||
if (blurdirection == 1)
|
||||
{
|
||||
// H
|
||||
result += texture(samplerColor, inUV + vec2(tex_offset.x * i, 0.0)).rgb * weight[i] * ubo.blurStrength;
|
||||
result += texture(samplerColor, inUV - vec2(tex_offset.x * i, 0.0)).rgb * weight[i] * ubo.blurStrength;
|
||||
}
|
||||
else
|
||||
{
|
||||
// V
|
||||
result += texture(samplerColor, inUV + vec2(0.0, tex_offset.y * i)).rgb * weight[i] * ubo.blurStrength;
|
||||
result += texture(samplerColor, inUV - vec2(0.0, tex_offset.y * i)).rgb * weight[i] * ubo.blurStrength;
|
||||
}
|
||||
}
|
||||
outFragColor = vec4(result, 1.0);
|
||||
}
|
||||
BIN
data/shaders/glsl/bloom/gaussblur.frag.spv
Normal file
BIN
data/shaders/glsl/bloom/gaussblur.frag.spv
Normal file
Binary file not shown.
14
data/shaders/glsl/bloom/gaussblur.vert
Normal file
14
data/shaders/glsl/bloom/gaussblur.vert
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) out vec2 outUV;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outUV = vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2);
|
||||
gl_Position = vec4(outUV * 2.0f - 1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
BIN
data/shaders/glsl/bloom/gaussblur.vert.spv
Normal file
BIN
data/shaders/glsl/bloom/gaussblur.vert.spv
Normal file
Binary file not shown.
12
data/shaders/glsl/bloom/generate-spirv.bat
Normal file
12
data/shaders/glsl/bloom/generate-spirv.bat
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
glslangvalidator -V colorpass.vert -o colorpass.vert.spv
|
||||
glslangvalidator -V colorpass.frag -o colorpass.frag.spv
|
||||
|
||||
glslangvalidator -V phongpass.vert -o phongpass.vert.spv
|
||||
glslangvalidator -V phongpass.frag -o phongpass.frag.spv
|
||||
|
||||
glslangvalidator -V gaussblur.vert -o gaussblur.vert.spv
|
||||
glslangvalidator -V gaussblur.frag -o gaussblur.frag.spv
|
||||
|
||||
glslangvalidator -V skybox.vert -o skybox.vert.spv
|
||||
glslangvalidator -V skybox.frag -o skybox.frag.spv
|
||||
|
||||
30
data/shaders/glsl/bloom/phongpass.frag
Normal file
30
data/shaders/glsl/bloom/phongpass.frag
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform sampler2D colorMap;
|
||||
|
||||
layout (location = 0) in vec3 inNormal;
|
||||
layout (location = 1) in vec2 inUV;
|
||||
layout (location = 2) in vec3 inColor;
|
||||
layout (location = 3) in vec3 inViewVec;
|
||||
layout (location = 4) in vec3 inLightVec;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 ambient = vec3(0.0f);
|
||||
|
||||
// Adjust light calculations for glow color
|
||||
if ((inColor.r >= 0.9) || (inColor.g >= 0.9) || (inColor.b >= 0.9))
|
||||
{
|
||||
ambient = inColor * 0.25;
|
||||
}
|
||||
|
||||
vec3 N = normalize(inNormal);
|
||||
vec3 L = normalize(inLightVec);
|
||||
vec3 V = normalize(inViewVec);
|
||||
vec3 R = reflect(-L, N);
|
||||
vec3 diffuse = max(dot(N, L), 0.0) * inColor;
|
||||
vec3 specular = pow(max(dot(R, V), 0.0), 8.0) * vec3(0.75);
|
||||
outFragColor = vec4(ambient + diffuse + specular, 1.0);
|
||||
}
|
||||
BIN
data/shaders/glsl/bloom/phongpass.frag.spv
Normal file
BIN
data/shaders/glsl/bloom/phongpass.frag.spv
Normal file
Binary file not shown.
38
data/shaders/glsl/bloom/phongpass.vert
Normal file
38
data/shaders/glsl/bloom/phongpass.vert
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec4 inPos;
|
||||
layout (location = 1) in vec2 inUV;
|
||||
layout (location = 2) in vec3 inColor;
|
||||
layout (location = 3) in vec3 inNormal;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 model;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec3 outNormal;
|
||||
layout (location = 1) out vec2 outUV;
|
||||
layout (location = 2) out vec3 outColor;
|
||||
layout (location = 3) out vec3 outViewVec;
|
||||
layout (location = 4) out vec3 outLightVec;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outNormal = inNormal;
|
||||
outColor = inColor;
|
||||
outUV = inUV;
|
||||
gl_Position = ubo.projection * ubo.view * ubo.model * inPos;
|
||||
|
||||
vec3 lightPos = vec3(-5.0, -5.0, 0.0);
|
||||
vec4 pos = ubo.view * ubo.model * inPos;
|
||||
outNormal = mat3(ubo.view * ubo.model) * inNormal;
|
||||
outLightVec = lightPos - pos.xyz;
|
||||
outViewVec = -pos.xyz;
|
||||
}
|
||||
BIN
data/shaders/glsl/bloom/phongpass.vert.spv
Normal file
BIN
data/shaders/glsl/bloom/phongpass.vert.spv
Normal file
Binary file not shown.
12
data/shaders/glsl/bloom/skybox.frag
Normal file
12
data/shaders/glsl/bloom/skybox.frag
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#version 450
|
||||
|
||||
layout (binding = 1) uniform samplerCube samplerCubeMap;
|
||||
|
||||
layout (location = 0) in vec3 inUVW;
|
||||
|
||||
layout (location = 0) out vec4 outFragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
outFragColor = texture(samplerCubeMap, inUVW);
|
||||
}
|
||||
BIN
data/shaders/glsl/bloom/skybox.frag.spv
Normal file
BIN
data/shaders/glsl/bloom/skybox.frag.spv
Normal file
Binary file not shown.
24
data/shaders/glsl/bloom/skybox.vert
Normal file
24
data/shaders/glsl/bloom/skybox.vert
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#version 450
|
||||
|
||||
layout (location = 0) in vec3 inPos;
|
||||
|
||||
layout (binding = 0) uniform UBO
|
||||
{
|
||||
mat4 projection;
|
||||
mat4 view;
|
||||
mat4 model;
|
||||
} ubo;
|
||||
|
||||
layout (location = 0) out vec3 outUVW;
|
||||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
outUVW = inPos;
|
||||
gl_Position = ubo.projection * ubo.view * ubo.model * vec4(inPos.xyz, 1.0);
|
||||
}
|
||||
BIN
data/shaders/glsl/bloom/skybox.vert.spv
Normal file
BIN
data/shaders/glsl/bloom/skybox.vert.spv
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue