On Wed, Oct 16, 2013 at 11:25 PM, Kenneth Graunke <kenn...@whitecape.org> wrote: > On 10/16/2013 03:49 PM, Ian Romanick wrote: > [snip] >> You are completely correct here. We should check what other vendors do. >> I think 5 tests will tell us everything we need to know (then we'll >> probably submit some spec bugs). I don't have any non-Intel hardware >> that supports either extension, so I can't actually try any of these. > > Thanks for the tests, Ian! > > I ran them on my Radeon HD 6870 with Catalyst 13.10 by doing: I ran these tests on NVIDIA GTX 650 OpenGL 4.3 drivers (319.17)
> $ PIGLIT_PLATFORM=glx glslparsertest --check-link 1.frag pass > >> 1. Does this compile, link, and run: >> >> #version 130 >> #extension GL_ARB_sample_shading: require >> >> out vec4 color; >> >> void main() { >> color = vec4(gl_SampleMask.length()); >> gl_SampleMask[0] = ~0; >> } > > Successfully compiled and linked fragment shader 1.frag: (no compiler output) > NVIDIA: Successfully compiled and linked fragment shader 1.frag: (no compiler output) Mesa: Successfully compiled and linked fragment shader 1.frag: (no compiler output) >> 2. Does this compile and link: >> >> #version 130 >> #extension GL_ARB_sample_shading: require >> >> out vec4 color; >> >> void main() { >> color = vec4(1); >> gl_SampleMask[0] = ~0; >> gl_SampleMask[1] = ~0; >> } > > Failed to compile fragment shader 2.frag: > Fragment shader failed to compile with the following errors: > ERROR: 0:9: error(#147) "[" array index out of range: '1' > ERROR: error(#273) 1 compilation errors. No code generated > NVIDIA: Failed to link: Fragment info ------------- 0(9) : warning C1068: array index out of bounds 0(9) : warning C1068: array index out of bounds 0(9) : warning C1068: array index out of bounds 0(9) : warning C1068: array index out of bounds 0(9) : warning C1068: array index out of bounds 0(9) : error C1068: array index out of bounds Failed to link fragment shader 2.frag: 0(9) : warning C1068: array index out of bounds 0(9) : warning C1068: array index out of bounds (compiler prints shader source here) Mesa: Failed to compile fragment shader 2.frag: 0:9(17): error: array index must be < 1 >> 3. Does this compile and link: >> >> #version 130 >> #extension GL_ARB_sample_shading: require >> #extension GL_ARB_gpu_shader5: require >> >> out vec4 color; >> >> void main() { >> color = vec4(1); >> gl_SampleMask = gl_SampleMaskIn; >> } > > Successfully compiled and linked fragment shader 3.frag: (no compiler output) > NVIDIA: Successfully compiled and linked fragment shader 3.frag: (no compiler output) Mesa: Failed to compile fragment shader 3.frag: 0:3(12): error: extension `GL_ARB_gpu_shader5' unsupported in fragment shader >> 4. Does this compile and link: >> >> #version 130 >> #extension GL_ARB_sample_shading: require >> >> out vec4 color; >> in int gl_SampleMask[1]; >> >> void main() { >> color = vec4(1); >> gl_SampleMask[0] = ~0; >> } > > Successfully compiled and linked fragment shader 4.frag: > WARNING: 0:5: warning(#375) Redeclaration of built-in name: gl_SampleMask > WARNING: 0:9: warning(#398) l-value required: assign "gl_SampleMask" (can't > modify an input) > > Presumably you meant "out int gl_SampleMask[1];" instead. With that change, > > Successfully compiled and linked fragment shader 4b.frag: > WARNING: 0:5: warning(#375) Redeclaration of built-in name: gl_SampleMask > With "out int gl_SampleMask[1];" change: NVIDIA: Successfully compiled and linked fragment shader 4.frag: (no compiler output) Mesa: mesa: Failed to compile fragment shader 4.frag: 0:0(0): error: `gl_SampleMask' redeclared >> 5. Does this compile and link: >> >> #version 130 >> #extension GL_ARB_sample_shading: require >> >> out vec4 color; >> in int gl_SampleMask[2]; >> >> void main() { >> color = vec4(1); >> gl_SampleMask[0] = ~0; >> gl_SampleMask[1] = ~0; >> } > > Successfully compiled and linked fragment shader 5.frag: > WARNING: 0:5: warning(#375) Redeclaration of built-in name: gl_SampleMask > WARNING: 0:9: warning(#398) l-value required: assign "gl_SampleMask" (can't > modify an input) > WARNING: 0:10: warning(#398) l-value required: assign "gl_SampleMask" (can't > modify an input) > > Again changing "in" to "out": > > Successfully compiled and linked fragment shader 5b.frag: > WARNING: 0:5: warning(#375) Redeclaration of built-in name: gl_SampleMask > NVIDIA: Failed to link: Fragment info ------------- 0(5) : error C5102: output semantic attribute "SAMPLEMASK" has too big of a numeric index (1) Failed to link fragment shader 5.frag: Mesa: mesa: Failed to compile fragment shader 5.frag: 0:0(0): error: `gl_SampleMask' redeclared 0:10(17): error: array index must be < 1 So, AMD and NVIDIA gives similar output for above test cases except for 5.frag. They both seem to use fixed length builtin array: gl_SampleMask[1]. Both allow redeclaring builtin variables. Mesa doesn't seem to allow any redeclaration of builtin variables. > I haven't actually tried drawing with the shaders. > > --Ken _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev