Switch to uniform blocks for mesh shaders - matches geometry shader

This commit is contained in:
baldurk
2016-02-07 18:48:50 +01:00
parent 6b2c1bfad6
commit 81f697fc1b
2 changed files with 15 additions and 9 deletions
+8 -5
View File
@@ -24,8 +24,11 @@
#version 420 core
layout (location = 0) in vec4 INsecondary;
layout (location = 1) in vec4 INnorm;
in v2f
{
vec4 secondary;
vec4 norm;
} IN;
layout (binding = 0, std140) uniform meshuniforms
{
@@ -50,17 +53,17 @@ void main(void)
if(type == MESHDISPLAY_SECONDARY)
{
color_out = vec4(INsecondary.xyz, 1);
color_out = vec4(IN.secondary.xyz, 1);
}
else if(type == MESHDISPLAY_SECONDARY_ALPHA)
{
color_out = vec4(INsecondary.www, 1);
color_out = vec4(IN.secondary.www, 1);
}
else if(type == MESHDISPLAY_FACELIT)
{
vec3 lightDir = normalize(vec3(0, -0.3f, -1));
color_out = vec4(Mesh.color.xyz*abs(dot(lightDir, INnorm.xyz)), 1);
color_out = vec4(Mesh.color.xyz*abs(dot(lightDir, IN.norm.xyz)), 1);
}
else //if(type == MESHDISPLAY_SOLID)
{
+7 -4
View File
@@ -44,8 +44,11 @@ out gl_PerVertex
float gl_ClipDistance[];
};
layout (location = 0) out vec4 OUTsecondary;
layout (location = 1) out vec4 OUTnorm;
out v2f
{
vec4 secondary;
vec4 norm;
} OUT;
void main(void)
{
@@ -65,8 +68,8 @@ void main(void)
gl_Position = Mesh.mvp * pos;
gl_Position.xy += Mesh.pointSpriteSize.xy*0.01f*psprite[gl_VertexID%4]*gl_Position.w;
OUTsecondary = secondary;
OUTnorm = vec4(0, 0, 1, 1);
OUT.secondary = secondary;
OUT.norm = vec4(0, 0, 1, 1);
// GL->VK conventions
gl_Position.y = -gl_Position.y;