<div dir="ltr"><div>The R600 code looks good.<br><br></div>Marek<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 14, 2013 at 10:12 AM, <span dir="ltr"><<a href="mailto:jfonseca@vmware.com" target="_blank">jfonseca@vmware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: José Fonseca <<a href="mailto:jfonseca@vmware.com">jfonseca@vmware.com</a>><br>
<br>
TGSI_OPCODE_IF condition had two possible interpretations:<br>
<br>
- src.x != 0.0f<br>
<br>
- Mesa statetracker when PIPE_SHADER_CAP_INTEGERS was false either for<br>
vertex and fragment shaders<br>
- gallivm/llvmpipe<br>
- postprocess<br>
- vl state tracker<br>
- vega state tracker<br>
- most old drivers<br>
- old internal state trackers<br>
- many graw examples<br>
<br>
- src.x != 0U<br>
<br>
- Mesa statetracker when PIPE_SHADER_CAP_INTEGERS was true for both<br>
vertex and fragment shaders<br>
- tgsi_exec/softpipe<br>
- r600<br>
- radeonsi<br>
- nv50<br>
<br>
And drivers that use draw module also were a mess (because Mesa would<br>
emit float IFs, but draw module supports native integers so it would<br>
interpret IF arg as integers...)<br>
<br>
This sort of works if the source argument is limited to float +0.0f or<br>
+1.0f, integer 0, but would fail if source is float -0.0f, or integer in<br>
the float NaN range. It could also fail if source is integer 1, and<br>
hardware flushes denormalized numbers to zero.<br>
<br>
But with this change there are now two opcodes, IF and UIF, with clear<br>
meaning.<br>
<br>
Drivers that do not support native integers do not need to worry about<br>
UIF. However, for backwards compatibility with old state trackers and<br>
examples, it is advisable that native integer capable drivers also<br>
support the float IF opcode.<br>
<br>
I tried to implement this for r600 and radeonsi based on the surrounding<br>
code. I couldn't do this for nouveau, so I just shunted IF/UIF<br>
together, which matches the current behavior.<br>
---<br>
src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c | 1 +<br>
src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c | 1 +<br>
src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c | 1 +<br>
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 19 ++++++++-<br>
src/gallium/auxiliary/tgsi/tgsi_dump.c | 2 +<br>
src/gallium/auxiliary/tgsi/tgsi_exec.c | 22 +++++++++++<br>
src/gallium/auxiliary/tgsi/tgsi_info.c | 2 +-<br>
src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h | 1 +<br>
src/gallium/docs/source/tgsi.rst | 21 ++++++++--<br>
.../drivers/nv50/codegen/nv50_ir_from_tgsi.cpp | 6 +++<br>
src/gallium/drivers/r600/r600_shader.c | 21 +++++++---<br>
.../drivers/radeon/radeon_setup_tgsi_llvm.c | 41 ++++++++++++++++----<br>
src/gallium/include/pipe/p_shader_tokens.h | 2 +-<br>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 8 +++-<br>
src/mesa/state_tracker/st_mesa_to_tgsi.c | 12 +++++-<br>
15 files changed, 137 insertions(+), 23 deletions(-)<br></blockquote></div><br></div></div>