[Mesa-dev] [PATCH 1/2] tgsi/scan: add uses_doubles to tgsi scanner

2015-02-19 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

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

Signed-off-by: Dave Airlie airl...@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 e6011d2..e19b8a1 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -97,6 +97,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_DRSQ)
+   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 5dc9267..daa73cc 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -86,7 +86,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;
-- 
1.9.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] tgsi/scan: add uses_doubles to tgsi scanner

2015-02-19 Thread Ilia Mirkin
On Thu, Feb 19, 2015 at 7:54 PM, Dave Airlie airl...@gmail.com wrote:
 From: Dave Airlie airl...@redhat.com

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

 Signed-off-by: Dave Airlie airl...@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 e6011d2..e19b8a1 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
 @@ -97,6 +97,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_DRSQ)

I added a few :)

 +   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 5dc9267..daa73cc 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
 +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
 @@ -86,7 +86,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;
 --
 1.9.3

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev