Bug 104915 - Indexed SHADING_LANGUAGE_VERSION query not supported
Summary: Indexed SHADING_LANGUAGE_VERSION query not supported
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: All All
: medium minor
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Reported: 2018-02-02 18:33 UTC by Baldur Karlsson
Modified: 2018-02-14 05:21 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

GLFW sample testing shading language version queries (1.06 KB, text/plain)
2018-02-02 18:33 UTC, Baldur Karlsson

Description Baldur Karlsson 2018-02-02 18:33:43 UTC
Created attachment 137134 [details]
GLFW sample testing shading language version queries

In GL4.3 the spec added new glGetStringi() query GL_SHADING_LANGUAGE_VERSION, which allows an application to query a list of supported versions (rather than just the latest, which glGetString() returns). I don't believe this ever existed in an extension, only in this new core version.

There are two queries relevant - the GL_SHADING_LANGUAGE_VERSION passed to glGetStringi(), and then the index ranges from 0 to whatever glGetIntegerv(GL_NUM_SHADING_LANGUAGE_VERSIONS) returns, which is the other query.

I've attached a simple program (using glfw for conciseness/clarity) that exhibits the problem in an isolated run. The important bit though is:

  printf("Shading language version: %s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));

  glGetIntegerv(GL_NUM_SHADING_LANGUAGE_VERSIONS, &numLanguages);
  printf("%d total languages\n", numLanguages);

  for(i = 0; i < numLanguages; i++)
    printf("language %d: %s\n", i, glGetStringi(GL_SHADING_LANGUAGE_VERSION, i));

Actual output:

  Shading language version: 4.50
  0 total languages

Expected output (something along these lines):

  Shading language version: 4.50
  10 total languages
  language 0: 450 core
  language 1: 450 compatibility
  language 2: 440 core
  language 3: 440 compatibility
  language 4: 430 core
  language 5: 430 compatibility
  language 6: 420 core
  language 7: 420 compatibility
  language 8: 410 core
  language 9: 410 compatibility
Comment 1 Tapani Pälli 2018-02-14 05:21:36 UTC
Fixed in Mesa master. Thanks for top quality bug report!

--- 8< ---
commit a553c54abf92533daf442073dd3408c35f57d8ba
Author: Vadym Shovkoplias <vadim.shovkoplias@gmail.com>
Date:   Tue Feb 13 11:38:22 2018 -0700

    mesa: add glsl version query (v4)
    and glGetStringi for GL_SHADING_LANGUAGE_VERSION
      - Combine similar functionality into
        _mesa_get_shading_language_version() function.
      - Change GLSL version return mechanism.
      - Add return of empty string for GLSL ver 1.10.
      - Move _mesa_get_shading_language_version() function
        to src/mesa/main/version.c.
      - Add OpenGL version check.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104915
    Signed-off-by: Andriy Khulap <andriy.khulap@globallogic.com>
    Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias@globallogic.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>

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.