Mesa (master): dri/osmesa: use preprocessor for selecting endian code paths

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 5 16:40:23 UTC 2019


Module: Mesa
Branch: master
Commit: cb0dbdd369eb5c1eb524c0463d94b42e71c72049
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cb0dbdd369eb5c1eb524c0463d94b42e71c72049

Author: Dylan Baker <dylan at pnwbakers.com>
Date:   Thu Sep  6 14:23:34 2018 -0700

dri/osmesa: use preprocessor for selecting endian code paths

Reviewed-by: Eric Engestrom <eric at engestrom.ch>

---

 src/mesa/drivers/osmesa/osmesa.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c
index acf1e3739ef..f5595ae020d 100644
--- a/src/mesa/drivers/osmesa/osmesa.c
+++ b/src/mesa/drivers/osmesa/osmesa.c
@@ -455,10 +455,11 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
     */
    if (osmesa->format == OSMESA_RGBA) {
       if (osmesa->DataType == GL_UNSIGNED_BYTE) {
-         if (_mesa_little_endian())
+#ifdef PIPE_ARCH_LITTLE_ENDIAN
             rb->Format = MESA_FORMAT_R8G8B8A8_UNORM;
-         else
+#else
             rb->Format = MESA_FORMAT_A8B8G8R8_UNORM;
+#endif
       }
       else if (osmesa->DataType == GL_UNSIGNED_SHORT) {
          rb->Format = MESA_FORMAT_RGBA_UNORM16;
@@ -469,10 +470,11 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
    }
    else if (osmesa->format == OSMESA_BGRA) {
       if (osmesa->DataType == GL_UNSIGNED_BYTE) {
-         if (_mesa_little_endian())
+#ifdef PIPE_ARCH_LITTLE_ENDIAN
             rb->Format = MESA_FORMAT_B8G8R8A8_UNORM;
-         else
+#else
             rb->Format = MESA_FORMAT_A8R8G8B8_UNORM;
+#endif
       }
       else if (osmesa->DataType == GL_UNSIGNED_SHORT) {
          _mesa_warning(ctx, "Unsupported OSMesa format BGRA/GLushort");
@@ -485,10 +487,11 @@ osmesa_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
    }
    else if (osmesa->format == OSMESA_ARGB) {
       if (osmesa->DataType == GL_UNSIGNED_BYTE) {
-         if (_mesa_little_endian())
+#ifdef PIPE_ARCH_LITTLE_ENDIAN
             rb->Format = MESA_FORMAT_A8R8G8B8_UNORM;
-         else
+#else
             rb->Format = MESA_FORMAT_B8G8R8A8_UNORM;
+#endif
       }
       else if (osmesa->DataType == GL_UNSIGNED_SHORT) {
          _mesa_warning(ctx, "Unsupported OSMesa format ARGB/GLushort");




More information about the mesa-commit mailing list