Re: [Mesa-dev] [PATCH] glsl_to_tgsi: don't rely on glsl types when visiting tex instructions

2017-03-23 Thread Samuel Pitoiset



On 03/23/2017 08:30 PM, Nicolai Hähnle wrote:

On 23.03.2017 20:17, Samuel Pitoiset wrote:

Instead add is_cube_shadow like is_cube_array.


I'm curious: why? Anyway, looks fine, so


Preliminary work for ARB_bindless_texture. I will introduce new types 
like sampler2DBindless_type.




Reviewed-by: Nicolai Hähnle 



Signed-off-by: Samuel Pitoiset 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 5bfcc73a3b..63de74adcb 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4133,13 +4133,13 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
const glsl_type *sampler_type = ir->sampler->type;
unsigned sampler_array_size = 1, sampler_base = 0;
uint16_t sampler_index = 0;
-   bool is_cube_array = false;
+   bool is_cube_array = false, is_cube_shadow = false;
unsigned i;

-   /* if we are a cube array sampler */
-   if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE &&
-sampler_type->sampler_array)) {
-  is_cube_array = true;
+   /* if we are a cube array sampler or a cube shadow */
+   if (sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) {
+  is_cube_array = sampler_type->sampler_array;
+  is_cube_shadow = sampler_type->sampler_shadow;
}

if (ir->coordinate) {
@@ -4177,8 +4177,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
   }
   break;
case ir_txb:
-  if (is_cube_array ||
-  sampler_type == glsl_type::samplerCubeShadow_type) {
+  if (is_cube_array || is_cube_shadow) {
  opcode = TGSI_OPCODE_TXB2;
   }
   else {





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


Re: [Mesa-dev] [PATCH] glsl_to_tgsi: don't rely on glsl types when visiting tex instructions

2017-03-23 Thread Nicolai Hähnle

On 23.03.2017 20:17, Samuel Pitoiset wrote:

Instead add is_cube_shadow like is_cube_array.


I'm curious: why? Anyway, looks fine, so

Reviewed-by: Nicolai Hähnle 



Signed-off-by: Samuel Pitoiset 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 5bfcc73a3b..63de74adcb 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4133,13 +4133,13 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
const glsl_type *sampler_type = ir->sampler->type;
unsigned sampler_array_size = 1, sampler_base = 0;
uint16_t sampler_index = 0;
-   bool is_cube_array = false;
+   bool is_cube_array = false, is_cube_shadow = false;
unsigned i;

-   /* if we are a cube array sampler */
-   if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE &&
-sampler_type->sampler_array)) {
-  is_cube_array = true;
+   /* if we are a cube array sampler or a cube shadow */
+   if (sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) {
+  is_cube_array = sampler_type->sampler_array;
+  is_cube_shadow = sampler_type->sampler_shadow;
}

if (ir->coordinate) {
@@ -4177,8 +4177,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
   }
   break;
case ir_txb:
-  if (is_cube_array ||
-  sampler_type == glsl_type::samplerCubeShadow_type) {
+  if (is_cube_array || is_cube_shadow) {
  opcode = TGSI_OPCODE_TXB2;
   }
   else {




--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glsl_to_tgsi: don't rely on glsl types when visiting tex instructions

2017-03-23 Thread Samuel Pitoiset
Instead add is_cube_shadow like is_cube_array.

Signed-off-by: Samuel Pitoiset 
---
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 5bfcc73a3b..63de74adcb 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4133,13 +4133,13 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
const glsl_type *sampler_type = ir->sampler->type;
unsigned sampler_array_size = 1, sampler_base = 0;
uint16_t sampler_index = 0;
-   bool is_cube_array = false;
+   bool is_cube_array = false, is_cube_shadow = false;
unsigned i;
 
-   /* if we are a cube array sampler */
-   if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE &&
-sampler_type->sampler_array)) {
-  is_cube_array = true;
+   /* if we are a cube array sampler or a cube shadow */
+   if (sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) {
+  is_cube_array = sampler_type->sampler_array;
+  is_cube_shadow = sampler_type->sampler_shadow;
}
 
if (ir->coordinate) {
@@ -4177,8 +4177,7 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir)
   }
   break;
case ir_txb:
-  if (is_cube_array ||
-  sampler_type == glsl_type::samplerCubeShadow_type) {
+  if (is_cube_array || is_cube_shadow) {
  opcode = TGSI_OPCODE_TXB2;
   }
   else {
-- 
2.12.0

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