<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>></p>
<div class="gmail_quote">On Jan 12, 2015 11:34 PM, "Iago Toral Quiroga" <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The 8888 suggests 8-bit components which is not correct, so<br>
replace that with the actual size of the components in each<br>
format.<br>
---<br>
src/mesa/main/format_utils.c | 20 ++++++++++----------<br>
src/mesa/main/format_utils.h | 8 ++++----<br>
src/mesa/main/readpix.c | 6 +++---<br>
src/mesa/main/texgetimage.c | 4 ++--<br>
src/mesa/state_tracker/st_cb_texture.c | 4 ++--<br>
src/mesa/swrast/s_drawpix.c | 2 +-<br>
6 files changed, 22 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c<br>
index bebc974..eb650a2 100644<br>
--- a/src/mesa/main/format_utils.c<br>
+++ b/src/mesa/main/format_utils.c<br>
@@ -27,16 +27,16 @@<br>
#include "format_pack.h"<br>
#include "format_unpack.h"<br>
<br>
-const mesa_array_format RGBA8888_FLOAT =<br>
+const mesa_array_format RGBA32_FLOAT =<br>
MESA_ARRAY_FORMAT(4, 1, 1, 1, 4, 0, 1, 2, 3);<br>
<br>
-const mesa_array_format RGBA8888_UBYTE =<br>
+const mesa_array_format RGBA8_UBYTE =<br>
MESA_ARRAY_FORMAT(1, 0, 0, 1, 4, 0, 1, 2, 3);<br>
<br>
-const mesa_array_format RGBA8888_UINT =<br>
+const mesa_array_format RGBA32_UINT =<br>
MESA_ARRAY_FORMAT(4, 0, 0, 0, 4, 0, 1, 2, 3);<br>
<br>
-const mesa_array_format RGBA8888_INT =<br>
+const mesa_array_format RGBA32_INT =<br>
MESA_ARRAY_FORMAT(4, 1, 0, 0, 4, 0, 1, 2, 3);<br>
<br>
static void<br>
@@ -257,7 +257,7 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride,<br>
if (!rebase_swizzle) {<br>
/* Handle the cases where we can directly unpack */<br>
if (!src_format_is_mesa_array_format) {<br>
- if (dst_array_format == RGBA8888_FLOAT) {<br>
+ if (dst_array_format == RGBA32_FLOAT) {<br>
for (row = 0; row < height; ++row) {<br>
_mesa_unpack_rgba_row(src_format, width,<br>
src, (float (*)[4])dst);<br>
@@ -265,7 +265,7 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride,<br>
dst += dst_stride;<br>
}<br>
return;<br>
- } else if (dst_array_format == RGBA8888_UBYTE) {<br>
+ } else if (dst_array_format == RGBA8_UBYTE) {<br>
assert(!_mesa_is_format_integer_color(src_format));<br>
for (row = 0; row < height; ++row) {<br>
_mesa_unpack_ubyte_rgba_row(src_format, width,<br>
@@ -274,7 +274,7 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride,<br>
dst += dst_stride;<br>
}<br>
return;<br>
- } else if (dst_array_format == RGBA8888_UINT &&<br>
+ } else if (dst_array_format == RGBA32_UINT &&<br>
_mesa_is_format_unsigned(src_format)) {<br>
assert(_mesa_is_format_integer_color(src_format));<br>
for (row = 0; row < height; ++row) {<br>
@@ -289,7 +289,7 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride,<br>
<br>
/* Handle the cases where we can directly pack */<br>
if (!dst_format_is_mesa_array_format) {<br>
- if (src_array_format == RGBA8888_FLOAT) {<br>
+ if (src_array_format == RGBA32_FLOAT) {<br>
for (row = 0; row < height; ++row) {<br>
_mesa_pack_float_rgba_row(dst_format, width,<br>
(const float (*)[4])src, dst);<br>
@@ -297,7 +297,7 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride,<br>
dst += dst_stride;<br>
}<br>
return;<br>
- } else if (src_array_format == RGBA8888_UBYTE) {<br>
+ } else if (src_array_format == RGBA8_UBYTE) {<br>
assert(!_mesa_is_format_integer_color(dst_format));<br>
for (row = 0; row < height; ++row) {<br>
_mesa_pack_ubyte_rgba_row(dst_format, width,<br>
@@ -306,7 +306,7 @@ _mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride,<br>
dst += dst_stride;<br>
}<br>
return;<br>
- } else if (src_array_format == RGBA8888_UINT &&<br>
+ } else if (src_array_format == RGBA32_UINT &&<br>
_mesa_is_format_unsigned(dst_format)) {<br>
assert(_mesa_is_format_integer_color(dst_format));<br>
for (row = 0; row < height; ++row) {<br>
diff --git a/src/mesa/main/format_utils.h b/src/mesa/main/format_utils.h<br>
index b588695..8f92a09 100644<br>
--- a/src/mesa/main/format_utils.h<br>
+++ b/src/mesa/main/format_utils.h<br>
@@ -34,10 +34,10 @@<br>
#include "imports.h"<br>
#include "macros.h"<br>
<br>
-extern const mesa_array_format RGBA8888_FLOAT;<br>
-extern const mesa_array_format RGBA8888_UBYTE;<br>
-extern const mesa_array_format RGBA8888_UINT;<br>
-extern const mesa_array_format RGBA8888_INT;<br>
+extern const mesa_array_format RGBA32_FLOAT;<br>
+extern const mesa_array_format RGBA8_UBYTE;<br>
+extern const mesa_array_format RGBA32_UINT;<br>
+extern const mesa_array_format RGBA32_INT;<br>
<br>
/* Only guaranteed to work for BITS <= 32 */<br>
#define MAX_UINT(BITS) ((BITS) == 32 ? UINT32_MAX : ((1u << (BITS)) - 1))<br>
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c<br>
index c589ca4..85f900d 100644<br>
--- a/src/mesa/main/readpix.c<br>
+++ b/src/mesa/main/readpix.c<br>
@@ -501,14 +501,14 @@ read_rgba_pixels( struct gl_context *ctx,<br>
if (dst_is_integer) {<br>
src_is_uint = _mesa_is_format_unsigned(rb_format);<br>
if (src_is_uint) {<br>
- rgba_format = RGBA8888_UINT;<br>
+ rgba_format = RGBA32_UINT;<br>
rgba_stride = width * 4 * sizeof(GLuint);<br>
} else {<br>
- rgba_format = RGBA8888_INT;<br>
+ rgba_format = RGBA32_INT;<br>
rgba_stride = width * 4 * sizeof(GLint);<br>
}<br>
} else {<br>
- rgba_format = RGBA8888_FLOAT;<br>
+ rgba_format = RGBA32_FLOAT;<br>
rgba_stride = width * 4 * sizeof(GLfloat);<br>
}<br>
<br>
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c<br>
index e45a45a..e4572e4 100644<br>
--- a/src/mesa/main/texgetimage.c<br>
+++ b/src/mesa/main/texgetimage.c<br>
@@ -314,7 +314,7 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,<br>
width, height, format, type,<br>
slice, 0, 0);<br>
_mesa_format_convert(dest, dstFormat, dstStride,<br>
- tempSlice, RGBA8888_FLOAT, srcStride,<br>
+ tempSlice, RGBA32_FLOAT, srcStride,<br>
width, height,<br>
needsRebase ? rebaseSwizzle : NULL);<br>
tempSlice += 4 * width * height;<br>
@@ -453,7 +453,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,<br>
bool need_convert;<br>
<br>
/* We will convert to RGBA float */<br>
- rgba_format = RGBA8888_FLOAT;<br>
+ rgba_format = RGBA32_FLOAT;<br>
rgba_stride = width * 4 * sizeof(GLfloat);<br>
<br>
/* If we are lucky and the dst format matches the RGBA format we need<br>
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c<br>
index 1fb9db6..abc68c0 100644<br>
--- a/src/mesa/state_tracker/st_cb_texture.c<br>
+++ b/src/mesa/state_tracker/st_cb_texture.c<br>
@@ -1170,7 +1170,7 @@ st_GetTexImage(struct gl_context * ctx,<br>
dst_format, rgba);<br>
<br>
_mesa_format_convert(dest, dstMesaFormat, dstStride,<br>
- rgba, RGBA8888_FLOAT, srcStride,<br>
+ rgba, RGBA32_FLOAT, srcStride,<br>
width, 1, NULL);<br>
}<br>
else {<br>
@@ -1184,7 +1184,7 @@ st_GetTexImage(struct gl_context * ctx,<br>
dst_format, rgba);<br>
<br>
_mesa_format_convert(dest, dstMesaFormat, dstStride,<br>
- rgba, RGBA8888_FLOAT, srcStride,<br>
+ rgba, RGBA32_FLOAT, srcStride,<br>
width, 1, NULL);<br>
}<br>
}<br>
diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c<br>
index b30e389..c992519 100644<br>
--- a/src/mesa/swrast/s_drawpix.c<br>
+++ b/src/mesa/swrast/s_drawpix.c<br>
@@ -489,7 +489,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y,<br>
uint32_t srcMesaFormat = _mesa_format_from_format_and_type(format, type);<br>
for (row = 0; row < height; row++) {<br>
int dstRowStride = 4 * width * sizeof(float);<br>
- _mesa_format_convert(rgba, RGBA8888_FLOAT, dstRowStride,<br>
+ _mesa_format_convert(rgba, RGBA32_FLOAT, dstRowStride,<br>
(void*)source, srcMesaFormat, srcStride,<br>
spanWidth, 1, NULL);<br>
if (transferOps)<br>
--<br>
1.9.1<br>
<br>
</blockquote></div>