Bug 82921 - layout(location=0) emits error >= MAX_UNIFORM_LOCATIONS due to integer underflow
Summary: layout(location=0) emits error >= MAX_UNIFORM_LOCATIONS due to integer underflow
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Tapani Pälli
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
: 83124 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-08-21 20:49 UTC by Micael Dias
Modified: 2014-09-26 05:32 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Micael Dias 2014-08-21 20:49:04 UTC
I have a

layout(location=0) uniform sampler2D diffuseTex;

in my shader, and it fails to compile with error:
"location(s) consumed by uniform diffuseTex >= MAX_UNIFORM_LOCATIONS (65536)".

I think this is because of this line in ast_to_hir.cpp:
> unsigned max_loc = qual->location + var->type->uniform_locations() - 1;

If "var->type->uniform_locations()" returns zero and qual->location is zero, we have an integer underflow, and therefore the following checks will fail.
Comment 1 Tapani Pälli 2014-08-22 04:44:42 UTC
will take a look
Comment 2 Tapani Pälli 2014-08-22 04:45:36 UTC
Micael, would be cool to have your shader as a test case.
Comment 3 Tapani Pälli 2014-08-22 05:08:34 UTC
a new piglit test case and fix for the bug has been sent for review ..
Comment 4 Micael Dias 2014-08-22 14:09:00 UTC
(In reply to comment #2)
> Micael, would be cool to have your shader as a test case.

As you created the piglit test, am I right to believe this is no longer needed?

The shader is a very simple one basically calling texture() on the uniform sampler2D.
Comment 5 Tapani Pälli 2014-08-27 11:16:14 UTC
Yep no additional tests needed. I sent another fix to the list, all explicit uniform Piglit tests are passing with this.
Comment 6 Tapani Pälli 2014-09-17 08:32:20 UTC
fix has been on the list for some time now ..

http://lists.freedesktop.org/archives/mesa-dev/2014-August/066681.html
Comment 7 Tapani Pälli 2014-09-17 08:32:35 UTC
*** Bug 83124 has been marked as a duplicate of this bug. ***
Comment 8 Tapani Pälli 2014-09-26 05:32:38 UTC
fixed in master


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.