summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-11-08 11:38:50 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-11-08 11:38:50 -0700
commit02f7f46fa15c7d31d774c638684d4f5b81e360ec (patch)
tree294fd1c2eb528057093d9c0f6299668e26bfed79 /src
parent89b7b187dda26f7c7cc5e80360d49fa32f89b6fd (diff)
new init_renderbuffer_bits() helper
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 0d23f7eec4..f58d532b2a 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -52,24 +52,15 @@
/**
- * gl_renderbuffer::AllocStorage()
+ * Compute the renderbuffer's Red/Green/EtcBit fields from the pipe format.
*/
-static GLboolean
-st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
- GLenum internalFormat,
- GLuint width, GLuint height)
+static int
+init_renderbuffer_bits(struct st_renderbuffer *strb, uint pipeFormat)
{
- struct pipe_context *pipe = ctx->st->pipe;
- struct st_renderbuffer *strb = st_renderbuffer(rb);
- const uint pipeFormat
- = st_choose_pipe_format(pipe, internalFormat, GL_NONE, GL_NONE);
struct pipe_format_info info;
- GLuint cpp;
- GLbitfield flags = PIPE_SURFACE_FLAG_RENDER; /* want to render to surface */
if (!st_get_format_info( pipeFormat, &info )) {
assert( 0 );
- return GL_FALSE;
}
strb->Base._ActualFormat = info.base_format;
@@ -81,9 +72,26 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
strb->Base.StencilBits = info.stencil_bits;
strb->Base.DataType = st_format_datatype(pipeFormat);
- assert(strb->Base.DataType);
+ return info.size;
+}
- cpp = info.size;
+
+/**
+ * gl_renderbuffer::AllocStorage()
+ */
+static GLboolean
+st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
+ GLenum internalFormat,
+ GLuint width, GLuint height)
+{
+ struct pipe_context *pipe = ctx->st->pipe;
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
+ const uint pipeFormat
+ = st_choose_pipe_format(pipe, internalFormat, GL_NONE, GL_NONE);
+ GLuint cpp;
+ GLbitfield flags = PIPE_SURFACE_FLAG_RENDER; /* want to render to surface */
+
+ cpp = init_renderbuffer_bits(strb, pipeFormat);
if (strb->surface && strb->surface->format != pipeFormat) {
/* need to change surface types, free this surface */
@@ -305,6 +313,8 @@ st_render_texture(GLcontext *ctx,
att->Zoffset);
assert(strb->surface);
+ init_renderbuffer_bits(strb, mt->format);
+
/*
printf("RENDER TO TEXTURE obj=%p mt=%p surf=%p %d x %d\n",
att->Texture, mt, strb->surface, rb->Width, rb->Height);