Hi,
I have a simple vertex shader:
#version 450
#extension GL_NV_command_list : enable
struct SceneData
{
mat4 modelMatrix;
mat4 viewMatrix;
mat4 projectionMatrix;
};
layout(commandBindableNV) uniform;
in layout( location = 0 ) vec3 position;
in layout( location = 1 ) vec3 normal;
layout( std140, binding = 0 ) uniform sceneDataBuffer {
SceneData sceneData;
};
out vec3 vertexNormal;
void main()
{
gl_Position = sceneData.projectionMatrix *
sceneData.viewMatrix *
sceneData.modelMatrix *
vec4( position, 1.0 );
vertexNormal = normal;
};
And a fragment shader:
#version 450
out layout( location = 0, index = 0 ) vec4 color;
in vec3 vertexNormal;
void main()
{
color = vec4( vertexNormal, 1.0 );
};
No matter what I tried, couldn’t get varying passing vertexNormal from vertex to shader stage. I verified normal attribute by checking its values (by adding to position, etc) they look correct. Its also failing if I change assignment of vertexNormal in vertex shader to:
vertexNormal = vec3(0.0, 1.0, 0.0);
My geometry always get’s rendered in black (verified by setting framebuffer background to white)
Was wondering if there is anything that can effect behaviour of varyings. Could this be a driver bug? Isn’t it should be all handled implicitly? Is there any state variable can effect varyings?
FYI, my shaders are compiling fine and progam linking fine as well. I tested similar shader on the same hardware but without NV_Command_List extension and had no problem in passing values between shader stages.
Any suggestion would be extremely appriciated.
Thanks in advance.
Ali