[Mesa-dev] [PATCH 2/4] mesa: Add helper function to see if we have a float depth format.

Ian Romanick idr at freedesktop.org
Mon Sep 15 14:57:01 PDT 2014


On 09/15/2014 10:41 AM, Roland Scheidegger wrote:
> Am 14.09.2014 16:07, schrieb Mathias.Froehlich at gmx.net:
>> From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
>>
>> Will be used in the implementation of NV_depth_buffer_float.
>>
>> Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de
>> ---
>>  src/mesa/main/glformats.c | 18 ++++++++++++++++++
>>  src/mesa/main/glformats.h |  3 +++
>>  2 files changed, 21 insertions(+)
>>
>> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
>> index 00478f9..16f7d6b 100644
>> --- a/src/mesa/main/glformats.c
>> +++ b/src/mesa/main/glformats.c
>> @@ -983,6 +983,24 @@ _mesa_is_depth_or_stencil_format(GLenum format)
>>  
>>  
>>  /**
>> + * Test if the given image format is a float depth format.
>> + */
>> +GLboolean
>> +_mesa_is_float_depth_format(GLenum format)
>> +{
>> +   switch (format) {
>> +      case GL_DEPTH_COMPONENT32F:
>> +      case GL_DEPTH_COMPONENT32F_NV:
>> +      case GL_DEPTH32F_STENCIL8:
>> +      case GL_DEPTH32F_STENCIL8_NV:
>> +         return GL_TRUE;
>> +      default:
>> +         return GL_FALSE;
>> +   }
>> +}
>> +
>> +
>> +/**
>>   * Test if an image format is a supported compressed format.
>>   * \param format the internal format token provided by the user.
>>   * \return GL_TRUE if compressed, GL_FALSE if uncompressed
>> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
>> index 7b03215..a960786 100644
>> --- a/src/mesa/main/glformats.h
>> +++ b/src/mesa/main/glformats.h
>> @@ -93,6 +93,9 @@ extern GLboolean
>>  _mesa_is_depth_or_stencil_format(GLenum format);
>>  
>>  extern GLboolean
>> +_mesa_is_float_depth_format(GLenum format);
>> +
>> +extern GLboolean
>>  _mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
>>  
>>  extern GLenum
>>
> 
> I'm amazed that the format enums are different. ARB_depth_buffer_float
> claims that's due to incompatible clamping behavior as per the revision
> history, but since the clamping behavior seems to be entirely controlled
> by the function entry points I don't see why that makes any sense.
> In any case the patches make sense to me but someone else should look at
> them.

I had the same reaction, but I think the clamping behavior is different
if you supply these as internal formats with, say, glTexImage2D... which
means the current patch series is probably missing some things. :(

> Roland



More information about the mesa-dev mailing list