diff options
author | Eduardo Lima Mitev <[email protected]> | 2017-10-10 14:55:56 +0200 |
---|---|---|
committer | Alejandro PiƱeiro <[email protected]> | 2018-03-30 09:14:56 +0200 |
commit | e7d97aa75ded652a36e8addad52d075c51b58c33 (patch) | |
tree | 1c5afdd8f9f5f6e74a1691d9cd7feb5cd2db1df6 /src/mesa | |
parent | abb6d0797c8a0c32f45d38d7a41e96b2db47a47d (diff) |
i965: Call spirv_to_nir() instead of glsl_to_nir() for SPIR-V shaders
This is the main fork of the shader compilation code-path, where a NIR
shader is obtained by calling spirv_to_nir() or glsl_to_nir(),
depending on its nature..
v2: Use 'spirv_data' member from gl_linked_shader to know which method
to call. (Timothy Arceri)
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_program.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 4579a58b820..fc77926d6e0 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -31,6 +31,7 @@ #include <pthread.h> #include "main/imports.h" +#include "main/glspirv.h" #include "program/prog_parameter.h" #include "program/prog_print.h" #include "program/prog_to_nir.h" @@ -74,9 +75,14 @@ brw_create_nir(struct brw_context *brw, ctx->Const.ShaderCompilerOptions[stage].NirOptions; nir_shader *nir; - /* First, lower the GLSL IR or Mesa IR to NIR */ + /* First, lower the GLSL/Mesa IR or SPIR-V to NIR */ if (shader_prog) { - nir = glsl_to_nir(shader_prog, stage, options); + if (shader_prog->_LinkedShaders[stage]->spirv_data) + nir = _mesa_spirv_to_nir(ctx, shader_prog, stage, options); + else + nir = glsl_to_nir(shader_prog, stage, options); + assert (nir); + nir_remove_dead_variables(nir, nir_var_shader_in | nir_var_shader_out); nir_lower_returns(nir); nir_validate_shader(nir); |