diff options
author | Eduardo Lima Mitev <[email protected]> | 2015-06-16 12:26:39 +0200 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-08-03 09:40:46 -0700 |
commit | 47d68908f2c3ad3e9011a2cf910b04cd3300673a (patch) | |
tree | 754c3d97151a223d4d64c4317bd4930a30d51037 /src/mesa | |
parent | abf4fa3c03ebe5716c90c8a310945c3621cf598f (diff) |
i965/nir/vec4: Select between new nir_vec4 or current vec4_visitor code-paths
The NIR->vec4 pass will be activated if both the following conditions are met:
* INTEL_USE_NIR environment variable is defined and is positive (1 or true)
* The stage is vertex shader (support for geometry shaders and
ARB_vertex_program will be added later).
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.cpp | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4.cpp | 18 |
2 files changed, 22 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 58587b24403..524798c6ac6 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -122,12 +122,14 @@ brw_compiler_create(void *mem_ctx, const struct brw_device_info *devinfo) compiler->glsl_compiler_options[MESA_SHADER_VERTEX].OptimizeForAOS = true; compiler->glsl_compiler_options[MESA_SHADER_GEOMETRY].OptimizeForAOS = 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; + if (compiler->scalar_vs || brw_env_var_as_boolean("INTEL_USE_NIR", false)) { + 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; diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 53270fb6eba..ce04f1b2173 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1709,6 +1709,9 @@ vec4_visitor::emit_shader_time_write(int shader_time_subindex, src_reg value) bool vec4_visitor::run(gl_clip_plane *clip_planes) { + bool use_vec4_nir = + compiler->glsl_compiler_options[MESA_SHADER_VERTEX].NirOptions != NULL; + sanity_param_count = prog->Parameters->NumParameters; if (shader_time_index >= 0) @@ -1718,11 +1721,18 @@ vec4_visitor::run(gl_clip_plane *clip_planes) emit_prolog(); - /* Generate VS IR for main(). (the visitor only descends into - * functions called "main"). - */ if (shader) { - visit_instructions(shader->base.ir); + if (use_vec4_nir) { + assert(prog->nir != NULL); + emit_nir_code(); + if (failed) + return false; + } else { + /* Generate VS IR for main(). (the visitor only descends into + * functions called "main"). + */ + visit_instructions(shader->base.ir); + } } else { emit_program_code(); } |