Recompile text-rendering shaders to be LunarG sample driver friendly

This commit is contained in:
baldurk
2016-02-07 18:39:50 +01:00
parent eaf31123f7
commit c5b3cf5849
2 changed files with 19 additions and 7 deletions
+10 -4
View File
@@ -27,22 +27,28 @@
layout (binding = 3) uniform sampler2D tex0;
layout (location = 0) out vec4 color_out;
// LunarG sample driver doesn't support in/out blocks yet it seems
/*
in v2f
{
vec4 tex;
vec2 glyphuv;
} IN;
*/
layout (location = 0) in vec4 INtex;
layout (location = 1) in vec2 INglyphuv;
void main(void)
{
float text = 0;
if(IN.glyphuv.x >= 0.0f && IN.glyphuv.x <= 1.0f &&
IN.glyphuv.y >= 0.0f && IN.glyphuv.y <= 1.0f)
if(INglyphuv.x >= 0.0f && INglyphuv.x <= 1.0f &&
INglyphuv.y >= 0.0f && INglyphuv.y <= 1.0f)
{
vec2 uv;
uv.x = mix(IN.tex.x, IN.tex.z, IN.glyphuv.x);
uv.y = mix(IN.tex.y, IN.tex.w, IN.glyphuv.y);
uv.x = mix(INtex.x, INtex.z, INglyphuv.x);
uv.y = mix(INtex.y, INtex.w, INglyphuv.y);
text = texture(tex0, uv.xy).x;
}
+9 -3
View File
@@ -57,11 +57,17 @@ out gl_PerVertex
float gl_ClipDistance[];
};
// LunarG sample driver doesn't support in/out blocks yet it seems
/*
out v2f
{
vec4 tex;
vec2 glyphuv;
} OUT;
*/
layout (location = 0) out vec4 OUTtex;
layout (location = 1) out vec2 OUTglyphuv;
void main(void)
{
@@ -85,12 +91,12 @@ void main(void)
glyph G = glyphs.data[ str.chars[strindex].x ];
OUT.glyphuv.xy = (pos.xy - G.posdata.xy) * G.posdata.zw;
OUT.tex = G.uvdata * general.CharacterSize.xyxy;
OUTglyphuv.xy = (pos.xy - G.posdata.xy) * G.posdata.zw;
OUTtex = G.uvdata * general.CharacterSize.xyxy;
const vec3 cols[5] = vec3[5](vec3(0, 0, 0),
vec3(1, 0, 0),
vec3(0, 1, 0),
vec3(0, 0, 1),
vec3(1, 0, 1));
}
}