It adds nothing, now that pipe_buffer has a pointer to the screen.
%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;
}
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);
}
unsigned stride,
unsigned max_index,
unsigned buffer_offset,
- struct st_buffer *buffer)
+ struct pipe_buffer *buffer)
{
unsigned i;
struct pipe_vertex_buffer state;
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));
$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);
}
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);
}
};
%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;
};
-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);
}
};
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;
-}
-
struct st_winsys;
-struct st_buffer {
- struct st_device *st_dev;
-
- struct pipe_buffer *buffer;
-};
-
-
struct st_context {
struct st_device *st_dev;
};
-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);