mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 11:30:21 +01:00
i965/nir: Add new utility method brw_glsl_base_type_for_nir_type()
This method returns the glsl_base_type corresponding to a nir_alu_type. It will factorize code currently present in fs_nir, that can be reused in vec4_nir on its upcoming emit_texture support. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
This commit is contained in:
parent
583c1c6170
commit
db8a6de571
3 changed files with 25 additions and 14 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue