gallium: move softpipe_get_tex_surface() into sp_texture.c
authorBrian <brian.paul@tungstengraphics.com>
Tue, 22 Jan 2008 03:14:22 +0000 (20:14 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Tue, 22 Jan 2008 04:17:20 +0000 (21:17 -0700)
src/mesa/pipe/softpipe/sp_surface.c
src/mesa/pipe/softpipe/sp_texture.c

index d5119654edb25a88514b054987c3fd1a0a2a2dae..e11570550737dd85417d181d6e743044d5412961 100644 (file)
 #include "pipe/util/p_tile.h"
 #include "sp_context.h"
 #include "sp_surface.h"
-#include "sp_texture.h"
-
-
-/**
- * Called via pipe->get_tex_surface()
- * XXX is this in the right place?
- */
-struct pipe_surface *
-softpipe_get_tex_surface(struct pipe_context *pipe,
-                         struct pipe_texture *pt,
-                         unsigned face, unsigned level, unsigned zslice)
-{
-   struct softpipe_texture *spt = softpipe_texture(pt);
-   struct pipe_surface *ps;
-
-   ps = pipe->winsys->surface_alloc(pipe->winsys);
-   if (ps) {
-      assert(ps->refcount);
-      assert(ps->winsys);
-      pipe->winsys->buffer_reference(pipe->winsys, &ps->buffer, spt->buffer);
-      ps->format = pt->format;
-      ps->cpp = pt->cpp;
-      ps->width = pt->width[level];
-      ps->height = pt->height[level];
-      ps->pitch = ps->width;
-      ps->offset = spt->level_offset[level];
-
-      if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) {
-        ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) *
-                      (pt->compressed ? ps->height/4 : ps->height) *
-                      ps->width * ps->cpp;
-      } else {
-        assert(face == 0);
-        assert(zslice == 0);
-      }
-   }
-   return ps;
-}
 
 
 /* Upload data to a rectangular sub-region.  Lots of choices how to do this:
index 532bcfcc51df6a7b82cd297329955d3fea77afb4..d43a6996e98f01f9386619655cbe8d5797d62aa5 100644 (file)
@@ -130,3 +130,39 @@ softpipe_texture_release(struct pipe_context *pipe, struct pipe_texture **pt)
    }
    *pt = NULL;
 }
+
+
+/**
+ * Called via pipe->get_tex_surface()
+ */
+struct pipe_surface *
+softpipe_get_tex_surface(struct pipe_context *pipe,
+                         struct pipe_texture *pt,
+                         unsigned face, unsigned level, unsigned zslice)
+{
+   struct softpipe_texture *spt = softpipe_texture(pt);
+   struct pipe_surface *ps;
+
+   ps = pipe->winsys->surface_alloc(pipe->winsys);
+   if (ps) {
+      assert(ps->refcount);
+      assert(ps->winsys);
+      pipe->winsys->buffer_reference(pipe->winsys, &ps->buffer, spt->buffer);
+      ps->format = pt->format;
+      ps->cpp = pt->cpp;
+      ps->width = pt->width[level];
+      ps->height = pt->height[level];
+      ps->pitch = ps->width;
+      ps->offset = spt->level_offset[level];
+
+      if (pt->target == PIPE_TEXTURE_CUBE || pt->target == PIPE_TEXTURE_3D) {
+        ps->offset += ((pt->target == PIPE_TEXTURE_CUBE) ? face : zslice) *
+                      (pt->compressed ? ps->height/4 : ps->height) *
+                      ps->width * ps->cpp;
+      } else {
+        assert(face == 0);
+        assert(zslice == 0);
+      }
+   }
+   return ps;
+}