aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_glsl_to_nir.cpp
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-07-04 10:22:02 +0200
committerNicolai Hähnle <[email protected]>2017-07-31 14:55:30 +0200
commitc5f97eab094c43cedcb2218599a1f0aa51b16238 (patch)
treea3ccfb1b3f7d28f12961f0c051476d7e1121659e /src/mesa/state_tracker/st_glsl_to_nir.cpp
parent2cf8c8461931c5b23cac4d9cf834f120150ff869 (diff)
st/mesa: get rid of st_glsl_types
It's a duplicate of glsl_type::count_attribute_slots. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_glsl_to_nir.cpp')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_nir.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp
index c8a7464a008..dd3d6faa753 100644
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp
@@ -39,7 +39,6 @@
#include "st_context.h"
#include "st_program.h"
-#include "st_glsl_types.h"
#include "compiler/nir/nir.h"
#include "compiler/glsl_types.h"
@@ -47,6 +46,12 @@
#include "compiler/glsl/ir.h"
+static int
+type_size(const struct glsl_type *type)
+{
+ return type->count_attribute_slots(false);
+}
+
/* Depending on PIPE_CAP_TGSI_TEXCOORD (st->needs_texcoord_semantic) we
* may need to fix up varying slots so the glsl->nir path is aligned
* with the anything->tgsi->nir path.
@@ -205,7 +210,7 @@ st_nir_assign_uniform_locations(struct gl_program *prog,
uniform->data.driver_location = loc;
- max = MAX2(max, loc + st_glsl_type_size(uniform->type));
+ max = MAX2(max, loc + type_size(uniform->type));
}
*size = max;
}
@@ -332,17 +337,17 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog, nir_shader *nir)
sort_varyings(&nir->outputs);
nir_assign_var_locations(&nir->outputs,
&nir->num_outputs,
- st_glsl_type_size);
+ type_size);
st_nir_fixup_varying_slots(st, &nir->outputs);
} else if (nir->stage == MESA_SHADER_FRAGMENT) {
sort_varyings(&nir->inputs);
nir_assign_var_locations(&nir->inputs,
&nir->num_inputs,
- st_glsl_type_size);
+ type_size);
st_nir_fixup_varying_slots(st, &nir->inputs);
nir_assign_var_locations(&nir->outputs,
&nir->num_outputs,
- st_glsl_type_size);
+ type_size);
} else if (nir->stage == MESA_SHADER_COMPUTE) {
/* TODO? */
} else {
@@ -372,7 +377,7 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog, nir_shader *nir)
&nir->uniforms, &nir->num_uniforms);
NIR_PASS_V(nir, nir_lower_system_values);
- NIR_PASS_V(nir, nir_lower_io, nir_var_all, st_glsl_type_size,
+ NIR_PASS_V(nir, nir_lower_io, nir_var_all, type_size,
(nir_lower_io_options)0);
if (screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_DEREF))
NIR_PASS_V(nir, nir_lower_samplers_as_deref, shader_program);