[Mesa-dev] [PATCH] i965: Fix I/L/LA SNORM formats.
Chris Forbes
chrisf at ijw.co.nz
Thu Feb 26 21:09:56 PST 2015
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
On Fri, Feb 27, 2015 at 5:52 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> I'll admit that I don't know that portion of the code all that well, but it
> looks sensible to me.
>
> Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
>
> On Thu, Feb 26, 2015 at 3:55 PM, Kenneth Graunke <kenneth at whitecape.org>
> wrote:
>>
>> _mesa_choose_tex_format (texformat.c) tries I8_SNORM, L8_SNORM, and
>> either L8A8_SNORM or A8L8_SNORM, none of which are supported by our
>> driver. Failing that, it falls back to RGBX for luminance, and RGBA
>> intensity and luminance alpha. So, we need to use swizzle overrrides
>> to obtain the correct values.
>>
>> Fixes Piglit's EXT_texture_snorm/fbo-blending-formats and
>> fbo-clear-formats on Gen6-8.
>>
>> v2: Rebase forward 3 years, don't require texformat.c changes.
>>
>> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>> ---
>> src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 20
>> +++++++++++++++++++-
>> 1 file changed, 19 insertions(+), 1 deletion(-)
>>
>> Tue Jul 17 11:08:59 2012 -0700.
>>
>> I'm down to 135 branches...making progress...
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
>> b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
>> index ec4dfdb..f479f44 100644
>> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
>> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
>> @@ -187,6 +187,8 @@ brw_get_texture_swizzle(const struct gl_context *ctx,
>> }
>> }
>>
>> + GLenum datatype = _mesa_get_format_datatype(img->TexFormat);
>> +
>> /* If the texture's format is alpha-only, force R, G, and B to
>> * 0.0. Similarly, if the texture's format has no alpha channel,
>> * force the alpha value read to 1.0. This allows for the
>> @@ -200,13 +202,29 @@ brw_get_texture_swizzle(const struct gl_context
>> *ctx,
>> swizzles[2] = SWIZZLE_ZERO;
>> break;
>> case GL_LUMINANCE:
>> - if (t->_IsIntegerFormat) {
>> + if (t->_IsIntegerFormat || datatype == GL_SIGNED_NORMALIZED) {
>> swizzles[0] = SWIZZLE_X;
>> swizzles[1] = SWIZZLE_X;
>> swizzles[2] = SWIZZLE_X;
>> swizzles[3] = SWIZZLE_ONE;
>> }
>> break;
>> + case GL_LUMINANCE_ALPHA:
>> + if (datatype == GL_SIGNED_NORMALIZED) {
>> + swizzles[0] = SWIZZLE_X;
>> + swizzles[1] = SWIZZLE_X;
>> + swizzles[2] = SWIZZLE_X;
>> + swizzles[3] = SWIZZLE_W;
>> + }
>> + break;
>> + case GL_INTENSITY:
>> + if (datatype == GL_SIGNED_NORMALIZED) {
>> + swizzles[0] = SWIZZLE_X;
>> + swizzles[1] = SWIZZLE_X;
>> + swizzles[2] = SWIZZLE_X;
>> + swizzles[3] = SWIZZLE_X;
>> + }
>> + break;
>> case GL_RED:
>> case GL_RG:
>> case GL_RGB:
>> --
>> 2.2.2
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list