nv50: adapt to clear interface changes

should support separate depth/stencil clears just fine.
This commit is contained in:
Roland Scheidegger
2010-05-29 01:25:09 +02:00
parent c5cccf8a49
commit e5b82c8222
3 changed files with 22 additions and 18 deletions

View File

@@ -51,13 +51,15 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers,
mode |= 0x3c; mode |= 0x3c;
} }
if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { if (buffers & PIPE_CLEAR_DEPTH) {
BEGIN_RING(chan, tesla, NV50TCL_CLEAR_DEPTH, 1); BEGIN_RING(chan, tesla, NV50TCL_CLEAR_DEPTH, 1);
OUT_RING (chan, fui(depth)); OUT_RING (chan, fui(depth));
mode |= NV50TCL_CLEAR_BUFFERS_Z;
}
if (buffers & PIPE_CLEAR_STENCIL) {
BEGIN_RING(chan, tesla, NV50TCL_CLEAR_STENCIL, 1); BEGIN_RING(chan, tesla, NV50TCL_CLEAR_STENCIL, 1);
OUT_RING (chan, stencil & 0xff); OUT_RING (chan, stencil & 0xff);
mode |= NV50TCL_CLEAR_BUFFERS_S;
mode |= 0x03;
} }
BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1); BEGIN_RING(chan, tesla, NV50TCL_CLEAR_BUFFERS, 1);

View File

@@ -150,6 +150,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1; return 1;
case PIPE_CAP_INDEP_BLEND_FUNC: case PIPE_CAP_INDEP_BLEND_FUNC:
return 0; return 0;
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
return 1;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT: case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1; return 1;

View File

@@ -27,6 +27,7 @@
#include "nv50_resource.h" #include "nv50_resource.h"
#include "pipe/p_defines.h" #include "pipe/p_defines.h"
#include "util/u_inlines.h" #include "util/u_inlines.h"
#include "util/u_pack_color.h"
#include "util/u_tile.h" #include "util/u_tile.h"
#include "util/u_format.h" #include "util/u_format.h"
@@ -221,50 +222,49 @@ nv50_surface_copy(struct pipe_context *pipe,
nv50_miptree_surface_del(ps_dst); nv50_miptree_surface_del(ps_dst);
} }
/* XXX this should probably look more along the lines of nv50_clear */
static void static void
nv50_surface_fill(struct pipe_context *pipe, struct pipe_resource *dest, nv50_clearRT(struct pipe_context *pipe,
struct pipe_subresource subdst, struct pipe_surface *dst,
unsigned destx, unsigned desty, unsigned destz, const float *rgba,
unsigned width, unsigned height, unsigned value) unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{ {
struct nv50_context *nv50 = nv50_context(pipe); struct nv50_context *nv50 = nv50_context(pipe);
struct pipe_surface *ps;
struct nv50_screen *screen = nv50->screen; struct nv50_screen *screen = nv50->screen;
struct nouveau_channel *chan = screen->eng2d->channel; struct nouveau_channel *chan = screen->eng2d->channel;
struct nouveau_grobj *eng2d = screen->eng2d; struct nouveau_grobj *eng2d = screen->eng2d;
int format, ret; int format, ret;
union util_color uc;
util_pack_color(rgba, dst->format, &uc);
format = nv50_format(dest->format); format = nv50_format(dst->format);
if (format < 0) if (format < 0)
return; return;
ps = nv50_miptree_surface_new(pipe->screen, dest, subdst.face,
subdst.level, destz, 0 /* bind flags */);
WAIT_RING (chan, 32); WAIT_RING (chan, 32);
ret = nv50_surface_set(screen, ps, 1); ret = nv50_surface_set(screen, dst, 1);
if (ret) if (ret)
return; return;
BEGIN_RING(chan, eng2d, NV50_2D_DRAW_SHAPE, 3); BEGIN_RING(chan, eng2d, NV50_2D_DRAW_SHAPE, 3);
OUT_RING (chan, NV50_2D_DRAW_SHAPE_RECTANGLES); OUT_RING (chan, NV50_2D_DRAW_SHAPE_RECTANGLES);
OUT_RING (chan, format); OUT_RING (chan, format);
OUT_RING (chan, value); OUT_RING (chan, uc.ui);
BEGIN_RING(chan, eng2d, NV50_2D_DRAW_POINT32_X(0), 4); BEGIN_RING(chan, eng2d, NV50_2D_DRAW_POINT32_X(0), 4);
OUT_RING (chan, destx); OUT_RING (chan, dstx);
OUT_RING (chan, desty); OUT_RING (chan, dsty);
OUT_RING (chan, width); OUT_RING (chan, width);
OUT_RING (chan, height); OUT_RING (chan, height);
nv50_miptree_surface_del(ps);
} }
void void
nv50_init_surface_functions(struct nv50_context *nv50) nv50_init_surface_functions(struct nv50_context *nv50)
{ {
nv50->pipe.resource_copy_region = nv50_surface_copy; nv50->pipe.resource_copy_region = nv50_surface_copy;
nv50->pipe.resource_fill_region = nv50_surface_fill; nv50->pipe.clearRT = nv50_clearRT;
} }