Summary: | sampler allowed as non-uniform / non-function parameters | ||
---|---|---|---|
Product: | Mesa | Reporter: | Ian Romanick <idr> |
Component: | glsl-compiler | Assignee: | Paul Berry <stereotype441> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | Test case |
This is fixed on master by the commits below. These have been cherry picked to 7.11 (f80ae99) and 7.10 (0a838d1). commit f07221056e1822187546b76387714b3172f9b2c5 Author: Paul Berry <stereotype441@gmail.com> Date: Tue Jul 12 12:03:02 2011 -0700 glsl: Ensure that sampler declarations are always uniform or "in" parameters This brings us into compliance with page 17 (page 22 of the PDF) of the GLSL 1.20 spec: "[Sampler types] can only be declared as function parameters or uniform variables (see Section 4.3.5 "Uniform"). ... [Samplers] cannot be used as out or inout function parameters." The spec isn't explicit about whether this rule applies to structs/arrays containing shaders, but the intent seems to be to ensure that it can always be determined at compile time which sampler is being used in each texture lookup. So to avoid creating a loophole, the rule needs to apply to structs/arrays containing shaders as well. Fixes piglit tests spec/glsl-1.10/compiler/samplers/*.frag, and fixes bug 38987. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38987 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> commit ddc1c96390b685bb95f7431e862c3a64fcefa085 Author: Paul Berry <stereotype441@gmail.com> Date: Mon Jul 11 16:44:13 2011 -0700 glsl: Move type_contains_sampler() into glsl_type for later reuse. The new location, as a member function of glsl_type, is more consistent with queries like is_sampler(), is_boolean(), is_float(), etc. Placing the function inside glsl_type also makes it available to any code that uses glsl_types. |
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.
Created attachment 48790 [details] Test case While writing a GLSL shader, I discovered that Mesa's compiler allows samplers to be declared as global variables without being uniforms. GLSL has always required that samplers be either uniforms or function parameters. That attached piglit test case fails.