[Mesa-dev] [PATCH 5/7] mesa: Fix the datatype of GL_DEPTH32F_STENCIL8's depth channel.

Brian Paul brianp at vmware.com
Mon Nov 28 07:36:55 PST 2011


On 11/27/2011 03:48 PM, Eric Anholt wrote:
> On Wed, 23 Nov 2011 13:52:07 -0700, Brian Paul<brianp at vmware.com>  wrote:
>> On 11/23/2011 01:37 PM, Eric Anholt wrote:
>>> Asking for the datatype of MESA_FORMAT_Z32_FLOAT_X24S8 is a bit funny
>>> -- there's a float depth channel, and a stencil channel that doesn't
>>> have a particular GLenum associated with its type, so what's the correct response?
>>>
>>> Because there is no query for stencil, just make this format's
>>> datatype be that of the depth channel.  It fixes the depth query (and
>>> thus a failure in piglit gl-3.0-required-sized-formats), and none of
>>> the other consumers of the _mesa_get_format_datatype() API care.
>>> ---
>>>    src/mesa/main/formats.c |    2 +-
>>>    1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
>>> index b934bd4..324de65 100644
>>> --- a/src/mesa/main/formats.c
>>> +++ b/src/mesa/main/formats.c
>>> @@ -1473,7 +1473,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
>>>          MESA_FORMAT_Z32_FLOAT_X24S8, /* Name */
>>>          "MESA_FORMAT_Z32_FLOAT_X24S8", /* StrName */
>>>          GL_DEPTH_STENCIL,            /* BaseFormat */
>>> -      GL_NONE /* XXX */,           /* DataType */
>>> +      GL_FLOAT,                    /* DataType */
>>>          0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
>>>          0, 0, 0, 32, 8,              /* Lum/Int/Index/Depth/StencilBits */
>>>          1, 1, 8                      /* BlockWidth/Height,Bytes */
>>
>> Minor nit: maybe add a comment to the effect of "we're ignoring stencil".
>
> Updated version:
>
>     {
>        MESA_FORMAT_Z32_FLOAT,       /* Name */
>        "MESA_FORMAT_Z32_FLOAT",     /* StrName */
>        GL_DEPTH_COMPONENT,          /* BaseFormat */
>        /* DataType here is used to answer GL_TEXTURE_DEPTH_TYPE queries, and is
>         * never used for stencil because stencil is always GL_UNSIGNED_INT.
>         */
>        GL_FLOAT,
>        0, 0, 0, 0,                  /* Red/Green/Blue/AlphaBits */
>        0, 0, 0, 32, 0,              /* Lum/Int/Index/Depth/StencilBits */
>        1, 1, 4                      /* BlockWidth/Height,Bytes */
>     },


Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list