[Mesa-dev] [PATCH 04/13] nir/glsl: Take a gl_shader_program and a stage rather than a gl_shader
Jason Ekstrand
jason at jlekstrand.net
Thu Oct 1 18:50:30 PDT 2015
---
src/glsl/nir/glsl_to_nir.cpp | 8 ++++++--
src/glsl/nir/glsl_to_nir.h | 3 ++-
src/mesa/drivers/dri/i965/brw_nir.c | 3 +--
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index f874582..ba08e17 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -129,9 +129,13 @@ private:
}; /* end of anonymous namespace */
nir_shader *
-glsl_to_nir(struct gl_shader *sh, const nir_shader_compiler_options *options)
+glsl_to_nir(const struct gl_shader_program *shader_prog,
+ gl_shader_stage stage,
+ const nir_shader_compiler_options *options)
{
- nir_shader *shader = nir_shader_create(NULL, sh->Stage, options);
+ struct gl_shader *sh = shader_prog->_LinkedShaders[stage];
+
+ nir_shader *shader = nir_shader_create(NULL, stage, options);
nir_visitor v1(shader);
nir_function_visitor v2(&v1);
diff --git a/src/glsl/nir/glsl_to_nir.h b/src/glsl/nir/glsl_to_nir.h
index 3801e8c..29badcd 100644
--- a/src/glsl/nir/glsl_to_nir.h
+++ b/src/glsl/nir/glsl_to_nir.h
@@ -32,7 +32,8 @@
extern "C" {
#endif
-nir_shader *glsl_to_nir(struct gl_shader *sh,
+nir_shader *glsl_to_nir(const struct gl_shader_program *shader_prog,
+ gl_shader_stage stage,
const nir_shader_compiler_options *options);
#ifdef __cplusplus
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
index 1d4f6ab..6ec2d76 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -83,13 +83,12 @@ brw_create_nir(struct brw_context *brw,
static const nir_lower_tex_options tex_options = {
.lower_txp = ~0,
};
- struct gl_shader *shader = shader_prog ? shader_prog->_LinkedShaders[stage] : NULL;
bool debug_enabled = INTEL_DEBUG & intel_debug_flag_for_shader_stage(stage);
nir_shader *nir;
/* First, lower the GLSL IR or Mesa IR to NIR */
if (shader_prog) {
- nir = glsl_to_nir(shader, options);
+ nir = glsl_to_nir(shader_prog, stage, options);
} else {
nir = prog_to_nir(prog, options);
nir_convert_to_ssa(nir); /* turn registers into SSA */
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list