Archived
1
Fork 0

Remove old shader files

This commit is contained in:
Joshua Goins 2022-02-08 09:33:18 -05:00
parent aac9e673ad
commit 833046aed0
6 changed files with 0 additions and 145 deletions

View file

@ -22,10 +22,6 @@ add_shaders(TARGET Renderer
shaders/mesh.vert.nocompile.glsl shaders/mesh.vert.nocompile.glsl
shaders/post.vert.glsl shaders/post.vert.glsl
shaders/post.frag.glsl shaders/post.frag.glsl
shaders/text.vert.glsl
shaders/text.frag.glsl
shaders/ui.vert.glsl
shaders/ui.frag.glsl
shaders/imgui.vert.glsl shaders/imgui.vert.glsl
shaders/imgui.frag.glsl shaders/imgui.frag.glsl
shaders/debug.vert.glsl shaders/debug.vert.glsl

View file

@ -1,5 +0,0 @@
uint getLower(const uint val) { return val & uint(0xFFFF); }
uint getUpper(const uint val) { return val >> 16 & uint(0xFFFF); }
float fixed_to_float(const uint val) { return float(val)/32.0; }
vec2 fixed2_to_vec2(const uint val) { return vec2(fixed_to_float(getLower(val)), fixed_to_float(getUpper(val))); }
vec2 uint_to_vec2(const uint val) { return vec2(getLower(val), getUpper(val)); }

View file

@ -1,15 +0,0 @@
layout(location = 0) in vec2 inUV;
layout (location = 0) out vec4 outColor;
layout (binding = 3) uniform sampler2D fontSampler;
vec4 toSRGB(vec4 v) {
return vec4(pow(v.rgb, vec3(2.2)), v.a);
}
void main() {
outColor = vec4(vec3(texture(fontSampler, inUV).r), texture(fontSampler, inUV).r);
outColor = toSRGB(outColor);
}

View file

@ -1,61 +0,0 @@
#extension GL_GOOGLE_include_directive : require
#include "font.glsl"
layout(location = 0) out vec2 outUV;
struct GlyphInstance {
uint position, index, instance;
};
struct StringInstance {
uint xy;
};
struct GlyphMetric {
uint x0_y0, x1_y1;
float xoff, yoff;
float xoff2, yoff2;
};
layout(std430, binding = 0) buffer readonly InstanceBuffer {
GlyphInstance instances[];
};
layout(std430, binding = 1) buffer readonly MetricBuffer {
GlyphMetric metrics[];
};
layout(std430, binding = 2) buffer readonly StringBuffer {
StringInstance strings[];
};
layout(push_constant) uniform readonly PushConstant{
vec2 screenSize;
mat4 mvp;
};
void main() {
const GlyphInstance instance = instances[gl_InstanceIndex];
const GlyphMetric metric = metrics[getLower(instance.index)];
vec2 p = vec2(gl_VertexIndex % 2, gl_VertexIndex / 2);
const vec2 p0 = uint_to_vec2(metric.x0_y0);
const vec2 p1 = uint_to_vec2(metric.x1_y1);
outUV = (p0 + (p1 - p0) * p) / vec2(2048, 1132);
p *= vec2(metric.xoff2 - metric.xoff, metric.yoff2 - metric.yoff);
p += vec2(metric.xoff, metric.yoff);
p += fixed2_to_vec2(instance.position);
p += vec2(0, 18.2316);
const StringInstance string = strings[instance.instance];
p += fixed2_to_vec2(string.xy);
p *= vec2(1, -1);
p *= 2.0 / screenSize;
p += vec2(-1, 1);
gl_Position = mvp * vec4(p, 0.0, 1.0);
}

View file

@ -1,22 +0,0 @@
layout (location = 0) in vec2 inUV;
layout (location = 1) in vec4 inColor;
layout (location = 0) out vec4 outColor;
layout (binding = 2) uniform sampler2D colorSampler;
vec4 toSRGB(vec4 v) {
return vec4(pow(v.rgb, vec3(2.2)), v.a);
}
void main() {
if(inColor.a == 0.0)
discard;
if(textureSize(colorSampler, 0).x > 1)
outColor = texture(colorSampler, inUV);
else
outColor = inColor;
outColor = toSRGB(outColor);
}

View file

@ -1,38 +0,0 @@
#extension GL_GOOGLE_include_directive : require
#include "font.glsl"
layout (location = 0) out vec2 outUV;
layout (location = 1) out vec4 outColor;
struct ElementInstance {
vec4 color;
uint position, size;
uint padding[2];
};
layout(std430, binding = 0) buffer readonly ElementBuffer {
ElementInstance elements[];
};
layout(push_constant) uniform readonly PushConstant{
vec2 screenSize;
mat4 mvp;
};
void main() {
const ElementInstance instance = elements[gl_InstanceIndex];
vec2 p = vec2(gl_VertexIndex % 2, gl_VertexIndex / 2);
outUV = p;
p *= fixed2_to_vec2(instance.size);
p += fixed2_to_vec2(instance.position);
p *= vec2(1, -1);
p *= 2.0 / screenSize;
p += vec2(-1, 1);
outColor = instance.color;
gl_Position = mvp * vec4(p, 0.0, 1.0);
}