[Mesa-dev] [PATCH] mesa: fix tex format selection for GL_R32F and other R/G float formats
Brian Paul
brianp at vmware.com
Mon Jan 16 09:06:32 PST 2012
On 01/16/2012 09:53 AM, Roland Scheidegger wrote:
> Am 16.01.2012 17:13, schrieb Brian Paul:
>> The i965 driver advertises GL_ARB_texture_float and GL_ARB_texture_rg
>> support but the ctx->TextureFormatSupported[] table entries for
>> MESA_FORMAT_R_FLOAT32 and MESA_FORMAT_RGBA_FLOAT32 are false on gen 4
>> hardware. So the case for GL_R32F would fail and we'd print an
>> implementation error.
>>
>> This patch adds more Mesa tex format options for GL_R32F and other R/G
>> formats so we fall back to 16-bit formats when 32-bit formats aren't
>> available.
>>
>> Eric made the same fix in commit 6216a5b4 for the non R/G formats.
>>
>> This should fix https://bugs.freedesktop.org/show_bug.cgi?id=44039
>>
>> NOTE: This is a candidate for the 8.0 branch.
>> ---
>> src/mesa/main/texformat.c | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
>> index 7e60541..2f680d9 100644
>> --- a/src/mesa/main/texformat.c
>> +++ b/src/mesa/main/texformat.c
>> @@ -788,19 +788,25 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
>> RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16);
>> RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
>> RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
>> + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
> I think the rgba_float16 case should be before rgba_float32.
>
>> break;
>> case GL_R32F:
>> RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
>> RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
>> + RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16);
>> + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
>> break;
>> case GL_RG16F:
>> RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
>> RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
>> RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
>> + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
> same as above, though I don't know if the rgba_float16 case should be
> placed before rg_float32 as well (as hw is typically twice as fast for
> filtering float16 compared to float32, but there's probably no hw out
> there which supports rg_float32 but not rg_float16).
Jose spotted those.
>
>> break;
>> case GL_RG32F:
>> RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
>> RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
>> + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
>> + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
>> break;
>>
>> default:
>
> (FWIW I also think the LUMINANCE16F, LUMINANCE_ALPHA16F and
> INTENSITY_16F formats above should probably have a rgba_float16 case as
> well which is preferred over rgba_float32.)
And ALPHA_16F.
I'll address those with a separate patch.
Thanks.
-Brian
More information about the mesa-dev
mailing list