[Mesa-dev] [PATCH 2/3] tgsi: emit code for SVIEWINFO and SAMPLE_I

2013-03-08 Thread sroland
From: Roland Scheidegger srol...@vmware.com

Can handle them since the single sampler interface was introduced.
---
 src/gallium/auxiliary/tgsi/tgsi_exec.c |   18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c 
b/src/gallium/auxiliary/tgsi/tgsi_exec.c
index 9945d42..8c6890b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
@@ -2139,7 +2139,8 @@ exec_txd(struct tgsi_exec_machine *mach,
 
 static void
 exec_txf(struct tgsi_exec_machine *mach,
- const struct tgsi_full_instruction *inst)
+ const struct tgsi_full_instruction *inst,
+ boolean is_samplei)
 {
const uint unit = inst-Src[1].Register.Index;
union tgsi_exec_channel r[4];
@@ -2147,13 +2148,20 @@ exec_txf(struct tgsi_exec_machine *mach,
float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
int j;
int8_t offsets[3];
+   unsigned target;
 
/* always fetch all 3 offsets, overkill but keeps code simple */
fetch_texel_offsets(mach, inst, offsets);
 
IFETCH(r[3], 0, TGSI_CHAN_W);
 
-   switch(inst-Texture.Texture) {
+   if (is_samplei) {
+  target = mach-SamplerViews[unit].Resource;
+   }
+   else {
+  target = inst-Texture.Texture;
+   }
+   switch(target) {
case TGSI_TEXTURE_3D:
case TGSI_TEXTURE_2D_ARRAY:
case TGSI_TEXTURE_SHADOW2D_ARRAY:
@@ -4112,7 +4120,7 @@ exec_instruction(
   break;
 
case TGSI_OPCODE_TXF:
-  exec_txf(mach, inst);
+  exec_txf(mach, inst, FALSE);
   break;
 
case TGSI_OPCODE_TXQ:
@@ -4339,7 +4347,7 @@ exec_instruction(
   break;
 
case TGSI_OPCODE_SAMPLE_I:
-  assert(0);
+  exec_txf(mach, inst, TRUE);
   break;
 
case TGSI_OPCODE_SAMPLE_I_MS:
@@ -4375,7 +4383,7 @@ exec_instruction(
   break;
 
case TGSI_OPCODE_SVIEWINFO:
-  assert(0);
+  exec_txq(mach, inst);
   break;
 
case TGSI_OPCODE_SAMPLE_POS:
-- 
1.7.9.5

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


Re: [Mesa-dev] [PATCH 2/3] tgsi: emit code for SVIEWINFO and SAMPLE_I

2013-03-08 Thread Jose Fonseca
Patches 1-2 look good to me. Still going through patch 3.

Jose

- Original Message -
 From: Roland Scheidegger srol...@vmware.com
 
 Can handle them since the single sampler interface was introduced.
 ---
  src/gallium/auxiliary/tgsi/tgsi_exec.c |   18 +-
  1 file changed, 13 insertions(+), 5 deletions(-)
 
 diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c
 b/src/gallium/auxiliary/tgsi/tgsi_exec.c
 index 9945d42..8c6890b 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
 @@ -2139,7 +2139,8 @@ exec_txd(struct tgsi_exec_machine *mach,
  
  static void
  exec_txf(struct tgsi_exec_machine *mach,
 - const struct tgsi_full_instruction *inst)
 + const struct tgsi_full_instruction *inst,
 + boolean is_samplei)
  {
 const uint unit = inst-Src[1].Register.Index;
 union tgsi_exec_channel r[4];
 @@ -2147,13 +2148,20 @@ exec_txf(struct tgsi_exec_machine *mach,
 float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
 int j;
 int8_t offsets[3];
 +   unsigned target;
  
 /* always fetch all 3 offsets, overkill but keeps code simple */
 fetch_texel_offsets(mach, inst, offsets);
  
 IFETCH(r[3], 0, TGSI_CHAN_W);
  
 -   switch(inst-Texture.Texture) {
 +   if (is_samplei) {
 +  target = mach-SamplerViews[unit].Resource;
 +   }
 +   else {
 +  target = inst-Texture.Texture;
 +   }
 +   switch(target) {
 case TGSI_TEXTURE_3D:
 case TGSI_TEXTURE_2D_ARRAY:
 case TGSI_TEXTURE_SHADOW2D_ARRAY:
 @@ -4112,7 +4120,7 @@ exec_instruction(
break;
  
 case TGSI_OPCODE_TXF:
 -  exec_txf(mach, inst);
 +  exec_txf(mach, inst, FALSE);
break;
  
 case TGSI_OPCODE_TXQ:
 @@ -4339,7 +4347,7 @@ exec_instruction(
break;
  
 case TGSI_OPCODE_SAMPLE_I:
 -  assert(0);
 +  exec_txf(mach, inst, TRUE);
break;
  
 case TGSI_OPCODE_SAMPLE_I_MS:
 @@ -4375,7 +4383,7 @@ exec_instruction(
break;
  
 case TGSI_OPCODE_SVIEWINFO:
 -  assert(0);
 +  exec_txq(mach, inst);
break;
  
 case TGSI_OPCODE_SAMPLE_POS:
 --
 1.7.9.5
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] tgsi: emit code for SVIEWINFO and SAMPLE_I

2013-03-08 Thread Roland Scheidegger
Am 08.03.2013 21:11, schrieb Brian Paul:
 On 03/08/2013 12:18 PM, srol...@vmware.com wrote:
 From: Roland Scheideggersrol...@vmware.com

 Can handle them since the single sampler interface was introduced.
 ---
   src/gallium/auxiliary/tgsi/tgsi_exec.c |   18 +-
   1 file changed, 13 insertions(+), 5 deletions(-)

 diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c
 b/src/gallium/auxiliary/tgsi/tgsi_exec.c
 index 9945d42..8c6890b 100644
 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c
 +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c
 @@ -2139,7 +2139,8 @@ exec_txd(struct tgsi_exec_machine *mach,

   static void
   exec_txf(struct tgsi_exec_machine *mach,
 - const struct tgsi_full_instruction *inst)
 + const struct tgsi_full_instruction *inst,
 + boolean is_samplei)
 
 Can't you just look at inst-Instruction.Opcode to see if it's a
 TGSI_OPCODE_SAMPLE_I instruction?
Sure yes that's probably slightly nicer. I guess I should make the same
change in the corresponding gallivm code...

Roland

 
 
   {
  const uint unit = inst-Src[1].Register.Index;
  union tgsi_exec_channel r[4];
 @@ -2147,13 +2148,20 @@ exec_txf(struct tgsi_exec_machine *mach,
  float rgba[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE];
  int j;
  int8_t offsets[3];
 +   unsigned target;

  /* always fetch all 3 offsets, overkill but keeps code simple */
  fetch_texel_offsets(mach, inst, offsets);

  IFETCH(r[3], 0, TGSI_CHAN_W);

 -   switch(inst-Texture.Texture) {
 +   if (is_samplei) {
 +  target = mach-SamplerViews[unit].Resource;
 +   }
 +   else {
 +  target = inst-Texture.Texture;
 +   }
 +   switch(target) {
  case TGSI_TEXTURE_3D:
  case TGSI_TEXTURE_2D_ARRAY:
  case TGSI_TEXTURE_SHADOW2D_ARRAY:
 @@ -4112,7 +4120,7 @@ exec_instruction(
 break;

  case TGSI_OPCODE_TXF:
 -  exec_txf(mach, inst);
 +  exec_txf(mach, inst, FALSE);
 break;

  case TGSI_OPCODE_TXQ:
 @@ -4339,7 +4347,7 @@ exec_instruction(
 break;

  case TGSI_OPCODE_SAMPLE_I:
 -  assert(0);
 +  exec_txf(mach, inst, TRUE);
 break;

  case TGSI_OPCODE_SAMPLE_I_MS:
 @@ -4375,7 +4383,7 @@ exec_instruction(
 break;

  case TGSI_OPCODE_SVIEWINFO:
 -  assert(0);
 +  exec_txq(mach, inst);
 break;

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