[Mesa-dev] [PATCH 2/6] glsl: Initialize ctx->ShaderCompilerOptions in standalone scaffolding.

Kenneth Graunke kenneth at whitecape.org
Wed Apr 17 17:30:21 PDT 2013


This code is copied from _mesa_init_shader_state().

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/standalone_scaffolding.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp
index 0c1f52f..3d9e1bf 100644
--- a/src/glsl/standalone_scaffolding.cpp
+++ b/src/glsl/standalone_scaffolding.cpp
@@ -122,4 +122,16 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
    ctx->Const.FragmentProgram.MaxUniformComponents = 64;
 
    ctx->Const.MaxDrawBuffers = 1;
+
+   /* Set up default shader compiler options. */
+   struct gl_shader_compiler_options options;
+   memset(&options, 0, sizeof(options));
+   options.MaxUnrollIterations = 32;
+   options.MaxIfDepth = UINT_MAX;
+
+   /* Default pragma settings */
+   options.DefaultPragmas.Optimize = true;
+
+   for (int sh = 0; sh < MESA_SHADER_TYPES; ++sh)
+      memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options));
 }
-- 
1.8.2.1



More information about the mesa-dev mailing list