[Mesa-dev] [PATCH v2 3/3] glsl/nir: fix variable type for image intrinsics and ubos

Timothy Arceri tarceri at itsqueeze.com
Tue Apr 10 23:18:40 UTC 2018


On 11/04/18 08:58, Jason Ekstrand wrote:
> On Tue, Apr 10, 2018 at 3:16 PM, Timothy Arceri <tarceri at itsqueeze.com 
> <mailto:tarceri at itsqueeze.com>> wrote:
> 
> 
> 
>     On 11/04/18 01:11, Jason Ekstrand wrote:
> 
>         On Tue, Apr 10, 2018 at 8:05 AM, Karol Herbst
>         <kherbst at redhat.com <mailto:kherbst at redhat.com>
>         <mailto:kherbst at redhat.com <mailto:kherbst at redhat.com>>> wrote:
> 
>              If the bindless image is passed through a struct we ended
>         up getting the
>              glsl_type of the struct, not the image.
> 
>              variable_referenced points to the declaration of the
>         struct, so it
>              won't work
>              for bindless images. So just drop it.
> 
>              Signed-off-by: Karol Herbst <kherbst at redhat.com
>         <mailto:kherbst at redhat.com>
>              <mailto:kherbst at redhat.com <mailto:kherbst at redhat.com>>>
>              ---
>                src/compiler/glsl/glsl_to_nir.cpp | 2 +-
>                1 file changed, 1 insertion(+), 1 deletion(-)
> 
>              diff --git a/src/compiler/glsl/glsl_to_nir.cpp
>              b/src/compiler/glsl/glsl_to_nir.cpp
>              index 9f233637306..bb9ba3af04a 100644
>              --- a/src/compiler/glsl/glsl_to_nir.cpp
>              +++ b/src/compiler/glsl/glsl_to_nir.cpp
>              @@ -893,7 +893,7 @@ nir_visitor::visit(ir_call *ir)
>                         exec_node *param = ir->actual_parameters.get_head();
>                         ir_dereference *image = (ir_dereference *)param;
>                         const glsl_type *type =
>              -           
>         image->variable_referenced()->type->without_array();
>              +            image->type->without_array();
> 
> 
>         I asked this question on the last version as well: Do we really
>         need without_array()?
> 
> 
>     And I replied to that question as well :P
> 
>     The struct member type is set in ir.cpp without removing the array:
> 
>         this->type = this->record->type->field_type(field);
> 
> 
> I'm not sure what you mean though.  if we have an array dereference, it 
> will strip one array level off of the type for each array dereference.

The code doesn't walk over the derefs it just returns the type of the 
deref parameter so we need to strip of the arrays ourselves.


More information about the mesa-dev mailing list