From f637a96e85a51a66f2c53b91118a6815bb61d6e6 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 3 Sep 2008 11:48:05 +0900 Subject: gallium: Have pipe_buffer_* receive a pipe_screen instead of a pipe_context. We want to use the pipe_buffer_* inlines everywhere, but a pipe context is not always available nor is it needed. --- src/gallium/state_trackers/python/p_context.i | 2 +- src/gallium/state_trackers/python/st_device.c | 2 +- src/gallium/state_trackers/python/st_softpipe_winsys.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gallium/state_trackers/python') diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 0b2621f7c31..231e07cd637 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -248,7 +248,7 @@ struct st_context { util_draw_vertex_buffer(pipe, vbuf, prim, num_verts, num_attribs); error2: - pipe_buffer_reference(pipe->winsys, &vbuf, NULL); + pipe_buffer_reference(pipe->screen, &vbuf, NULL); error1: ; } diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index f71d85dd9b4..bd71755f0b1 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -293,7 +293,7 @@ st_buffer_destroy(struct st_buffer *st_buf) { if(st_buf) { struct pipe_winsys *winsys = st_buf->st_dev->screen->winsys; - pipe_buffer_reference(winsys, &st_buf->buffer, NULL); + pipe_buffer_reference(pipe->screen, &st_buf->buffer, NULL); FREE(st_buf); } } diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index 2d4f5434b35..f62113a4691 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -221,7 +221,7 @@ st_softpipe_surface_release(struct pipe_winsys *winsys, surf->refcount--; if (surf->refcount == 0) { if (surf->buffer) - pipe_buffer_reference(winsys, &surf->buffer, NULL); + winsys_buffer_reference(winsys, &surf->buffer, NULL); free(surf); } *s = NULL; -- cgit v1.2.3 From 78435d9142b4762cdf7193729bcd3148d990de3d Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 4 Sep 2008 09:33:10 +0900 Subject: python: Use pipe_buffer_* inlines as much as possible. --- src/gallium/state_trackers/python/gallium.i | 2 +- src/gallium/state_trackers/python/p_context.i | 16 ++++++++-------- src/gallium/state_trackers/python/p_texture.i | 6 +++--- src/gallium/state_trackers/python/st_device.c | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/gallium/state_trackers/python') diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i index a67372c6239..68d2db3325a 100644 --- a/src/gallium/state_trackers/python/gallium.i +++ b/src/gallium/state_trackers/python/gallium.i @@ -46,7 +46,7 @@ #include "pipe/p_shader_tokens.h" #include "cso_cache/cso_context.h" #include "util/u_draw_quad.h" -#include "util/p_tile.h" +#include "util/u_tile.h" #include "tgsi/tgsi_text.h" #include "tgsi/tgsi_dump.h" diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 231e07cd637..1fdcec639f7 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -225,30 +225,30 @@ struct st_context { const float *vertices) { struct pipe_context *pipe = $self->pipe; - struct pipe_winsys *winsys = pipe->winsys; + struct pipe_screen *screen = pipe->screen; struct pipe_buffer *vbuf; float *map; unsigned size; size = num_verts * num_attribs * 4 * sizeof(float); - vbuf = winsys->buffer_create(winsys, - 32, - PIPE_BUFFER_USAGE_VERTEX, - size); + vbuf = pipe_buffer_create(screen, + 32, + PIPE_BUFFER_USAGE_VERTEX, + size); if(!vbuf) goto error1; - map = winsys->buffer_map(winsys, vbuf, PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map(screen, vbuf, PIPE_BUFFER_USAGE_CPU_WRITE); if (!map) goto error2; memcpy(map, vertices, size); - pipe->winsys->buffer_unmap(pipe->winsys, vbuf); + pipe_buffer_unmap(screen, vbuf); util_draw_vertex_buffer(pipe, vbuf, prim, num_verts, num_attribs); error2: - pipe_buffer_reference(pipe->screen, &vbuf, NULL); + pipe_buffer_reference(screen, &vbuf, NULL); error1: ; } diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index f23afea1677..33fb3743cce 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -180,7 +180,7 @@ struct st_buffer { } void write( const char *STRING, unsigned LENGTH, unsigned offset = 0) { - struct pipe_winsys *winsys = $self->st_dev->screen->winsys; + struct pipe_screen *screen = $self->st_dev->screen; char *map; assert($self->buffer->refcount); @@ -195,10 +195,10 @@ struct st_buffer { return; } - map = winsys->buffer_map(winsys, $self->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); + map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_WRITE); if(map) { memcpy(map + offset, STRING, LENGTH); - winsys->buffer_unmap(winsys, $self->buffer); + pipe_buffer_unmap(screen, $self->buffer); } } }; diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index bd71755f0b1..95c1378a032 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -292,8 +292,8 @@ void st_buffer_destroy(struct st_buffer *st_buf) { if(st_buf) { - struct pipe_winsys *winsys = st_buf->st_dev->screen->winsys; - pipe_buffer_reference(pipe->screen, &st_buf->buffer, NULL); + struct pipe_screen *screen = st_buf->st_dev->screen; + pipe_buffer_reference(screen, &st_buf->buffer, NULL); FREE(st_buf); } } @@ -303,7 +303,7 @@ struct st_buffer * st_buffer_create(struct st_device *st_dev, unsigned alignment, unsigned usage, unsigned size) { - struct pipe_winsys *winsys = st_dev->screen->winsys; + struct pipe_screen *screen = st_dev->screen; struct st_buffer *st_buf; st_buf = CALLOC_STRUCT(st_buffer); @@ -312,7 +312,7 @@ st_buffer_create(struct st_device *st_dev, st_buf->st_dev = st_dev; - st_buf->buffer = winsys->buffer_create(winsys, alignment, usage, size); + st_buf->buffer = pipe_buffer_create(screen, alignment, usage, size); if(!st_buf->buffer) { st_buffer_destroy(st_buf); return NULL; -- cgit v1.2.3 From 46efe73daf4784da95ff5b38e5ec13474addcd93 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 4 Sep 2008 22:23:32 +0900 Subject: python: Cleanup tri example. --- src/gallium/state_trackers/python/samples/tri.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/gallium/state_trackers/python') diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index 1271c67627d..193479f7d6c 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -167,7 +167,6 @@ def test(dev): 1:MOV OUT[1], IN[1] 2:END ''') - #vs.dump() ctx.set_vertex_shader(vs) # fragment shader @@ -178,7 +177,6 @@ def test(dev): 0:MOV OUT[0], IN[0] 1:END ''') - #fs.dump() ctx.set_fragment_shader(fs) nverts = 3 @@ -218,6 +216,7 @@ 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)) -- cgit v1.2.3