glsl: Fix incorrect hard-coded location of the gl_SecondaryFragColorEXT built-in.
[mesa.git] / src / compiler / glsl / standalone.cpp
index e5b9057cd013235bdd24b5564565ab933aa8ad67..88fe5fde09611a6c8ee0d694522be198ce50c225 100644 (file)
@@ -222,7 +222,11 @@ initialize_context(struct gl_context *ctx, gl_api api)
    ctx->Const.GenerateTemporaryNames = true;
    ctx->Const.MaxPatchVertices = 32;
 
-   ctx->Driver.NewShader = _mesa_new_shader;
+   /* GL_ARB_explicit_uniform_location, GL_MAX_UNIFORM_LOCATIONS */
+   ctx->Const.MaxUserAssignableUniformLocations =
+      4 * MESA_SHADER_STAGES * MAX_UNIFORMS;
+
+   ctx->Driver.NewShader = _mesa_new_linked_shader;
 }
 
 /* Returned string will have 'ctx' as its ralloc owner. */
@@ -381,8 +385,14 @@ standalone_compile_shader(const struct standalone_options *_options,
 
       compile_shader(ctx, shader);
 
-      if (strlen(shader->InfoLog) > 0)
-         printf("Info log for %s:\n%s\n", files[i], shader->InfoLog);
+      if (strlen(shader->InfoLog) > 0) {
+         if (!options->just_log)
+            printf("Info log for %s:\n", files[i]);
+
+         printf("%s", shader->InfoLog);
+         if (!options->just_log)
+            printf("\n");
+      }
 
       if (!shader->CompileStatus) {
          status = EXIT_FAILURE;
@@ -396,17 +406,23 @@ standalone_compile_shader(const struct standalone_options *_options,
       link_shaders(ctx, whole_program);
       status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
 
-      if (strlen(whole_program->InfoLog) > 0)
-         printf("Info log for linking:\n%s\n", whole_program->InfoLog);
+      if (strlen(whole_program->InfoLog) > 0) {
+         printf("\n");
+         if (!options->just_log)
+            printf("Info log for linking:\n");
+         printf("%s", whole_program->InfoLog);
+         if (!options->just_log)
+            printf("\n");
+      }
 
       for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) {
-         struct gl_shader *shader = whole_program->_LinkedShaders[i];
+         struct gl_linked_shader *shader = whole_program->_LinkedShaders[i];
 
          if (!shader)
             continue;
 
          shader->Program = rzalloc(shader, gl_program);
-         init_gl_program(shader->Program, shader->Type);
+         init_gl_program(shader->Program, shader->Stage);
       }
    }