summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/python
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/python')
-rw-r--r--src/gallium/state_trackers/python/p_context.i41
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/interpreter.py4
-rw-r--r--src/gallium/state_trackers/python/samples/tri.py8
-rw-r--r--src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py7
-rwxr-xr-xsrc/gallium/state_trackers/python/tests/texture_render.py7
-rwxr-xr-xsrc/gallium/state_trackers/python/tests/texture_sample.py7
6 files changed, 29 insertions, 45 deletions
diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i
index a0bf063d81..9a3003a56c 100644
--- a/src/gallium/state_trackers/python/p_context.i
+++ b/src/gallium/state_trackers/python/p_context.i
@@ -308,45 +308,10 @@ error1:
pipe_surface_reference(&_dst, NULL);
}
- void surface_clear(struct st_surface *surface, unsigned value = 0)
+ void clear(unsigned buffers, const float *rgba, double depth = 0.0f,
+ unsigned stencil = 0)
{
- unsigned i;
- struct pipe_surface *_surface = NULL;
-
- if(!surface)
- SWIG_exception(SWIG_TypeError, "surface must not be null");
-
- for(i = 0; i < $self->framebuffer.nr_cbufs; ++i) {
- struct pipe_surface *cbuf = $self->framebuffer.cbufs[i];
- if(cbuf) {
- if(cbuf->texture == surface->texture &&
- cbuf->face == surface->face &&
- cbuf->level == surface->level &&
- cbuf->zslice == surface->zslice) {
- _surface = cbuf;
- break;
- }
- }
- }
-
- if(!_surface) {
- struct pipe_surface *zsbuf = $self->framebuffer.zsbuf;
- if(zsbuf) {
- if(zsbuf->texture == surface->texture &&
- zsbuf->face == surface->face &&
- zsbuf->level == surface->level &&
- zsbuf->zslice == surface->zslice) {
- _surface = zsbuf;
- }
- }
- }
-
- if(!_surface)
- SWIG_exception(SWIG_ValueError, "surface not bound");
-
- $self->pipe->clear($self->pipe, _surface, value);
- fail:
- return;
+ $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil);
}
};
diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py
index 510adcc242..d02099389f 100755
--- a/src/gallium/state_trackers/python/retrace/interpreter.py
+++ b/src/gallium/state_trackers/python/retrace/interpreter.py
@@ -531,8 +531,8 @@ class Context(Object):
self.dirty = False
return None
- def clear(self, surface, value):
- self.real.surface_clear(surface, value)
+ def clear(self, buffers, rgba, depth, stencil):
+ self.real.clear(buffers, rgba, depth, stencil)
def _present(self):
self.real.flush()
diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py
index 4c84d121c4..4b9659861d 100644
--- a/src/gallium/state_trackers/python/samples/tri.py
+++ b/src/gallium/state_trackers/python/samples/tri.py
@@ -150,8 +150,12 @@ def test(dev):
fb.set_cbuf(0, cbuf)
fb.set_zsbuf(zbuf)
ctx.set_framebuffer(fb)
- ctx.surface_clear(cbuf, 0x00000000)
- ctx.surface_clear(zbuf, 0xffffffff)
+ rgba = FloatArray(4);
+ rgba[0] = 0.0
+ rgba[1] = 0.0
+ rgba[2] = 0.0
+ rgba[3] = 0.0
+ ctx.clear(PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL, rgba, 1.0, 0xff)
# vertex shader
vs = Shader('''
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
index 434ac9b3fc..472769f259 100644
--- a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
+++ b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
@@ -122,7 +122,12 @@ def test(dev, name):
fb.nr_cbufs = 1
fb.set_cbuf(0, cbuf)
ctx.set_framebuffer(fb)
- ctx.surface_clear(cbuf, 0x80808080)
+ rgba = FloatArray(4);
+ rgba[0] = 0.5
+ rgba[1] = 0.5
+ rgba[2] = 0.5
+ rgba[3] = 0.5
+ ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
# vertex shader
vs = Shader(file('vert-' + name + '.sh', 'rt').read())
diff --git a/src/gallium/state_trackers/python/tests/texture_render.py b/src/gallium/state_trackers/python/tests/texture_render.py
index 580bf65c13..0b76932b6e 100755
--- a/src/gallium/state_trackers/python/tests/texture_render.py
+++ b/src/gallium/state_trackers/python/tests/texture_render.py
@@ -161,7 +161,12 @@ class TextureTest(TestCase):
fb.nr_cbufs = 1
fb.set_cbuf(0, dst_surface)
ctx.set_framebuffer(fb)
- ctx.surface_clear(dst_surface, 0x00000000)
+ rgba = FloatArray(4);
+ rgba[0] = 0.0
+ rgba[1] = 0.0
+ rgba[2] = 0.0
+ rgba[3] = 0.0
+ ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
del fb
# vertex shader
diff --git a/src/gallium/state_trackers/python/tests/texture_sample.py b/src/gallium/state_trackers/python/tests/texture_sample.py
index f5f49f6e51..a382424667 100755
--- a/src/gallium/state_trackers/python/tests/texture_sample.py
+++ b/src/gallium/state_trackers/python/tests/texture_sample.py
@@ -206,7 +206,12 @@ class TextureTest(TestCase):
fb.nr_cbufs = 1
fb.set_cbuf(0, cbuf)
ctx.set_framebuffer(fb)
- ctx.surface_clear(cbuf, 0x00000000)
+ rgba = FloatArray(4);
+ rgba[0] = 0.5
+ rgba[1] = 0.5
+ rgba[2] = 0.5
+ rgba[3] = 0.5
+ ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
del fb
# vertex shader