gl-400-fbo-multisample, glMinSampleShading invalid input
elect86 opened this issue · 4 comments
Based on the docs
void glMinSampleShading(GLfloat value);
value can be only [0, 1], then 2 should be wrong..
I think that's a wrong reading of the documentation. :D
https://www.opengl.org/registry/specs/ARB/sample_shading.txt
😱
Wait, I was going to close this when I double read the docs and saw that I missed a *SAMPLES
..
If MULTISAMPLE or SAMPLE_SHADING_ARB is disabled, sample shading has no
effect. Otherwise, an implementation must provide a minimum ofmax(ceil(MIN_SAMPLE_SHADING_VALUE_ARB*SAMPLES),1) unique color values and sets of texture coordinates for each fragment. These are associated with the samples in an implementation-dependent manner. The value of MIN_SAMPLE_SHADING_VALUE_ARB is specified by calling void MinSampleShadingARB(clampf value); with <value> set to the desired minimum sample shading fraction. <value> is clamped to [0,1] when specified. The sample shading fraction may be queried by calling GetFloatv with pname set to MIN_SAMPLE_SHADING_VALUE_ARB. When the sample shading fraction is 1.0, a separate set of colors and other associated data are evaluated for each sample, each set of values are evaluated at the sample location.
It is really clamped, if I glMinSampleShading(2.0f)
and get it back I get 1.0f..
if you look at the function, the MIN_SAMPLE_SHADING_VALUE_ARB
is multiplied by SAMPLES
, that in your example is 4, so if we set it to 1.0f, we will get max(ceil(1.0f * 4), 1) = 4
, exactly once shading per sample
Every other value >1 wouldn't make sense because otherwise shading will be performed more time than the samples number..
Am I right or I am missing anything?
Groovounet, please reply.
Everywhere in code glMinSampleShading seems to be misused with parameter >1.0.
I tried glGetFloatv with GL_MIN_SAMPLE_SHADING_VALUE and it returned 1.0 for values greater than 1.0. So it simply clamps.
https://github.com/g-truc/ogl-samples/blob/master/tests/gl-320-texture-derivative.cpp#L189
https://github.com/g-truc/ogl-samples/blob/master/tests/gl-430-direct-state-access-ext.cpp#L285
and more....
This issue is fixed in 4.5.4 branch.
Thanks for reporting,
Christophe