diff options
author | Marek Olšák <[email protected]> | 2014-08-03 04:31:56 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-08-11 21:53:57 +0200 |
commit | 002211f9eea258acc253528024ee104aa1fcd90d (patch) | |
tree | de9c794cf0313358ae483a5701e167404d22b550 /src | |
parent | 5c69173907e72a0978af5028db336f051ce733b0 (diff) |
mesa: move ShaderCompilerOptions into gl_constants
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/glsl_parser_extras.cpp | 2 | ||||
-rw-r--r-- | src/glsl/link_varyings.cpp | 2 | ||||
-rw-r--r-- | src/glsl/linker.cpp | 4 | ||||
-rw-r--r-- | src/glsl/standalone_scaffolding.cpp | 2 | ||||
-rw-r--r-- | src/glsl/test_optpass.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 22 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.cpp | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_context.c | 2 | ||||
-rw-r--r-- | src/mesa/main/ff_fragment_shader.cpp | 2 | ||||
-rw-r--r-- | src/mesa/main/ffvertex_prog.c | 2 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 4 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 4 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 4 | ||||
-rw-r--r-- | src/mesa/program/programopt.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 6 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 |
19 files changed, 37 insertions, 37 deletions
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 2d94d3554cd..ad91c466143 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -1472,7 +1472,7 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader, if (!state->error && !shader->ir->is_empty()) { struct gl_shader_compiler_options *options = - &ctx->ShaderCompilerOptions[shader->Stage]; + &ctx->Const.ShaderCompilerOptions[shader->Stage]; /* Do some optimization at compile time to reduce shader IR size * and reduce later work if the same shader is linked multiple times diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 1438a4b16c2..54ceae1b9eb 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -329,7 +329,7 @@ tfeedback_decl::init(struct gl_context *ctx, const void *mem_ctx, * class must behave specially to account for the fact that gl_ClipDistance * is converted from a float[8] to a vec4[2]. */ - if (ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].LowerClipDistance && + if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].LowerClipDistance && strcmp(this->var_name, "gl_ClipDistance") == 0) { this->is_clip_distance_mesa = true; } diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index 0096fb023dc..497a77aeab4 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -2660,12 +2660,12 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (!prog->LinkStatus) goto done; - if (ctx->ShaderCompilerOptions[i].LowerClipDistance) { + if (ctx->Const.ShaderCompilerOptions[i].LowerClipDistance) { lower_clip_distance(prog->_LinkedShaders[i]); } while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, - &ctx->ShaderCompilerOptions[i], + &ctx->Const.ShaderCompilerOptions[i], ctx->Const.NativeIntegers)) ; } diff --git a/src/glsl/standalone_scaffolding.cpp b/src/glsl/standalone_scaffolding.cpp index abdd83a4408..2b76dd17b2a 100644 --- a/src/glsl/standalone_scaffolding.cpp +++ b/src/glsl/standalone_scaffolding.cpp @@ -164,5 +164,5 @@ void initialize_context_to_defaults(struct gl_context *ctx, gl_api api) options.DefaultPragmas.Optimize = true; for (int sh = 0; sh < MESA_SHADER_STAGES; ++sh) - memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options)); + memcpy(&ctx->Const.ShaderCompilerOptions[sh], &options, sizeof(options)); } diff --git a/src/glsl/test_optpass.cpp b/src/glsl/test_optpass.cpp index e4878bf15c7..24c06f11b14 100644 --- a/src/glsl/test_optpass.cpp +++ b/src/glsl/test_optpass.cpp @@ -242,7 +242,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); diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 7f438961a99..8811e8d4e6d 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -253,10 +253,10 @@ i915CreateContext(int api, /* FINISHME: Are there other options that should be enabled for software * FINISHME: vertex shaders? */ - ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = true; + ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = true; struct gl_shader_compiler_options *const fs_options = - & ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; + & ctx->Const.ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; fs_options->MaxIfDepth = 0; fs_options->EmitNoNoise = true; fs_options->EmitNoPow = true; diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 171501f69fe..bf2aedbabe4 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -482,21 +482,21 @@ brw_initialize_context_constants(struct brw_context *brw) /* We want the GLSL compiler to emit code that uses condition codes */ for (int i = 0; i < MESA_SHADER_STAGES; i++) { - ctx->ShaderCompilerOptions[i].MaxIfDepth = brw->gen < 6 ? 16 : UINT_MAX; - ctx->ShaderCompilerOptions[i].EmitCondCodes = true; - ctx->ShaderCompilerOptions[i].EmitNoNoise = true; - ctx->ShaderCompilerOptions[i].EmitNoMainReturn = true; - ctx->ShaderCompilerOptions[i].EmitNoIndirectInput = true; - ctx->ShaderCompilerOptions[i].EmitNoIndirectOutput = + ctx->Const.ShaderCompilerOptions[i].MaxIfDepth = brw->gen < 6 ? 16 : UINT_MAX; + ctx->Const.ShaderCompilerOptions[i].EmitCondCodes = true; + ctx->Const.ShaderCompilerOptions[i].EmitNoNoise = true; + ctx->Const.ShaderCompilerOptions[i].EmitNoMainReturn = true; + ctx->Const.ShaderCompilerOptions[i].EmitNoIndirectInput = true; + ctx->Const.ShaderCompilerOptions[i].EmitNoIndirectOutput = (i == MESA_SHADER_FRAGMENT); - ctx->ShaderCompilerOptions[i].EmitNoIndirectTemp = + ctx->Const.ShaderCompilerOptions[i].EmitNoIndirectTemp = (i == MESA_SHADER_FRAGMENT); - ctx->ShaderCompilerOptions[i].EmitNoIndirectUniform = false; - ctx->ShaderCompilerOptions[i].LowerClipDistance = true; + ctx->Const.ShaderCompilerOptions[i].EmitNoIndirectUniform = false; + ctx->Const.ShaderCompilerOptions[i].LowerClipDistance = true; } - ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = true; - ctx->ShaderCompilerOptions[MESA_SHADER_GEOMETRY].OptimizeForAOS = true; + ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = true; + ctx->Const.ShaderCompilerOptions[MESA_SHADER_GEOMETRY].OptimizeForAOS = true; /* ARB_viewport_array */ if (brw->gen >= 7 && ctx->API == API_OPENGL_CORE) { diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index f56ea68756b..00331351c11 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -122,7 +122,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) for (stage = 0; stage < ARRAY_SIZE(shProg->_LinkedShaders); stage++) { const struct gl_shader_compiler_options *options = - &ctx->ShaderCompilerOptions[stage]; + &ctx->Const.ShaderCompilerOptions[stage]; struct brw_shader *shader = (struct brw_shader *)shProg->_LinkedShaders[stage]; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index d5749f3e10d..7815c4e9656 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -340,7 +340,7 @@ GLboolean r200CreateContext( gl_api api, ctx->Const.MaxDrawBuffers = 1; ctx->Const.MaxColorAttachments = 1; - ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE; + ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE; /* Install the customized pipeline: */ diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index edd94e2ae9f..f717660c952 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -303,7 +303,7 @@ r100CreateContext( gl_api api, ctx->Const.MaxColorAttachments = 1; ctx->Const.MaxRenderbufferSize = 2048; - ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = true; + ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = true; /* Install the customized pipeline: */ diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 8758b5e9d23..9bb706cc549 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -1252,7 +1252,7 @@ create_new_program(struct gl_context *ctx, struct state_key *key) validate_ir_tree(p.shader->ir); const struct gl_shader_compiler_options *options = - &ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; + &ctx->Const.ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; while (do_common_optimization(p.shader->ir, false, false, options, ctx->Const.NativeIntegers)) diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 728cf968b7e..d5afc3d812c 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -1676,7 +1676,7 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx) return NULL; create_new_program( &key, prog, - ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS, + ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS, ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps ); #if 0 diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e141ac65893..3775b5ba996 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3529,6 +3529,8 @@ struct gl_constants GLfloat MaxFragmentInterpolationOffset; GLboolean FakeSWMSAA; + + struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; }; @@ -4172,8 +4174,6 @@ struct gl_context */ struct gl_pipeline_object *_Shader; - struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_STAGES]; - struct gl_query_state Query; /**< occlusion, timer queries */ struct gl_transform_feedback_state TransformFeedback; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index b4a5e70506b..620cab3cc0e 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -119,7 +119,7 @@ _mesa_init_shader_state(struct gl_context *ctx) options.DefaultPragmas.Optimize = GL_TRUE; for (sh = 0; sh < MESA_SHADER_STAGES; ++sh) - memcpy(&ctx->ShaderCompilerOptions[sh], &options, sizeof(options)); + memcpy(&ctx->Const.ShaderCompilerOptions[sh], &options, sizeof(options)); ctx->Shader.Flags = _mesa_get_shader_flags(); @@ -826,7 +826,7 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) if (!sh) return; - options = &ctx->ShaderCompilerOptions[sh->Stage]; + options = &ctx->Const.ShaderCompilerOptions[sh->Stage]; /* set default pragma state for shader */ sh->Pragmas = options->DefaultPragmas; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index b088160d3c3..4c246d12804 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2795,7 +2795,7 @@ get_mesa_program(struct gl_context *ctx, GLenum target = _mesa_shader_stage_to_program(shader->Stage); const char *target_string = _mesa_shader_stage_to_string(shader->Stage); struct gl_shader_compiler_options *options = - &ctx->ShaderCompilerOptions[shader->Stage]; + &ctx->Const.ShaderCompilerOptions[shader->Stage]; validate_ir_tree(shader->ir); @@ -2980,7 +2980,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) bool progress; exec_list *ir = prog->_LinkedShaders[i]->ir; const struct gl_shader_compiler_options *options = - &ctx->ShaderCompilerOptions[prog->_LinkedShaders[i]->Stage]; + &ctx->Const.ShaderCompilerOptions[prog->_LinkedShaders[i]->Stage]; do { progress = false; diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c index 92a8831d208..b654b1db648 100644 --- a/src/mesa/program/programopt.c +++ b/src/mesa/program/programopt.c @@ -218,7 +218,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro void _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog) { - if (ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS) + if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS) _mesa_insert_mvp_dp4_code( ctx, vprog ); else _mesa_insert_mvp_mad_code( ctx, vprog ); diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 9eb3c48bd79..dc0cdafffed 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -268,7 +268,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, * driver prefers DP4 or MUL/MAD for vertex transformation. */ if (debug_get_option_mesa_mvp_dp4()) - ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE; + ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = GL_TRUE; return st_create_context_priv(ctx, pipe, options); } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index e523c203c2c..c6824d4bd88 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -158,15 +158,15 @@ void st_init_limits(struct st_context *st) switch (sh) { case PIPE_SHADER_FRAGMENT: pc = &c->Program[MESA_SHADER_FRAGMENT]; - options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; + options = &c->ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; break; case PIPE_SHADER_VERTEX: pc = &c->Program[MESA_SHADER_VERTEX]; - options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX]; + options = &c->ShaderCompilerOptions[MESA_SHADER_VERTEX]; break; case PIPE_SHADER_GEOMETRY: pc = &c->Program[MESA_SHADER_GEOMETRY]; - options = &st->ctx->ShaderCompilerOptions[MESA_SHADER_GEOMETRY]; + options = &c->ShaderCompilerOptions[MESA_SHADER_GEOMETRY]; break; default: /* compute shader, etc. */ diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 0290553c6e9..2aa42c89574 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5176,7 +5176,7 @@ get_mesa_program(struct gl_context *ctx, GLenum target = _mesa_shader_stage_to_program(shader->Stage); bool progress; 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)]; struct pipe_screen *pscreen = ctx->st->pipe->screen; unsigned ptarget = shader_stage_to_ptarget(shader->Stage); @@ -5365,7 +5365,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) bool progress; exec_list *ir = prog->_LinkedShaders[i]->ir; const struct gl_shader_compiler_options *options = - &ctx->ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(prog->_LinkedShaders[i]->Type)]; + &ctx->Const.ShaderCompilerOptions[_mesa_shader_enum_to_shader_stage(prog->_LinkedShaders[i]->Type)]; /* If there are forms of indirect addressing that the driver * cannot handle, perform the lowering pass. |