util/hash_set: Rework the API to know about hashing
[mesa.git] / src / glsl / test_optpass.cpp
index 1a15f3c63aeea48fe29ee56884b00042c946636a..ac3e3f48c510ae7976093f407d6087bd2738f9e4 100644 (file)
@@ -62,11 +62,10 @@ do_optimization(struct exec_list *ir, const char *optimization,
    int int_3;
    int int_4;
 
-   if (sscanf(optimization, "do_common_optimization ( %d , %d ) ",
-              &int_0, &int_1) == 2) {
-      return do_common_optimization(ir, int_0 != 0, false, int_1, options);
+   if (sscanf(optimization, "do_common_optimization ( %d ) ", &int_0) == 1) {
+      return do_common_optimization(ir, int_0 != 0, false, options, true);
    } else if (strcmp(optimization, "do_algebraic") == 0) {
-      return do_algebraic(ir);
+      return do_algebraic(ir, true, options);
    } else if (strcmp(optimization, "do_constant_folding") == 0) {
       return do_constant_folding(ir);
    } else if (strcmp(optimization, "do_constant_variable") == 0) {
@@ -201,6 +200,7 @@ int test_optpass(int argc, char **argv)
    initialize_context_to_defaults(ctx, API_OPENGL_COMPAT);
 
    ctx->Driver.NewShader = _mesa_new_shader;
+   ir_variable::temporaries_allocate_names = true;
 
    struct gl_shader *shader = rzalloc(NULL, struct gl_shader);
    shader->Type = shader_type;
@@ -235,7 +235,7 @@ int test_optpass(int argc, char **argv)
    /* Print out the initial IR */
    if (!state->error && !quiet) {
       printf("*** pre-optimization IR:\n");
-      _mesa_print_ir(shader->ir, state);
+      _mesa_print_ir(stdout, shader->ir, state);
       printf("\n--\n");
    }
 
@@ -243,7 +243,7 @@ int test_optpass(int argc, char **argv)
    if (!state->error) {
       GLboolean progress;
       const struct gl_shader_compiler_options *options =
-         &ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader_type)];
+         &ctx->Const.ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(shader_type)];
       do {
          progress = do_optimization_passes(shader->ir, &argv[optind],
                                            argc - optind, quiet != 0, options);
@@ -255,7 +255,7 @@ int test_optpass(int argc, char **argv)
       if (!quiet) {
          printf("*** resulting IR:\n");
       }
-      _mesa_print_ir(shader->ir, state);
+      _mesa_print_ir(stdout, shader->ir, state);
       if (!quiet) {
          printf("\n--\n");
       }