summaryrefslogtreecommitdiffstats
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/gallium.i3
-rw-r--r--src/gallium/state_trackers/python/p_context.i165
-rw-r--r--src/gallium/state_trackers/python/p_device.i22
-rw-r--r--src/gallium/state_trackers/python/p_state.i4
-rw-r--r--src/gallium/state_trackers/python/p_texture.i157
-rw-r--r--src/gallium/state_trackers/python/st_device.c36
-rw-r--r--src/gallium/state_trackers/python/st_device.h6
-rw-r--r--src/gallium/state_trackers/python/st_sample.c24
8 files changed, 203 insertions, 214 deletions
diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i
index aeed1cd118c..c6084f78aee 100644
--- a/src/gallium/state_trackers/python/gallium.i
+++ b/src/gallium/state_trackers/python/gallium.i
@@ -72,9 +72,8 @@
%rename(Device) st_device;
%rename(Context) st_context;
-%rename(Texture) pipe_texture;
+%rename(Resource) pipe_resource;
%rename(Surface) st_surface;
-%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 02ce5647eb6..882219f4bc5 100644
--- a/src/gallium/state_trackers/python/p_context.i
+++ b/src/gallium/state_trackers/python/p_context.i
@@ -144,7 +144,7 @@ struct st_context {
}
void set_constant_buffer(unsigned shader, unsigned index,
- struct pipe_buffer *buffer )
+ struct pipe_resource *buffer )
{
$self->pipe->set_constant_buffer($self->pipe, shader, index, buffer);
}
@@ -168,7 +168,7 @@ struct st_context {
}
void set_fragment_sampler_texture(unsigned index,
- struct pipe_texture *texture) {
+ struct pipe_resource *texture) {
struct pipe_sampler_view templ;
if(!texture)
@@ -186,7 +186,7 @@ struct st_context {
}
void set_vertex_sampler_texture(unsigned index,
- struct pipe_texture *texture) {
+ struct pipe_resource *texture) {
struct pipe_sampler_view templ;
if(!texture)
@@ -208,7 +208,7 @@ struct st_context {
unsigned stride,
unsigned max_index,
unsigned buffer_offset,
- struct pipe_buffer *buffer)
+ struct pipe_resource *buffer)
{
unsigned i;
struct pipe_vertex_buffer state;
@@ -252,7 +252,7 @@ struct st_context {
$self->pipe->draw_arrays($self->pipe, mode, start, count);
}
- void draw_elements( struct pipe_buffer *indexBuffer,
+ void draw_elements( struct pipe_resource *indexBuffer,
unsigned indexSize,
unsigned mode, unsigned start, unsigned count)
{
@@ -262,7 +262,7 @@ struct st_context {
mode, start, count);
}
- void draw_range_elements( struct pipe_buffer *indexBuffer,
+ void draw_range_elements( struct pipe_resource *indexBuffer,
unsigned indexSize, unsigned minIndex, unsigned maxIndex,
unsigned mode, unsigned start, unsigned count)
{
@@ -279,7 +279,8 @@ struct st_context {
{
struct pipe_context *pipe = $self->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_buffer *vbuf;
+ struct pipe_resource *vbuf;
+ struct pipe_transfer *transfer;
struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
struct pipe_vertex_buffer vbuffer;
float *map;
@@ -289,17 +290,16 @@ struct st_context {
size = num_verts * num_attribs * 4 * sizeof(float);
vbuf = pipe_buffer_create(screen,
- 32,
- PIPE_BUFFER_USAGE_VERTEX,
+ PIPE_BIND_VERTEX_BUFFER,
size);
if(!vbuf)
goto error1;
-
- map = pipe_buffer_map(screen, vbuf, PIPE_BUFFER_USAGE_CPU_WRITE);
+
+ map = pipe_buffer_map(pipe, vbuf, PIPE_TRANSFER_WRITE, &transfer);
if (!map)
goto error2;
memcpy(map, vertices, size);
- pipe_buffer_unmap(screen, vbuf);
+ pipe_buffer_unmap(pipe, vbuf, transfer);
cso_save_vertex_elements($self->cso);
@@ -326,7 +326,7 @@ struct st_context {
cso_restore_vertex_elements($self->cso);
error2:
- pipe_buffer_reference(&vbuf, NULL);
+ pipe_resource_reference(&vbuf, NULL);
error1:
;
}
@@ -362,11 +362,11 @@ error1:
struct pipe_surface *_dst = NULL;
struct pipe_surface *_src = NULL;
- _dst = st_pipe_surface(dst, PIPE_BUFFER_USAGE_GPU_WRITE);
+ _dst = st_pipe_surface(dst, PIPE_BIND_BLIT_DESTINATION);
if(!_dst)
SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
- _src = st_pipe_surface(src, PIPE_BUFFER_USAGE_GPU_READ);
+ _src = st_pipe_surface(src, PIPE_BIND_BLIT_SOURCE);
if(!_src)
SWIG_exception(SWIG_ValueError, "couldn't acquire source surface for reading");
@@ -384,7 +384,7 @@ error1:
{
struct pipe_surface *_dst = NULL;
- _dst = st_pipe_surface(dst, PIPE_BUFFER_USAGE_GPU_WRITE);
+ _dst = st_pipe_surface(dst, PIPE_BIND_BLIT_DESTINATION);
if(!_dst)
SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
@@ -400,7 +400,7 @@ error1:
unsigned x, unsigned y, unsigned w, unsigned h,
char **STRING, int *LENGTH)
{
- struct pipe_texture *texture = surface->texture;
+ struct pipe_resource *texture = surface->texture;
struct pipe_context *pipe = $self->pipe;
struct pipe_transfer *transfer;
unsigned stride;
@@ -411,16 +411,16 @@ error1:
if(!*STRING)
return;
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_READ,
- x, y, w, h);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
if(transfer) {
pipe_get_tile_raw(pipe, transfer, 0, 0, w, h, *STRING, stride);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
}
@@ -430,7 +430,7 @@ error1:
unsigned x, unsigned y, unsigned w, unsigned h,
const char *STRING, unsigned LENGTH, unsigned stride = 0)
{
- struct pipe_texture *texture = surface->texture;
+ struct pipe_resource *texture = surface->texture;
struct pipe_context *pipe = $self->pipe;
struct pipe_transfer *transfer;
@@ -440,18 +440,18 @@ error1:
if(LENGTH < util_format_get_nblocksy(texture->format, h) * stride)
SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
if(!transfer)
SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer");
pipe_put_tile_raw(pipe, transfer, 0, 0, w, h, STRING, stride);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
fail:
return;
@@ -464,16 +464,16 @@ error1:
{
struct pipe_context *pipe = $self->pipe;
struct pipe_transfer *transfer;
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_READ,
- x, y, w, h);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
if(transfer) {
pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
}
@@ -484,16 +484,16 @@ error1:
{
struct pipe_context *pipe = $self->pipe;
struct pipe_transfer *transfer;
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
if(transfer) {
pipe_put_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
}
@@ -526,14 +526,13 @@ error1:
rgba8 = (unsigned char *) *STRING;
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_READ,
- x, y,
- w, h);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
if(transfer) {
pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba);
for(j = 0; j < h; ++j) {
@@ -541,7 +540,7 @@ error1:
for(k = 0; k <4; ++k)
rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]);
}
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
free(rgba);
@@ -554,16 +553,16 @@ error1:
{
struct pipe_context *pipe = $self->pipe;
struct pipe_transfer *transfer;
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_READ,
- x, y, w, h);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
if(transfer) {
pipe_get_tile_z(pipe, transfer, 0, 0, w, h, z);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
}
@@ -574,16 +573,16 @@ error1:
{
struct pipe_context *pipe = $self->pipe;
struct pipe_transfer *transfer;
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_WRITE,
- x, y, w, h);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_WRITE,
+ x, y, w, h);
if(transfer) {
pipe_put_tile_z(pipe, transfer, 0, 0, w, h, z);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
}
@@ -611,20 +610,20 @@ error1:
if(!rgba2)
return ~0;
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_READ,
- x, y, w, h);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_READ,
+ x, y, w, h);
if(!transfer) {
FREE(rgba2);
return ~0;
}
pipe_get_tile_rgba(pipe, transfer, 0, 0, w, h, rgba2);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
p1 = rgba;
p2 = rgba2;
diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i
index 0eba488a078..18d5efcffb1 100644
--- a/src/gallium/state_trackers/python/p_device.i
+++ b/src/gallium/state_trackers/python/p_device.i
@@ -81,7 +81,7 @@ struct st_device {
/**
* Check if the given pipe_format is supported as a texture or
* drawing surface.
- * \param type one of PIPE_TEXTURE, PIPE_SURFACE
+ * \param tex_usage bitmask of PIPE_BIND flags
*/
int is_format_supported( enum pipe_format format,
enum pipe_texture_target target,
@@ -89,7 +89,7 @@ struct st_device {
unsigned geom_flags ) {
/* We can't really display surfaces with the python statetracker so mask
* out that usage */
- tex_usage &= ~PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ tex_usage &= ~PIPE_BIND_DISPLAY_TARGET;
return $self->screen->is_format_supported( $self->screen,
format,
@@ -103,7 +103,7 @@ struct st_device {
return st_context_create($self);
}
- struct pipe_texture *
+ struct pipe_resource *
texture_create(
enum pipe_format format,
unsigned width,
@@ -113,11 +113,11 @@ struct st_device {
enum pipe_texture_target target = PIPE_TEXTURE_2D,
unsigned tex_usage = 0
) {
- struct pipe_texture templat;
+ struct pipe_resource templat;
/* We can't really display surfaces with the python statetracker so mask
* out that usage */
- tex_usage &= ~PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ tex_usage &= ~PIPE_BIND_DISPLAY_TARGET;
memset(&templat, 0, sizeof(templat));
templat.format = format;
@@ -126,14 +126,14 @@ struct st_device {
templat.depth0 = depth;
templat.last_level = last_level;
templat.target = target;
- templat.tex_usage = tex_usage;
+ templat.bind = tex_usage;
- return $self->screen->texture_create($self->screen, &templat);
+ return $self->screen->resource_create($self->screen, &templat);
}
-
- struct pipe_buffer *
- buffer_create(unsigned size, unsigned alignment = 0, unsigned usage = 0) {
- return pipe_buffer_create($self->screen, alignment, usage, size);
+
+ struct pipe_resource *
+ buffer_create(unsigned size, unsigned bind = 0) {
+ return pipe_buffer_create($self->screen, bind, size);
}
};
diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i
index eda77b56f8e..c1e6ea1b43c 100644
--- a/src/gallium/state_trackers/python/p_state.i
+++ b/src/gallium/state_trackers/python/p_state.i
@@ -114,7 +114,7 @@
SWIG_exception(SWIG_ValueError, "index out of bounds");
if(surface) {
- _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE);
+ _surface = st_pipe_surface(surface, PIPE_BIND_RENDER_TARGET);
if(!_surface)
SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
}
@@ -131,7 +131,7 @@
struct pipe_surface *_surface = NULL;
if(surface) {
- _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE);
+ _surface = st_pipe_surface(surface, PIPE_BIND_DEPTH_STENCIL);
if(!_surface)
SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
}
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
index 923a6285289..1208976905d 100644
--- a/src/gallium/state_trackers/python/p_texture.i
+++ b/src/gallium/state_trackers/python/p_texture.i
@@ -33,97 +33,144 @@
*/
-%nodefaultctor pipe_texture;
+%nodefaultctor pipe_resource;
%nodefaultctor st_surface;
-%nodefaultctor pipe_buffer;
-%nodefaultdtor pipe_texture;
+%nodefaultdtor pipe_resource;
%nodefaultdtor st_surface;
-%nodefaultdtor pipe_buffer;
-%ignore pipe_texture::screen;
+%ignore pipe_resource::screen;
%immutable st_surface::texture;
%immutable st_surface::face;
%immutable st_surface::level;
%immutable st_surface::zslice;
-%newobject pipe_texture::get_surface;
+%newobject pipe_resource::get_surface;
+/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */
+%rename(read) read_;
+%rename(write) write_;
-%extend pipe_texture {
-
- ~pipe_texture() {
- struct pipe_texture *ptr = $self;
- pipe_texture_reference(&ptr, NULL);
+%extend pipe_resource {
+
+ ~pipe_resource() {
+ struct pipe_resource *ptr = $self;
+ pipe_resource_reference(&ptr, NULL);
}
-
+
unsigned get_width(unsigned level=0) {
return u_minify($self->width0, level);
}
-
+
unsigned get_height(unsigned level=0) {
return u_minify($self->height0, level);
}
-
+
unsigned get_depth(unsigned level=0) {
return u_minify($self->depth0, level);
}
-
+
/** Get a surface which is a "view" into a texture */
struct st_surface *
get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0)
{
struct st_surface *surface;
-
+
if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6U : 1U))
SWIG_exception(SWIG_ValueError, "face out of bounds");
if(level > $self->last_level)
SWIG_exception(SWIG_ValueError, "level out of bounds");
if(zslice >= u_minify($self->depth0, level))
SWIG_exception(SWIG_ValueError, "zslice out of bounds");
-
+
surface = CALLOC_STRUCT(st_surface);
if(!surface)
return NULL;
-
- pipe_texture_reference(&surface->texture, $self);
+
+ pipe_resource_reference(&surface->texture, $self);
surface->face = face;
surface->level = level;
surface->zslice = zslice;
-
+
return surface;
fail:
return NULL;
}
-
+
+ unsigned __len__(void)
+ {
+ assert($self->target == PIPE_BUFFER);
+ assert(p_atomic_read(&$self->reference.count) > 0);
+ return $self->width0;
+ }
+
+ %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
+ void read_(char **STRING, int *LENGTH)
+ {
+ struct pipe_screen *screen = $self->screen;
+ /* XXX need context here not screen */
+
+ assert($self->target == PIPE_BUFFER);
+ assert(p_atomic_read(&$self->reference.count) > 0);
+
+ *LENGTH = $self->width0;
+ *STRING = (char *) malloc($self->width0);
+ if(!*STRING)
+ return;
+
+ pipe_buffer_read(screen, $self, 0, $self->width0, *STRING);
+ }
+
+ %cstring_input_binary(const char *STRING, unsigned LENGTH);
+ void write_(const char *STRING, unsigned LENGTH, unsigned offset = 0)
+ {
+ struct pipe_screen *screen = $self->screen;
+ /* XXX need context here not screen */
+
+ assert($self->target == PIPE_BUFFER);
+ assert(p_atomic_read(&$self->reference.count) > 0);
+
+ if(offset > $self->width0)
+ SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
+
+ if(offset + LENGTH > $self->width0)
+ SWIG_exception(SWIG_ValueError, "data length must fit inside the buffer");
+
+ pipe_buffer_write(screen, $self, offset, LENGTH, STRING);
+
+fail:
+ return;
+ }
+
+
};
struct st_surface
{
%immutable;
-
- struct pipe_texture *texture;
+
+ struct pipe_resource *texture;
unsigned face;
unsigned level;
unsigned zslice;
-
+
};
%extend st_surface {
-
+
%immutable;
-
+
unsigned format;
unsigned width;
unsigned height;
-
+
~st_surface() {
- pipe_texture_reference(&$self->texture, NULL);
+ pipe_resource_reference(&$self->texture, NULL);
FREE($self);
}
-
+
};
@@ -146,55 +193,3 @@ struct st_surface
return u_minify(surface->texture->height0, surface->level);
}
%}
-
-/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */
-%rename(read) read_;
-%rename(write) write_;
-
-%extend pipe_buffer {
-
- ~pipe_buffer() {
- struct pipe_buffer *ptr = $self;
- pipe_buffer_reference(&ptr, NULL);
- }
-
- unsigned __len__(void)
- {
- 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)
- {
- struct pipe_screen *screen = $self->screen;
-
- assert(p_atomic_read(&$self->reference.count) > 0);
-
- *LENGTH = $self->size;
- *STRING = (char *) malloc($self->size);
- if(!*STRING)
- return;
-
- 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)
- {
- struct pipe_screen *screen = $self->screen;
-
- assert(p_atomic_read(&$self->reference.count) > 0);
-
- if(offset > $self->size)
- SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
-
- if(offset + LENGTH > $self->size)
- SWIG_exception(SWIG_ValueError, "data length must fit inside the buffer");
-
- pipe_buffer_write(screen, $self, offset, LENGTH, STRING);
-
-fail:
- return;
- }
-};
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 4f227a092c5..135acad45e1 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -129,7 +129,7 @@ st_context_destroy(struct st_context *st_ctx)
pipe_sampler_view_reference(&st_ctx->fragment_sampler_views[i], NULL);
for(i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; ++i)
pipe_sampler_view_reference(&st_ctx->vertex_sampler_views[i], NULL);
- pipe_texture_reference(&st_ctx->default_texture, NULL);
+ pipe_resource_reference(&st_ctx->default_texture, NULL);
FREE(st_ctx);
@@ -231,8 +231,7 @@ st_context_create(struct st_device *st_dev)
{
struct pipe_context *pipe = st_ctx->pipe;
struct pipe_screen *screen = st_dev->screen;
- struct pipe_texture templat;
- struct pipe_transfer *transfer;
+ struct pipe_resource templat;
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view;
unsigned i;
@@ -245,24 +244,21 @@ st_context_create(struct st_device *st_dev)
templat.depth0 = 1;
templat.last_level = 0;
- st_ctx->default_texture = screen->texture_create( screen, &templat );
+ st_ctx->default_texture = screen->resource_create( screen, &templat );
if(st_ctx->default_texture) {
- transfer = pipe->get_tex_transfer(pipe,
- st_ctx->default_texture,
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- 0, 0,
- st_ctx->default_texture->width0,
- st_ctx->default_texture->height0);
- if (transfer) {
- uint32_t *map;
- map = (uint32_t *) pipe->transfer_map(pipe, transfer);
- if(map) {
- *map = 0x00000000;
- pipe->transfer_unmap(pipe, transfer);
- }
- pipe->tex_transfer_destroy(pipe, transfer);
- }
+ struct pipe_box box;
+ uint32_t zero = 0;
+
+ u_box_origin_2d( 1, 1, &box );
+
+ pipe->transfer_inline_write(pipe,
+ st_ctx->default_texture,
+ u_subresource(0,0),
+ PIPE_TRANSFER_WRITE,
+ &box,
+ &zero,
+ sizeof zero,
+ 0);
}
u_sampler_view_default_template(&view_templ,
diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h
index dcd0dc6e273..2dca7a1974e 100644
--- a/src/gallium/state_trackers/python/st_device.h
+++ b/src/gallium/state_trackers/python/st_device.h
@@ -40,7 +40,7 @@ struct st_winsys;
struct st_surface
{
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
unsigned face;
unsigned level;
unsigned zslice;
@@ -59,7 +59,7 @@ struct st_context
void *fs;
void *gs;
- struct pipe_texture *default_texture;
+ struct pipe_resource *default_texture;
struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
@@ -85,7 +85,7 @@ struct st_device
static INLINE struct pipe_surface *
st_pipe_surface(struct st_surface *surface, unsigned usage)
{
- struct pipe_texture *texture = surface->texture;
+ struct pipe_resource *texture = surface->texture;
struct pipe_screen *screen = texture->screen;
return screen->get_tex_surface(screen, texture, surface->face, surface->level, surface->zslice, usage);
}
diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c
index 218a77fb0a1..25bfbf1ab73 100644
--- a/src/gallium/state_trackers/python/st_sample.c
+++ b/src/gallium/state_trackers/python/st_sample.c
@@ -546,22 +546,22 @@ st_sample_surface(struct pipe_context *pipe,
float *rgba,
boolean norm)
{
- struct pipe_texture *texture = surface->texture;
+ struct pipe_resource *texture = surface->texture;
unsigned width = u_minify(texture->width0, surface->level);
unsigned height = u_minify(texture->height0, surface->level);
uint rgba_stride = width * 4;
struct pipe_transfer *transfer;
void *raw;
- transfer = pipe->get_tex_transfer(pipe,
- surface->texture,
- surface->face,
- surface->level,
- surface->zslice,
- PIPE_TRANSFER_WRITE,
- 0, 0,
- width,
- height);
+ transfer = pipe_get_transfer(pipe,
+ surface->texture,
+ surface->face,
+ surface->level,
+ surface->zslice,
+ PIPE_TRANSFER_WRITE,
+ 0, 0,
+ width,
+ height);
if (!transfer)
return;
@@ -590,6 +590,6 @@ st_sample_surface(struct pipe_context *pipe,
pipe->transfer_unmap(pipe, transfer);
}
-
- pipe->tex_transfer_destroy(pipe, transfer);
+
+ pipe->transfer_destroy(pipe, transfer);
}