diff options
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r-- | src/mesa/main/shaderapi.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index cc350c93b97..2977a29ab74 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -94,18 +94,24 @@ _mesa_init_shader_state(GLcontext *ctx) /* Device drivers may override these to control what kind of instructions * are generated by the GLSL compiler. */ - ctx->Shader.EmitHighLevelInstructions = GL_TRUE; - ctx->Shader.EmitContReturn = GL_TRUE; - ctx->Shader.EmitCondCodes = GL_FALSE; - ctx->Shader.EmitComments = GL_FALSE; - ctx->Shader.EmitNoIfs = GL_FALSE; - ctx->Shader.Flags = get_shader_flags(); + struct gl_shader_compiler_options options; + GLuint i; + options.EmitHighLevelInstructions = GL_TRUE; + options.EmitContReturn = GL_TRUE; + options.EmitCondCodes = GL_FALSE; + options.EmitComments = GL_FALSE; + options.EmitNoIfs = GL_FALSE; /* Default pragma settings */ - ctx->Shader.DefaultPragmas.IgnoreOptimize = GL_FALSE; - ctx->Shader.DefaultPragmas.IgnoreDebug = GL_FALSE; - ctx->Shader.DefaultPragmas.Optimize = GL_TRUE; - ctx->Shader.DefaultPragmas.Debug = GL_FALSE; + options.DefaultPragmas.IgnoreOptimize = GL_FALSE; + options.DefaultPragmas.IgnoreDebug = GL_FALSE; + options.DefaultPragmas.Optimize = GL_TRUE; + options.DefaultPragmas.Debug = GL_FALSE; + + for(i = 0; i < MESA_SHADER_TYPES; ++i) + memcpy(&ctx->ShaderCompilerOptions[i], &options, sizeof(options)); + + ctx->Shader.Flags = get_shader_flags(); } @@ -789,13 +795,16 @@ static void compile_shader(GLcontext *ctx, GLuint shaderObj) { struct gl_shader *sh; + struct gl_shader_compiler_options *options; sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader"); if (!sh) return; + options = &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(sh->Type)]; + /* set default pragma state for shader */ - sh->Pragmas = ctx->Shader.DefaultPragmas; + sh->Pragmas = options->DefaultPragmas; /* this call will set the sh->CompileStatus field to indicate if * compilation was successful. |