summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <darktama@iinet.net.au>2006-12-08 11:45:39 +0000
committerBen Skeggs <darktama@iinet.net.au>2006-12-08 11:45:39 +0000
commite62b2f9c2ec083db40abcf2991201e9e108861f1 (patch)
treee181d2a8d9cf3c7fef2c004bdd67956e74231d4a
parentbda66ac426e7ebd0c9383c665a43bc9dbe3154f7 (diff)
Implement a simple nv30Clear, and make sure we get a nouveau_renderbuffer
for the depth buffer and not a Mesa renderbuffer adaptor
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_buffers.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv30_state.c18
2 files changed, 22 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
index a356fd1212..42d8691752 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_buffers.c
@@ -239,7 +239,10 @@ nouveau_build_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb)
_mesa_update_draw_buffer_bounds(ctx);
color[0] = (nouveau_renderbuffer *)fb->_ColorDrawBuffers[0][0];
- depth = (nouveau_renderbuffer *)fb->_DepthBuffer;
+ if (fb->_DepthBuffer && fb->_DepthBuffer->Wrapped)
+ depth = (nouveau_renderbuffer *)fb->_DepthBuffer->Wrapped;
+ else
+ depth = (nouveau_renderbuffer *)fb->_DepthBuffer;
if (!nmesa->hw_func.BindBuffers(nmesa, 1, color, depth))
return GL_FALSE;
diff --git a/src/mesa/drivers/dri/nouveau/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c
index 3228320623..aab0bd9fda 100644
--- a/src/mesa/drivers/dri/nouveau/nv30_state.c
+++ b/src/mesa/drivers/dri/nouveau/nv30_state.c
@@ -79,6 +79,23 @@ static void nv30BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfac
OUT_RING_CACHE((dfactorA<<16) | dfactorRGB);
}
+static void nv30Clear(GLcontext *ctx, GLbitfield mask)
+{
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+ GLuint hw_bufs = 0;
+
+ if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT))
+ hw_bufs |= 0xf0;
+ if (mask & (BUFFER_BIT_DEPTH))
+ hw_bufs |= 0x03;
+
+ if (hw_bufs) {
+ /* should we flush the state cache before this? */
+ BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_CLEAR_WHICH_BUFFERS, 1);
+ OUT_RING(hw_bufs);
+ }
+}
+
static void nv30ClearColor(GLcontext *ctx, const GLfloat color[4])
{
nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
@@ -740,6 +757,7 @@ void nv30InitStateFuncs(GLcontext *ctx, struct dd_function_table *func)
func->BlendColor = nv30BlendColor;
func->BlendEquationSeparate = nv30BlendEquationSeparate;
func->BlendFuncSeparate = nv30BlendFuncSeparate;
+ func->Clear = nv30Clear;
func->ClearColor = nv30ClearColor;
func->ClearDepth = nv30ClearDepth;
func->ClearStencil = nv30ClearStencil;