[Mesa-dev] [RFC 18/24] nvc0/ir: fix 1D arrays images for Kepler
Ilia Mirkin
imirkin at alum.mit.edu
Wed Apr 13 20:39:39 UTC 2016
On Tue, Apr 12, 2016 at 7:57 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> For 1D arrays, the array index is stored in the Z component.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> .../drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> index 0ef0939..0a3daca 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
> @@ -1614,13 +1614,22 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)
>
> // calculate clamped coordinates
> for (c = 0; c < arg; ++c) {
> + int subOp = getSuClampSubOp(su, c);
> +
> src[c] = bld.getScratch();
> - if (c == 0 && raw)
> + if (c == 0 && raw) {
> v = loadSuInfo32(NULL, base + NVE4_SU_INFO_RAW_X);
> - else
> - v = loadSuInfo32(NULL, base + NVE4_SU_INFO_DIM(c));
> + } else {
> + if (c == 1 && su->tex.target == TEX_TARGET_1D_ARRAY) {
> + // The array index is stored in the Z component for 1D arrays.
> + v = loadSuInfo32(NULL, base + NVE4_SU_INFO_DIM(2));
> + subOp = getSuClampSubOp(su, 2);
This seems complicated... how about just doing
int dimc = c;
if (c == 1 && 1d array)
dimc = 2;
And then you can avoid having the duplicate loadSuInfo logic and the
duplicate suclampsubop call.
> + } else {
> + v = loadSuInfo32(NULL, base + NVE4_SU_INFO_DIM(c));
> + }
> + }
> bld.mkOp3(OP_SUCLAMP, TYPE_S32, src[c], su->getSrc(c), v, zero)
> - ->subOp = getSuClampSubOp(su, c);
> + ->subOp = subOp;
> }
> for (; c < 3; ++c)
> src[c] = zero;
> --
> 2.8.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list