python: Hide away the surface usage flags.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 30 Mar 2009 14:09:18 +0000 (15:09 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 30 Mar 2009 16:19:10 +0000 (17:19 +0100)
Surfaces are now by definition GPU views. So CPU access flags don't make
any sense when creating a surface.

For now we are forcing surfaces to be GPU read/write, but that will go away
soon.

src/gallium/state_trackers/python/p_texture.i
src/gallium/state_trackers/python/retrace/interpreter.py
src/gallium/state_trackers/python/samples/tri.py
src/gallium/state_trackers/python/tests/texture.py

index b03054adcced16c7ac09ab9f187b407637f6c431..fee9fb0bf84c781e25e0bb48d96c00c85013f06c 100644 (file)
@@ -79,8 +79,9 @@
    
    /** Get a surface which is a "view" into a texture */
    struct pipe_surface *
-   get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0, unsigned usage=0 )
+   get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0 )
    {
+      const usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE;
       struct pipe_screen *screen = $self->screen;
       return screen->get_tex_surface(screen, $self, face, level, zslice, usage);
    }
index a22314d2000cc5a12c05f61e05145ed5f3e230cb..510adcc2425b1b7ed63df81b9783cb2766634f22 100755 (executable)
@@ -272,7 +272,7 @@ class Screen(Object):
         pass
 
     def get_tex_surface(self, texture, face, level, zslice, usage):
-        return texture.get_surface(face, level, zslice, usage)
+        return texture.get_surface(face, level, zslice)
     
     def tex_surface_destroy(self, surface):
         self.interpreter.unregister_object(surface)
index 9581b307bf54503307e591c3fc1aafef996482e1..72e94560af46b13be5ada1482714b95688f0a782 100644 (file)
@@ -135,7 +135,7 @@ def test(dev):
         width, height,
         tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
     )
-    _cbuf = cbuf.get_surface(usage = PIPE_BUFFER_USAGE_GPU_READ|PIPE_BUFFER_USAGE_GPU_WRITE)
+    _cbuf = cbuf.get_surface()
     fb = Framebuffer()
     fb.width = width
     fb.height = height
@@ -205,8 +205,8 @@ def test(dev):
 
     ctx.flush()
     
-    show_image(cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE))
-    #save_image('tri.png', cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE))
+    show_image(cbuf.get_surface())
+    #save_image('tri.png', cbuf.get_surface())
 
 
 
index ce1c66720b45e91d00a0e6c9bfa9c75fea731340..bd95f734fe79180b2fdd62baac1f0ae250408131 100644 (file)
@@ -197,7 +197,6 @@ class TextureTest(TestCase):
         
         expected_rgba = FloatArray(height*width*4) 
         texture.get_surface(
-            usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE,
             face = face,
             level = level,
             zslice = zslice,
@@ -213,7 +212,7 @@ class TextureTest(TestCase):
             tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
         )
 
-        cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_GPU_WRITE|PIPE_BUFFER_USAGE_GPU_READ)
+        cbuf = cbuf_tex.get_surface()
         fb = Framebuffer()
         fb.width = width
         fb.height = height
@@ -290,7 +289,7 @@ class TextureTest(TestCase):
     
         ctx.flush()
     
-        cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ)
+        cbuf = cbuf_tex.get_surface()
         
         total = h*w
         different = cbuf.compare_tile_rgba(x, y, w, h, expected_rgba, tol=4.0/256)