aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/pack.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-10 08:28:58 +0200
committermarha <marha@users.sourceforge.net>2011-10-10 08:28:58 +0200
commitbaf98f9bb36f956245d83ecd04f90625d6d68d2b (patch)
treec4af86b7cdb9c57cc539fa0764050865233e3617 /mesalib/src/mesa/main/pack.c
parent7fae5492e3ef8e5fa15f742be4c2a15b9782e89a (diff)
parentafbd3947071a33f59dda122f1ac396442a02c128 (diff)
downloadvcxsrv-baf98f9bb36f956245d83ecd04f90625d6d68d2b.tar.gz
vcxsrv-baf98f9bb36f956245d83ecd04f90625d6d68d2b.tar.bz2
vcxsrv-baf98f9bb36f956245d83ecd04f90625d6d68d2b.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/main/pack.c')
-rw-r--r--mesalib/src/mesa/main/pack.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index 62e352f3f..092e541c5 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -467,6 +467,69 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max)
}
}
+/*
+ * integer packing , no transfer operations only packs
+ * to dst of GL_UNSIGNED_INT or GL_INT
+ */
+void
+_mesa_pack_rgba_span_int(struct gl_context *ctx, GLuint n, GLuint rgba[][4],
+ GLenum dstFormat, GLenum dstType,
+ GLvoid *dstAddr)
+{
+ int i;
+
+ switch(dstType) {
+ case GL_UNSIGNED_INT: {
+ GLuint *dst = (GLuint *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED_INTEGER_EXT:
+ case GL_GREEN_INTEGER_EXT:
+ case GL_BLUE_INTEGER_EXT:
+ case GL_ALPHA_INTEGER_EXT:
+ case GL_RGB_INTEGER_EXT:
+ case GL_RGBA_INTEGER_EXT:
+ case GL_BGR_INTEGER_EXT:
+ case GL_BGRA_INTEGER_EXT:
+ case GL_LUMINANCE_INTEGER_EXT:
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = (GLuint) rgba[i][RCOMP];
+ dst[i*4+1] = (GLuint) rgba[i][GCOMP];
+ dst[i*4+2] = (GLuint) rgba[i][BCOMP];
+ dst[i*4+3] = (GLuint) rgba[i][ACOMP];
+ }
+ break;
+ }
+ }
+ break;
+ case GL_INT: {
+ GLint *dst = (GLint *) dstAddr;
+ switch (dstFormat) {
+ case GL_RED_INTEGER_EXT:
+ case GL_GREEN_INTEGER_EXT:
+ case GL_BLUE_INTEGER_EXT:
+ case GL_ALPHA_INTEGER_EXT:
+ case GL_RGB_INTEGER_EXT:
+ case GL_RGBA_INTEGER_EXT:
+ case GL_BGR_INTEGER_EXT:
+ case GL_BGRA_INTEGER_EXT:
+ case GL_LUMINANCE_INTEGER_EXT:
+ case GL_LUMINANCE_ALPHA_INTEGER_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = (GLint) rgba[i][RCOMP];
+ dst[i*4+1] = (GLint) rgba[i][GCOMP];
+ dst[i*4+2] = (GLint) rgba[i][BCOMP];
+ dst[i*4+3] = (GLint) rgba[i][ACOMP];
+ }
+ break;
+ }
+ }
+ break;
+ default:
+ assert(0);
+ return;
+ }
+}
/**