Bug 29185

Summary: [glsl2] GL_ARB_draw_buffers unsupported in vertex shader
Product: Mesa Reporter: Gordon Jin <gordon.jin>
Component: glsl-compilerAssignee: Ian Romanick <idr>
Status: VERIFIED FIXED QA Contact: fangxun <xunx.fang>
Severity: minor    
Priority: low    
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Gordon Jin 2010-07-20 18:27:06 UTC
piglit/tests/glslparsertest/glsl2/draw_buffers-05.vert was changed (http://cgit.freedesktop.org/piglit/commit/?id=48fc4beee7ae3818eef746396749be5e00ae670a) to expect GL_ARB_draw_buffers supported in vertex shader (for version 1.10).

But mesa glsl2 branch still considers not to support it in vertex shader:
src/glsl/glsl_parser_extras.cpp:
   } else if (strcmp(name, "GL_ARB_draw_buffers") == 0) {
      /* This extension is only supported in fragment shaders.
       */
      if (state->target != fragment_shader) {
         unsupported = true;
      } else {
         state->ARB_draw_buffers_enable = (ext_mode != extension_disable);
         state->ARB_draw_buffers_warn = (ext_mode == extension_warn);
      }

so the piglit case fails to compile with error: 
extension `GL_ARB_draw_buffers' unsupported in vertex shader

It passes with mesa master branch.
Comment 1 Ian Romanick 2010-07-20 19:25:07 UTC
As mentioned in the comment in the test, I'm not 100% sure which behavior is correct.  Nvidia and ATI each do the opposite in their compilers, and the spec (GL_ARB_draw_buffers) doesn't provide any guidance.

I'm decreasing the severity.
Comment 2 Ian Romanick 2013-08-27 23:50:57 UTC
commit 6aba035f6b0dee0e0b78b2110fa75463c7888c3a
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Mon Jul 29 10:40:51 2013 -0700

    glsl: Remove shader stage checking for extension handling.
    
    Certain extensions only add functionality to particular shader stages.
    (For example, ARB_draw_instanced only adds variables to the vertex
    shader stage.)
    
    Previously, we only allowed such extensions to be enabled in the shader
    stages where they're useful.  However, I've never found any text which
    mandates that behavior; in my opinion, you should be able to turn on
    extensions in any shader stage, even if they have no effect.
    
    Fixes Piglit tests glslparsertest/glsl2/draw_buffers-05.vert and
    ARB_draw_instanced/preprocessor/feature-macro-enabled.frag.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29185
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>

This commit is now queued for 9.1 and 9.2 branches.
Comment 3 Gordon Jin 2013-10-11 04:58:01 UTC
Xun, please help verify.
Comment 4 fangxun 2014-07-17 08:53:47 UTC
Verified it on mesa 10.2 branch.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.