From 6d3a2c97f4a78e85545286e0e126cd3a27bd1cbd Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Sun, 5 Sep 2010 18:49:54 +0200 Subject: 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 --- src/mesa/drivers/dri/i915/i915_context.c | 6 +++++- src/mesa/drivers/dri/i965/brw_context.c | 7 +++++-- src/mesa/drivers/dri/r600/r600_context.c | 8 ++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index d8715cf026d..845ec2c3c4a 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -174,7 +174,11 @@ i915CreateContext(int api, ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; - ctx->Shader.EmitNoIfs = GL_TRUE; + /* FINISHME: Are there other options that should be enabled for software + * FINISHME: vertex shaders? + */ + ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = GL_TRUE; + ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoIfs = GL_TRUE; ctx->Const.MaxDrawBuffers = 1; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index d2b20165f9d..daa281ece46 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -66,6 +66,7 @@ GLboolean brwCreateContext( int api, struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context); struct intel_context *intel = &brw->intel; GLcontext *ctx = &intel->ctx; + unsigned i; if (!brw) { printf("%s: failed to alloc context\n", __FUNCTION__); @@ -110,8 +111,10 @@ GLboolean brwCreateContext( int api, ctx->Const.MaxPointSizeAA = 255.0; /* We want the GLSL compiler to emit code that uses condition codes */ - ctx->Shader.EmitCondCodes = GL_TRUE; - ctx->Shader.EmitNVTempInitialization = GL_TRUE; + for (i = 0; i <= MESA_SHADER_FRAGMENT; i++) { + ctx->ShaderCompilerOptions[i].EmitCondCodes = GL_TRUE; + ctx->ShaderCompilerOptions[i].EmitNVTempInitialization = GL_TRUE; + } ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024); ctx->Const.VertexProgram.MaxAluInstructions = 0; diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index bb959e7d2d9..b0a79c7b598 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -337,6 +337,9 @@ static void r600ParseOptions(context_t *r600, radeonScreenPtr screen) static void r600InitGLExtensions(GLcontext *ctx) { context_t *r600 = R700_CONTEXT(ctx); +#ifdef R600_ENABLE_GLSL_TEST + unsigned i; +#endif driInitExtensions(ctx, card_extensions, GL_TRUE); if (r600->radeon.radeonScreen->kernel_mm) @@ -346,8 +349,9 @@ static void r600InitGLExtensions(GLcontext *ctx) driInitExtensions(ctx, gl_20_extension, GL_TRUE); _mesa_enable_2_0_extensions(ctx); - /* glsl compiler has problem if this is not GL_TRUE */ - ctx->Shader.EmitCondCodes = GL_TRUE; + /* glsl compiler has problem if this is not GL_TRUE */ + for (i = 0; i <= MESA_SHADER_FRAGMENT; i++) + ctx->ShaderCompilerOptions[i].EmitCondCodes = GL_TRUE; #endif /* R600_ENABLE_GLSL_TEST */ if (driQueryOptionb -- cgit v1.2.3