aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_shader.cpp
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-09-21 11:18:23 -0700
committerJason Ekstrand <[email protected]>2015-09-21 13:26:52 -0700
commit60befc63470a9cf1ac59ca74cd0a8164a25db09e (patch)
tree9ca7009964429db246f571be7ebfdda203c47ac4 /src/mesa/drivers/dri/i965/brw_shader.cpp
parent6dfc5e28f7d08094210d8cecd3ed4a5b393dafe9 (diff)
i965: Clean up GLSL compiler option setup
The only functional change here is that we now set EmitNoIndirectOutput and EmitNoIndirectTemp for compute shaders. Compute shaders don't have outputs per-se and we should have been setting EmitNoIndirectTemp all along. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_shader.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.cpp46
1 files changed, 20 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index eed73fbadc3..c311a038e4f 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -115,41 +115,35 @@ brw_compiler_create(void *mem_ctx, const struct brw_device_info *devinfo)
compiler->glsl_compiler_options[i].EmitNoNoise = true;
compiler->glsl_compiler_options[i].EmitNoMainReturn = true;
compiler->glsl_compiler_options[i].EmitNoIndirectInput = true;
- compiler->glsl_compiler_options[i].EmitNoIndirectOutput =
- (i == MESA_SHADER_FRAGMENT);
- compiler->glsl_compiler_options[i].EmitNoIndirectTemp =
- (i == MESA_SHADER_FRAGMENT);
compiler->glsl_compiler_options[i].EmitNoIndirectUniform = false;
compiler->glsl_compiler_options[i].LowerClipDistance = true;
+ bool is_scalar;
+ switch (i) {
+ case MESA_SHADER_FRAGMENT:
+ case MESA_SHADER_COMPUTE:
+ is_scalar = true;
+ break;
+ case MESA_SHADER_VERTEX:
+ is_scalar = compiler->scalar_vs;
+ break;
+ default:
+ is_scalar = false;
+ break;
+ }
+
+ compiler->glsl_compiler_options[i].EmitNoIndirectOutput = is_scalar;
+ compiler->glsl_compiler_options[i].EmitNoIndirectTemp = is_scalar;
+ compiler->glsl_compiler_options[i].OptimizeForAOS = !is_scalar;
+
/* !ARB_gpu_shader5 */
if (devinfo->gen < 7)
compiler->glsl_compiler_options[i].EmitNoIndirectSampler = true;
- }
- compiler->glsl_compiler_options[MESA_SHADER_VERTEX].OptimizeForAOS = true;
- compiler->glsl_compiler_options[MESA_SHADER_GEOMETRY].OptimizeForAOS = true;
-
- if (compiler->scalar_vs || brw_env_var_as_boolean("INTEL_USE_NIR", true)) {
- if (compiler->scalar_vs) {
- /* If we're using the scalar backend for vertex shaders, we need to
- * configure these accordingly.
- */
- compiler->glsl_compiler_options[MESA_SHADER_VERTEX].EmitNoIndirectOutput = true;
- compiler->glsl_compiler_options[MESA_SHADER_VERTEX].EmitNoIndirectTemp = true;
- compiler->glsl_compiler_options[MESA_SHADER_VERTEX].OptimizeForAOS = false;
- }
-
- compiler->glsl_compiler_options[MESA_SHADER_VERTEX].NirOptions = nir_options;
- }
-
- if (brw_env_var_as_boolean("INTEL_USE_NIR", true)) {
- compiler->glsl_compiler_options[MESA_SHADER_GEOMETRY].NirOptions = nir_options;
+ if (is_scalar || brw_env_var_as_boolean("INTEL_USE_NIR", true))
+ compiler->glsl_compiler_options[i].NirOptions = nir_options;
}
- compiler->glsl_compiler_options[MESA_SHADER_FRAGMENT].NirOptions = nir_options;
- compiler->glsl_compiler_options[MESA_SHADER_COMPUTE].NirOptions = nir_options;
-
return compiler;
}