[Mesa-dev] [PATCH 00/10] radeonsi, radv: fix cube map coordinate derivatives

Nicolai Hähnle nhaehnle at gmail.com
Tue Jan 10 15:12:12 UTC 2017


Hi all,

this series has two parts:

Patches 1-5 fix a bug in how radeonsi handles explicit derivatives for cube
map sampling plus some related cleanups. The old computation is based on a
"finite differences" approach that fails when the texture coordinate +
derivative vector lands in a different face of the cube. The new computation
is based on applying the chain rule for derivatives to the projection of the
texture coordinate onto the selected face of the cube.

This fixes GL45-CTS.texture_cube_map_array.sampling.

Patches 6-10 are meant to stop well-meaning souls from making things worse
by copy&pasting the fix into radv. While maintaining radv is not my job,
it's pretty obvious that when subtle code like this ends up duplicated,
everybody loses. So these patches move the cube map coordinate handling into
amd/common and change both radeonsi and ac/nir to use the shared code.

This is followed by a bunch of fairly straightforward patches that remove
duplicated code like emit_llvm_intrinsic from ac/nir. radeonsi could be
moved over to use the amd/common functions as well, but it tends to use the
gallivm functions for the corresponding functionality, so the pay-off for
moving radeonsi over is not as high.

All testing has been on radeonsi, and radv is only compile-tested, so more
testing is appreciated. To make your lives easier, you can get the full
series from https://cgit.freedesktop.org/~nh/mesa/log/?h=cubemaps

Please review!
Thanks,
Nicolai
--
 src/amd/common/ac_llvm_util.c                | 362 ++++++++++++++
 src/amd/common/ac_llvm_util.h                |  57 +++
 src/amd/common/ac_nir_to_llvm.c              | 441 +++--------------
 src/gallium/drivers/radeonsi/si_shader.c     |   6 +-
 .../drivers/radeonsi/si_shader_internal.h    |   6 +-
 .../drivers/radeonsi/si_shader_tgsi_alu.c    | 141 ------
 .../drivers/radeonsi/si_shader_tgsi_setup.c  |   4 +
 7 files changed, 509 insertions(+), 508 deletions(-)



More information about the mesa-dev mailing list