[Mesa-dev] [Bug 89590] Crash in glLinkProgram with shaders with multiple constant arrays

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Mar 16 05:45:47 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=89590

            Bug ID: 89590
           Summary: Crash in glLinkProgram with shaders with multiple
                    constant arrays
           Product: Mesa
           Version: 10.5
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Mesa core
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: jlegg at feralinteractive.com
        QA Contact: mesa-dev at lists.freedesktop.org

Created attachment 114347
  --> https://bugs.freedesktop.org/attachment.cgi?id=114347&action=edit
Reproducer

glLinkProgram crashes if there are multiple shaders with used arrays of
constants attached to the program, and the arrays have different numbers of
elements. For example:

Vertex shader:
#version 330
in vec2 in_position;
void main()
{
    const float zs[4] = float[4](0, 0, 0, 0);
    gl_Position = vec4(in_position, zs[int(in_position.x) % 4], 1.0);
}


Fragment shader:
#version 330
void main()
{
    const vec4 colours[2] = vec4[2](vec4(1, 0, 0, 0), vec4(0, 1, 0, 0));
    gl_FragColor = colours[int(gl_FragCoord.x) % 2];
}

The attached program uses these shaders and reproduces the bug.

Backtrace from Mesa 10.5.1:
> #0 linker::copy_constant_to_storage(gl_constant_value*, ir_constant const*, glsl_base_type, unsigned int, unsigned int) glsl/link_uniform_initializers.cpp:66
> #1 linker::set_uniform_initializer(void*, gl_shader_program*, char const*, glsl_type const*, ir_constant*, unsigned int) glsl/link_uniform_initializers.cpp:210
> #2 link_set_uniform_initializers(gl_shader_program*, unsigned int) glsl/link_uniform_initializers.cpp:309
> #3 link_assign_uniform_locations(gl_shader_program*, unsigned int) glsl/link_uniforms.cpp:1034
> #4 link_shaders(gl_context*, gl_shader_program*) glsl/linker.cpp:2869
> #5 _mesa_glsl_link_shader mesa/program/ir_to_mesa.cpp:3031
> #6 link_program mesa/main/shaderapi.c:932

The second argument to linker::copy_constant_to_storage, val, appears bogus, as
it points to something near 0x0.

The arrays of constants do not have to be declared const in the shader, as long
as all the element's values are known at compile time.

I found this using an AMD PITCAIRN gpu on Fedora 21, x86_64 architecture.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150316/86b112f0/attachment.html>


More information about the mesa-dev mailing list