Mesa (master): tgsi/scan: add uses_doubles to tgsi scanner

Dave Airlie airlied at kemper.freedesktop.org
Wed Sep 2 06:07:20 UTC 2015


Module: Mesa
Branch: master
Commit: ee67fd70c22c6389fd90886ef3ddf5bf6601b3a0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee67fd70c22c6389fd90886ef3ddf5bf6601b3a0

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Feb 20 10:40:46 2015 +1000

tgsi/scan: add uses_doubles to tgsi scanner

This allows drivers to work out if a shader contains any
double opcodes easily.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/auxiliary/tgsi/tgsi_scan.c |    4 ++++
 src/gallium/auxiliary/tgsi/tgsi_scan.h |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index 7523baf..9810b54 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -100,6 +100,10 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
             assert(fullinst->Instruction.Opcode < TGSI_OPCODE_LAST);
             info->opcode_count[fullinst->Instruction.Opcode]++;
 
+            if (fullinst->Instruction.Opcode >= TGSI_OPCODE_F2D &&
+                fullinst->Instruction.Opcode <= TGSI_OPCODE_DSSG)
+               info->uses_doubles = true;
+
             for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) {
                const struct tgsi_full_src_register *src =
                   &fullinst->Src[i];
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index b81bdd7..c5900bc 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -95,7 +95,7 @@ struct tgsi_shader_info
    boolean writes_viewport_index;
    boolean writes_layer;
    boolean is_msaa_sampler[PIPE_MAX_SAMPLERS];
-
+   boolean uses_doubles; /**< uses any of the double instructions */
    unsigned clipdist_writemask;
    unsigned culldist_writemask;
    unsigned num_written_culldistance;




More information about the mesa-commit mailing list