[Mesa-dev] [PATCH] gallium: fix tgsi SAMPLE_L opcode to use separate source for explicit lod

Christoph Bumiller e0425955 at student.tuwien.ac.at
Tue Feb 12 04:31:02 PST 2013


On 11.02.2013 20:47, sroland at vmware.com wrote:
> From: Roland Scheidegger <sroland at vmware.com>
> 
> It looks like using coord.w as explicit lod value is a mistake, most likely
> because some dx10 docs had it specified that way. Seems this was changed though:
> http://msdn.microsoft.com/en-us/library/windows/desktop/hh447229%28v=vs.85%29.aspx
> - let's just hope it doesn't depend on runtime build version or something.
> Not only would this need translation (so go against the stated goal these
> opcodes should be close to dx10 semantics) but it would prevent usage of this
> opcode with cube arrays, which is apparently possible:
> http://msdn.microsoft.com/en-us/library/windows/desktop/bb509699%28v=vs.85%29.aspx
> (Note not only does this show cube arrays using explicit lod, but also the
> confusion with this opcode: it lists an explicit lod parameter value, but then
> states last component of location is used as lod).
> (For "true" hw drivers, only nv50 had code to handle it, and it appears the
> code was already right for the new semantics, though fix up the seemingly
> wrong c/d arguments while there.)
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c   |    5 +----
>  src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c    |    2 +-
>  src/gallium/auxiliary/tgsi/tgsi_exec.c             |    2 +-
>  src/gallium/auxiliary/tgsi/tgsi_info.c             |    2 +-
>  src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h       |    2 +-
>  src/gallium/docs/source/tgsi.rst                   |   12 ++++++------
>  .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp     |    2 +-
>  .../state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp    |    9 ++-------
>  8 files changed, 14 insertions(+), 22 deletions(-)
> 

> diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
> index 5078eb4..acec623 100644
> --- a/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
> +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_from_tgsi.cpp
> @@ -2065,7 +2065,7 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
>     case TGSI_OPCODE_SAMPLE_L:
>     case TGSI_OPCODE_SAMPLE_C:
>     case TGSI_OPCODE_SAMPLE_C_LZ:
> -      handleTEX(dst0, 1, 2, 0x30, 0x31, 0x40, 0x50);
> +      handleTEX(dst0, 1, 2, 0x30, 0x30, 0x30, 0x40);

Thanks, this looks good. It was probably completely wrong before.

>        break;
>     case TGSI_OPCODE_TXF:
>     case TGSI_OPCODE_LOAD:




More information about the mesa-dev mailing list