From: Marek Olšák Date: Wed, 27 Nov 2019 20:04:14 +0000 (-0500) Subject: llvmpipe: implement TEX_LZ and TXF_LZ opcodes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=525c8b90c746410b04b60056a574a617e88adeb2;p=mesa.git llvmpipe: implement TEX_LZ and TXF_LZ opcodes gallivm receives these opcodes anyway because st_draw_feedback.c uses shaders that were assembled for drivers, not llvmpipe. Reviewed-by: Roland Scheidegger --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index 5ae3d51d986..df6ddd82e72 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -1689,7 +1689,8 @@ lp_build_lod_property( * constant coords maybe). * There's at least hope for sample opcodes as well as size queries. */ - if (reg->Register.File == TGSI_FILE_CONSTANT || + if (inst->Instruction.Opcode == TGSI_OPCODE_TEX_LZ || + reg->Register.File == TGSI_FILE_CONSTANT || reg->Register.File == TGSI_FILE_IMMEDIATE) { lod_property = LP_SAMPLER_LOD_SCALAR; } @@ -1814,8 +1815,10 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, /* Note lod and especially projected are illegal in a LOT of cases */ if (modifier == LP_BLD_TEX_MODIFIER_LOD_BIAS || modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_LOD) { - if (inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE || - inst->Texture.Texture == TGSI_TEXTURE_CUBE_ARRAY) { + if (inst->Instruction.Opcode == TGSI_OPCODE_TEX_LZ) { + lod = bld->bld_base.base.zero; + } else if (inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE || + inst->Texture.Texture == TGSI_TEXTURE_CUBE_ARRAY) { /* note that shadow cube array with bias/explicit lod does not exist */ lod = lp_build_emit_fetch(&bld->bld_base, inst, 1, 0); } @@ -2172,7 +2175,8 @@ emit_fetch_texels( struct lp_build_tgsi_soa_context *bld, /* always have lod except for buffers and msaa targets ? */ if (target != TGSI_TEXTURE_BUFFER && target != TGSI_TEXTURE_2D_MSAA && - target != TGSI_TEXTURE_2D_ARRAY_MSAA) { + target != TGSI_TEXTURE_2D_ARRAY_MSAA && + inst->Instruction.Opcode != TGSI_OPCODE_TXF_LZ) { sample_key |= LP_SAMPLER_LOD_EXPLICIT << LP_SAMPLER_LOD_CONTROL_SHIFT; explicit_lod = lp_build_emit_fetch(&bld->bld_base, inst, 0, 3); lod_property = lp_build_lod_property(&bld->bld_base, inst, 0); @@ -4096,9 +4100,11 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm, bld.bld_base.op_actions[TGSI_OPCODE_TXB].emit = txb_emit; bld.bld_base.op_actions[TGSI_OPCODE_TXD].emit = txd_emit; bld.bld_base.op_actions[TGSI_OPCODE_TXL].emit = txl_emit; + bld.bld_base.op_actions[TGSI_OPCODE_TEX_LZ].emit = txl_emit; bld.bld_base.op_actions[TGSI_OPCODE_TXP].emit = txp_emit; bld.bld_base.op_actions[TGSI_OPCODE_TXQ].emit = txq_emit; bld.bld_base.op_actions[TGSI_OPCODE_TXF].emit = txf_emit; + bld.bld_base.op_actions[TGSI_OPCODE_TXF_LZ].emit = txf_emit; bld.bld_base.op_actions[TGSI_OPCODE_TEX2].emit = tex2_emit; bld.bld_base.op_actions[TGSI_OPCODE_TXB2].emit = txb2_emit; bld.bld_base.op_actions[TGSI_OPCODE_TXL2].emit = txl2_emit; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index ce41baa529b..6688c6e36c2 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -265,8 +265,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION: return 1; case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: - case PIPE_CAP_TGSI_TEX_TXF_LZ: return 0; + case PIPE_CAP_TGSI_TEX_TXF_LZ: case PIPE_CAP_SAMPLER_VIEW_TARGET: return 1; case PIPE_CAP_FAKE_SW_MSAA: