From 4de8e2123ebeb50db252b2bb57fb167058fa4683 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 17:06:15 -0600 Subject: mesa: rename functions to be more consistant with rest of mesa --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index d83b166742..7ac53ec0ca 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -583,7 +583,7 @@ void radeon_fbo_init(struct radeon_context *radeon) radeon->glCtx->Driver.FinishRenderTexture = radeon_finish_render_texture; radeon->glCtx->Driver.ResizeBuffers = radeon_resize_buffers; radeon->glCtx->Driver.ValidateFramebuffer = radeon_validate_framebuffer; - radeon->glCtx->Driver.BlitFramebuffer = _mesa_meta_blit_framebuffer; + radeon->glCtx->Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer; } -- cgit v1.2.3 From ddffe4546a81216cde4376ee49cbaa021f4d04bb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:40:35 -0600 Subject: drivers: use more mesa format functions --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 7ac53ec0ca..f19170b612 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -387,6 +387,8 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, struct gl_texture_image *texImage) { int retry = 0; + gl_format texFormat; + restart: if (texImage->TexFormat == &_mesa_texformat_argb8888) { rrb->cpp = 4; @@ -438,24 +440,25 @@ restart: return GL_FALSE; } texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0, - texImage->TexFormat->DataType, + _mesa_get_format_datatype(texImage->TexFormat->MesaFormat), 1); retry++; goto restart; } + texFormat = texImage->TexFormat->MesaFormat; + rrb->pitch = texImage->Width * rrb->cpp; rrb->base.InternalFormat = rrb->base._ActualFormat; rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; - rrb->base.RedBits = texImage->TexFormat->RedBits; - rrb->base.GreenBits = texImage->TexFormat->GreenBits; - rrb->base.BlueBits = texImage->TexFormat->BlueBits; - rrb->base.AlphaBits = texImage->TexFormat->AlphaBits; - rrb->base.DepthBits = texImage->TexFormat->DepthBits; - rrb->base.StencilBits = texImage->TexFormat->StencilBits; - + rrb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); + rrb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); + rrb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); + rrb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); + rrb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); + rrb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_nop_alloc_storage; -- 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/radeon/radeon_fbo.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index f19170b612..90ea2ec335 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -390,42 +390,42 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, gl_format texFormat; restart: - if (texImage->TexFormat == &_mesa_texformat_argb8888) { + if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { rrb->cpp = 4; rrb->base._ActualFormat = GL_RGBA8; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_rgb565) { + else if (texImage->TexFormat == MESA_FORMAT_RGB565) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGB5; rrb->base._BaseFormat = GL_RGB; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb1555) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGB5_A1; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb4444) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGBA4; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_z16) { + else if (texImage->TexFormat == MESA_FORMAT_Z16) { rrb->cpp = 2; rrb->base._ActualFormat = GL_DEPTH_COMPONENT16; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; rrb->base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_s8_z24) { + else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { rrb->cpp = 4; rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; rrb->base._BaseFormat = GL_DEPTH_STENCIL_EXT; @@ -436,29 +436,30 @@ restart: /* try redoing the FBO */ if (retry == 1) { DBG("Render to texture BAD FORMAT %d\n", - texImage->TexFormat->MesaFormat); + texImage->TexFormat); return GL_FALSE; } texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0, - _mesa_get_format_datatype(texImage->TexFormat->MesaFormat), + _mesa_get_format_datatype(texImage->TexFormat), 1); retry++; goto restart; } - texFormat = texImage->TexFormat->MesaFormat; + texFormat = texImage->TexFormat; rrb->pitch = texImage->Width * rrb->cpp; rrb->base.InternalFormat = rrb->base._ActualFormat; rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; - rrb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); - rrb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); - rrb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); - rrb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); - rrb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); - rrb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); + rrb->base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); + rrb->base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); + rrb->base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); + rrb->base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); + rrb->base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); + rrb->base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); + rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_nop_alloc_storage; -- 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/radeon/radeon_fbo.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 90ea2ec335..3f4f382d6c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -33,7 +33,6 @@ #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "main/context.h" -#include "main/texformat.h" #include "main/texrender.h" #include "drivers/common/meta.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/radeon/radeon_fbo.c | 102 +++++++------------------------ 1 file changed, 23 insertions(+), 79 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 3f4f382d6c..796dd1b423 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -90,11 +90,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - rb->_ActualFormat = GL_RGB5; + rb->Format = MESA_FORMAT_RGB565; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 5; - rb->GreenBits = 6; - rb->BlueBits = 5; cpp = 2; break; case GL_RGB: @@ -102,12 +99,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->_ActualFormat = GL_RGB8; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 8; - rb->GreenBits = 8; - rb->BlueBits = 8; - rb->AlphaBits = 0; cpp = 4; break; case GL_RGBA: @@ -118,12 +111,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - rb->_ActualFormat = GL_RGBA8; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 8; - rb->GreenBits = 8; - rb->BlueBits = 8; - rb->AlphaBits = 8; cpp = 4; break; case GL_STENCIL_INDEX: @@ -132,31 +121,26 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: /* alloc a depth+stencil buffer */ - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; + rb->Format = MESA_FORMAT_Z24_S8; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - rb->StencilBits = 8; cpp = 4; break; case GL_DEPTH_COMPONENT16: - rb->_ActualFormat = GL_DEPTH_COMPONENT16; + rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_SHORT; - rb->DepthBits = 16; cpp = 2; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->_ActualFormat = GL_DEPTH_COMPONENT24; + rb->Format = MESA_FORMAT_Z32; rb->DataType = GL_UNSIGNED_INT; - rb->DepthBits = 24; cpp = 4; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; + rb->Format = MESA_FORMAT_Z24_S8; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - rb->DepthBits = 24; - rb->StencilBits = 8; cpp = 4; break; default: @@ -165,6 +149,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, return GL_FALSE; } + rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); + if (ctx->Driver.Flush) ctx->Driver.Flush(ctx); /* +r6/r7 */ @@ -212,7 +198,7 @@ radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, ASSERT(rb->Name == 0); rb->Width = width; rb->Height = height; - rb->_ActualFormat = internalFormat; + rb->InternalFormat = internalFormat; return GL_TRUE; } @@ -269,55 +255,32 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) /* XXX format junk */ switch (format) { case GL_RGB5: - rrb->base._ActualFormat = GL_RGB5; - rrb->base._BaseFormat = GL_RGBA; - rrb->base.RedBits = 5; - rrb->base.GreenBits = 6; - rrb->base.BlueBits = 5; rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGB; break; case GL_RGB8: - rrb->base._ActualFormat = GL_RGB8; - rrb->base._BaseFormat = GL_RGB; - rrb->base.RedBits = 8; - rrb->base.GreenBits = 8; - rrb->base.BlueBits = 8; - rrb->base.AlphaBits = 0; rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGB; break; case GL_RGBA8: - rrb->base._ActualFormat = GL_RGBA8; - rrb->base._BaseFormat = GL_RGBA; - rrb->base.RedBits = 8; - rrb->base.GreenBits = 8; - rrb->base.BlueBits = 8; - rrb->base.AlphaBits = 8; rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGBA; break; case GL_STENCIL_INDEX8_EXT: - rrb->base._ActualFormat = GL_STENCIL_INDEX8_EXT; - rrb->base._BaseFormat = GL_STENCIL_INDEX; - rrb->base.StencilBits = 8; rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_STENCIL_INDEX; break; case GL_DEPTH_COMPONENT16: - rrb->base._ActualFormat = GL_DEPTH_COMPONENT16; - rrb->base._BaseFormat = GL_DEPTH_COMPONENT; - rrb->base.DepthBits = 16; rrb->base.DataType = GL_UNSIGNED_SHORT; + rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH_COMPONENT24: - rrb->base._ActualFormat = GL_DEPTH_COMPONENT24; - rrb->base._BaseFormat = GL_DEPTH_COMPONENT; - rrb->base.DepthBits = 24; rrb->base.DataType = GL_UNSIGNED_INT; + rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH24_STENCIL8_EXT: - rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; - rrb->base._BaseFormat = GL_DEPTH_STENCIL_EXT; - rrb->base.DepthBits = 24; - rrb->base.StencilBits = 8; rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; + rrb->base._BaseFormat = GL_STENCIL_INDEX; break; default: fprintf(stderr, "%s: Unknown format 0x%04x\n", __FUNCTION__, format); @@ -390,44 +353,26 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, restart: if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { - rrb->cpp = 4; - rrb->base._ActualFormat = GL_RGBA8; - rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_RGB565) { - rrb->cpp = 2; - rrb->base._ActualFormat = GL_RGB5; - rrb->base._BaseFormat = GL_RGB; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { - rrb->cpp = 2; - rrb->base._ActualFormat = GL_RGB5_A1; - rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { - rrb->cpp = 2; - rrb->base._ActualFormat = GL_RGBA4; - rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_Z16) { - rrb->cpp = 2; - rrb->base._ActualFormat = GL_DEPTH_COMPONENT16; - rrb->base._BaseFormat = GL_DEPTH_COMPONENT; rrb->base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { - rrb->cpp = 4; - rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; - rrb->base._BaseFormat = GL_DEPTH_STENCIL_EXT; rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; DBG("Render to DEPTH_STENCIL texture OK\n"); } @@ -448,16 +393,15 @@ restart: texFormat = texImage->TexFormat; + rrb->base.Format = texFormat; + + rrb->cpp = _mesa_get_format_bytes(texFormat); rrb->pitch = texImage->Width * rrb->cpp; - rrb->base.InternalFormat = rrb->base._ActualFormat; + rrb->base.InternalFormat = texImage->InternalFormat; + rrb->base._BaseFormat = _mesa_base_fbo_format(ctx, rrb->base.InternalFormat); + rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; - rrb->base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); - rrb->base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); - rrb->base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); - rrb->base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); - rrb->base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); - rrb->base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_nop_alloc_storage; -- cgit v1.2.3 From c47b03ebebd4db30bf5ed17b44c0f8757306b197 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 13:14:22 -0600 Subject: radeon: initialize renderbuffer Format field in radeon_create_renderbuffer() Plus, use MESA_FORMAT_S8_Z24 everywhere. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 796dd1b423..21007d85c3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -121,7 +121,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: /* alloc a depth+stencil buffer */ - rb->Format = MESA_FORMAT_Z24_S8; + rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; break; @@ -139,7 +139,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - rb->Format = MESA_FORMAT_Z24_S8; + rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; break; @@ -255,30 +255,37 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) /* XXX format junk */ switch (format) { case GL_RGB5: + rrb->base.Format = MESA_FORMAT_RGB565; rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case GL_RGB8: + rrb->base.Format = MESA_FORMAT_ARGB8888; rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case GL_RGBA8: + rrb->base.Format = MESA_FORMAT_ARGB8888; rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGBA; break; case GL_STENCIL_INDEX8_EXT: + rrb->base.Format = MESA_FORMAT_S8; rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_STENCIL_INDEX; break; case GL_DEPTH_COMPONENT16: + rrb->base.Format = MESA_FORMAT_Z16; rrb->base.DataType = GL_UNSIGNED_SHORT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH_COMPONENT24: + rrb->base.Format = MESA_FORMAT_Z32; rrb->base.DataType = GL_UNSIGNED_INT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH24_STENCIL8_EXT: + rrb->base.Format = MESA_FORMAT_S8_Z24; rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; rrb->base._BaseFormat = GL_STENCIL_INDEX; break; -- cgit v1.2.3 From 3f30b0709b5a71915df336194f9f805e4c306cef Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 14 Oct 2009 16:20:07 -0400 Subject: Use the right pitch when rendering to a texture We need to get the pitch from the texture level we are rendering to, rather than just using the base texel width. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index d83b166742..2012cbcf83 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -445,7 +445,6 @@ restart: goto restart; } - rrb->pitch = texImage->Width * rrb->cpp; rrb->base.InternalFormat = rrb->base._ActualFormat; rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; @@ -555,8 +554,10 @@ radeon_render_texture(GLcontext * ctx, imageOffset += offsets[att->Zoffset]; } - /* store that offset in the region */ + /* store that offset in the region, along with the correct pitch for + * the image we are rendering to */ rrb->draw_offset = imageOffset; + rrb->pitch = radeon_image->mt->levels[att->TextureLevel].rowstride; /* update drawing region, etc */ radeon_draw_buffer(ctx, fb); -- cgit v1.2.3 From eb1b8ed1484f0cc792c5237114b54d5fa53164cc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 12:26:17 -0600 Subject: radeon: fix some renderbuffer format bugs --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 21007d85c3..096ded23fb 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -280,14 +280,14 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH_COMPONENT24: - rrb->base.Format = MESA_FORMAT_Z32; - rrb->base.DataType = GL_UNSIGNED_INT; - rrb->base._BaseFormat = GL_DEPTH_COMPONENT; + rrb->base.Format = MESA_FORMAT_S8_Z24; + rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; + rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; case GL_DEPTH24_STENCIL8_EXT: rrb->base.Format = MESA_FORMAT_S8_Z24; rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; - rrb->base._BaseFormat = GL_STENCIL_INDEX; + rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; default: fprintf(stderr, "%s: Unknown format 0x%04x\n", __FUNCTION__, format); -- cgit v1.2.3 From cf0e25d4c89b62f37ff8d1f11c50efcab6557c7f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 19:20:38 -0600 Subject: radeon: simplify radeon_create_renderbuffer() --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 35 ++++++++++++++------------------ 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 096ded23fb..40846828c5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -240,8 +240,13 @@ radeon_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, return GL_FALSE; } + +/** + * Create a renderbuffer for a window's color, depth and/or stencil buffer. + * Not used for user-created renderbuffers. + */ struct radeon_renderbuffer * -radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) +radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv) { struct radeon_renderbuffer *rrb; @@ -252,40 +257,30 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) _mesa_init_renderbuffer(&rrb->base, 0); rrb->base.ClassID = RADEON_RB_CLASS; - /* XXX format junk */ + rrb->base.Format = format; + switch (format) { - case GL_RGB5: - rrb->base.Format = MESA_FORMAT_RGB565; + case MESA_FORMAT_RGB565: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; - case GL_RGB8: - rrb->base.Format = MESA_FORMAT_ARGB8888; + case MESA_FORMAT_XRGB8888: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; - case GL_RGBA8: - rrb->base.Format = MESA_FORMAT_ARGB8888; + case MESA_FORMAT_ARGB8888: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGBA; break; - case GL_STENCIL_INDEX8_EXT: - rrb->base.Format = MESA_FORMAT_S8; + case MESA_FORMAT_S8: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_STENCIL_INDEX; break; - case GL_DEPTH_COMPONENT16: - rrb->base.Format = MESA_FORMAT_Z16; + case MESA_FORMAT_Z16: rrb->base.DataType = GL_UNSIGNED_SHORT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; - case GL_DEPTH_COMPONENT24: - rrb->base.Format = MESA_FORMAT_S8_Z24; - rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; - rrb->base._BaseFormat = GL_DEPTH_STENCIL; - break; - case GL_DEPTH24_STENCIL8_EXT: - rrb->base.Format = MESA_FORMAT_S8_Z24; + case MESA_FORMAT_S8_Z24: rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; @@ -296,7 +291,7 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) } rrb->dPriv = driDrawPriv; - rrb->base.InternalFormat = format; + rrb->base.InternalFormat = _mesa_get_format_base_format(format); rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_alloc_window_storage; -- cgit v1.2.3 From 11caea687e3f10ae12d33e44edf84635f73047dd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 18:06:18 -0600 Subject: mesa: choose texture format in core mesa, not drivers Call the ctx->Driver.ChooseTextureFormat() function from core Mesa's _mesa_[Copy]TexImage functions instead of in the driver functions. One less thing for drivers to do. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 40846828c5..3f0ab83996 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -385,6 +385,9 @@ restart: texImage->TexFormat); return GL_FALSE; } + /* XXX why is the tex format being set here? + * I think this can be removed. + */ texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0, _mesa_get_format_datatype(texImage->TexFormat), 1); -- cgit v1.2.3 From 52374d7e4cc183fb783a7012b026d4254ca43b14 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 17:05:08 -0600 Subject: radeon: add case for MESA_FORMAT_X8_Z24 in radeon_create_renderbuffer() --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 3f0ab83996..9e6e8994fa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -280,12 +280,17 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv) rrb->base.DataType = GL_UNSIGNED_SHORT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; + case MESA_FORMAT_X8_Z24: + rrb->base.DataType = GL_UNSIGNED_INT; + rrb->base._BaseFormat = GL_DEPTH_COMPONENT; + break; case MESA_FORMAT_S8_Z24: rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; default: - fprintf(stderr, "%s: Unknown format 0x%04x\n", __FUNCTION__, format); + fprintf(stderr, "%s: Unknown format %s\n", + __FUNCTION__, _mesa_get_format_name(format)); _mesa_delete_renderbuffer(&rrb->base); return NULL; } -- cgit v1.2.3 From e2131e017184a595a735e7ea1eced1552b8a7d22 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 07:47:34 -0600 Subject: radeon: fix incorrect Z format in radeon_alloc_renderbuffer_storage() And update error message. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 8dda47fcd1..bf69cd9337 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -133,7 +133,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->Format = MESA_FORMAT_Z32; + rb->Format = MESA_FORMAT_X8_Z24; rb->DataType = GL_UNSIGNED_INT; cpp = 4; break; @@ -145,7 +145,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, break; default: _mesa_problem(ctx, - "Unexpected format in intel_alloc_renderbuffer_storage"); + "Unexpected format in radeon_alloc_renderbuffer_storage"); return GL_FALSE; } -- cgit v1.2.3 From f2651264d385fb31f89859fc1287ca0e41835cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 08:05:22 +0100 Subject: radeon: FBO fixes for big endian. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 34 ++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index bf69cd9337..7ec641ff18 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -90,7 +90,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - rb->Format = MESA_FORMAT_RGB565; + rb->Format = _dri_texformat_rgb565; rb->DataType = GL_UNSIGNED_BYTE; cpp = 2; break; @@ -99,7 +99,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->Format = MESA_FORMAT_ARGB8888; + rb->Format = _dri_texformat_argb8888; rb->DataType = GL_UNSIGNED_BYTE; cpp = 4; break; @@ -111,7 +111,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - rb->Format = MESA_FORMAT_ARGB8888; + rb->Format = _dri_texformat_argb8888; rb->DataType = GL_UNSIGNED_BYTE; cpp = 4; break; @@ -261,14 +261,32 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv) switch (format) { case MESA_FORMAT_RGB565: + assert(_mesa_little_endian()); + rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGB; + break; + case MESA_FORMAT_RGB565_REV: + assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case MESA_FORMAT_XRGB8888: + assert(_mesa_little_endian()); + rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGB; + break; + case MESA_FORMAT_XRGB8888_REV: + assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case MESA_FORMAT_ARGB8888: + assert(_mesa_little_endian()); + rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGBA; + break; + case MESA_FORMAT_ARGB8888_REV: + assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGBA; break; @@ -359,21 +377,21 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, gl_format texFormat; restart: - if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { + if (texImage->TexFormat == _dri_texformat_argb8888) { rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } - else if (texImage->TexFormat == MESA_FORMAT_RGB565) { + else if (texImage->TexFormat == _dri_texformat_rgb565) { rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } - else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { + else if (texImage->TexFormat == _dri_texformat_argb1555) { rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { + else if (texImage->TexFormat == _dri_texformat_argb4444) { rrb->base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to ARGB1555 texture OK\n"); + DBG("Render to ARGB4444 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_Z16) { rrb->base.DataType = GL_UNSIGNED_SHORT; -- cgit v1.2.3 From 6c41bb25a2e260dbce2c2d72ec64d1beb74527de Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 3 Dec 2009 20:21:16 +0100 Subject: radeon: workaround an FBO issue Fixes #21501 --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/mesa/drivers/dri/radeon/radeon_fbo.c') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 7ec641ff18..fc21069a92 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -369,6 +369,12 @@ radeon_framebuffer_renderbuffer(GLcontext * ctx, } +/* TODO: According to EXT_fbo spec internal format of texture image + * once set during glTexImage call, should be preserved when + * attaching image to renderbuffer. When HW doesn't support + * rendering to format of attached image, set framebuffer + * completeness accordingly in radeon_validate_framebuffer (issue #79). + */ static GLboolean radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, struct gl_texture_image *texImage) -- cgit v1.2.3