aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/python
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2009-03-26 11:19:15 +0000
committerJosé Fonseca <[email protected]>2009-03-26 11:19:15 +0000
commitd18c2ee3d5a1d0352a6f8d48aa067e8983dd5878 (patch)
treed396ece8190d0a163b7e65a4f90489156fbc2af6 /src/gallium/state_trackers/python
parentca9d2044a2390267477f1e7118b16f21f2557dd3 (diff)
python: Drop st_buffer.
It adds nothing, now that pipe_buffer has a pointer to the screen.
Diffstat (limited to 'src/gallium/state_trackers/python')
-rw-r--r--src/gallium/state_trackers/python/gallium.i2
-rw-r--r--src/gallium/state_trackers/python/p_context.i16
-rw-r--r--src/gallium/state_trackers/python/p_device.i4
-rw-r--r--src/gallium/state_trackers/python/p_texture.i44
-rw-r--r--src/gallium/state_trackers/python/st_device.c34
-rw-r--r--src/gallium/state_trackers/python/st_device.h14
6 files changed, 34 insertions, 80 deletions
diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i
index 79e68de1df8..8b43c1721ef 100644
--- a/src/gallium/state_trackers/python/gallium.i
+++ b/src/gallium/state_trackers/python/gallium.i
@@ -72,7 +72,7 @@
%rename(Context) st_context;
%rename(Texture) pipe_texture;
%rename(Surface) pipe_surface;
-%rename(Buffer) st_buffer;
+%rename(Buffer) pipe_buffer;
%rename(BlendColor) pipe_blend_color;
%rename(Blend) pipe_blend_state;
diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i
index 178ab0e24ef..05f3f222035 100644
--- a/src/gallium/state_trackers/python/p_context.i
+++ b/src/gallium/state_trackers/python/p_context.i
@@ -116,11 +116,11 @@ struct st_context {
}
void set_constant_buffer(unsigned shader, unsigned index,
- struct st_buffer *buffer )
+ struct pipe_buffer *buffer )
{
struct pipe_constant_buffer state;
memset(&state, 0, sizeof(state));
- state.buffer = buffer ? buffer->buffer : NULL;
+ state.buffer = buffer;
$self->pipe->set_constant_buffer($self->pipe, shader, index, &state);
}
@@ -154,7 +154,7 @@ struct st_context {
unsigned stride,
unsigned max_index,
unsigned buffer_offset,
- struct st_buffer *buffer)
+ struct pipe_buffer *buffer)
{
unsigned i;
struct pipe_vertex_buffer state;
@@ -163,7 +163,7 @@ struct st_context {
state.stride = stride;
state.max_index = max_index;
state.buffer_offset = buffer_offset;
- state.buffer = buffer ? buffer->buffer : NULL;
+ state.buffer = buffer;
memcpy(&$self->vertex_buffers[index], &state, sizeof(state));
@@ -198,22 +198,22 @@ struct st_context {
$self->pipe->draw_arrays($self->pipe, mode, start, count);
}
- void draw_elements( struct st_buffer *indexBuffer,
+ void draw_elements( struct pipe_buffer *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
$self->pipe->draw_elements($self->pipe,
- indexBuffer->buffer,
+ indexBuffer,
indexSize,
mode, start, count);
}
- void draw_range_elements( struct st_buffer *indexBuffer,
+ void draw_range_elements( struct pipe_buffer *indexBuffer,
unsigned indexSize, unsigned minIndex, unsigned maxIndex,
unsigned mode, unsigned start, unsigned count)
{
$self->pipe->draw_range_elements($self->pipe,
- indexBuffer->buffer,
+ indexBuffer,
indexSize, minIndex, maxIndex,
mode, start, count);
}
diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i
index 84fd2e4349b..f16fe5b0ff7 100644
--- a/src/gallium/state_trackers/python/p_device.i
+++ b/src/gallium/state_trackers/python/p_device.i
@@ -122,9 +122,9 @@ struct st_device {
return $self->screen->texture_create($self->screen, &templat);
}
- struct st_buffer *
+ struct pipe_buffer *
buffer_create(unsigned size, unsigned alignment = 0, unsigned usage = 0) {
- return st_buffer_create($self, alignment, usage, size);
+ return pipe_buffer_create($self->screen, alignment, usage, size);
}
};
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
index 4648af691d1..63c63db9ebe 100644
--- a/src/gallium/state_trackers/python/p_texture.i
+++ b/src/gallium/state_trackers/python/p_texture.i
@@ -35,11 +35,11 @@
%nodefaultctor pipe_texture;
%nodefaultctor pipe_surface;
-%nodefaultctor st_buffer;
+%nodefaultctor pipe_buffer;
%nodefaultdtor pipe_texture;
%nodefaultdtor pipe_surface;
-%nodefaultdtor st_buffer;
+%nodefaultdtor pipe_buffer;
%ignore pipe_texture::screen;
@@ -308,53 +308,55 @@
};
-struct st_buffer {
-};
+/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */
+%rename(read) pipe_buffer_read_;
+%rename(write) pipe_buffer_write_;
-%extend st_buffer {
+%extend pipe_buffer {
- ~st_buffer() {
- st_buffer_destroy($self);
+ ~pipe_buffer() {
+ struct pipe_buffer *ptr = $self;
+ pipe_buffer_reference(&ptr, NULL);
}
unsigned __len__(void)
{
- assert(p_atomic_read(&$self->buffer->reference.count) > 0);
- return $self->buffer->size;
+ assert(p_atomic_read(&$self->reference.count) > 0);
+ return $self->size;
}
%cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
- void read(char **STRING, int *LENGTH)
+ void read_(char **STRING, int *LENGTH)
{
- struct pipe_screen *screen = $self->st_dev->screen;
+ struct pipe_screen *screen = $self->screen;
- assert(p_atomic_read(&$self->buffer->reference.count) > 0);
+ assert(p_atomic_read(&$self->reference.count) > 0);
- *LENGTH = $self->buffer->size;
- *STRING = (char *) malloc($self->buffer->size);
+ *LENGTH = $self->size;
+ *STRING = (char *) malloc($self->size);
if(!*STRING)
return;
- pipe_buffer_read(screen, $self->buffer, 0, $self->buffer->size, STRING);
+ pipe_buffer_read(screen, $self, 0, $self->size, STRING);
}
%cstring_input_binary(const char *STRING, unsigned LENGTH);
- void write(const char *STRING, unsigned LENGTH, unsigned offset = 0)
+ void write_(const char *STRING, unsigned LENGTH, unsigned offset = 0)
{
- struct pipe_screen *screen = $self->st_dev->screen;
+ struct pipe_screen *screen = $self->screen;
- assert(p_atomic_read(&$self->buffer->reference.count) > 0);
+ assert(p_atomic_read(&$self->reference.count) > 0);
- if(offset > $self->buffer->size) {
+ if(offset > $self->size) {
PyErr_SetString(PyExc_ValueError, "offset must be smaller than buffer size");
return;
}
- if(offset + LENGTH > $self->buffer->size) {
+ if(offset + LENGTH > $self->size) {
PyErr_SetString(PyExc_ValueError, "data length must fit inside the buffer");
return;
}
- pipe_buffer_write(screen, $self->buffer, offset, LENGTH, STRING);
+ pipe_buffer_write(screen, $self, offset, LENGTH, STRING);
}
};
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 366d4eb19af..b4f8649d3bc 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -291,37 +291,3 @@ st_context_create(struct st_device *st_dev)
return st_ctx;
}
-
-
-void
-st_buffer_destroy(struct st_buffer *st_buf)
-{
- if(st_buf) {
- pipe_buffer_reference(&st_buf->buffer, NULL);
- FREE(st_buf);
- }
-}
-
-
-struct st_buffer *
-st_buffer_create(struct st_device *st_dev,
- unsigned alignment, unsigned usage, unsigned size)
-{
- struct pipe_screen *screen = st_dev->screen;
- struct st_buffer *st_buf;
-
- st_buf = CALLOC_STRUCT(st_buffer);
- if(!st_buf)
- return NULL;
-
- st_buf->st_dev = st_dev;
-
- st_buf->buffer = pipe_buffer_create(screen, alignment, usage, size);
- if(!st_buf->buffer) {
- st_buffer_destroy(st_buf);
- return NULL;
- }
-
- return st_buf;
-}
-
diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h
index 0641aff149f..d1bd8c31f4f 100644
--- a/src/gallium/state_trackers/python/st_device.h
+++ b/src/gallium/state_trackers/python/st_device.h
@@ -38,13 +38,6 @@ struct pipe_context;
struct st_winsys;
-struct st_buffer {
- struct st_device *st_dev;
-
- struct pipe_buffer *buffer;
-};
-
-
struct st_context {
struct st_device *st_dev;
@@ -78,13 +71,6 @@ struct st_device {
};
-struct st_buffer *
-st_buffer_create(struct st_device *st_dev,
- unsigned alignment, unsigned usage, unsigned size);
-
-void
-st_buffer_destroy(struct st_buffer *st_buf);
-
struct st_context *
st_context_create(struct st_device *st_dev);