[Mesa-dev] [PATCH 06/10] mesa: Remove old validate_io function

Ian Romanick idr at freedesktop.org
Fri May 20 07:26:01 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

The new validate_io catches all of the cases (and many more) that the
old function caught.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/main/shader_query.cpp | 104 -----------------------------------------
 1 file changed, 104 deletions(-)

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 5fa611f..a636b04 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1371,106 +1371,6 @@ _mesa_get_program_resourceiv(struct gl_shader_program *shProg,
 }
 
 static bool
-validate_io(const struct gl_shader *producer,
-            const struct gl_shader *consumer)
-{
-   assert(producer && consumer);
-   unsigned inputs = 0, outputs = 0;
-
-   /* From OpenGL ES 3.1 spec (Interface matching):
-    *
-    *    "An output variable is considered to match an input variable in the
-    *    subsequent shader if:
-    *
-    *    - the two variables match in name, type, and qualification; or
-    *    - the two variables are declared with the same location qualifier and
-    *      match in type and qualification.
-    *
-    *    ...
-    *
-    *    At an interface between program objects, the set of inputs and outputs
-    *    are considered to match exactly if and only if:
-    *
-    *    - Every declared input variable has a matching output, as described
-    *    above.
-    *
-    *    - There are no user-defined output variables declared without a
-    *    matching input variable declaration.
-    *
-    *    - All matched input and output variables have identical precision
-    *    qualification.
-    *
-    *    When the set of inputs and outputs on an interface between programs
-    *    matches exactly, all inputs are well-defined except when the
-    *    corresponding outputs were not written in the previous shader. However,
-    *    any mismatch between inputs and outputs will result in a validation
-    *    failure."
-    *
-    * OpenGL Core 4.5 spec includes same paragraph as above but without check
-    * for precision and the last 'validation failure' clause. Therefore
-    * behaviour is more relaxed, input and output amount is not required by the
-    * spec to be validated.
-    *
-    * FIXME: Update once Khronos spec bug #15331 is resolved.
-    * FIXME: Add validation by type, currently information loss during varying
-    * packing makes this challenging.
-    */
-
-   /* For each output in a, find input in b and do any required checks. */
-   foreach_in_list(ir_instruction, out, producer->ir) {
-      ir_variable *out_var = out->as_variable();
-      if (!out_var || out_var->data.mode != ir_var_shader_out ||
-          is_gl_identifier(out_var->name))
-         continue;
-
-      outputs++;
-
-      inputs = 0;
-      foreach_in_list(ir_instruction, in, consumer->ir) {
-         ir_variable *in_var = in->as_variable();
-         if (!in_var || in_var->data.mode != ir_var_shader_in ||
-             is_gl_identifier(in_var->name))
-            continue;
-
-         inputs++;
-
-         /* Match by location qualifier and precision.
-          *
-          * FIXME: Add explicit location matching validation here. Be careful
-          * not to match varyings with explicit locations to varyings without
-          * explicit locations.
-          */
-         if ((in_var->data.explicit_location &&
-             out_var->data.explicit_location) &&
-             in_var->data.location == out_var->data.location &&
-             in_var->data.precision == out_var->data.precision)
-            continue;
-
-         unsigned len = strlen(in_var->name);
-
-         /* Handle input swizzle in variable name. */
-         const char *dot = strchr(in_var->name, '.');
-         if (dot)
-            len = dot - in_var->name;
-
-         /* Match by name and precision. */
-         if (strncmp(in_var->name, out_var->name, len) == 0) {
-            /* From OpenGL ES 3.1 spec:
-             *     "When both shaders are in separate programs, mismatched
-             *     precision qualifiers will result in a program interface
-             *     mismatch that will result in program pipeline validation
-             *     failures, as described in section 7.4.1 (“Shader Interface
-             *     Matching”) of the OpenGL ES 3.1 Specification."
-             */
-            if (in_var->data.precision != out_var->data.precision)
-               return false;
-         }
-      }
-   }
-   return inputs == outputs;
-}
-
-static bool
 validate_io(struct gl_shader_program *producer,
             struct gl_shader_program *consumer)
 {
@@ -1667,10 +1567,6 @@ _mesa_validate_pipeline_io(struct gl_pipeline_object *pipeline)
             break;
 
          if (shProg[prev]->IsES || shProg[idx]->IsES) {
-            if (!validate_io(shProg[prev]->_LinkedShaders[prev],
-                             shProg[idx]->_LinkedShaders[idx]))
-               return false;
-
             if (!validate_io(shProg[prev], shProg[idx]))
                return false;
          }
-- 
2.5.5



More information about the mesa-dev mailing list