[Mesa-dev] [PATCH v2 13/78] i965/nir: Move brw_type_for_nir_type() to brw_nir to allow reuse
Eduardo Lima Mitev
elima at igalia.com
Thu Jul 23 03:16:53 PDT 2015
Upcoming NIR->vec4 pass can benefit from this method, so lets move it up.
---
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 18 ------------------
src/mesa/drivers/dri/i965/brw_nir.c | 18 ++++++++++++++++++
src/mesa/drivers/dri/i965/brw_nir.h | 3 +++
3 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 33469d4..f7802d0 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -481,24 +481,6 @@ fs_visitor::nir_emit_instr(nir_instr *instr)
}
}
-static brw_reg_type
-brw_type_for_nir_type(nir_alu_type type)
-{
- switch (type) {
- case nir_type_unsigned:
- return BRW_REGISTER_TYPE_UD;
- case nir_type_bool:
- case nir_type_int:
- return BRW_REGISTER_TYPE_D;
- case nir_type_float:
- return BRW_REGISTER_TYPE_F;
- default:
- unreachable("unknown type");
- }
-
- return BRW_REGISTER_TYPE_F;
-}
-
bool
fs_visitor::optimize_frontfacing_ternary(nir_alu_instr *instr,
const fs_reg &result)
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
index a4b65d2..b241121 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -186,3 +186,21 @@ brw_create_nir(struct brw_context *brw,
return nir;
}
+
+enum brw_reg_type
+brw_type_for_nir_type(nir_alu_type type)
+{
+ switch (type) {
+ case nir_type_unsigned:
+ return BRW_REGISTER_TYPE_UD;
+ case nir_type_bool:
+ case nir_type_int:
+ return BRW_REGISTER_TYPE_D;
+ case nir_type_float:
+ return BRW_REGISTER_TYPE_F;
+ default:
+ unreachable("unknown type");
+ }
+
+ return BRW_REGISTER_TYPE_F;
+}
diff --git a/src/mesa/drivers/dri/i965/brw_nir.h b/src/mesa/drivers/dri/i965/brw_nir.h
index c76defd..6152321 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.h
+++ b/src/mesa/drivers/dri/i965/brw_nir.h
@@ -24,6 +24,7 @@
#pragma once
#include "brw_context.h"
+#include "brw_reg.h"
#include "glsl/nir/nir.h"
#ifdef __cplusplus
@@ -80,6 +81,8 @@ nir_shader *brw_create_nir(struct brw_context *brw,
gl_shader_stage stage,
bool is_scalar);
+enum brw_reg_type brw_type_for_nir_type(nir_alu_type type);
+
#ifdef __cplusplus
}
#endif
--
2.1.4
More information about the mesa-dev
mailing list