summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shaderapi.c
diff options
context:
space:
mode:
authorLuca Barbieri <[email protected]>2010-09-05 18:49:54 +0200
committerIan Romanick <[email protected]>2010-09-08 20:36:37 -0700
commit6d3a2c97f4a78e85545286e0e126cd3a27bd1cbd (patch)
tree90583a2499c09d4211616dd2b36a3e9134092c2c /src/mesa/main/shaderapi.c
parentede4205b245ee58bacf866d298273ebbe31feacf (diff)
glsl: make compiler options per-target
This allows us to specify different options, especially useful for chips without unified shaders. Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main/shaderapi.c')
-rw-r--r--src/mesa/main/shaderapi.c31
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.