[Mesa-dev] [PATCH 03/13] gallium: Introduce 32-bit bytewise format names
Adam Jackson
ajax at redhat.com
Thu May 16 06:06:06 PDT 2013
From: Richard Sandiford <r.sandiford at uk.ibm.com>
RGBA8888 has R at byte 0 and A at byte 3, regardless of platform
endianness.
Reviewed-by: Adam Jackson <ajax at redhat.com>
---
src/gallium/include/pipe/p_format.h | 38 +++++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 098b25b..1289983 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -33,6 +33,7 @@
extern "C" {
#endif
+#include "p_config.h"
enum pipe_type {
PIPE_TYPE_UNORM = 0,
@@ -53,10 +54,10 @@ enum pipe_type {
enum pipe_format {
PIPE_FORMAT_NONE = 0,
- PIPE_FORMAT_B8G8R8A8_UNORM = 1,
- PIPE_FORMAT_B8G8R8X8_UNORM = 2,
- PIPE_FORMAT_A8R8G8B8_UNORM = 3,
- PIPE_FORMAT_X8R8G8B8_UNORM = 4,
+ PIPE_FORMAT_ARGB8888_UNORM = 1,
+ PIPE_FORMAT_XRGB8888_UNORM = 2,
+ PIPE_FORMAT_BGRA8888_UNORM = 3,
+ PIPE_FORMAT_BGRX8888_UNORM = 4,
PIPE_FORMAT_B5G5R5A1_UNORM = 5,
PIPE_FORMAT_B4G4R4A4_UNORM = 6,
PIPE_FORMAT_B5G6R5_UNORM = 7,
@@ -119,8 +120,8 @@ enum pipe_format {
PIPE_FORMAT_R8_UNORM = 64,
PIPE_FORMAT_R8G8_UNORM = 65,
PIPE_FORMAT_R8G8B8_UNORM = 66,
- PIPE_FORMAT_R8G8B8A8_UNORM = 67,
- PIPE_FORMAT_X8B8G8R8_UNORM = 68,
+ PIPE_FORMAT_ABGR8888_UNORM = 67,
+ PIPE_FORMAT_RGBX8888_UNORM = 68,
PIPE_FORMAT_R8_USCALED = 69,
PIPE_FORMAT_R8G8_USCALED = 70,
PIPE_FORMAT_R8G8B8_USCALED = 71,
@@ -180,7 +181,7 @@ enum pipe_format {
PIPE_FORMAT_R5SG5SB6U_NORM = 120,
/* TODO: re-order these */
- PIPE_FORMAT_A8B8G8R8_UNORM = 121,
+ PIPE_FORMAT_RGBA8888_UNORM = 121,
PIPE_FORMAT_B5G5R5X1_UNORM = 122,
PIPE_FORMAT_R10G10B10A2_USCALED = 123,
PIPE_FORMAT_R11G11B10_FLOAT = 124,
@@ -193,7 +194,7 @@ enum pipe_format {
PIPE_FORMAT_B10G10R10A2_UNORM = 131,
PIPE_FORMAT_R10SG10SB10SA2U_NORM = 132,
PIPE_FORMAT_R8G8Bx_SNORM = 133,
- PIPE_FORMAT_R8G8B8X8_UNORM = 134,
+ PIPE_FORMAT_XBGR8888_UNORM = 134,
PIPE_FORMAT_B4G4R4X4_UNORM = 135,
/* some stencil samplers formats */
@@ -343,6 +344,27 @@ enum pipe_format {
PIPE_FORMAT_COUNT
};
+#if defined(PIPE_ARCH_LITTLE_ENDIAN)
+#define PIPE_FORMAT_R8G8B8A8_UNORM PIPE_FORMAT_ABGR8888_UNORM
+#define PIPE_FORMAT_R8G8B8X8_UNORM PIPE_FORMAT_XBGR8888_UNORM
+#define PIPE_FORMAT_B8G8R8X8_UNORM PIPE_FORMAT_XRGB8888_UNORM
+#define PIPE_FORMAT_B8G8R8A8_UNORM PIPE_FORMAT_ARGB8888_UNORM
+#define PIPE_FORMAT_B8G8R8X8_UNORM PIPE_FORMAT_XRGB8888_UNORM
+#define PIPE_FORMAT_A8R8G8B8_UNORM PIPE_FORMAT_BGRA8888_UNORM
+#define PIPE_FORMAT_X8R8G8B8_UNORM PIPE_FORMAT_BGRX8888_UNORM
+#define PIPE_FORMAT_A8B8G8R8_UNORM PIPE_FORMAT_RGBA8888_UNORM
+#define PIPE_FORMAT_X8B8G8R8_UNORM PIPE_FORMAT_RGBX8888_UNORM
+#elif defined(PIPE_ARCH_BIG_ENDIAN)
+#define PIPE_FORMAT_R8G8B8A8_UNORM PIPE_FORMAT_RGBA8888_UNORM
+#define PIPE_FORMAT_R8G8B8X8_UNORM PIPE_FORMAT_RGBX8888_UNORM
+#define PIPE_FORMAT_B8G8R8A8_UNORM PIPE_FORMAT_BGRA8888_UNORM
+#define PIPE_FORMAT_B8G8R8X8_UNORM PIPE_FORMAT_BGRX8888_UNORM
+#define PIPE_FORMAT_A8R8G8B8_UNORM PIPE_FORMAT_ARGB8888_UNORM
+#define PIPE_FORMAT_X8R8G8B8_UNORM PIPE_FORMAT_XRGB8888_UNORM
+#define PIPE_FORMAT_A8B8G8R8_UNORM PIPE_FORMAT_ABGR8888_UNORM
+#define PIPE_FORMAT_X8B8G8R8_UNORM PIPE_FORMAT_XBGR8888_UNORM
+#endif
+
enum pipe_video_chroma_format
{
PIPE_VIDEO_CHROMA_FORMAT_420,
--
1.8.2.1
More information about the mesa-dev
mailing list