From: José Fonseca Date: Mon, 30 Mar 2009 14:09:18 +0000 (+0100) Subject: python: Hide away the surface usage flags. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=68342f9036d3c94ee50c4cbe5c7b36439eeb6825;p=mesa.git 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. --- diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index b03054adcce..fee9fb0bf84 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 a22314d2000..510adcc2425 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 9581b307bf5..72e94560af4 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 ce1c66720b4..bd95f734fe7 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)