diff options
author | Brian Paul <[email protected]> | 2005-09-22 05:19:57 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-09-22 05:19:57 +0000 |
commit | 676d0accf5cc43e86057b14cfb8bba9316932582 (patch) | |
tree | eaefcddf33d92bd92adac7106701e99dc2b5da85 /src | |
parent | f1e2826856d7df00d0e98106b93ddab51b26ff04 (diff) |
Replace gl_renderbuffer.ComponentSizes[] with separate RedBits, GreenBits,
BlueBits, etc fields.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/common/drirenderbuffer.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_buffer.c | 2 | ||||
-rw-r--r-- | src/mesa/main/fbobject.c | 12 | ||||
-rw-r--r-- | src/mesa/main/framebuffer.c | 12 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 8 | ||||
-rw-r--r-- | src/mesa/main/renderbuffer.c | 55 | ||||
-rw-r--r-- | src/mesa/swrast/s_stencil.c | 2 |
7 files changed, 49 insertions, 44 deletions
diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c index 764dafc7f4f..cb26bb48970 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.c +++ b/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -100,7 +100,7 @@ driNewRenderbuffer(GLenum format, GLvoid *addr, } /* XXX if we were allocating a user-created renderbuffer, we'd have - * to fill in the ComponentSizes[] array too. + * to fill in the Red/Green/Blue/.../Bits values too. */ drb->Base.AllocStorage = driRenderbufferStorage; diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 5db0b496c73..64a920da2b1 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -130,7 +130,7 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, GLboolean rgbMode, xrb->Base._BaseFormat = GL_COLOR_INDEX; xrb->Base.DataType = GL_UNSIGNED_INT; } - xrb->Base.ComponentSizes[0] = 0; /* XXX fix? */ + /* only need to set Red/Green/EtcBits fields for user-created RBs */ } return xrb; } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 3980d09f8ae..f41f464e3d1 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -747,7 +747,7 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) case GL_RENDERBUFFER_RED_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { - *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; + *params = ctx->CurrentRenderbuffer->RedBits; } else { *params = 0; @@ -756,7 +756,7 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) case GL_RENDERBUFFER_GREEN_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { - *params = ctx->CurrentRenderbuffer->ComponentSizes[1]; + *params = ctx->CurrentRenderbuffer->GreenBits; } else { *params = 0; @@ -765,7 +765,7 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) case GL_RENDERBUFFER_BLUE_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { - *params = ctx->CurrentRenderbuffer->ComponentSizes[2]; + *params = ctx->CurrentRenderbuffer->BlueBits; } else { *params = 0; @@ -774,7 +774,7 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) case GL_RENDERBUFFER_ALPHA_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_RGB || ctx->CurrentRenderbuffer->_BaseFormat == GL_RGBA) { - *params = ctx->CurrentRenderbuffer->ComponentSizes[3]; + *params = ctx->CurrentRenderbuffer->AlphaBits; } else { *params = 0; @@ -782,7 +782,7 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) break; case GL_RENDERBUFFER_DEPTH_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) { - *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; + *params = ctx->CurrentRenderbuffer->DepthBits; } else { *params = 0; @@ -790,7 +790,7 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) break; case GL_RENDERBUFFER_STENCIL_SIZE_EXT: if (ctx->CurrentRenderbuffer->_BaseFormat == GL_STENCIL_INDEX) { - *params = ctx->CurrentRenderbuffer->ComponentSizes[0]; + *params = ctx->CurrentRenderbuffer->StencilBits; } else { *params = 0; diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 628afc7a86b..4ad82c85ffe 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -329,13 +329,13 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) if (fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer) { fb->Visual.redBits - = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->ComponentSizes[0]; + = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->RedBits; fb->Visual.greenBits - = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->ComponentSizes[1]; + = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->GreenBits; fb->Visual.blueBits - = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->ComponentSizes[2]; + = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->BlueBits; fb->Visual.alphaBits - = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->ComponentSizes[3]; + = fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer->AlphaBits; fb->Visual.rgbBits = fb->Visual.redBits + fb->Visual.greenBits + fb->Visual.blueBits; fb->Visual.floatMode = GL_FALSE; @@ -344,13 +344,13 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) { fb->Visual.haveDepthBuffer = GL_TRUE; fb->Visual.depthBits - = fb->Attachment[BUFFER_DEPTH].Renderbuffer->ComponentSizes[0]; + = fb->Attachment[BUFFER_DEPTH].Renderbuffer->DepthBits; } if (fb->Attachment[BUFFER_STENCIL].Renderbuffer) { fb->Visual.haveStencilBuffer = GL_TRUE; fb->Visual.stencilBits - = fb->Attachment[BUFFER_STENCIL].Renderbuffer->ComponentSizes[0]; + = fb->Attachment[BUFFER_STENCIL].Renderbuffer->StencilBits; } compute_depth_max(fb); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 6ed7a22807e..e63082948cb 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2055,7 +2055,13 @@ struct gl_renderbuffer GLenum _BaseFormat; /* Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or */ /* GL_STENCIL_INDEX. */ GLenum DataType; /* Type of values passed to the Get/Put functions */ - GLubyte ComponentSizes[4]; /* bits per component or channel */ + GLubyte RedBits; /**< Bits per image component */ + GLubyte GreenBits; + GLubyte BlueBits; + GLubyte AlphaBits; + GLubyte IndexBits; + GLubyte DepthBits; + GLubyte StencilBits; GLvoid *Data; /* Delete this renderbuffer */ diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 17fb6456e85..4ebaa1f6118 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -937,10 +937,10 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ubyte3; rb->PutValues = put_values_ubyte3; rb->PutMonoValues = put_mono_values_ubyte3; - rb->ComponentSizes[0] = 8 * sizeof(GLubyte); - rb->ComponentSizes[1] = 8 * sizeof(GLubyte); - rb->ComponentSizes[2] = 8 * sizeof(GLubyte); - rb->ComponentSizes[3] = 0; + rb->RedBits = 8 * sizeof(GLubyte); + rb->GreenBits = 8 * sizeof(GLubyte); + rb->BlueBits = 8 * sizeof(GLubyte); + rb->AlphaBits = 0; pixelSize = 3 * sizeof(GLubyte); break; case GL_RGBA: @@ -958,10 +958,10 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ubyte4; rb->PutValues = put_values_ubyte4; rb->PutMonoValues = put_mono_values_ubyte4; - rb->ComponentSizes[0] = 8 * sizeof(GLubyte); - rb->ComponentSizes[1] = 8 * sizeof(GLubyte); - rb->ComponentSizes[2] = 8 * sizeof(GLubyte); - rb->ComponentSizes[3] = 8 * sizeof(GLubyte); + rb->RedBits = 8 * sizeof(GLubyte); + rb->GreenBits = 8 * sizeof(GLubyte); + rb->BlueBits = 8 * sizeof(GLubyte); + rb->AlphaBits = 8 * sizeof(GLubyte); pixelSize = 4 * sizeof(GLubyte); break; case GL_RGB10_A2: @@ -977,10 +977,10 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ushort4; rb->PutValues = put_values_ushort4; rb->PutMonoValues = put_mono_values_ushort4; - rb->ComponentSizes[0] = 8 * sizeof(GLushort); - rb->ComponentSizes[1] = 8 * sizeof(GLushort); - rb->ComponentSizes[2] = 8 * sizeof(GLushort); - rb->ComponentSizes[3] = 8 * sizeof(GLushort); + rb->RedBits = 8 * sizeof(GLushort); + rb->GreenBits = 8 * sizeof(GLushort); + rb->BlueBits = 8 * sizeof(GLushort); + rb->AlphaBits = 8 * sizeof(GLushort); pixelSize = 4 * sizeof(GLushort); break; #if 00 @@ -995,10 +995,10 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_alpha8; rb->PutValues = put_values_alpha8; rb->PutMonoValues = put_mono_values_alpha8; - rb->ComponentSizes[0] = 0; /*red*/ - rb->ComponentSizes[1] = 0; /*green*/ - rb->ComponentSizes[2] = 0; /*blue*/ - rb->ComponentSizes[3] = 8 * sizeof(GLubyte); + rb->RedBits = 0; /*red*/ + rb->GreenBits = 0; /*green*/ + rb->BlueBits = 0; /*blue*/ + rb->AlphaBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; #endif @@ -1016,7 +1016,7 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ubyte; rb->PutValues = put_values_ubyte; rb->PutMonoValues = put_mono_values_ubyte; - rb->ComponentSizes[0] = 8 * sizeof(GLubyte); + rb->StencilBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; case GL_STENCIL_INDEX16_EXT: @@ -1030,7 +1030,7 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ushort; rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; - rb->ComponentSizes[0] = 8 * sizeof(GLushort); + rb->StencilBits = 8 * sizeof(GLushort); pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT: @@ -1045,7 +1045,7 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ushort; rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; - rb->ComponentSizes[0] = 8 * sizeof(GLushort); + rb->DepthBits = 8 * sizeof(GLushort); pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: @@ -1060,7 +1060,7 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_uint; rb->PutValues = put_values_uint; rb->PutMonoValues = put_mono_values_uint; - rb->ComponentSizes[0] = 8 * sizeof(GLuint); + rb->DepthBits = 8 * sizeof(GLuint); pixelSize = sizeof(GLuint); break; case GL_COLOR_INDEX8_EXT: @@ -1074,7 +1074,7 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ubyte; rb->PutValues = put_values_ubyte; rb->PutMonoValues = put_mono_values_ubyte; - rb->ComponentSizes[0] = 8 * sizeof(GLubyte); + rb->IndexBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; case GL_COLOR_INDEX16_EXT: @@ -1088,7 +1088,7 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ushort; rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; - rb->ComponentSizes[0] = 8 * sizeof(GLushort); + rb->IndexBits = 8 * sizeof(GLushort); pixelSize = sizeof(GLushort); break; case COLOR_INDEX32: @@ -1102,7 +1102,7 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_uint; rb->PutValues = put_values_uint; rb->PutMonoValues = put_mono_values_uint; - rb->ComponentSizes[0] = 8 * sizeof(GLuint); + rb->IndexBits = 8 * sizeof(GLuint); pixelSize = sizeof(GLuint); break; default: @@ -1118,7 +1118,6 @@ soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, ASSERT(rb->PutMonoRow); ASSERT(rb->PutValues); ASSERT(rb->PutMonoValues); - ASSERT(rb->ComponentSizes[0] > 0); /* free old buffer storage */ if (rb->Data) @@ -1399,10 +1398,10 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name) rb->InternalFormat = GL_NONE; rb->_BaseFormat = GL_NONE; rb->DataType = GL_NONE; - rb->ComponentSizes[0] = 0; - rb->ComponentSizes[1] = 0; - rb->ComponentSizes[2] = 0; - rb->ComponentSizes[3] = 0; + rb->RedBits = rb->GreenBits = rb->BlueBits = rb->AlphaBits = 0; + rb->IndexBits = 0; + rb->DepthBits = 0; + rb->StencilBits = 0; rb->Data = NULL; rb->GetPointer = nop_get_pointer; diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c index 238beddc358..b465b5a2c68 100644 --- a/src/mesa/swrast/s_stencil.c +++ b/src/mesa/swrast/s_stencil.c @@ -1127,7 +1127,7 @@ _swrast_write_stencil_span(GLcontext *ctx, GLint n, GLint x, GLint y, void _swrast_clear_stencil_buffer( GLcontext *ctx, struct gl_renderbuffer *rb ) { - const GLubyte stencilBits = rb->ComponentSizes[0]; + const GLubyte stencilBits = ctx->DrawBuffer->Visual.stencilBits; const GLuint mask = ctx->Stencil.WriteMask[0]; const GLuint invMask = ~mask; const GLuint clearVal = (ctx->Stencil.Clear & mask); |