st/xa: Support a couple of new formats
authorThomas Hellstrom <thellstrom@vmware.com>
Fri, 9 Nov 2018 12:19:12 +0000 (13:19 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Wed, 14 Nov 2018 12:12:09 +0000 (13:12 +0100)
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/state_trackers/xa/xa_tracker.c
src/gallium/state_trackers/xa/xa_tracker.h.in

index 5ac98f8eed0b2749e360ff9753cdd2026ca3a8bc..0909044fb91ee0be5664d6f282252213bd252fd2 100644 (file)
@@ -89,6 +89,15 @@ xa_get_pipe_format(struct xa_tracker *xa, enum xa_formats xa_format)
     fdesc.xa_format = xa_format;
 
     switch (xa_format) {
+    case xa_format_a8:
+        if (xa->screen->is_format_supported(xa->screen, PIPE_FORMAT_R8_UNORM,
+                                            PIPE_TEXTURE_2D, 0, 0,
+                                            stype_bind[xa_type_a] |
+                                            PIPE_BIND_RENDER_TARGET))
+            fdesc.format = PIPE_FORMAT_R8_UNORM;
+        else
+            fdesc.format = PIPE_FORMAT_L8_UNORM;
+       break;
     case xa_format_a8r8g8b8:
        fdesc.format = PIPE_FORMAT_B8G8R8A8_UNORM;
        break;
@@ -101,15 +110,21 @@ xa_get_pipe_format(struct xa_tracker *xa, enum xa_formats xa_format)
     case xa_format_x1r5g5b5:
        fdesc.format = PIPE_FORMAT_B5G5R5A1_UNORM;
        break;
-    case xa_format_a8:
-        if (xa->screen->is_format_supported(xa->screen, PIPE_FORMAT_R8_UNORM,
-                                            PIPE_TEXTURE_2D, 0, 0,
-                                            stype_bind[xa_type_a] |
-                                            PIPE_BIND_RENDER_TARGET))
-            fdesc.format = PIPE_FORMAT_R8_UNORM;
-        else
-            fdesc.format = PIPE_FORMAT_L8_UNORM;
-       break;
+    case xa_format_a4r4g4b4:
+        fdesc.format = PIPE_FORMAT_B4G4R4A4_UNORM;
+        break;
+    case xa_format_a2b10g10r10:
+        fdesc.format = PIPE_FORMAT_R10G10B10A2_UNORM;
+        break;
+    case xa_format_x2b10g10r10:
+        fdesc.format = PIPE_FORMAT_R10G10B10X2_UNORM;
+        break;
+    case xa_format_b8g8r8a8:
+        fdesc.format = PIPE_FORMAT_A8R8G8B8_UNORM;
+        break;
+    case xa_format_b8g8r8x8:
+        fdesc.format = PIPE_FORMAT_X8R8G8B8_UNORM;
+        break;
     case xa_format_z24:
        fdesc.format = PIPE_FORMAT_Z24X8_UNORM;
        break;
index fc721eed38bed1bb044dc5b3cd42c049521bfc33..3d136707152a24e65751e2ae75b5dd308931c310 100644 (file)
@@ -126,6 +126,11 @@ enum xa_formats {
     xa_format_x8r8g8b8 = xa_format(32, xa_type_argb, 0, 8, 8, 8),
     xa_format_r5g6b5 = xa_format(16, xa_type_argb, 0, 5, 6, 5),
     xa_format_x1r5g5b5 = xa_format(16, xa_type_argb, 0, 5, 5, 5),
+    xa_format_a4r4g4b4 = xa_format(16, xa_type_argb, 4, 4, 4, 4),
+    xa_format_a2b10g10r10 = xa_format(32, xa_type_abgr, 2, 10, 10, 10),
+    xa_format_x2b10g10r10 = xa_format(32, xa_type_abgr, 0, 10, 10, 10),
+    xa_format_b8g8r8a8 = xa_format(32, xa_type_bgra, 8, 8, 8, 8),
+    xa_format_b8g8r8x8 = xa_format(32, xa_type_bgra, 0, 8, 8, 8),
 
     xa_format_z16 = xa_format_c(16, xa_type_z, 16, 0),
     xa_format_z32 = xa_format_c(32, xa_type_z, 32, 0),