aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/python
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2009-04-04 19:01:51 +0200
committerMichel Dänzer <[email protected]>2009-04-04 19:01:51 +0200
commiteb168e26aa63f11a47d70c4555cae30691a2cd57 (patch)
tree8dcde608f562fc781027b4e0e21263f9f295e70e /src/gallium/state_trackers/python
parentba14b043bc1ab87e8e5e46e6e909a8def9535028 (diff)
gallium: Clean up driver clear() interface.
Only allows clearing currently bound buffers, but colour and depth/stencil in a single call.
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 a0bf063d814..9a3003a56c4 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 510adcc2425..d02099389fb 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 4c84d121c49..4b9659861df 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 434ac9b3fc8..472769f2592 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 580bf65c13b..0b76932b6ed 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 f5f49f6e515..a382424667c 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