pouët.net

Go to bottom

OpenGL transform feedback half float output

category: code [glöplog]
 
I've been trying to output to half float buffers using OpenGL's transform feedback without success, and after many frustrated atempts and removing most code I've ended up with this simple shader like:
Code:out uint2 O0; void main() { const vec4 t = vec4(1.0, 0.0, 0.0, 0.0); O0.x = packHalf2x16(t.xy); O0.y = packHalf2x16(t.zw); }

And I get a point on the screen (the camera is moving), which makes sense. However if I remove "const" I get a black screen. Shouldn't packHalf2x16 work with compile time variables instead of constants? Is it a driver bug or am I missing something?
added on the 2013-11-22 17:54:48 by xernobyl xernobyl
half float, wtf is that?
most likely you are not missing something, but doing something terrible wrong.
added on the 2013-11-22 19:55:13 by rudi rudi
half float = 16bit float

...but seeing

Code:out uint2 O0;


made me laugh :D Anyone reading that with a bad screen / wrong font is in for trouble!
added on the 2013-11-22 20:12:33 by psonice psonice
The OpenGL Shading Language specification says:
"Shaders should declare the version of the language they are written to."
And "packHalf2x16" was added in OpenGL4.
So your shader might needs:
#version 440
or older version but must be >= 400.
added on the 2013-11-22 22:11:02 by tomohiro tomohiro
#extension GL_ARB_shading_language_packing : require

I forgot that line. The shader compiles so that shouldn't be an issue, right?
added on the 2013-11-23 00:09:15 by xernobyl xernobyl
Anyway, I've ended up coding my very own sluggish packHalf2x16 and everything's working. Maybe I just don't know how to properly use GLSL extensions. Shouldn't it all work just by adding "#extension GL_ARB_shading_language_packing : require"?
added on the 2013-11-23 01:07:04 by xernobyl xernobyl
You don't need #extension if you're on a GL4.x context.

Anyhow, that sounds like a driver bug to me. const should never be affecting any results you're getting. You may consider reporting this to your vendor.
added on the 2013-11-23 10:36:30 by kbi kbi
Which vendor is it?
added on the 2013-11-23 15:30:43 by las las

login

Go to top