summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_fbo.c6
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c78
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.h8
3 files changed, 65 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c
index cf89fe5b38f..9967fe5139e 100644
--- a/src/mesa/drivers/dri/radeon/radeon_fbo.c
+++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c
@@ -196,7 +196,7 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe
case GL_R3_G3_B2:
case GL_RGB4:
case GL_RGB5:
- rb->Format = _dri_texformat_rgb565;
+ rb->Format = _radeon_texformat_rgb565;
rb->DataType = GL_UNSIGNED_BYTE;
cpp = 2;
break;
@@ -205,7 +205,7 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- rb->Format = _dri_texformat_argb8888;
+ rb->Format = _radeon_texformat_argb8888;
rb->DataType = GL_UNSIGNED_BYTE;
cpp = 4;
break;
@@ -217,7 +217,7 @@ radeon_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffe
case GL_RGB10_A2:
case GL_RGBA12:
case GL_RGBA16:
- rb->Format = _dri_texformat_argb8888;
+ rb->Format = _radeon_texformat_argb8888;
rb->DataType = GL_UNSIGNED_BYTE;
cpp = 4;
break;
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index d84004527bb..6b597c8c931 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -342,7 +342,7 @@ static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa,
/* r100 can only do this */
if (IS_R100_CLASS(rmesa->radeonScreen) || fbo)
- return _dri_texformat_argb8888;
+ return _radeon_texformat_argb8888;
if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) ||
(srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
@@ -355,7 +355,7 @@ static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa,
(srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian)) {
return MESA_FORMAT_RGBA8888_REV;
} else if (IS_R200_CLASS(rmesa->radeonScreen)) {
- return _dri_texformat_argb8888;
+ return _radeon_texformat_argb8888;
} else if (srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && !littleEndian) ||
srcType == GL_UNSIGNED_INT_8_8_8_8)) {
return MESA_FORMAT_ARGB8888_REV;
@@ -363,7 +363,7 @@ static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa,
srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) {
return MESA_FORMAT_ARGB8888;
} else
- return _dri_texformat_argb8888;
+ return _radeon_texformat_argb8888;
}
gl_format radeonChooseTextureFormat_mesa(struct gl_context * ctx,
@@ -403,17 +403,17 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx,
switch (type) {
case GL_UNSIGNED_INT_10_10_10_2:
case GL_UNSIGNED_INT_2_10_10_10_REV:
- return do32bpt ? _dri_texformat_argb8888 :
- _dri_texformat_argb1555;
+ return do32bpt ? _radeon_texformat_argb8888 :
+ _radeon_texformat_argb1555;
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return _dri_texformat_argb4444;
+ return _radeon_texformat_argb4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return _dri_texformat_argb1555;
+ return _radeon_texformat_argb1555;
default:
return do32bpt ? radeonChoose8888TexFormat(rmesa, format, type, fbo) :
- _dri_texformat_argb4444;
+ _radeon_texformat_argb4444;
}
case 3:
@@ -422,16 +422,16 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx,
switch (type) {
case GL_UNSIGNED_SHORT_4_4_4_4:
case GL_UNSIGNED_SHORT_4_4_4_4_REV:
- return _dri_texformat_argb4444;
+ return _radeon_texformat_argb4444;
case GL_UNSIGNED_SHORT_5_5_5_1:
case GL_UNSIGNED_SHORT_1_5_5_5_REV:
- return _dri_texformat_argb1555;
+ return _radeon_texformat_argb1555;
case GL_UNSIGNED_SHORT_5_6_5:
case GL_UNSIGNED_SHORT_5_6_5_REV:
- return _dri_texformat_rgb565;
+ return _radeon_texformat_rgb565;
default:
- return do32bpt ? _dri_texformat_argb8888 :
- _dri_texformat_rgb565;
+ return do32bpt ? _radeon_texformat_argb8888 :
+ _radeon_texformat_rgb565;
}
case GL_RGBA8:
@@ -440,26 +440,26 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx,
case GL_RGBA16:
return !force16bpt ?
radeonChoose8888TexFormat(rmesa, format, type, fbo) :
- _dri_texformat_argb4444;
+ _radeon_texformat_argb4444;
case GL_RGBA4:
case GL_RGBA2:
- return _dri_texformat_argb4444;
+ return _radeon_texformat_argb4444;
case GL_RGB5_A1:
- return _dri_texformat_argb1555;
+ return _radeon_texformat_argb1555;
case GL_RGB8:
case GL_RGB10:
case GL_RGB12:
case GL_RGB16:
- return !force16bpt ? _dri_texformat_argb8888 :
- _dri_texformat_rgb565;
+ return !force16bpt ? _radeon_texformat_argb8888 :
+ _radeon_texformat_rgb565;
case GL_RGB5:
case GL_RGB4:
case GL_R3_G3_B2:
- return _dri_texformat_rgb565;
+ return _radeon_texformat_rgb565;
case GL_ALPHA:
case GL_ALPHA4:
@@ -470,7 +470,7 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx,
/* r200: can't use a8 format since interpreting hw I8 as a8 would result
in wrong rgb values (same as alpha value instead of 0). */
if (IS_R200_CLASS(rmesa->radeonScreen))
- return _dri_texformat_al88;
+ return _radeon_texformat_al88;
else
return MESA_FORMAT_A8;
case 1:
@@ -491,7 +491,7 @@ gl_format radeonChooseTextureFormat(struct gl_context * ctx,
case GL_LUMINANCE12_ALPHA12:
case GL_LUMINANCE16_ALPHA16:
case GL_COMPRESSED_LUMINANCE_ALPHA:
- return _dri_texformat_al88;
+ return _radeon_texformat_al88;
case GL_INTENSITY:
case GL_INTENSITY4:
@@ -994,8 +994,8 @@ void radeonTexSubImage3D(struct gl_context * ctx, GLenum target, GLint level,
unsigned radeonIsFormatRenderable(gl_format mesa_format)
{
- if (mesa_format == _dri_texformat_argb8888 || mesa_format == _dri_texformat_rgb565 ||
- mesa_format == _dri_texformat_argb1555 || mesa_format == _dri_texformat_argb4444)
+ if (mesa_format == _radeon_texformat_argb8888 || mesa_format == _radeon_texformat_rgb565 ||
+ mesa_format == _radeon_texformat_argb1555 || mesa_format == _radeon_texformat_argb4444)
return 1;
switch (mesa_format)
@@ -1072,6 +1072,36 @@ void radeon_image_target_texture_2d(struct gl_context *ctx, GLenum target,
}
#endif
+gl_format _radeon_texformat_rgba8888 = MESA_FORMAT_NONE;
+gl_format _radeon_texformat_argb8888 = MESA_FORMAT_NONE;
+gl_format _radeon_texformat_rgb565 = MESA_FORMAT_NONE;
+gl_format _radeon_texformat_argb4444 = MESA_FORMAT_NONE;
+gl_format _radeon_texformat_argb1555 = MESA_FORMAT_NONE;
+gl_format _radeon_texformat_al88 = MESA_FORMAT_NONE;
+/*@}*/
+
+
+static void
+radeonInitTextureFormats(void)
+{
+ if (_mesa_little_endian()) {
+ _radeon_texformat_rgba8888 = MESA_FORMAT_RGBA8888;
+ _radeon_texformat_argb8888 = MESA_FORMAT_ARGB8888;
+ _radeon_texformat_rgb565 = MESA_FORMAT_RGB565;
+ _radeon_texformat_argb4444 = MESA_FORMAT_ARGB4444;
+ _radeon_texformat_argb1555 = MESA_FORMAT_ARGB1555;
+ _radeon_texformat_al88 = MESA_FORMAT_AL88;
+ }
+ else {
+ _radeon_texformat_rgba8888 = MESA_FORMAT_RGBA8888_REV;
+ _radeon_texformat_argb8888 = MESA_FORMAT_ARGB8888_REV;
+ _radeon_texformat_rgb565 = MESA_FORMAT_RGB565_REV;
+ _radeon_texformat_argb4444 = MESA_FORMAT_ARGB4444_REV;
+ _radeon_texformat_argb1555 = MESA_FORMAT_ARGB1555_REV;
+ _radeon_texformat_al88 = MESA_FORMAT_AL88_REV;
+ }
+}
+
void
radeon_init_common_texture_funcs(radeonContextPtr radeon,
struct dd_function_table *functions)
@@ -1101,5 +1131,5 @@ radeon_init_common_texture_funcs(radeonContextPtr radeon,
functions->EGLImageTargetTexture2D = radeon_image_target_texture_2d;
#endif
- driInitTextureFormats();
+ radeonInitTextureFormats();
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h
index 41763aae0a4..0fa48bd1091 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.h
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.h
@@ -34,6 +34,14 @@
#include "main/formats.h"
#include "main/mfeatures.h"
+extern gl_format _radeon_texformat_rgba8888;
+extern gl_format _radeon_texformat_argb8888;
+extern gl_format _radeon_texformat_rgb565;
+extern gl_format _radeon_texformat_argb4444;
+extern gl_format _radeon_texformat_argb1555;
+extern gl_format _radeon_texformat_al88;
+
+extern
void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
GLuint numrows, GLuint rowsize);
struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx);