[Mesa-dev] [PATCH 2/5] st/mesa: use private pipe_sampler_view in decompress_with_blit()

Brian Paul brianp at vmware.com
Tue Feb 14 07:06:26 PST 2012


On 02/14/2012 07:55 AM, Jose Fonseca wrote:
>
>
> ----- Original Message -----
>> Similar to the previous commit.
>> ---
>>   src/mesa/state_tracker/st_cb_texture.c |    7 +++++--
>>   1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_cb_texture.c
>> b/src/mesa/state_tracker/st_cb_texture.c
>> index c2011da..b0f6b14 100644
>> --- a/src/mesa/state_tracker/st_cb_texture.c
>> +++ b/src/mesa/state_tracker/st_cb_texture.c
>> @@ -609,8 +609,7 @@ decompress_with_blit(struct gl_context * ctx,
>>      struct pipe_context *pipe = st->pipe;
>>      struct st_texture_image *stImage = st_texture_image(texImage);
>>      struct st_texture_object *stObj =
>>      st_texture_object(texImage->TexObject);
>> -   struct pipe_sampler_view *src_view =
>> -      st_get_texture_sampler_view(stObj, pipe);
>> +   struct pipe_sampler_view *src_view;
>>      const GLuint width = texImage->Width;
>>      const GLuint height = texImage->Height;
>>      struct pipe_surface *dst_surface;
>> @@ -632,6 +631,8 @@ decompress_with_blit(struct gl_context * ctx,
>>         pipe->render_condition(pipe, NULL, 0);
>>      }
>>
>> +   src_view = st_create_texture_sampler_view(pipe, stObj->pt);
>> +
>>      /* Choose the source mipmap level */
>>      src_view->u.tex.first_level = src_view->u.tex.last_level =
>>      texImage->Level;
>
> This doesn't look right, although the problem was there before.  We should not be touching the sampler view parameters after creation, as that goes against the point of a sampler view (it's not merely a passive structure), and will cause bugs on drivers that create internal resources based on the sample view parameters (such as svga pipe driver).
>
> I'm pretty surprised this didn't cause problems before.
>
> The right way of doing this is either to create a variant of st_create_texture_sampler_view that accepts the desired first_level/last_level, or simply call pipe->create_sampler_view from here.

Thanks for catching that.  I'll post a new patch in a bit.

-Brian



More information about the mesa-dev mailing list