diff options
author | Timothy Arceri <[email protected]> | 2018-01-30 11:51:31 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-01-31 09:14:08 +1100 |
commit | 93e213f91f64189ff5fe65844a9fe5b8c48366c2 (patch) | |
tree | 85332864c48b5cb7f6bfdcd21d8e6234bae97c55 /src | |
parent | dd6d6c63a700af98a7a7d65dcdf72e8be69d4643 (diff) |
st/glsl_to_nir: copy nir compiler options to context
Various nir passes may expect this to be here as does the nir
serialisation pass.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 20 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_nir.cpp | 10 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index a4cac6a1f23..42d53cbf82d 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -26,6 +26,8 @@ * **************************************************************************/ +#include "compiler/nir/nir.h" + #include "main/imports.h" #include "main/context.h" #include "main/macros.h" @@ -156,31 +158,49 @@ void st_init_limits(struct pipe_screen *screen, for (sh = 0; sh < PIPE_SHADER_TYPES; ++sh) { struct gl_shader_compiler_options *options; struct gl_program_constants *pc; + const nir_shader_compiler_options *nir_options = NULL; + + if (screen->get_compiler_options) { + nir_options = (const nir_shader_compiler_options *) + screen->get_compiler_options(screen, PIPE_SHADER_IR_NIR, sh); + } switch (sh) { case PIPE_SHADER_FRAGMENT: pc = &c->Program[MESA_SHADER_FRAGMENT]; options = &c->ShaderCompilerOptions[MESA_SHADER_FRAGMENT]; + c->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].NirOptions = + nir_options; break; case PIPE_SHADER_VERTEX: pc = &c->Program[MESA_SHADER_VERTEX]; options = &c->ShaderCompilerOptions[MESA_SHADER_VERTEX]; + c->ShaderCompilerOptions[MESA_SHADER_VERTEX].NirOptions = + nir_options; break; case PIPE_SHADER_GEOMETRY: pc = &c->Program[MESA_SHADER_GEOMETRY]; options = &c->ShaderCompilerOptions[MESA_SHADER_GEOMETRY]; + c->ShaderCompilerOptions[MESA_SHADER_GEOMETRY].NirOptions = + nir_options; break; case PIPE_SHADER_TESS_CTRL: pc = &c->Program[MESA_SHADER_TESS_CTRL]; options = &c->ShaderCompilerOptions[MESA_SHADER_TESS_CTRL]; + c->ShaderCompilerOptions[MESA_SHADER_TESS_CTRL].NirOptions = + nir_options; break; case PIPE_SHADER_TESS_EVAL: pc = &c->Program[MESA_SHADER_TESS_EVAL]; options = &c->ShaderCompilerOptions[MESA_SHADER_TESS_EVAL]; + c->ShaderCompilerOptions[MESA_SHADER_TESS_EVAL].NirOptions = + nir_options; break; case PIPE_SHADER_COMPUTE: pc = &c->Program[MESA_SHADER_COMPUTE]; options = &c->ShaderCompilerOptions[MESA_SHADER_COMPUTE]; + c->ShaderCompilerOptions[MESA_SHADER_COMPUTE].NirOptions = + nir_options; if (!screen->get_param(screen, PIPE_CAP_COMPUTE)) continue; diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 8639544142e..6d3a7c78dcd 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -304,14 +304,8 @@ st_glsl_to_nir(struct st_context *st, struct gl_program *prog, struct gl_shader_program *shader_program, gl_shader_stage stage) { - struct pipe_screen *pscreen = st->pipe->screen; - enum pipe_shader_type ptarget = pipe_shader_type_from_mesa(stage); - const nir_shader_compiler_options *options; - - assert(pscreen->get_compiler_options); /* drivers using NIR must implement this */ - - options = (const nir_shader_compiler_options *) - pscreen->get_compiler_options(pscreen, PIPE_SHADER_IR_NIR, ptarget); + const nir_shader_compiler_options *options = + st->ctx->Const.ShaderCompilerOptions[prog->info.stage].NirOptions; assert(options); if (prog->nir) |