summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp5
-rw-r--r--src/mesa/main/mtypes.h2
3 files changed, 10 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 972e458f437..8141b45f735 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -68,6 +68,8 @@
#include "tnl/t_pipeline.h"
#include "util/ralloc.h"
+#include "glsl/nir/nir.h"
+
/***************************************
* Mesa's Driver Functions
***************************************/
@@ -549,6 +551,8 @@ brw_initialize_context_constants(struct brw_context *brw)
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxInputComponents = 128;
}
+ static const nir_shader_compiler_options nir_options = {};
+
/* We want the GLSL compiler to emit code that uses condition codes */
for (int i = 0; i < MESA_SHADER_STAGES; i++) {
ctx->Const.ShaderCompilerOptions[i].MaxIfDepth = brw->gen < 6 ? 16 : UINT_MAX;
@@ -562,6 +566,7 @@ brw_initialize_context_constants(struct brw_context *brw)
(i == MESA_SHADER_FRAGMENT);
ctx->Const.ShaderCompilerOptions[i].EmitNoIndirectUniform = false;
ctx->Const.ShaderCompilerOptions[i].LowerClipDistance = true;
+ ctx->Const.ShaderCompilerOptions[i].NirOptions = &nir_options;
}
ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS = true;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index a0300aa36d5..e24bf92eef5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -82,9 +82,12 @@ count_nir_instrs(nir_shader *nir)
void
fs_visitor::emit_nir_code()
{
+ const nir_shader_compiler_options *options =
+ ctx->Const.ShaderCompilerOptions[stage].NirOptions;
+
/* first, lower the GLSL IR shader to NIR */
lower_output_reads(shader->base.ir);
- nir_shader *nir = glsl_to_nir(shader->base.ir, NULL, true);
+ nir_shader *nir = glsl_to_nir(shader->base.ir, true, options);
nir_validate_shader(nir);
nir_lower_global_vars_to_local(nir);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index efeee8bff67..c43c6ac6710 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3036,7 +3036,7 @@ struct gl_shader_compiler_options
struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
- struct nir_shader_compiler_options *NirOptions;
+ const struct nir_shader_compiler_options *NirOptions;
};