[Mesa-dev] [PATCH 59/78] i965/nir/vec4: Add utility method shader_opcode_for_nir_opcode()
Jason Ekstrand
jason at jlekstrand.net
Tue Jun 30 15:30:04 PDT 2015
On Fri, Jun 26, 2015 at 1:07 AM, Eduardo Lima Mitev <elima at igalia.com> wrote:
> This is a helper method that returns a shader instruction opcode from the
> corresponding NIR texture opcode. It will be used to keep code in
> nir_emit_texture() clean.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89580
> ---
> src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 39 ++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> index 741b9af..6e9df99 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> @@ -1313,6 +1313,45 @@ vec4_visitor::nir_emit_jump(nir_jump_instr *instr)
> }
> }
>
> +static enum opcode
> +shader_opcode_for_nir_opcode(nir_texop nir_opcode)
This should be renamed to something that indicates that it's only
usable for texture ops. How about brw_opcode_for_nir_tex or something
like that?
--Jason
> +{
> + switch (nir_opcode) {
> + case nir_texop_query_levels:
> + return SHADER_OPCODE_TXS;
> +
> + case nir_texop_tex:
> + return SHADER_OPCODE_TXL;
> +
> + case nir_texop_tg4:
> + return SHADER_OPCODE_TG4;
> +
> + case nir_texop_txd:
> + return SHADER_OPCODE_TXD;
> +
> + case nir_texop_txf:
> + return SHADER_OPCODE_TXF;
> +
> + case nir_texop_txf_ms:
> + return SHADER_OPCODE_TXF_CMS;
> +
> + case nir_texop_txl:
> + return SHADER_OPCODE_TXL;
> +
> + case nir_texop_txs:
> + return SHADER_OPCODE_TXS;
> +
> + case nir_texop_txb:
> + unreachable("TXB (ie: texture() with bias on glsl) is not valid for vertex shaders.\n");
> +
> + case nir_texop_lod:
> + unreachable("LOD (ie: textureQueryLOD on glsl) is not valid for vertex shaders.\n");
> +
> + default:
> + unreachable("Unknown texture opcode");
> + }
> +}
> +
> void
> vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
> {
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list