[Mesa-dev] [PATCH 17/17] i965/fs: don't make a fake ir_texture in the Mesa IR frontend

Connor Abbott cwabbott0 at gmail.com
Tue Oct 14 16:50:39 PDT 2014


On Tue, Oct 14, 2014 at 12:54 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> From: Connor Abbott <connor.abbott at intel.com>
>
> Now that we've made all the texture emit code mostly independent of GLSL
> IR, this isn't necessary any more.
>
> Signed-off-by: Connor Abbott <connor.abbott at intel.com>
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_fp.cpp | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
> index 1ba24a9..6348bc1 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
> @@ -391,14 +391,7 @@ fs_visitor::emit_fragment_program_code()
>        case OPCODE_TEX:
>        case OPCODE_TXB:
>        case OPCODE_TXP: {
> -         /* We piggy-back on the GLSL IR support for texture setup.  To do so,
> -          * we have to cook up an ir_texture that has the coordinate field
> -          * with appropriate type, and shadow_comparitor set or not.  All the
> -          * other properties of ir_texture are passed in as arguments to the
> -          * emit_texture_gen* function.
> -          */
> -         ir_texture *ir = NULL;
> -
> +         ir_texture_opcode op;
>           fs_reg lod;
>           fs_reg dpdy;
>           fs_reg coordinate = src[0];
> @@ -408,10 +401,10 @@ fs_visitor::emit_fragment_program_code()
>
>           switch (fpi->Opcode) {
>           case OPCODE_TEX:
> -            ir = new(mem_ctx) ir_texture(ir_tex);
> +            op = ir_tex;
>              break;
>           case OPCODE_TXP: {
> -            ir = new(mem_ctx) ir_texture(ir_tex);
> +            op = ir_tex;
>
>              coordinate = fs_reg(this, glsl_type::vec3_type);
>              fs_reg invproj = fs_reg(this, glsl_type::float_type);
> @@ -423,15 +416,13 @@ fs_visitor::emit_fragment_program_code()
>              break;
>           }
>           case OPCODE_TXB:
> -            ir = new(mem_ctx) ir_texture(ir_txb);
> +            op = ir_txb;
>              lod = offset(src[0], 3);
>              break;
>           default:
>              unreachable("not reached");
>           }
>
> -         ir->type = glsl_type::vec4_type;
> -
>           const glsl_type *coordinate_type;
>           switch (fpi->TexSrcTarget) {
>           case TEXTURE_1D_INDEX:
> @@ -479,7 +470,7 @@ fs_visitor::emit_fragment_program_code()
>           if (fpi->TexShadow)
>              shadow_c = offset(coordinate, 2);
>
> -         emit_texture(ir->op, glsl_type::vec4_type, coordinate, coordinate_type,
> +         emit_texture(op, glsl_type::vec4_type, coordinate, coordinate_type,
>                        shadow_c, lod, dpdy, 0, sample_index,
>                        reg_undef, 0, /* offset, components */
>                        reg_undef, /* mcs */
> --
> 2.1.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

I think there are a few more texture-related patches in my nir-i965-fs
branch which you don't have here, namely:

i965/fs: don't pass through the coordinate type
i965/fs: be more careful about types when emitting textures

Like the one fixing integer texture swizzles, I only realized I needed
these after I started working on the NIR backend, so I never sent them
as part of the original series, but it seems to me like they should
probably be in there (and it's likely that they have conflicts too).
Did you miss them?


More information about the mesa-dev mailing list