Bug 71723 - Sampler arrays indexed with non-constant expressions
Summary: Sampler arrays indexed with non-constant expressions
Status: RESOLVED NOTABUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 9.2
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-18 07:20 UTC by Victor Luchits
Modified: 2013-12-13 20:18 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test vertex shader (1.34 KB, text/plain)
2013-11-18 07:20 UTC, Victor Luchits
Details

Description Victor Luchits 2013-11-18 07:20:55 UTC
Created attachment 89383 [details]
Test vertex shader

Hello,

in my opinion GLSL compiler in mesa is too restrictive when it comes to sampler arrays. The attached vertex shader can not be compiled due to the "sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later":

Lines 159-136 of src/glsl/ast_array_index.cpp say:

    * This restriction was added in GLSL 1.30.  Shaders using earlier version
    * of the language should not be rejected by the compiler front-end for
    * using this construct.  This allows useful things such as using a loop
    * counter as the index to an array of samplers.  If the loop in unrolled,
    * the code should compile correctly.  Instead, emit a warning.

If compiler actually attempted to unroll the loop above, it would notice that the code does compile correctly in that case. Instead it just emits and error and, in my opinion, contradicts the comment above by not allowing the aforementioned "useful thing".

Can the compiler be changed to _first_ attempt to unroll the loop and then check for sampler array indices being constants?
Comment 1 Emil Velikov 2013-12-13 20:18:03 UTC
I'm guessing this can be closed as "notabug", as per ML discussion [1]

[1] http://lists.freedesktop.org/archives/mesa-dev/2013-November/048565.html


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.