[Mesa-dev] [PATCH 2/2] gallium: Desambiguate TGSI_OPCODE_IF.
Marek Olšák
maraeo at gmail.com
Sun Apr 14 10:33:54 PDT 2013
The R600 code looks good.
Marek
On Sun, Apr 14, 2013 at 10:12 AM, <jfonseca at vmware.com> wrote:
> From: José Fonseca <jfonseca at vmware.com>
>
> TGSI_OPCODE_IF condition had two possible interpretations:
>
> - src.x != 0.0f
>
> - Mesa statetracker when PIPE_SHADER_CAP_INTEGERS was false either for
> vertex and fragment shaders
> - gallivm/llvmpipe
> - postprocess
> - vl state tracker
> - vega state tracker
> - most old drivers
> - old internal state trackers
> - many graw examples
>
> - src.x != 0U
>
> - Mesa statetracker when PIPE_SHADER_CAP_INTEGERS was true for both
> vertex and fragment shaders
> - tgsi_exec/softpipe
> - r600
> - radeonsi
> - nv50
>
> And drivers that use draw module also were a mess (because Mesa would
> emit float IFs, but draw module supports native integers so it would
> interpret IF arg as integers...)
>
> This sort of works if the source argument is limited to float +0.0f or
> +1.0f, integer 0, but would fail if source is float -0.0f, or integer in
> the float NaN range. It could also fail if source is integer 1, and
> hardware flushes denormalized numbers to zero.
>
> But with this change there are now two opcodes, IF and UIF, with clear
> meaning.
>
> Drivers that do not support native integers do not need to worry about
> UIF. However, for backwards compatibility with old state trackers and
> examples, it is advisable that native integer capable drivers also
> support the float IF opcode.
>
> I tried to implement this for r600 and radeonsi based on the surrounding
> code. I couldn't do this for nouveau, so I just shunted IF/UIF
> together, which matches the current behavior.
> ---
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c | 1 +
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c | 1 +
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c | 1 +
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 19 ++++++++-
> src/gallium/auxiliary/tgsi/tgsi_dump.c | 2 +
> src/gallium/auxiliary/tgsi/tgsi_exec.c | 22 +++++++++++
> src/gallium/auxiliary/tgsi/tgsi_info.c | 2 +-
> src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h | 1 +
> src/gallium/docs/source/tgsi.rst | 21 ++++++++--
> .../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp | 6 +++
> src/gallium/drivers/r600/r600_shader.c | 21 +++++++---
> .../drivers/radeon/radeon_setup_tgsi_llvm.c | 41
> ++++++++++++++++----
> src/gallium/include/pipe/p_shader_tokens.h | 2 +-
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +++-
> src/mesa/state_tracker/st_mesa_to_tgsi.c | 12 +++++-
> 15 files changed, 137 insertions(+), 23 deletions(-)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130414/ff14c4bb/attachment.html>
More information about the mesa-dev
mailing list