Merge commit 'origin/master' into gallium-0.2
[mesa.git] / src / mesa / main / texformat_tmp.h
index 5f0c674d4fb2bcce95b603d05798161c8685a536..08b6d8f12fbdb6f207a51c4413fdbbb59fd77ee5 100644 (file)
@@ -3,6 +3,7 @@
  * Version:  6.5.1
  *
  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2008 VMware, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -1238,6 +1239,31 @@ static void store_texel_srgba8(struct gl_texture_image *texImage,
    dst[0] = rgba[RCOMP];
    dst[1] = rgba[GCOMP];
    dst[2] = rgba[BCOMP];
+   dst[3] = rgba[ACOMP];
+}
+#endif
+
+/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */
+static void FETCH(sargb8)(const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
+   texel[RCOMP] = nonlinear_to_linear(src[1]);
+   texel[GCOMP] = nonlinear_to_linear(src[2]);
+   texel[BCOMP] = nonlinear_to_linear(src[3]);
+   texel[ACOMP] = UBYTE_TO_FLOAT(src[0]); /* linear! */
+}
+
+#if DIM == 3
+static void store_texel_sargb8(struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 4);
+   dst[0] = rgba[ACOMP];
+   dst[1] = rgba[RCOMP];
+   dst[2] = rgba[GCOMP];
+   dst[3] = rgba[BCOMP];
 }
 #endif