summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <[email protected]>2014-10-10 13:06:36 +0200
committerIago Toral Quiroga <[email protected]>2015-01-12 11:20:28 +0100
commit41a785b09c4218670ef34f62bd409a3b38edbd61 (patch)
treeab554f4889ffc80390d67e4c2b88fcd21926c0bb /src/mesa/main
parent1a5ec9624a64c90455c9174143454c592efce89e (diff)
mesa/main/pack_tmp.h: Add float conversion support
We will use this in a later patch to refactor _mesa_pack_rgba_span_float. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/pack_tmp.h75
1 files changed, 74 insertions, 1 deletions
diff --git a/src/mesa/main/pack_tmp.h b/src/mesa/main/pack_tmp.h
index 0d4eb387d80..c6882db14fa 100644
--- a/src/mesa/main/pack_tmp.h
+++ b/src/mesa/main/pack_tmp.h
@@ -31,6 +31,79 @@ FN_NAME(struct gl_context *ctx,
int i;
switch (dstFormat) {
+#ifdef FLOAT_SRC_CONVERT
+ case GL_RED:
+ for (i=0;i<n;i++)
+ dst[i] = FLOAT_SRC_CONVERT(rgba[i][RCOMP]);
+ break;
+ case GL_GREEN:
+ for (i=0;i<n;i++)
+ dst[i] = FLOAT_SRC_CONVERT(rgba[i][GCOMP]);
+ break;
+ case GL_BLUE:
+ for (i=0;i<n;i++)
+ dst[i] = FLOAT_SRC_CONVERT(rgba[i][BCOMP]);
+ break;
+ case GL_ALPHA:
+ for (i=0;i<n;i++)
+ dst[i] = FLOAT_SRC_CONVERT(rgba[i][ACOMP]);
+ break;
+ case GL_LUMINANCE:
+ for (i=0;i<n;i++)
+ dst[i] = FLOAT_SRC_CONVERT(luminance[i]);
+ break;
+ case GL_LUMINANCE_ALPHA:
+ for (i=0;i<n;i++) {
+ dst[i*2+0] = FLOAT_SRC_CONVERT(luminance[i]);
+ dst[i*2+1] = FLOAT_SRC_CONVERT(rgba[i][ACOMP]);
+ }
+ break;
+ case GL_RG:
+ for (i=0;i<n;i++) {
+ dst[i*2+0] = FLOAT_SRC_CONVERT(rgba[i][RCOMP]);
+ dst[i*2+1] = FLOAT_SRC_CONVERT(rgba[i][GCOMP]);
+ }
+ break;
+ case GL_RGB:
+ for (i=0;i<n;i++) {
+ dst[i*3+0] = FLOAT_SRC_CONVERT(rgba[i][RCOMP]);
+ dst[i*3+1] = FLOAT_SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_SRC_CONVERT(rgba[i][BCOMP]);
+ }
+ break;
+ case GL_RGBA:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = FLOAT_SRC_CONVERT(rgba[i][RCOMP]);
+ dst[i*4+1] = FLOAT_SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_SRC_CONVERT(rgba[i][BCOMP]);
+ dst[i*4+3] = FLOAT_SRC_CONVERT(rgba[i][ACOMP]);
+ }
+ break;
+ case GL_BGR:
+ for (i=0;i<n;i++) {
+ dst[i*3+0] = FLOAT_SRC_CONVERT(rgba[i][BCOMP]);
+ dst[i*3+1] = FLOAT_SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*3+2] = FLOAT_SRC_CONVERT(rgba[i][RCOMP]);
+ }
+ break;
+ case GL_BGRA:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = FLOAT_SRC_CONVERT(rgba[i][BCOMP]);
+ dst[i*4+1] = FLOAT_SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*4+2] = FLOAT_SRC_CONVERT(rgba[i][RCOMP]);
+ dst[i*4+3] = FLOAT_SRC_CONVERT(rgba[i][ACOMP]);
+ }
+ break;
+ case GL_ABGR_EXT:
+ for (i=0;i<n;i++) {
+ dst[i*4+0] = FLOAT_SRC_CONVERT(rgba[i][ACOMP]);
+ dst[i*4+1] = FLOAT_SRC_CONVERT(rgba[i][BCOMP]);
+ dst[i*4+2] = FLOAT_SRC_CONVERT(rgba[i][GCOMP]);
+ dst[i*4+3] = FLOAT_SRC_CONVERT(rgba[i][RCOMP]);
+ }
+ break;
+#endif
+#ifdef SRC_CONVERT
case GL_RED_INTEGER_EXT:
for (i=0;i<n;i++) {
dst[i] = SRC_CONVERT(rgba[i][RCOMP]);
@@ -112,7 +185,7 @@ FN_NAME(struct gl_context *ctx,
dst[i*2+1] = SRC_CONVERT(rgba[i][ACOMP]);
}
break;
-
+#endif
default:
_mesa_problem(ctx,
"Unsupported format (%s)",