[Mesa-dev] [PATCH 63/65] mesa/glformats: Consider DEPTH/STENCIL when resolving a mesa_format

Eduardo Lima Mitev elima at igalia.com
Wed Feb 3 15:57:09 UTC 2016


On 02/03/2016 04:53 PM, Ilia Mirkin wrote:
> On Wed, Feb 3, 2016 at 10:45 AM, Eduardo Lima Mitev <elima at igalia.com> wrote:
>> _mesa_format_from_format_and_type() is currently not considering DEPTH and
>> STENCIL formats, which are not array formats and are not handled anywhere.
>>
>> This patch adds cases for common combinations of DEPTH/STENCIL format and
>> types.
>> ---
>>  src/mesa/main/glformats.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
>> index e947543..aee4365 100644
>> --- a/src/mesa/main/glformats.c
>> +++ b/src/mesa/main/glformats.c
>> @@ -3513,6 +3513,21 @@ _mesa_format_from_format_and_type(GLenum format, GLenum type)
>>     case GL_UNSIGNED_INT_10F_11F_11F_REV:
>>        if (format == GL_RGB)
>>           return MESA_FORMAT_R11G11B10_FLOAT;
>> +   case GL_FLOAT:
>> +      if (format == GL_DEPTH_COMPONENT)
>> +         return MESA_FORMAT_Z_FLOAT32;
>> +   case GL_UNSIGNED_INT:
>> +      if (format == GL_DEPTH_COMPONENT)
>> +         return MESA_FORMAT_Z_UNORM32;
>> +   case GL_UNSIGNED_SHORT:
>> +      if (format == GL_DEPTH_COMPONENT)
>> +         return MESA_FORMAT_Z_UNORM16;
>> +   case GL_UNSIGNED_INT_24_8:
>> +      if (format == GL_DEPTH_STENCIL)
>> +         return MESA_FORMAT_Z24_UNORM_S8_UINT;
>> +   case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
>> +      if (format == GL_DEPTH_STENCIL)
>> +         return MESA_FORMAT_Z32_FLOAT_S8X24_UINT;
> 
> These are all missing breaks. Now it does all end up falling through
> to the end and hitting a break... probably. But that's not how the
> rest of the cases work. The r11g11b10 one is the only other one also
> missing a break.
> 

Wow, that was fast :)

Good catch! This patch is fresh from this morning. I will fix it
immediately.

Thanks Ilia!

Eduardo


More information about the mesa-dev mailing list