diff options
author | Marek Olšák <[email protected]> | 2014-07-02 03:55:47 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-07-11 19:36:29 +0200 |
commit | 04aa2bd724157b8d9e5748b17de10c7517e2c388 (patch) | |
tree | e94cebc2cbcc60f9d696080270a8ab2db5f4b4d0 /src | |
parent | b279f0143f4dce67c8f5af57cd4a5942eb403c13 (diff) |
radeonsi: fix texture fetches with derivatives for 1DArray and 3D textures
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 7bff8f95d59..ed09efef39d 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -1652,11 +1652,37 @@ static void tex_fetch_args( /* Pack user derivatives */ if (opcode == TGSI_OPCODE_TXD) { - for (chan = 0; chan < 2; chan++) { - address[count++] = lp_build_emit_fetch(bld_base, inst, 1, chan); - if (num_coords > 1) - address[count++] = lp_build_emit_fetch(bld_base, inst, 2, chan); + int num_deriv_channels, param; + + switch (target) { + case TGSI_TEXTURE_3D: + num_deriv_channels = 3; + break; + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_SHADOW2D: + case TGSI_TEXTURE_RECT: + case TGSI_TEXTURE_SHADOWRECT: + case TGSI_TEXTURE_2D_ARRAY: + case TGSI_TEXTURE_SHADOW2D_ARRAY: + case TGSI_TEXTURE_CUBE: + case TGSI_TEXTURE_SHADOWCUBE: + case TGSI_TEXTURE_CUBE_ARRAY: + case TGSI_TEXTURE_SHADOWCUBE_ARRAY: + num_deriv_channels = 2; + break; + case TGSI_TEXTURE_1D: + case TGSI_TEXTURE_SHADOW1D: + case TGSI_TEXTURE_1D_ARRAY: + case TGSI_TEXTURE_SHADOW1D_ARRAY: + num_deriv_channels = 1; + break; + default: + assert(0); /* no other targets are valid here */ } + + for (param = 1; param <= 2; param++) + for (chan = 0; chan < num_deriv_channels; chan++) + address[count++] = lp_build_emit_fetch(bld_base, inst, param, chan); } /* Pack texture coordinates */ |