From 427d36a22741890a7ce55b6b5bcd40fd4bdd2d35 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 12 Feb 2013 16:41:56 +0100 Subject: gallium: fix tgsi SAMPLE_L opcode to use separate source for explicit lod 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.) v2: fix comment, separate out other changes. Reviewed-by: Jose Fonseca --- src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp index aaa46f19e8c..ed1f8dac948 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp +++ b/src/gallium/state_trackers/d3d1x/gd3d1x/sm4_to_tgsi.cpp @@ -470,14 +470,9 @@ struct sm4_to_tgsi_converter case SM4_OPCODE_SAMPLE_D: // dst, coord, res, samp, ddx, ddy ureg_SAMPLE_D(ureg, _dst(), _src(1), resources[_idx(SM4_FILE_RESOURCE, 2)], samplers[_idx(SM4_FILE_SAMPLER, 3)], _src(4), _src(5)); break; - case SM4_OPCODE_SAMPLE_L: // dst, coord, res, samp, bias.x - { - struct ureg_dst tmp = _tmp(); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), _src(1)); - ureg_MOV(ureg, ureg_writemask(tmp, TGSI_WRITEMASK_W), ureg_swizzle(_src(4), 0, 0, 0, 0)); - ureg_SAMPLE_L(ureg, _dst(), ureg_src(tmp), resources[_idx(SM4_FILE_RESOURCE, 2)], samplers[_idx(SM4_FILE_SAMPLER, 3)]); + case SM4_OPCODE_SAMPLE_L: // dst, coord, res, samp, lod.x + ureg_SAMPLE_L(ureg, _dst(), _src(1), resources[_idx(SM4_FILE_RESOURCE, 2)], samplers[_idx(SM4_FILE_SAMPLER, 3)], _src(4)); break; - } default: ok = false; break; -- cgit v1.2.3