[Mesa-dev] [PATCH 05/12] i965: Store a key_tex pointer in vec4_visitor.
Matt Turner
mattst88 at gmail.com
Sat Aug 29 12:22:58 PDT 2015
On Sat, Aug 29, 2015 at 2:23 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> I'm about to remove the base class for VS/GS/HS/DS program keys, at
> which point we won't be able to use key->tex anymore. Instead, we'll
> need to store a direct pointer (like we do in the FS backend).
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/i965/brw_vec4.h | 1 +
> src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 4 ++--
> src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 13 +++++++------
> 3 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
> index 7c31932..10439f2 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.h
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.h
> @@ -101,6 +101,7 @@ public:
> }
>
> const struct brw_vue_prog_key * const key;
> + const struct brw_sampler_prog_key_data * const key_tex;
> struct brw_vue_prog_data * const prog_data;
> unsigned int sanity_param_count;
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> index 59e440a..f3dc112 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> @@ -1409,7 +1409,7 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
> * emitting anything other than setting up the constant result.
> */
> if (instr->op == nir_texop_tg4) {
> - int swiz = GET_SWZ(key->tex.swizzles[sampler], instr->component);
> + int swiz = GET_SWZ(key_tex->swizzles[sampler], instr->component);
> if (swiz == SWIZZLE_ZERO || swiz == SWIZZLE_ONE) {
> emit(MOV(dest, src_reg(swiz == SWIZZLE_ONE ? 1.0f : 0.0f)));
> return;
> @@ -1471,7 +1471,7 @@ vec4_visitor::nir_emit_texture(nir_tex_instr *instr)
> sample_index = get_nir_src(instr->src[i].src, BRW_REGISTER_TYPE_D, 1);
> assert(coord_type != NULL);
> if (devinfo->gen >= 7 &&
> - key->tex.compressed_multisample_layout_mask & (1<<sampler)) {
> + key_tex->compressed_multisample_layout_mask & (1 << sampler)) {
> mcs = emit_mcs_fetch(coord_type, coordinate, sampler_reg);
> } else {
> mcs = src_reg(0u);
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index 978d28c..5a6e8a8 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -2693,7 +2693,7 @@ vec4_visitor::emit_texture(ir_texture_opcode op,
> }
>
> if (devinfo->gen == 6 && op == ir_tg4) {
> - emit_gen6_gather_wa(key->tex.gen6_gather_wa[sampler], inst->dst);
> + emit_gen6_gather_wa(key_tex->gen6_gather_wa[sampler], inst->dst);
> }
>
> swizzle_result(op, dest,
> @@ -2745,7 +2745,7 @@ vec4_visitor::visit(ir_texture *ir)
> */
> if (ir->op == ir_tg4) {
> ir_constant *chan = ir->lod_info.component->as_constant();
> - int swiz = GET_SWZ(key->tex.swizzles[sampler], chan->value.i[0]);
> + int swiz = GET_SWZ(key_tex->swizzles[sampler], chan->value.i[0]);
> if (swiz == SWIZZLE_ZERO || swiz == SWIZZLE_ONE) {
> dst_reg result(this, ir->type);
> this->result = src_reg(result);
> @@ -2803,7 +2803,7 @@ vec4_visitor::visit(ir_texture *ir)
> ir->lod_info.sample_index->accept(this);
> sample_index = this->result;
>
> - if (devinfo->gen >= 7 && key->tex.compressed_multisample_layout_mask & (1<<sampler))
> + if (devinfo->gen >= 7 && key_tex->compressed_multisample_layout_mask & (1 << sampler))
> mcs = emit_mcs_fetch(ir->coordinate->type, coordinate, sampler_reg);
> else
> mcs = src_reg(0u);
> @@ -2881,14 +2881,14 @@ vec4_visitor::emit_gen6_gather_wa(uint8_t wa, dst_reg dst)
> uint32_t
> vec4_visitor::gather_channel(unsigned gather_component, uint32_t sampler)
> {
> - int swiz = GET_SWZ(key->tex.swizzles[sampler], gather_component);
> + int swiz = GET_SWZ(key_tex->swizzles[sampler], gather_component);
> switch (swiz) {
> case SWIZZLE_X: return 0;
> case SWIZZLE_Y:
> /* gather4 sampler is broken for green channel on RG32F --
> * we must ask for blue instead.
> */
> - if (key->tex.gather_channel_quirk_mask & (1<<sampler))
> + if (key_tex->gather_channel_quirk_mask & (1<<sampler))
Thanks for adding spaces around << -- you should do it here too. :)
More information about the mesa-dev
mailing list