From 8ad02016a543eed776ac0efb380d7f594575f9b9 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 12 Jul 2018 12:37:00 +0200 Subject: [PATCH] vrend_formats: Replace RGB(8|16) formats with RGBX(8|16) Three component formats are not very helpful, at least the Intel driver doesn't expose them as color renderable, and other drivers most likely also just emulate them using RGBX textur formats. RGB32* we have to keep though because it is needed for ARB_rbo_rgb32 which in turn is needed for OpenGL 4.0. To handle the latter, mesa/virgl will take care that RGB32* textures are only allocated as buffers objects. Reviewed-by: Gurchetan Singh Signed-off-by: Gert Wollny Signed-off-by: Jakob Bornecrantz --- src/virgl_hw.h | 5 +++++ src/vrend_formats.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/virgl_hw.h b/src/virgl_hw.h index cd828ed..fa8e1c8 100644 --- a/src/virgl_hw.h +++ b/src/virgl_hw.h @@ -194,9 +194,14 @@ enum virgl_formats { VIRGL_FORMAT_R8G8B8X8_SRGB = 230, + VIRGL_FORMAT_R8G8B8X8_UINT = 231, + VIRGL_FORMAT_R8G8B8X8_SINT = 232, VIRGL_FORMAT_B10G10R10X2_UNORM = 233, VIRGL_FORMAT_R16G16B16X16_UNORM = 234, VIRGL_FORMAT_R16G16B16X16_SNORM = 235, + VIRGL_FORMAT_R16G16B16X16_FLOAT = 236, + VIRGL_FORMAT_R16G16B16X16_UINT = 237, + VIRGL_FORMAT_R16G16B16X16_SINT = 238, VIRGL_FORMAT_R10G10B10A2_UINT = 253, diff --git a/src/vrend_formats.c b/src/vrend_formats.c index 09edc43..8f92903 100644 --- a/src/vrend_formats.c +++ b/src/vrend_formats.c @@ -119,10 +119,10 @@ static struct vrend_format_table integer_base_formats[] = { }; static struct vrend_format_table integer_3comp_formats[] = { - { VIRGL_FORMAT_R8G8B8_UINT, GL_RGB8UI, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, NO_SWIZZLE }, - { VIRGL_FORMAT_R8G8B8_SINT, GL_RGB8I, GL_RGB_INTEGER, GL_BYTE, NO_SWIZZLE }, - { VIRGL_FORMAT_R16G16B16_UINT, GL_RGB16UI, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, NO_SWIZZLE }, - { VIRGL_FORMAT_R16G16B16_SINT, GL_RGB16I, GL_RGB_INTEGER, GL_SHORT, NO_SWIZZLE }, + { VIRGL_FORMAT_R8G8B8X8_UINT, GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, RGB1_SWIZZLE }, + { VIRGL_FORMAT_R8G8B8X8_SINT, GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE, RGB1_SWIZZLE }, + { VIRGL_FORMAT_R16G16B16X16_UINT, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, RGB1_SWIZZLE }, + { VIRGL_FORMAT_R16G16B16X16_SINT, GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT, RGB1_SWIZZLE }, { VIRGL_FORMAT_R32G32B32_UINT, GL_RGB32UI, GL_RGB_INTEGER, GL_UNSIGNED_INT, NO_SWIZZLE }, { VIRGL_FORMAT_R32G32B32_SINT, GL_RGB32I, GL_RGB_INTEGER, GL_INT, NO_SWIZZLE }, }; @@ -167,7 +167,7 @@ static struct vrend_format_table float_rg_formats[] = { }; static struct vrend_format_table float_3comp_formats[] = { - { VIRGL_FORMAT_R16G16B16_FLOAT, GL_RGB16F, GL_RGB, GL_HALF_FLOAT, NO_SWIZZLE }, + { VIRGL_FORMAT_R16G16B16X16_FLOAT, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, RGB1_SWIZZLE }, { VIRGL_FORMAT_R32G32B32_FLOAT, GL_RGB32F, GL_RGB, GL_FLOAT, NO_SWIZZLE }, };