aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_nir.cpp16
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir.c21
-rw-r--r--src/mesa/drivers/dri/i965/brw_nir.h2
3 files changed, 25 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index b51fe0e5eba..e922a85573c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -1699,20 +1699,8 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
}
}
- enum glsl_base_type dest_base_type;
- switch (instr->dest_type) {
- case nir_type_float:
- dest_base_type = GLSL_TYPE_FLOAT;
- break;
- case nir_type_int:
- dest_base_type = GLSL_TYPE_INT;
- break;
- case nir_type_unsigned:
- dest_base_type = GLSL_TYPE_UINT;
- break;
- default:
- unreachable("bad type");
- }
+ enum glsl_base_type dest_base_type =
+ brw_glsl_base_type_for_nir_type (instr->dest_type);
const glsl_type *dest_type =
glsl_type::get_instance(dest_base_type, nir_tex_instr_dest_size(instr),
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
index beb7d6912c8..49d17422546 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -216,3 +216,24 @@ brw_type_for_nir_type(nir_alu_type type)
return BRW_REGISTER_TYPE_F;
}
+
+/* Returns the glsl_base_type corresponding to a nir_alu_type.
+ * This is used by both brw_vec4_nir and brw_fs_nir.
+ */
+enum glsl_base_type
+brw_glsl_base_type_for_nir_type(nir_alu_type type)
+{
+ switch (type) {
+ case nir_type_float:
+ return GLSL_TYPE_FLOAT;
+
+ case nir_type_int:
+ return GLSL_TYPE_INT;
+
+ case nir_type_unsigned:
+ return GLSL_TYPE_UINT;
+
+ default:
+ unreachable("bad type");
+ }
+}
diff --git a/src/mesa/drivers/dri/i965/brw_nir.h b/src/mesa/drivers/dri/i965/brw_nir.h
index 6152321521b..ad712930536 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.h
+++ b/src/mesa/drivers/dri/i965/brw_nir.h
@@ -83,6 +83,8 @@ nir_shader *brw_create_nir(struct brw_context *brw,
enum brw_reg_type brw_type_for_nir_type(nir_alu_type type);
+enum glsl_base_type brw_glsl_base_type_for_nir_type(nir_alu_type type);
+
#ifdef __cplusplus
}
#endif