Mesa (master): glsl: verify location when dual source blending

Tapani Pälli tpalli at kemper.freedesktop.org
Wed Jul 29 05:19:44 UTC 2015


Module: Mesa
Branch: master
Commit: e17056f5a20beb752a530180fce1aba0e68877b6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e17056f5a20beb752a530180fce1aba0e68877b6

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Fri Jul  3 10:19:23 2015 +0300

glsl: verify location when dual source blending

Same check is made for glBindFragDataLocationIndexed but it was missing
when using layout qualifiers.

Fixes following Piglit test:
	arb_blend_func_extended-output-location

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Timothy Arceri <t_arceri at yahoo.com.au>

---

 src/glsl/linker.cpp |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index c8d2e8e..a781211 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2431,6 +2431,25 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
 	 }
       }
 
+      /* From GL4.5 core spec, section 15.2 (Shader Execution):
+       *
+       *     "Output binding assignments will cause LinkProgram to fail:
+       *     ...
+       *     If the program has an active output assigned to a location greater
+       *     than or equal to the value of MAX_DUAL_SOURCE_DRAW_BUFFERS and has
+       *     an active output assigned an index greater than or equal to one;"
+       */
+      if (target_index == MESA_SHADER_FRAGMENT && var->data.index >= 1 &&
+          var->data.location - generic_base >=
+          (int) constants->MaxDualSourceDrawBuffers) {
+         linker_error(prog,
+                      "output location %d >= GL_MAX_DUAL_SOURCE_DRAW_BUFFERS "
+                      "with index %u for %s\n",
+                      var->data.location - generic_base, var->data.index,
+                      var->name);
+         return false;
+      }
+
       const unsigned slots = var->type->count_attribute_slots();
 
       /* From GL4.5 core spec, section 11.1.1 (Vertex Attributes):




More information about the mesa-commit mailing list