summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2015-08-18 01:53:29 -0700
committerKenneth Graunke <[email protected]>2015-08-25 11:12:35 -0700
commit5f14c417c86ced1847746c64d4db54c7e5ddc187 (patch)
tree89e91b11db0783a8ad4315bd7a9726bb25947194 /src
parentd4d5b430a52aab148c8697deaedd8864e1749f3c (diff)
nir: Use nir_shader::stage rather than passing it around.
Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/nir/glsl_to_nir.cpp10
-rw-r--r--src/glsl/nir/nir.h3
-rw-r--r--src/glsl/nir/nir_lower_samplers.cpp6
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir.c2
4 files changed, 9 insertions, 12 deletions
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 9cc065f25a9..5fb4ee25c40 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -44,7 +44,7 @@ namespace {
class nir_visitor : public ir_visitor
{
public:
- nir_visitor(nir_shader *shader, gl_shader_stage stage);
+ nir_visitor(nir_shader *shader);
~nir_visitor();
virtual void visit(ir_variable *);
@@ -85,7 +85,6 @@ private:
bool supports_ints;
nir_shader *shader;
- gl_shader_stage stage;
nir_function_impl *impl;
exec_list *cf_node_list;
nir_instr *result; /* result of the expression tree last visited */
@@ -134,7 +133,7 @@ glsl_to_nir(struct gl_shader *sh, const nir_shader_compiler_options *options)
{
nir_shader *shader = nir_shader_create(NULL, sh->Stage, options);
- nir_visitor v1(shader, sh->Stage);
+ nir_visitor v1(shader);
nir_function_visitor v2(&v1);
v2.run(sh->ir);
visit_exec_list(sh->ir, &v1);
@@ -142,11 +141,10 @@ glsl_to_nir(struct gl_shader *sh, const nir_shader_compiler_options *options)
return shader;
}
-nir_visitor::nir_visitor(nir_shader *shader, gl_shader_stage stage)
+nir_visitor::nir_visitor(nir_shader *shader)
{
this->supports_ints = shader->options->native_integers;
this->shader = shader;
- this->stage = stage;
this->is_global = true;
this->var_table = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
_mesa_key_pointer_equal);
@@ -263,7 +261,7 @@ nir_visitor::visit(ir_variable *ir)
break;
case ir_var_shader_in:
- if (stage == MESA_SHADER_FRAGMENT &&
+ if (shader->stage == MESA_SHADER_FRAGMENT &&
ir->data.location == VARYING_SLOT_FACE) {
/* For whatever reason, GLSL IR makes gl_FrontFacing an input */
var->data.location = SYSTEM_VALUE_FRONT_FACE;
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 308298a5085..40871f73e96 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1648,8 +1648,7 @@ void nir_lower_load_const_to_scalar(nir_shader *shader);
void nir_lower_phis_to_scalar(nir_shader *shader);
void nir_lower_samplers(nir_shader *shader,
- const struct gl_shader_program *shader_program,
- gl_shader_stage stage);
+ const struct gl_shader_program *shader_program);
void nir_lower_system_values(nir_shader *shader);
void nir_lower_tex_projector(nir_shader *shader);
diff --git a/src/glsl/nir/nir_lower_samplers.cpp b/src/glsl/nir/nir_lower_samplers.cpp
index 7a0b0a09ffe..9583b457d8d 100644
--- a/src/glsl/nir/nir_lower_samplers.cpp
+++ b/src/glsl/nir/nir_lower_samplers.cpp
@@ -168,11 +168,11 @@ lower_impl(nir_function_impl *impl, const struct gl_shader_program *shader_progr
}
extern "C" void
-nir_lower_samplers(nir_shader *shader, const struct gl_shader_program *shader_program,
- gl_shader_stage stage)
+nir_lower_samplers(nir_shader *shader,
+ const struct gl_shader_program *shader_program)
{
nir_foreach_overload(shader, overload) {
if (overload->impl)
- lower_impl(overload->impl, shader_program, stage);
+ lower_impl(overload->impl, shader_program, shader->stage);
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
index dfac44fd406..8c6d28a7cd8 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -136,7 +136,7 @@ brw_create_nir(struct brw_context *brw,
nir_validate_shader(nir);
if (shader_prog) {
- nir_lower_samplers(nir, shader_prog, stage);
+ nir_lower_samplers(nir, shader_prog);
nir_validate_shader(nir);
}