uvec4 gl_Position as StreamOutput member

I’m converting all my (DX) code to OpenGL.
Some of my vertex shaders write to a uint4 (uvec4) StreamOutput buffer (TransformFeedback).
using any “user” output name runs fine on NVidia & ATI driver.
using gl_Position (SV_POSITION) does not work on NVidia (runs on ATI).

Is it an issue in the NVidia driver or something prohibited (gl_Position MUST be float4 ???)
by the standard (means that ATI driver is too much permissive ?)

Did you check the info log with glGet[Shader|Program]InfoLog() after compilation of the shader and link of the program for any warnings or errors?

What #version and #extension directives have you specified at the beginning of your shader?

The GLSL specs only mention built-in variable gl_Position as vec4. I don’t know offhand if any extension changes that. If your custom output name works, that’s the more general and modern method anyway.

thanks for your very fast answer :)

there is no error during link [glGetProgramiv(GL_LINK_STATUS) => ok]
I’ll give a try to get the InfoLog even on Link valid status to see if there are warnings.
(is there a way to enable “warning as error” during shader compilation ?)

I prefix the shader with “#version 420 core”

Yes, it runs fine without using gl_Position.
But, I spend 2 weeks converting roughtly my whole DirectX code to OpenGL
then spend 4 weeks (not finished) tracking “magic” issues like this one.
And … generaly speaking, I trying to have a list of “howto” & “hownotto”
with explanations (not “magic”)

is there a way to enable “warning as error” during shader compilation <<

Yes, that was possible with the NVEmulate tool. (I haven’t used it in a long time.)

You might also want to check out Nsight if you spend a lot of time with debugging graphics programs.

Hi :)

I add in my code some lines to retrieve the InfoLog from Shader (compile) & Program (link) even if there is no error.
On NVidia hardware, I get nothing (I assume there is no warning) (using a uvec4 as type for a StreamOutput value in a VS, named “toto” or “gl_Position”)
On ATI hardware, I get this warning :

Outputs that are integers should be qualified with the interpolation qualifier “flat”

which seems to me rather … surprising because outputs are outputs so I don’t undestand the need to qualify interpolation mode (as input, it’s clear, but as output, I don’t understand)

thanks for the informations.

I will try nvemulate. It seems very interesting to be able to take a look at the ASM code of a shader (I’m using nearly every day GPU Shader analyzer from ATI for this feature, it would be really great to have such a tool (GUI able to open & edit a text file, then compile with some options and see the ASM result) for NVidia hardware)

To “debug” DX code I’m using GPA (Intel) which is very convenient.

I tried nsight some weeks ago (to debug my DX -> OpenGL conversion) but, maybe I didn’t try enough, I didn’t achieve to get the informations I need to debug with it … I’ll try more ;)