nir/spirv: Add a missing break statement
[mesa.git] / src / glsl / main.cpp
index 4ae8f0987d510405555a920764f8ff43c06780be..df93a013edeb6622abac656b044f0b094e00b3e5 100644 (file)
@@ -35,6 +35,7 @@
 #include "glsl_parser_extras.h"
 #include "ir_optimization.h"
 #include "program.h"
+#include "program/hash_table.h"
 #include "loop_analysis.h"
 #include "standalone_scaffolding.h"
 
@@ -175,8 +176,6 @@ initialize_context(struct gl_context *ctx, gl_api api)
       ctx->Const.MaxGeometryOutputVertices = 256;
       ctx->Const.MaxGeometryTotalOutputComponents = 1024;
 
-//      ctx->Const.MaxGeometryVaryingComponents = 64;
-
       ctx->Const.MaxVarying = 60 / 4;
       break;
    case 300:
@@ -204,6 +203,9 @@ initialize_context(struct gl_context *ctx, gl_api api)
       break;
    }
 
+   ctx->Const.GenerateTemporaryNames = true;
+   ctx->Const.MaxPatchVertices = 32;
+
    ctx->Driver.NewShader = _mesa_new_shader;
 }
 
@@ -273,10 +275,10 @@ usage_fail(const char *name)
 {
 
    const char *header =
-      "usage: %s [options] <file.vert | file.geom | file.frag>\n"
+      "usage: %s [options] <file.vert | file.tesc | file.tese | file.geom | file.frag | file.comp>\n"
       "\n"
       "Possible options are:\n";
-   printf(header, name, name);
+   printf(header, name);
    for (const struct option *o = compiler_opts; o->name != 0; ++o) {
       printf("    --%s\n", o->name);
    }
@@ -350,6 +352,11 @@ main(int argc, char **argv)
    assert(whole_program != NULL);
    whole_program->InfoLog = ralloc_strdup(whole_program, "");
 
+   /* Created just to avoid segmentation faults */
+   whole_program->AttributeBindings = new string_to_uint_map;
+   whole_program->FragDataBindings = new string_to_uint_map;
+   whole_program->FragDataIndexBindings = new string_to_uint_map;
+
    for (/* empty */; argc > optind; optind++) {
       whole_program->Shaders =
         reralloc(whole_program, whole_program->Shaders,
@@ -368,6 +375,10 @@ main(int argc, char **argv)
       const char *const ext = & argv[optind][len - 5];
       if (strncmp(".vert", ext, 5) == 0 || strncmp(".glsl", ext, 5) == 0)
         shader->Type = GL_VERTEX_SHADER;
+      else if (strncmp(".tesc", ext, 5) == 0)
+        shader->Type = GL_TESS_CONTROL_SHADER;
+      else if (strncmp(".tese", ext, 5) == 0)
+        shader->Type = GL_TESS_EVALUATION_SHADER;
       else if (strncmp(".geom", ext, 5) == 0)
         shader->Type = GL_GEOMETRY_SHADER;
       else if (strncmp(".frag", ext, 5) == 0)
@@ -396,6 +407,8 @@ main(int argc, char **argv)
    }
 
    if ((status == EXIT_SUCCESS) && do_link)  {
+      _mesa_clear_shader_program_data(whole_program);
+
       link_shaders(ctx, whole_program);
       status = (whole_program->LinkStatus) ? EXIT_SUCCESS : EXIT_FAILURE;
 
@@ -406,6 +419,10 @@ main(int argc, char **argv)
    for (unsigned i = 0; i < MESA_SHADER_STAGES; i++)
       ralloc_free(whole_program->_LinkedShaders[i]);
 
+   delete whole_program->AttributeBindings;
+   delete whole_program->FragDataBindings;
+   delete whole_program->FragDataIndexBindings;
+
    ralloc_free(whole_program);
    _mesa_glsl_release_types();
    _mesa_glsl_release_builtin_functions();