summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/image.h
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-10-30 11:55:02 +0100
committerIago Toral Quiroga <[email protected]>2015-01-12 11:20:29 +0100
commita177b30f1f2a74c14a649e9990eaab8826523c69 (patch)
treecbbf8b3498dfd6bf868887f0611611c42fec0d35 /src/mesa/main/image.h
parentdcef50b9b5cecbfe38c55059971ce80142585865 (diff)
mesa: Add _mesa_swap2_copy and _mesa_swap4_copy
We have _mesa_swap{2,4} but these do in-place byte-swapping only. The new functions receive an extra parameter so we can swap bytes on a source input array and store the results in a (possibly different) destination array. This is useful to implement byte-swapping in pixel uploads, since in this case we need to swap bytes on the src data which is owned by the application so we can't do an in-place byte swap. v2: - Include compiler.h in image.h, which is necessary to build in MSCV as indicated by Brian Paul. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main/image.h')
-rw-r--r--src/mesa/main/image.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h
index abd84bf2f87..44863cc5927 100644
--- a/src/mesa/main/image.h
+++ b/src/mesa/main/image.h
@@ -28,15 +28,28 @@
#include "glheader.h"
+#include "compiler.h"
struct gl_context;
struct gl_pixelstore_attrib;
extern void
-_mesa_swap2( GLushort *p, GLuint n );
+_mesa_swap2_copy(GLushort *dst, GLushort *src, GLuint n);
extern void
-_mesa_swap4( GLuint *p, GLuint n );
+_mesa_swap4_copy(GLuint *dst, GLuint *src, GLuint n);
+
+static inline void
+_mesa_swap2(GLushort *p, GLuint n)
+{
+ _mesa_swap2_copy(p, p, n);
+}
+
+static inline void
+_mesa_swap4(GLuint *p, GLuint n)
+{
+ _mesa_swap4_copy(p, p, n);
+}
extern GLintptr
_mesa_image_offset( GLuint dimensions,