[virglrenderer-devel] [PATCH] vrend: Remove two more BGRA formats from GLES

Tomeu Vizoso tomeu.vizoso at collabora.com
Wed May 23 09:09:11 UTC 2018


Remove VIRGL_FORMAT_B8G8R8A8_SRGB and VIRGL_FORMAT_B8G8R8X8_SRGB when
running on GLES because we cannot upload textures in GL_BGRA.

Mesa has been extended to use instead their RGBA counterparts.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
---
 src/vrend_formats.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/vrend_formats.c b/src/vrend_formats.c
index 9474dad16615..ac6dc525fbde 100644
--- a/src/vrend_formats.c
+++ b/src/vrend_formats.c
@@ -231,8 +231,6 @@ static struct vrend_format_table rgtc_formats[] = {
 };
 
 static struct vrend_format_table srgb_formats[] = {
-  { VIRGL_FORMAT_B8G8R8X8_SRGB, GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, RGB1_SWIZZLE },
-  { VIRGL_FORMAT_B8G8R8A8_SRGB, GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, NO_SWIZZLE },
   { VIRGL_FORMAT_R8G8B8X8_SRGB, GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, RGB1_SWIZZLE },
   { VIRGL_FORMAT_R8G8B8A8_SRGB, GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, NO_SWIZZLE },
 
@@ -240,6 +238,12 @@ static struct vrend_format_table srgb_formats[] = {
   { VIRGL_FORMAT_L8A8_SRGB, GL_SRG8_EXT, GL_RG, GL_UNSIGNED_BYTE, RRRG_SWIZZLE },
 };
 
+static struct vrend_format_table gl_srgb_formats[] =
+{
+  { VIRGL_FORMAT_B8G8R8X8_SRGB, GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, RGB1_SWIZZLE },
+  { VIRGL_FORMAT_B8G8R8A8_SRGB, GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, NO_SWIZZLE },
+};
+
 static struct vrend_format_table bit10_formats[] = {
   { VIRGL_FORMAT_B10G10R10X2_UNORM, GL_RGB10_A2, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV, RGB1_SWIZZLE },
   { VIRGL_FORMAT_B10G10R10A2_UNORM, GL_RGB10_A2, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV, NO_SWIZZLE },
@@ -402,11 +406,11 @@ void vrend_build_format_list_common(void)
 
 void vrend_build_format_list_gl(void)
 {
-  /* We don't want VIRGL_FORMAT_B4G4R4A4_UNORM to be supported on GLES because
-   * it's not as well supported as VIRGL_FORMAT_A4B4G4R4_UNORM in some
-   * operations.
+  /* GL_BGRA formats aren't as well supported in GLES as in GL, specially in
+   * transfer operations. So we only register support for it in GL.
    */
   add_formats(gl_base_rgba_formats);
+  add_formats(gl_srgb_formats);
 }
 
 void vrend_build_format_list_gles(void)
-- 
2.17.0



More information about the virglrenderer-devel mailing list