Re: [Mesa-dev] [PATCH 1/3] i965: Use intel_get_image_dims in alloc_texture_storage

2016-07-19 Thread Jason Ekstrand
On Tue, Jul 19, 2016 at 7:20 AM, Jason Ekstrand 
wrote:

>
>
> On Tue, Jul 19, 2016 at 5:56 AM, Iago Toral  wrote:
>
>> On Mon, 2016-07-18 at 22:16 -0700, Jason Ekstrand wrote:
>> > The intel_get_image_dims helper function handles some image dimension
>> > sanitization for us for things such as 1-D array textures.  We should
>> > probably be using it here.
>> >
>> > Signed-off-by: Jason Ekstrand 
>> > Cc: "12.0 11.2 11.1" 
>> > ---
>> >  src/mesa/drivers/dri/i965/intel_tex.c | 2 ++
>> >  1 file changed, 2 insertions(+)
>> >
>> > diff --git a/src/mesa/drivers/dri/i965/intel_tex.c
>> > b/src/mesa/drivers/dri/i965/intel_tex.c
>> > index 8c32fe3..d3e24f4 100644
>> > --- a/src/mesa/drivers/dri/i965/intel_tex.c
>> > +++ b/src/mesa/drivers/dri/i965/intel_tex.c
>> > @@ -141,6 +141,8 @@ intel_alloc_texture_storage(struct gl_context
>> > *ctx,
>> > !intel_miptree_match_image(intel_texobj->mt, first_image) ||
>> > intel_texobj->mt->last_level != levels - 1) {
>> >intel_miptree_release(_texobj->mt);
>> > +
>> > +  intel_get_image_dims(first_image, , , );
>>
>> I don't think we want this. This code calls intel_miptree_create below,
>> which then calls miptree_create and that
>> calls intel_miptree_create_layout, which has this code:
>>
>>if (target == GL_TEXTURE_1D_ARRAY) {
>>   /* ... */
>>   assert(height0 == 1 || depth0 == 1);
>>   if (height0 > 1) {
>>  depth0 = height0;
>>  height0 = 1;
>>   }
>>}
>>
>
> Are you serious? "1-D Arrays are hard.  Let's just make sure it works
> in either case".  Wow...
>
> I'll see if I can't delete that code.
>

Ok, I just sent out a v2 that deletes that bit of magic and hackery.


>
> --Jason
>
>
>>
>> Maybe we should just call the function in intel_miptree_create_layout
>> instead?
>>
>> Iago
>>
>> >intel_texobj->mt = intel_miptree_create(brw, texobj->Target,
>> >first_image-
>> > >TexFormat,
>> >0, levels - 1,
>>
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] i965: Use intel_get_image_dims in alloc_texture_storage

2016-07-19 Thread Jason Ekstrand
On Tue, Jul 19, 2016 at 5:56 AM, Iago Toral  wrote:

> On Mon, 2016-07-18 at 22:16 -0700, Jason Ekstrand wrote:
> > The intel_get_image_dims helper function handles some image dimension
> > sanitization for us for things such as 1-D array textures.  We should
> > probably be using it here.
> >
> > Signed-off-by: Jason Ekstrand 
> > Cc: "12.0 11.2 11.1" 
> > ---
> >  src/mesa/drivers/dri/i965/intel_tex.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/src/mesa/drivers/dri/i965/intel_tex.c
> > b/src/mesa/drivers/dri/i965/intel_tex.c
> > index 8c32fe3..d3e24f4 100644
> > --- a/src/mesa/drivers/dri/i965/intel_tex.c
> > +++ b/src/mesa/drivers/dri/i965/intel_tex.c
> > @@ -141,6 +141,8 @@ intel_alloc_texture_storage(struct gl_context
> > *ctx,
> > !intel_miptree_match_image(intel_texobj->mt, first_image) ||
> > intel_texobj->mt->last_level != levels - 1) {
> >intel_miptree_release(_texobj->mt);
> > +
> > +  intel_get_image_dims(first_image, , , );
>
> I don't think we want this. This code calls intel_miptree_create below,
> which then calls miptree_create and that
> calls intel_miptree_create_layout, which has this code:
>
>if (target == GL_TEXTURE_1D_ARRAY) {
>   /* ... */
>   assert(height0 == 1 || depth0 == 1);
>   if (height0 > 1) {
>  depth0 = height0;
>  height0 = 1;
>   }
>}
>

Are you serious? "1-D Arrays are hard.  Let's just make sure it works
in either case".  Wow...

I'll see if I can't delete that code.

--Jason


>
> Maybe we should just call the function in intel_miptree_create_layout
> instead?
>
> Iago
>
> >intel_texobj->mt = intel_miptree_create(brw, texobj->Target,
> >first_image-
> > >TexFormat,
> >0, levels - 1,
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] i965: Use intel_get_image_dims in alloc_texture_storage

2016-07-19 Thread Iago Toral
On Mon, 2016-07-18 at 22:16 -0700, Jason Ekstrand wrote:
> The intel_get_image_dims helper function handles some image dimension
> sanitization for us for things such as 1-D array textures.  We should
> probably be using it here.
> 
> Signed-off-by: Jason Ekstrand 
> Cc: "12.0 11.2 11.1" 
> ---
>  src/mesa/drivers/dri/i965/intel_tex.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_tex.c
> b/src/mesa/drivers/dri/i965/intel_tex.c
> index 8c32fe3..d3e24f4 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex.c
> @@ -141,6 +141,8 @@ intel_alloc_texture_storage(struct gl_context
> *ctx,
> !intel_miptree_match_image(intel_texobj->mt, first_image) ||
> intel_texobj->mt->last_level != levels - 1) {
>    intel_miptree_release(_texobj->mt);
> +
> +  intel_get_image_dims(first_image, , , );

I don't think we want this. This code calls intel_miptree_create below,
which then calls miptree_create and that
calls intel_miptree_create_layout, which has this code:

   if (target == GL_TEXTURE_1D_ARRAY) {
      /* ... */
  assert(height0 == 1 || depth0 == 1);
  if (height0 > 1) {
 depth0 = height0;
 height0 = 1;
  }
   }

Maybe we should just call the function in intel_miptree_create_layout
instead?

Iago

>    intel_texobj->mt = intel_miptree_create(brw, texobj->Target,
>    first_image-
> >TexFormat,
>    0, levels - 1,
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] i965: Use intel_get_image_dims in alloc_texture_storage

2016-07-18 Thread Jason Ekstrand
The intel_get_image_dims helper function handles some image dimension
sanitization for us for things such as 1-D array textures.  We should
probably be using it here.

Signed-off-by: Jason Ekstrand 
Cc: "12.0 11.2 11.1" 
---
 src/mesa/drivers/dri/i965/intel_tex.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_tex.c 
b/src/mesa/drivers/dri/i965/intel_tex.c
index 8c32fe3..d3e24f4 100644
--- a/src/mesa/drivers/dri/i965/intel_tex.c
+++ b/src/mesa/drivers/dri/i965/intel_tex.c
@@ -141,6 +141,8 @@ intel_alloc_texture_storage(struct gl_context *ctx,
!intel_miptree_match_image(intel_texobj->mt, first_image) ||
intel_texobj->mt->last_level != levels - 1) {
   intel_miptree_release(_texobj->mt);
+
+  intel_get_image_dims(first_image, , , );
   intel_texobj->mt = intel_miptree_create(brw, texobj->Target,
   first_image->TexFormat,
   0, levels - 1,
-- 
2.5.0.400.gff86faf

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