[Mesa-dev] [PATCH 23/24] i965: Call spirv_to_nir() instead of glsl_to_nir() for SPIR-V shaders
Eduardo Lima Mitev
elima at igalia.com
Wed Nov 15 13:22:26 UTC 2017
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..
---
src/mesa/drivers/dri/i965/brw_program.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 5ecfb9f5b11..c1b2625b383 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"
@@ -75,7 +76,13 @@ brw_create_nir(struct brw_context *brw,
/* First, lower the GLSL IR or Mesa IR to NIR */
if (shader_prog) {
- nir = glsl_to_nir(shader_prog, stage, options);
+ if (!shader_prog->data->spirv) {
+ nir = glsl_to_nir(shader_prog, stage, options);
+ } else {
+ nir = _mesa_spirv_to_nir(ctx, 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);
--
2.11.0
More information about the mesa-dev
mailing list