Bug 86594 - Segfault in glGetActiveUniformName
Summary: Segfault in glGetActiveUniformName
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 10.3
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-23 00:03 UTC by Simon Budig
Modified: 2014-12-17 20:30 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Testcase (4.43 KB, text/plain)
2014-11-23 01:14 UTC, Simon Budig
Details

Description Simon Budig 2014-11-23 00:03:07 UTC
I am trying to get some information about a compiled GL shader program, in particular I need to get information about the Uniform Variables used.

The code I use is this:

  glGetProgramiv (program, GL_ACTIVE_UNIFORMS, &n_uniforms);
  fprintf (stderr, "%d uniforms:\n", n_uniforms);

  for (i = 0; i < n_uniforms; i++)
    {
      glGetActiveUniformName (program, i, 79, &namelen, name);
      name[namelen] = '\0';
      fprintf (stderr, "  %2d: %s\n", i, name);
    }

I get a segfault within glGetActiveUniformName, something is wrong here. The same code works fine with the NVidia proprietary drivers.

Some more information:

GL_VERSION   : 2.1 Mesa 10.3.2
GL_VENDOR    : Intel Open Source Technology Center
GL_RENDERER  : Mesa DRI Intel(R) Ironlake Mobile 
GLEW_VERSION : 1.10.0
GLSL VERSION : 1.20

This is using debian unstable with libgl1-mesa-glx:amd64, 10.3.2-1, amd64

Valgrind is not really helpful, even with debug symbols installed:

==27042== Process terminating with default action of signal 11 (SIGSEGV)
==27042==  Bad permissions for mapped region at address 0x0
==27042==    at 0x0: ???
==27042==    by 0x402BFF: main (shadertoy.c:458)
==27042==
Comment 1 Simon Budig 2014-11-23 01:14:15 UTC
Created attachment 109875 [details]
Testcase

This is a testcase triggering the crash for me.

Compile with

   gcc -Wall -g -o bugtest bugtest.c -lglut -lGLEW -lGL -lm
Comment 2 Chris Forbes 2014-11-23 01:31:58 UTC
Looks like there's more than one thing wrong here.

glGetActiveUniformName is introduced with 3.1/ARB_uniform_buffer_object, which is not supported on Ironlake. Your test program ends up calling through a null function pointer, because GLEW never wired it up.

On 2.1, your best option here is glGetActiveUniform.


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.