[Mesa-dev] [PATCH 1/2] st/mesa: directly compute level=0 texture size in st_finalize_texture
Brian Paul
brianp at vmware.com
Tue Jun 7 22:20:31 UTC 2016
I took a stab at fixing this too. My raw patch is attached below. Very
little testing.
-Brian
On 06/07/2016 04:06 PM, Nicolai Hähnle wrote:
> Scratch that, there's a good reason to try to preserve the previous
> texture size... working on yet another alternative.
>
> On 07.06.2016 23:19, Nicolai Hähnle wrote:
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> The width0/height0/depth0 on stObj may not have been set at this point.
>> Observed in a trace that set up levels 2..9 of a 2d texture, and set
>> the base
>> level to 2, with height 1. This made the guess logic always bail.
>>
>> Originally investigated by Ilia Mirkin, this patch makes sure we
>> always get a
>> pipe texture whose level=0 dimensions are compatible with the base
>> level image
>> of the texture.
>>
>> Fixes the gl-1.2-texture-base-level piglit test provided by Brian Paul.
>>
>> Cc: "12.0" <mesa-stable at lists.freedesktop.org>
>> ---
>> src/mesa/state_tracker/st_cb_texture.c | 31
>> +++++++++++++++----------------
>> 1 file changed, 15 insertions(+), 16 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_cb_texture.c
>> b/src/mesa/state_tracker/st_cb_texture.c
>> index 44e21b1..1604993 100644
>> --- a/src/mesa/state_tracker/st_cb_texture.c
>> +++ b/src/mesa/state_tracker/st_cb_texture.c
>> @@ -2478,22 +2478,21 @@ st_finalize_texture(struct gl_context *ctx,
>> /* Find size of level=0 Gallium mipmap image, plus number of
>> texture layers */
>> {
>> GLuint width, height, depth;
>> - if (!guess_base_level_size(stObj->base.Target,
>> - firstImage->base.Width2,
>> - firstImage->base.Height2,
>> - firstImage->base.Depth2,
>> - firstImage->base.Level,
>> - &width, &height, &depth)) {
>> - width = stObj->width0;
>> - height = stObj->height0;
>> - depth = stObj->depth0;
>> - } else {
>> - /* The width/height/depth may have been previously reset in
>> - * guess_and_alloc_texture. */
>> - stObj->width0 = width;
>> - stObj->height0 = height;
>> - stObj->depth0 = depth;
>> - }
>> +
>> + width = firstImage->base.Width2;
>> + if (width > 1)
>> + width <<= firstImage->base.Level;
>> + height = firstImage->base.Height2;
>> + if (stObj->base.Target != GL_TEXTURE_1D_ARRAY && height > 1)
>> + height <<= firstImage->base.Level;
>> + depth = firstImage->base.Depth2;
>> + if (stObj->base.Target == GL_TEXTURE_3D && depth > 1)
>> + depth <<= firstImage->base.Level;
>> +
>> + stObj->width0 = width;
>> + stObj->height0 = height;
>> + stObj->depth0 = depth;
>> +
>> /* convert GL dims to Gallium dims */
>> st_gl_texture_dims_to_pipe_dims(stObj->base.Target, width,
>> height, depth,
>> &ptWidth, &ptHeight, &ptDepth,
>> &ptLayers);
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: guess.patch
Type: text/x-patch
Size: 1162 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160607/576c6009/attachment.bin>
More information about the mesa-dev
mailing list