tgsi/scan: add uses_doubles to tgsi scanner
authorDave Airlie <airlied@redhat.com>
Fri, 20 Feb 2015 00:40:46 +0000 (10:40 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 2 Sep 2015 06:06:13 +0000 (16:06 +1000)
This allows drivers to work out if a shader contains any
double opcodes easily.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_scan.h

index 7523baf4ce01018eb5b3b045e96fba3082c1bb54..9810b5468d9f2c96d4e4eecb703574c04f7ed181 100644 (file)
@@ -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];
index b81bdd71f143cdd8075da8093eb1ea78e672c159..c5900bc05d4bf108cc2c8d2c9382b7a5911a7104 100644 (file)
@@ -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;