From 68342f9036d3c94ee50c4cbe5c7b36439eeb6825 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 30 Mar 2009 15:09:18 +0100 Subject: python: Hide away the surface usage flags. 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 | 3 ++- src/gallium/state_trackers/python/retrace/interpreter.py | 2 +- src/gallium/state_trackers/python/samples/tri.py | 6 +++--- src/gallium/state_trackers/python/tests/texture.py | 5 ++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index b03054adcc..fee9fb0bf8 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -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); } diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index a22314d200..510adcc242 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -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) diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index 9581b307bf..72e94560af 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -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()) diff --git a/src/gallium/state_trackers/python/tests/texture.py b/src/gallium/state_trackers/python/tests/texture.py index ce1c66720b..bd95f734fe 100644 --- a/src/gallium/state_trackers/python/tests/texture.py +++ b/src/gallium/state_trackers/python/tests/texture.py @@ -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) -- cgit v1.2.3