diff options
author | José Fonseca <[email protected]> | 2007-12-11 01:14:38 +0000 |
---|---|---|
committer | José Fonseca <[email protected]> | 2007-12-11 01:14:38 +0000 |
commit | 12363674e5aa39b780020339038186b7715bd4b2 (patch) | |
tree | a7bb56b6ccf37e29000f6ef72fb602908c4c08e1 /src/mesa/state_tracker | |
parent | 609538f57c93c6b6166777a329d80c46fef86f0b (diff) |
Add surface storage allocation function to winsys interface.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index ef6aec6e88e..047de412e32 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -90,29 +90,15 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, uint type = strb->screenSurface ? PIPE_SCREEN_SURFACE : PIPE_SURFACE; const enum pipe_format pipeFormat = st_choose_pipe_format(pipe, internalFormat, GL_NONE, GL_NONE, type); - GLuint cpp; GLbitfield flags = 0x0; /* XXX needed? */ - cpp = init_renderbuffer_bits(strb, pipeFormat); - assert(cpp); - - if (strb->surface && strb->surface->format != pipeFormat) { - /* need to change surface types, free this surface */ - pipe_surface_reference(&strb->surface, NULL); - assert(strb->surface == NULL); - } - if (!strb->surface) { - strb->surface = pipe->winsys->surface_alloc(pipe->winsys, pipeFormat); + strb->surface = pipe->winsys->surface_alloc(pipe->winsys); assert(strb->surface); if (!strb->surface) return GL_FALSE; - strb->surface->cpp = cpp; } - strb->surface->pitch = pipe->winsys->surface_pitch(pipe->winsys, cpp, - width, flags); - /* loop here since mapping is refcounted */ while (strb->surface->map) pipe_surface_unmap(strb->surface); @@ -120,20 +106,24 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, pipe->winsys->buffer_reference(pipe->winsys, &strb->surface->buffer, NULL); - /* XXX don't hard-code magic 32 here */ - strb->surface->buffer = pipe->winsys->buffer_create(pipe->winsys, 32, 0, 0); + pipe->winsys->surface_alloc_storage(pipe->winsys, + strb->surface, + width, + height, + pipeFormat, + flags); if (!strb->surface->buffer) return GL_FALSE; /* out of memory, try s/w buffer? */ - pipe->winsys->buffer_data(pipe->winsys, strb->surface->buffer, - strb->surface->pitch * cpp * height, NULL, - PIPE_BUFFER_USAGE_PIXEL); - ASSERT(strb->surface->buffer); ASSERT(strb->surface->format); + ASSERT(strb->surface->cpp); + ASSERT(strb->surface->width == width); + ASSERT(strb->surface->height == height); + ASSERT(strb->surface->pitch); - strb->Base.Width = strb->surface->width = width; - strb->Base.Height = strb->surface->height = height; + strb->Base.Width = width; + strb->Base.Height = height; return GL_TRUE; } |