From f782f90c45fc9a483483ebd36c1971ecd0c7988d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:38:50 -0600 Subject: mesa: use _mesa_get_texstore_func() --- src/mesa/drivers/dri/unichrome/via_tex.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 54073e7691..388fd9392c 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -797,22 +797,25 @@ static void viaTexImage(GLcontext *ctx, else { GLint dstRowStride; GLboolean success; + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); } else { dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes; } - ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + ASSERT(storeImage); + success = storeImage(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } -- cgit v1.2.3 From b58bc12ed4a3de6c828bd26c4820d7ddbb1eabd6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 19:58:18 -0600 Subject: via: use mesa texture format helper functions --- src/mesa/drivers/dri/unichrome/via_tex.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 388fd9392c..02a0043bbe 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -30,6 +30,7 @@ #include "main/macros.h" #include "main/mtypes.h" #include "main/enums.h" +#include "main/formats.h" #include "main/colortab.h" #include "main/convolve.h" #include "main/context.h" @@ -689,15 +690,9 @@ static void viaTexImage(GLcontext *ctx, assert(texImage->TexFormat); - if (dims == 1) { - texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; - texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; - } - else { - texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; - texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; - } - texelBytes = texImage->TexFormat->TexelBytes; + _mesa_set_fetch_functions(texImage, dims); + + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); if (texelBytes == 0) { /* compressed format */ @@ -804,7 +799,7 @@ static void viaTexImage(GLcontext *ctx, dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); } else { - dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes; + dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } ASSERT(storeImage); success = storeImage(ctx, dims, -- cgit v1.2.3 From 0b1f4dc0fa62c46030b39a0f7027dd1b0ef966fd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:41:11 -0600 Subject: drivers: use new _mesa_texstore() function --- src/mesa/drivers/dri/unichrome/via_tex.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 02a0043bbe..f700994025 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -792,8 +792,6 @@ static void viaTexImage(GLcontext *ctx, else { GLint dstRowStride; GLboolean success; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); @@ -801,16 +799,15 @@ static void viaTexImage(GLcontext *ctx, else { dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } - ASSERT(storeImage); - success = storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + success = _mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } -- cgit v1.2.3 From 1f7c914ad0beea8a29c1a171c7cd1a12f2efe0fa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 20:28:45 -0600 Subject: mesa: replace gl_texture_format with gl_format Now gl_texture_image::TexFormat is a simple MESA_FORMAT_x enum. ctx->Driver.ChooseTexture format also returns a MESA_FORMAT_x. gl_texture_format will go away next. --- src/mesa/drivers/dri/unichrome/via_tex.c | 68 ++++++++++++++++---------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index f700994025..b6be06d1ee 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -49,7 +49,7 @@ #include "via_ioctl.h" #include "via_3d_reg.h" -static const struct gl_texture_format * +static gl_format viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -66,56 +66,56 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, if ( format == GL_BGRA ) { if ( type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_BYTE ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } else if ( type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_8_8_8_8 ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case 3: case GL_RGB: case GL_COMPRESSED_RGB: if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } else if ( type == GL_UNSIGNED_BYTE ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case GL_RGB5: case GL_RGB4: case GL_R3_G3_B2: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_ALPHA4: @@ -123,7 +123,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: @@ -132,7 +132,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: @@ -143,7 +143,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: @@ -151,35 +151,35 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: @@ -188,16 +188,16 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; default: fprintf(stderr, "unexpected texture format %s in %s\n", _mesa_lookup_enum_by_nr(internalFormat), __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } static int logbase2(int n) @@ -458,7 +458,7 @@ static GLboolean viaSetTexImages(GLcontext *ctx, GLuint widthExp = 0; GLuint heightExp = 0; - switch (baseImage->image.TexFormat->MesaFormat) { + switch (baseImage->image.TexFormat) { case MESA_FORMAT_ARGB8888: texFormat = HC_HTXnFM_ARGB8888; break; @@ -692,7 +692,7 @@ static void viaTexImage(GLcontext *ctx, _mesa_set_fetch_functions(texImage, dims); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texelBytes == 0) { /* compressed format */ @@ -700,7 +700,7 @@ static void viaTexImage(GLcontext *ctx, texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } /* Minimum pitch of 32 bytes */ @@ -794,10 +794,10 @@ static void viaTexImage(GLcontext *ctx, GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { - dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, dims, texImage->_BaseFormat, -- cgit v1.2.3 From b6bdafdf2cf1110b4a5ca7cf9e1c3dcb124b800f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:29:44 -0600 Subject: mesa: remove gl_texture_image::IsCompressed field Use _mesa_is_format_compressed() instead. --- src/mesa/drivers/dri/unichrome/via_tex.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index b6be06d1ee..a4cf5466fd 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -696,7 +696,6 @@ static void viaTexImage(GLcontext *ctx, if (texelBytes == 0) { /* compressed format */ - texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, @@ -713,7 +712,7 @@ static void viaTexImage(GLcontext *ctx, viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes); /* allocate memory */ - if (texImage->IsCompressed) + if (_mesa_is_format_compressed(texImage->TexFormat)) sizeInBytes = texImage->CompressedSize; else sizeInBytes = postConvWidth * postConvHeight * texelBytes; @@ -793,7 +792,7 @@ static void viaTexImage(GLcontext *ctx, GLint dstRowStride; GLboolean success; - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { -- cgit v1.2.3 From 4ca9ba254462b9be55b78df1d50519e10b2f4d73 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:42:37 -0600 Subject: mesa: move mesa_set_fetch_functions() --- src/mesa/drivers/dri/unichrome/via_tex.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a4cf5466fd..13458aba1c 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -37,6 +37,7 @@ #include "main/mipmap.h" #include "main/simple_list.h" #include "main/texcompress.h" +#include "main/texfetch.h" #include "main/texformat.h" #include "main/texobj.h" #include "main/texstore.h" -- cgit v1.2.3 From 32aa40eee46fd0b15f3873069f2440ea2dd75408 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 21:13:25 -0600 Subject: mesa: removed gl_texture_image::CompressedSize field Just call ctx->Driver.CompressedTextureSize() when we need to get the compressed image size. --- src/mesa/drivers/dri/unichrome/via_tex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 13458aba1c..a99aa9debc 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -674,6 +674,7 @@ static void viaTexImage(GLcontext *ctx, struct via_texture_object *viaObj = (struct via_texture_object *)texObj; struct via_texture_image *viaImage = (struct via_texture_image *)texImage; int heaps[3], nheaps, i; + GLuint compressedSize; if (!is_empty_list(&vmesa->freed_tex_buffers)) { viaCheckBreadcrumb(vmesa, 0); @@ -697,7 +698,7 @@ static void viaTexImage(GLcontext *ctx, if (texelBytes == 0) { /* compressed format */ - texImage->CompressedSize = + compressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, texImage->TexFormat); @@ -714,7 +715,7 @@ static void viaTexImage(GLcontext *ctx, /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) - sizeInBytes = texImage->CompressedSize; + sizeInBytes = compressedSize; else sizeInBytes = postConvWidth * postConvHeight * texelBytes; -- cgit v1.2.3 From 1a2bb37264b4448d33f2948fe1702c9dc936395d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:12:36 -0600 Subject: mesa: lift _mesa_set_fetch_functions() calls out of drivers Call it from in the main Mesa glTexImage functions. --- src/mesa/drivers/dri/unichrome/via_tex.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a99aa9debc..fa7542c5cb 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -37,7 +37,6 @@ #include "main/mipmap.h" #include "main/simple_list.h" #include "main/texcompress.h" -#include "main/texfetch.h" #include "main/texformat.h" #include "main/texobj.h" #include "main/texstore.h" @@ -692,8 +691,6 @@ static void viaTexImage(GLcontext *ctx, assert(texImage->TexFormat); - _mesa_set_fetch_functions(texImage, dims); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texelBytes == 0) { -- cgit v1.2.3 From 3e34a2a2b97e7c93955deedb7c12b73bccd6662d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 18:11:35 -0600 Subject: drivers: don't include texformat.h And remove other unneeded #includes while we're at it. --- src/mesa/drivers/dri/unichrome/via_tex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index fa7542c5cb..a72dcd6be2 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -35,13 +35,12 @@ #include "main/convolve.h" #include "main/context.h" #include "main/mipmap.h" +#include "main/mm.h" #include "main/simple_list.h" #include "main/texcompress.h" -#include "main/texformat.h" #include "main/texobj.h" #include "main/texstore.h" -#include "main/mm.h" #include "via_context.h" #include "via_fb.h" #include "via_tex.h" -- cgit v1.2.3 From 45e76d2665b38ba3787548310efc59e969124c01 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 8 Oct 2009 20:27:27 -0600 Subject: mesa: remove a bunch of gl_renderbuffer fields _ActualFormat is replaced by Format (MESA_FORMAT_x). ColorEncoding, ComponentType, RedBits, GreenBits, BlueBits, etc. are all replaced by MESA_FORMAT_x queries. --- src/mesa/drivers/dri/unichrome/via_context.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 6eb19ac079..e7b6b030d1 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -32,6 +32,7 @@ #include "main/glheader.h" #include "main/context.h" +#include "main/formats.h" #include "main/matrix.h" #include "main/state.h" #include "main/simple_list.h" @@ -163,24 +164,28 @@ viaInitRenderbuffer(struct via_renderbuffer *vrb, GLenum format, if (format == GL_RGBA) { /* Color */ rb->_BaseFormat = GL_RGBA; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; } else if (format == GL_DEPTH_COMPONENT16) { /* Depth */ rb->_BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ + rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_INT; } else if (format == GL_DEPTH_COMPONENT24) { /* Depth */ rb->_BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ + rb->Format = MESA_FORMAT_Z32; rb->DataType = GL_UNSIGNED_INT; } else { /* Stencil */ ASSERT(format == GL_STENCIL_INDEX8_EXT); rb->_BaseFormat = GL_STENCIL_INDEX; + rb->Format = MESA_FORMAT_S8; rb->DataType = GL_UNSIGNED_BYTE; } -- cgit v1.2.3 From 1160acbfea986a821761d18f5f14d5d2cb0dea8c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 19:49:21 -0600 Subject: dri/drivers: update driNewRenderbuffer() to take a gl_format Now pass a specific MESA_FORMAT_x token to indicate the renderbuffer's format. This is better than passing a GLenum and having to guess the specific format. I'm unable to test all the drivers, but any issues should be easy to fix. --- src/mesa/drivers/dri/unichrome/via_screen.c | 12 ++++++------ src/mesa/drivers/dri/unichrome/via_span.c | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 3dbb570571..5b5477d8e0 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -248,7 +248,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, /* XXX check/fix the offset/pitch parameters! */ { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, NULL, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(frontRb, mesaVis); @@ -257,7 +257,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, NULL, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(backRb, mesaVis); @@ -266,7 +266,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); @@ -274,7 +274,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, + = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); @@ -282,7 +282,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 32) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, NULL, + = driNewRenderbuffer(MESA_FORMAT_Z32, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); @@ -291,7 +291,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, + = driNewRenderbuffer(MESA_FORMAT_S8, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(stencilRb, mesaVis); diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index b908f0fb23..e847164cd0 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -23,6 +23,7 @@ */ #include "main/glheader.h" +#include "main/formats.h" #include "main/macros.h" #include "main/mtypes.h" #include "main/colormac.h" @@ -177,24 +178,22 @@ void viaInitSpanFuncs(GLcontext *ctx) void viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis) { - if (vrb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - viaInitPointers_565(&vrb->Base); - } - else { - viaInitPointers_8888(&vrb->Base); - } + if (vrb->Base.Format == MESA_FORMAT_RGB565) { + viaInitPointers_565(&vrb->Base); } - else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + else if (vrb->Base.Format == MESA_FORMAT_ARGB8888) { + viaInitPointers_8888(&vrb->Base); + } + else if (vrb->Base.Format == MESA_FORMAT_Z16) { viaInitDepthPointers_z16(&vrb->Base); } - else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + else if (vrb->Base.Format == MESA_FORMAT_Z24_S8) { viaInitDepthPointers_z24_s8(&vrb->Base); } - else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT32) { + else if (vrb->Base.Format == MESA_FORMAT_Z32) { viaInitDepthPointers_z32(&vrb->Base); } - else if (vrb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + else if (vrb->Base.Format == MESA_FORMAT_S8) { viaInitStencilPointers_z24_s8(&vrb->Base); } } -- cgit v1.2.3 From 35efc6a1b3e3dada2cf9bd3a503c1b84f4bcb7f5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 16:28:24 -0600 Subject: mesa: change compressed texture size calls Replace calls to ctx->Driver.CompressedTextureSize with calls to _mesa_format_image_size. The former always called the later. --- src/mesa/drivers/dri/unichrome/via_tex.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a72dcd6be2..1bc5ddc429 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -672,7 +672,6 @@ static void viaTexImage(GLcontext *ctx, struct via_texture_object *viaObj = (struct via_texture_object *)texObj; struct via_texture_image *viaImage = (struct via_texture_image *)texImage; int heaps[3], nheaps, i; - GLuint compressedSize; if (!is_empty_list(&vmesa->freed_tex_buffers)) { viaCheckBreadcrumb(vmesa, 0); @@ -692,14 +691,6 @@ static void viaTexImage(GLcontext *ctx, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - if (texelBytes == 0) { - /* compressed format */ - compressedSize = - ctx->Driver.CompressedTextureSize(ctx, texImage->Width, - texImage->Height, texImage->Depth, - texImage->TexFormat); - } - /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { postConvWidth = 32 / texelBytes; @@ -711,7 +702,10 @@ static void viaTexImage(GLcontext *ctx, /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) - sizeInBytes = compressedSize; + sizeInBytes = _mesa_format_image_size(texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth); else sizeInBytes = postConvWidth * postConvHeight * texelBytes; -- cgit v1.2.3 From e3f2efc4f14d6f0d06560d2acfac73628f5a74a6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:23:37 -0600 Subject: mesa: remove calls to _mesa_compressed_row_stride() --- src/mesa/drivers/dri/unichrome/via_tex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/unichrome') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 1bc5ddc429..24924d2613 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -785,7 +785,7 @@ static void viaTexImage(GLcontext *ctx, GLboolean success; if (_mesa_is_format_compressed(texImage->TexFormat)) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); } else { dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat); -- cgit v1.2.3