diff options
author | Eric Anholt <[email protected]> | 2015-02-02 16:13:49 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2015-02-18 14:47:50 -0800 |
commit | f90bb54734bf03be6c736812226e3f65f2e11519 (patch) | |
tree | 5ec1cc55001f020619f34184cf02811021346c1e /src/glsl/nir/glsl_to_nir.cpp | |
parent | 4a95be9772a255776309f23180519a4a8560f2dd (diff) |
nir: Add a nir_shader_compiler_options struct pointed to by the shaders.
This will be used to give the optimization passes a chance to customize
behavior for the particular target device.
v2: Rebase to master (no TGSI->NIR present)
Reviewed-by: Kenneth Graunke <[email protected]> (v1)
Diffstat (limited to 'src/glsl/nir/glsl_to_nir.cpp')
-rw-r--r-- | src/glsl/nir/glsl_to_nir.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp index 92cfab34a2e..bc43a7563dc 100644 --- a/src/glsl/nir/glsl_to_nir.cpp +++ b/src/glsl/nir/glsl_to_nir.cpp @@ -124,11 +124,32 @@ private: }; /* end of anonymous namespace */ +static const nir_shader_compiler_options default_options = { +}; + nir_shader * glsl_to_nir(exec_list *ir, _mesa_glsl_parse_state *state, bool native_integers) { - nir_shader *shader = nir_shader_create(NULL); + const nir_shader_compiler_options *options; + + if (state) { + struct gl_context *ctx = state->ctx; + struct gl_shader_compiler_options *gl_options = + &ctx->Const.ShaderCompilerOptions[state->stage]; + + if (!gl_options->NirOptions) { + nir_shader_compiler_options *new_options = + rzalloc(ctx, nir_shader_compiler_options); + options = gl_options->NirOptions = new_options; + } else { + options = gl_options->NirOptions; + } + } else { + options = &default_options; + } + + nir_shader *shader = nir_shader_create(NULL, options); if (state) { shader->num_user_structures = state->num_user_structures; |