mesa/program_interface_query: fix transform feedback varyings.
[mesa.git] / src / mesa / main / pipelineobj.c
index f2a872dc83a7b5949535ff3821d318ec19ac4420..5a46cfe2dcda357e872811a8d42736a84d7f646d 100644 (file)
@@ -43,8 +43,8 @@
 #include "main/shaderobj.h"
 #include "main/transformfeedback.h"
 #include "main/uniforms.h"
-#include "glsl/glsl_parser_extras.h"
-#include "glsl/ir_uniform.h"
+#include "compiler/glsl/glsl_parser_extras.h"
+#include "compiler/glsl/ir_uniform.h"
 #include "program/program.h"
 #include "program/prog_parameter.h"
 #include "util/ralloc.h"
@@ -442,6 +442,7 @@ void
 _mesa_bind_pipeline(struct gl_context *ctx,
                     struct gl_pipeline_object *pipe)
 {
+   int i;
    /* First bind the Pipeline to pipeline binding point */
    _mesa_reference_pipeline_object(ctx, &ctx->Pipeline.Current, pipe);
 
@@ -467,6 +468,9 @@ _mesa_bind_pipeline(struct gl_context *ctx,
 
       FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
 
+      for (i = 0; i < MESA_SHADER_STAGES; i++)
+         _mesa_shader_program_init_subroutine_defaults(ctx->_Shader->CurrentProgram[i]);
+
       if (ctx->Driver.UseProgram)
          ctx->Driver.UseProgram(ctx, NULL);
    }
@@ -626,7 +630,7 @@ _mesa_GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
    /* Are geometry shaders available in this context?
     */
    const bool has_gs = _mesa_has_geometry_shaders(ctx);
-   const bool has_tess = _mesa_has_tessellation(ctx);;
+   const bool has_tess = _mesa_has_tessellation(ctx);
 
    if (!pipe) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
@@ -902,7 +906,8 @@ _mesa_validate_program_pipeline(struct gl_context* ctx,
    /* Validate inputs against outputs, this cannot be done during linking
     * since programs have been linked separately from each other.
     *
-    * From OpenGL 4.5 Core spec:
+    * Section 11.1.3.11 (Validation) of the OpenGL 4.5 Core Profile spec says:
+    *
     *     "Separable program objects may have validation failures that cannot be
     *     detected without the complete program pipeline. Mismatched interfaces,
     *     improper usage of program objects together, and the same
@@ -910,8 +915,21 @@ _mesa_validate_program_pipeline(struct gl_context* ctx,
     *     program objects."
     *
     * OpenGL ES 3.1 specification has the same text.
+    *
+    * Section 11.1.3.11 (Validation) of the OpenGL ES spec also says:
+    *
+    *    An INVALID_OPERATION error is generated by any command that transfers
+    *    vertices to the GL or launches compute work if the current set of
+    *    active program objects cannot be executed, for reasons including:
+    *
+    *    * The current program pipeline object contains a shader interface
+    *      that doesn't have an exact match (see section 7.4.1)
+    *
+    * Based on this, only perform the most-strict checking on ES or when the
+    * application has created a debug context.
     */
-   if (!_mesa_validate_pipeline_io(pipe))
+   if ((_mesa_is_gles(ctx) || (ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT)) &&
+       !_mesa_validate_pipeline_io(pipe))
       return GL_FALSE;
 
    pipe->Validated = GL_TRUE;
@@ -964,8 +982,5 @@ _mesa_GetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize,
       return;
    }
 
-   if (pipe->InfoLog)
-      _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog);
-   else
-      *length = 0;
+   _mesa_copy_string(infoLog, bufSize, length, pipe->InfoLog);
 }