From 8bd87b662f70070686fdfbea36f3660bd2586e32 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 17 May 2010 21:32:41 +0200 Subject: st/python: adapt to interface changes compile tested only. Should probably change the python surface_copy/fill functions also into resource_copy/fill_region functions and adapt the code using them. --- src/gallium/state_trackers/python/p_context.i | 30 +++++++++++++++++----- src/gallium/state_trackers/python/p_device.i | 10 +++++--- src/gallium/tests/python/retrace/interpreter.py | 4 +-- src/gallium/tests/python/tests/surface_copy.py | 7 ++--- src/gallium/tests/python/tests/texture_blit.py | 18 +++++++------ src/gallium/tests/python/tests/texture_transfer.py | 7 ++--- 6 files changed, 49 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 3c5509cb5e..3d7b640b47 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -413,16 +413,17 @@ error1: /* * Surface functions */ - + void surface_copy(struct st_surface *dst, unsigned destx, unsigned desty, struct st_surface *src, unsigned srcx, unsigned srcy, unsigned width, unsigned height) { +/* XXX struct pipe_surface *_dst = NULL; struct pipe_surface *_src = NULL; - + _dst = st_pipe_surface(dst, PIPE_BIND_BLIT_DESTINATION); if(!_dst) SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing"); @@ -430,12 +431,20 @@ error1: _src = st_pipe_surface(src, PIPE_BIND_BLIT_SOURCE); if(!_src) SWIG_exception(SWIG_ValueError, "couldn't acquire source surface for reading"); - + $self->pipe->surface_copy($self->pipe, _dst, destx, desty, _src, srcx, srcy, width, height); - + fail: pipe_surface_reference(&_src, NULL); pipe_surface_reference(&_dst, NULL); +*/ + struct pipe_subresource subdst, subsrc; + subsrc.face = src->face; + subsrc.level = src->level; + subdst.face = dst->face; + subdst.level = dst->level; + $self->pipe->resource_copy_region($self->pipe, dst->texture, subdst, destx, desty, dst->zslice, + src->texture, subsrc, srcx, srcy, src->zslice, width, height); } void surface_fill(struct st_surface *dst, @@ -443,16 +452,23 @@ error1: unsigned width, unsigned height, unsigned value) { +/* XXX struct pipe_surface *_dst = NULL; - - _dst = st_pipe_surface(dst, PIPE_BIND_BLIT_DESTINATION); + + _dst = st_pipe_surface(dst, PIPE_BIND_BLIT_DESTINATION); if(!_dst) SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing"); $self->pipe->surface_fill($self->pipe, _dst, x, y, width, height, value); - + fail: pipe_surface_reference(&_dst, NULL); +*/ + struct pipe_subresource subdst; + subdst.face = dst->face; + subdst.level = dst->level; + $self->pipe->resource_fill_region($self->pipe, dst->texture, subdst, x, y, dst->zslice, + width, height, value); } %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1)); diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i index 959c13f54d..d55086fefd 100644 --- a/src/gallium/state_trackers/python/p_device.i +++ b/src/gallium/state_trackers/python/p_device.i @@ -85,16 +85,18 @@ struct st_device { */ int is_format_supported( enum pipe_format format, enum pipe_texture_target target, + unsigned sample_count, unsigned bind, unsigned geom_flags ) { /* We can't really display surfaces with the python statetracker so mask * out that usage */ bind &= ~PIPE_BIND_DISPLAY_TARGET; - return $self->screen->is_format_supported( $self->screen, - format, - target, - bind, + return $self->screen->is_format_supported( $self->screen, + format, + target, + sample_count, + bind, geom_flags ); } diff --git a/src/gallium/tests/python/retrace/interpreter.py b/src/gallium/tests/python/retrace/interpreter.py index e58a69322e..4599d68d7d 100755 --- a/src/gallium/tests/python/retrace/interpreter.py +++ b/src/gallium/tests/python/retrace/interpreter.py @@ -230,8 +230,8 @@ class Screen(Object): context = self.real.context_create() return Context(self.interpreter, context) - def is_format_supported(self, format, target, bind, geom_flags): - return self.real.is_format_supported(format, target, bind, geom_flags) + def is_format_supported(self, format, target, sample_count, bind, geom_flags): + return self.real.is_format_supported(format, target, sample_count, bind, geom_flags) def resource_create(self, templat): return self.real.resource_create( diff --git a/src/gallium/tests/python/tests/surface_copy.py b/src/gallium/tests/python/tests/surface_copy.py index 8d84164403..7a6ede3804 100755 --- a/src/gallium/tests/python/tests/surface_copy.py +++ b/src/gallium/tests/python/tests/surface_copy.py @@ -70,13 +70,14 @@ class TextureTest(TestCase): face = self.face level = self.level zslice = self.zslice - + bind = PIPE_BIND_SAMPLER_VIEW geom_flags = 0 - if not dev.is_format_supported(format, target, bind, geom_flags): + sample_count = 0 + if not dev.is_format_supported(format, target, sample_count, bind, geom_flags): raise TestSkip - if not dev.is_format_supported(format, target, bind, geom_flags): + if not dev.is_format_supported(format, target, sample_count, bind, geom_flags): raise TestSkip # textures diff --git a/src/gallium/tests/python/tests/texture_blit.py b/src/gallium/tests/python/tests/texture_blit.py index 77f006ea04..58706dab93 100755 --- a/src/gallium/tests/python/tests/texture_blit.py +++ b/src/gallium/tests/python/tests/texture_blit.py @@ -130,17 +130,18 @@ class TextureColorSampleTest(TestCase): zslice = self.zslice minz = 0.0 maxz = 1.0 - + bind = PIPE_BIND_SAMPLER_VIEW geom_flags = 0 + sample_count = 0 if width != height: geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE if not is_pot(width) or not is_pot(height) or not is_pot(depth): geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO - - if not dev.is_format_supported(format, target, bind, geom_flags): + + if not dev.is_format_supported(format, target, sample_count, bind, geom_flags): raise TestSkip - + # disabled blending/masking blend = Blend() blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE @@ -348,17 +349,18 @@ class TextureDepthSampleTest(TestCase): zslice = self.zslice minz = 0.0 maxz = 1.0 - + bind = PIPE_BIND_SAMPLER_VIEW geom_flags = 0 + sample_count = 0 if width != height: geom_flags |= PIPE_TEXTURE_GEOM_NON_SQUARE if not is_pot(width) or not is_pot(height) or not is_pot(depth): geom_flags |= PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO - - if not dev.is_format_supported(format, target, bind, geom_flags): + + if not dev.is_format_supported(format, target, sample_count, bind, geom_flags): raise TestSkip - + # disabled blending/masking blend = Blend() blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE diff --git a/src/gallium/tests/python/tests/texture_transfer.py b/src/gallium/tests/python/tests/texture_transfer.py index 4aa3d6c709..65c919bc64 100755 --- a/src/gallium/tests/python/tests/texture_transfer.py +++ b/src/gallium/tests/python/tests/texture_transfer.py @@ -71,12 +71,13 @@ class TextureTest(TestCase): face = self.face level = self.level zslice = self.zslice - + bind = PIPE_BIND_SAMPLER_VIEW geom_flags = 0 - if not dev.is_format_supported(format, target, bind, geom_flags): + sample_count = 0 + if not dev.is_format_supported(format, target, sample_count, bind, geom_flags): raise TestSkip - + # textures texture = dev.resource_create( target = target, -- cgit v1.2.3