Mesa (master): nvfx: adapt to clear interface changes

Roland Scheidegger sroland at kemper.freedesktop.org
Thu Jun 3 15:47:35 UTC 2010


Module: Mesa
Branch: master
Commit: c5cccf8a49daa4a9c0ebd72a1783fe27b352471c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5cccf8a49daa4a9c0ebd72a1783fe27b352471c

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Sat May 29 01:24:25 2010 +0200

nvfx: adapt to clear interface changes

---

 src/gallium/drivers/nvfx/nvfx_screen.c  |    2 +
 src/gallium/drivers/nvfx/nvfx_surface.c |   38 ++++++++++++++++++++++---------
 2 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c
index 7e534a0..a78d241 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -80,6 +80,8 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 		return 0;
 	case PIPE_CAP_INDEP_BLEND_FUNC:
 		return 0;
+	case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
+		return 0;
 	case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
 	case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
 		return 1;
diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c
index fc3a670..c853f36 100644
--- a/src/gallium/drivers/nvfx/nvfx_surface.c
+++ b/src/gallium/drivers/nvfx/nvfx_surface.c
@@ -30,6 +30,7 @@
 #include "nvfx_resource.h"
 #include "pipe/p_defines.h"
 #include "util/u_inlines.h"
+#include "util/u_pack_color.h"
 
 static void
 nvfx_surface_copy(struct pipe_context *pipe,
@@ -55,26 +56,41 @@ nvfx_surface_copy(struct pipe_context *pipe,
 }
 
 static void
-nvfx_surface_fill(struct pipe_context *pipe, struct pipe_resource *dest,
-		  struct pipe_subresource subdst,
-		  unsigned destx, unsigned desty, unsigned destz,
-		  unsigned width, unsigned height, unsigned value)
+nvfx_clearRT(struct pipe_context *pipe,
+	     struct pipe_surface *dst,
+	     const float *rgba,
+	     unsigned dstx, unsigned dsty,
+	     unsigned width, unsigned height)
 {
 	struct nvfx_context *nvfx = nvfx_context(pipe);
-	struct pipe_surface *ps;
 	struct nv04_surface_2d *eng2d = nvfx->screen->eng2d;
+	union util_color uc;
+	util_pack_color(rgba, dst->format, &uc);
+
+	eng2d->fill(eng2d, dst, dstx, dsty, width, height, uc.ui);
+}
 
-	ps = nvfx_miptree_surface_new(pipe->screen, dest, subdst.face,
-				      subdst.level, destz, 0 /* bind flags */);
-	
-	eng2d->fill(eng2d, ps, destx, desty, width, height, value);
+static void
+nvfx_clearDS(struct pipe_context *pipe,
+	     struct pipe_surface *dst,
+	     unsigned clear_flags,
+	     double depth,
+	     unsigned stencil,
+	     unsigned dstx, unsigned dsty,
+	     unsigned width, unsigned height)
+{
+	struct nvfx_context *nvfx = nvfx_context(pipe);
+	struct nv04_surface_2d *eng2d = nvfx->screen->eng2d;
 
-	nvfx_miptree_surface_del(ps);
+	eng2d->fill(eng2d, dst, dstx, dsty, width, height,
+		    util_pack_z_stencil(dst->format, depth, stencil));
 }
 
+
 void
 nvfx_init_surface_functions(struct nvfx_context *nvfx)
 {
 	nvfx->pipe.resource_copy_region = nvfx_surface_copy;
-	nvfx->pipe.resource_fill_region = nvfx_surface_fill;
+	nvfx->pipe.clearRT = nvfx_clearRT;
+	nvfx->pipe.clearDS = nvfx_clearDS;
 }




More information about the mesa-commit mailing list