aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vega
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/vega')
-rw-r--r--src/gallium/state_trackers/vega/api_filters.c28
-rw-r--r--src/gallium/state_trackers/vega/api_images.c8
-rw-r--r--src/gallium/state_trackers/vega/api_masks.c7
-rw-r--r--src/gallium/state_trackers/vega/image.c32
-rw-r--r--src/gallium/state_trackers/vega/image.h2
-rw-r--r--src/gallium/state_trackers/vega/mask.c40
-rw-r--r--src/gallium/state_trackers/vega/mask.h2
-rw-r--r--src/gallium/state_trackers/vega/paint.c20
-rw-r--r--src/gallium/state_trackers/vega/paint.h2
-rw-r--r--src/gallium/state_trackers/vega/polygon.c9
-rw-r--r--src/gallium/state_trackers/vega/renderer.c61
-rw-r--r--src/gallium/state_trackers/vega/renderer.h8
-rw-r--r--src/gallium/state_trackers/vega/shader.c9
-rw-r--r--src/gallium/state_trackers/vega/st_inlines.h67
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c24
-rw-r--r--src/gallium/state_trackers/vega/vg_context.h10
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.c12
-rw-r--r--src/gallium/state_trackers/vega/vg_tracker.c36
-rw-r--r--src/gallium/state_trackers/vega/vg_tracker.h2
19 files changed, 178 insertions, 201 deletions
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index a643f38624f..b1c08af9382 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -57,14 +57,14 @@ struct filter_info {
struct pipe_sampler_view *extra_texture_view;
};
-static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
+static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx,
const VGuint *color_data,
const VGint color_data_len)
{
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_texture *tex = 0;
- struct pipe_texture templ;
+ struct pipe_resource *tex = 0;
+ struct pipe_resource templ;
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_1D;
@@ -73,20 +73,20 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx,
templ.width0 = color_data_len;
templ.height0 = 1;
templ.depth0 = 1;
- templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
+ templ.bind = PIPE_BIND_SAMPLER_VIEW;
- tex = screen->texture_create(screen, &templ);
+ tex = screen->resource_create(screen, &templ);
{ /* upload color_data */
struct pipe_transfer *transfer =
- pipe->get_tex_transfer(pipe, tex,
+ pipe_get_transfer(pipe, tex,
0, 0, 0,
PIPE_TRANSFER_READ_WRITE ,
0, 0, tex->width0, tex->height0);
void *map = pipe->transfer_map(pipe, transfer);
memcpy(map, color_data, sizeof(VGint)*color_data_len);
pipe->transfer_unmap(pipe, transfer);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
return tex;
@@ -97,7 +97,7 @@ static INLINE struct pipe_sampler_view *create_texture_1d_view(struct vg_context
const VGint color_data_len)
{
struct pipe_context *pipe = ctx->pipe;
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view;
@@ -109,7 +109,7 @@ static INLINE struct pipe_sampler_view *create_texture_1d_view(struct vg_context
u_sampler_view_default_template(&view_templ, texture, texture->format);
view = pipe->create_sampler_view(pipe, texture, &view_templ);
/* want the texture to go away if the view is freed */
- pipe_texture_reference(&texture, NULL);
+ pipe_resource_reference(&texture, NULL);
return view;
}
@@ -121,7 +121,7 @@ static INLINE struct pipe_surface * setup_framebuffer(struct vg_image *dst)
struct pipe_framebuffer_state fb;
struct pipe_surface *dst_surf = pipe->screen->get_tex_surface(
pipe->screen, dst->sampler_view->texture, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_RENDER_TARGET);
/* drawing dest */
memset(&fb, 0, sizeof(fb));
@@ -170,14 +170,14 @@ static void setup_constant_buffer(struct vg_context *ctx, const void *buffer,
VGint param_bytes)
{
struct pipe_context *pipe = ctx->pipe;
- struct pipe_buffer **cbuf = &ctx->filter.buffer;
+ struct pipe_resource **cbuf = &ctx->filter.buffer;
/* We always need to get a new buffer, to keep the drivers simple and
* avoid gratuitous rendering synchronization. */
- pipe_buffer_reference(cbuf, NULL);
+ pipe_resource_reference(cbuf, NULL);
- *cbuf = pipe_buffer_create(pipe->screen, 16,
- PIPE_BUFFER_USAGE_CONSTANT,
+ *cbuf = pipe_buffer_create(pipe->screen,
+ PIPE_BIND_CONSTANT_BUFFER,
param_bytes);
if (*cbuf) {
diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c
index fec473d9d23..6c7fd3b346c 100644
--- a/src/gallium/state_trackers/vega/api_images.c
+++ b/src/gallium/state_trackers/vega/api_images.c
@@ -441,9 +441,9 @@ void vgReadPixels(void * data, VGint dataStride,
{
struct pipe_transfer *transfer;
- transfer = pipe->get_tex_transfer(pipe, strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ,
- 0, 0, width, height);
+ transfer = pipe_get_transfer(pipe, strb->texture, 0, 0, 0,
+ PIPE_TRANSFER_READ,
+ 0, 0, width, height);
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
@@ -457,7 +457,7 @@ void vgReadPixels(void * data, VGint dataStride,
dst += dataStride;
}
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
}
diff --git a/src/gallium/state_trackers/vega/api_masks.c b/src/gallium/state_trackers/vega/api_masks.c
index 2f2d925252d..7c28ea5c872 100644
--- a/src/gallium/state_trackers/vega/api_masks.c
+++ b/src/gallium/state_trackers/vega/api_masks.c
@@ -51,7 +51,7 @@ draw_clear_quad(struct vg_context *st,
const VGfloat color[4])
{
struct pipe_context *pipe = st->pipe;
- struct pipe_buffer *buf;
+ struct pipe_resource *buf;
VGuint i;
/* positions */
@@ -81,7 +81,8 @@ draw_clear_quad(struct vg_context *st,
/* put vertex data into vbuf */
buf = pipe_user_buffer_create(pipe->screen,
st->clear.vertices,
- sizeof(st->clear.vertices));
+ sizeof(st->clear.vertices),
+ PIPE_BIND_VERTEX_BUFFER);
/* draw */
@@ -93,7 +94,7 @@ draw_clear_quad(struct vg_context *st,
4, /* verts */
2); /* attribs/vert */
- pipe_buffer_reference(&buf, NULL);
+ pipe_resource_reference(&buf, NULL);
}
}
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index c3268a84a60..9c323b1809c 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -81,7 +81,7 @@ static INLINE void vg_sync_size(VGfloat *src_loc, VGfloat *dst_loc)
static void vg_copy_texture(struct vg_context *ctx,
- struct pipe_texture *dst, VGint dx, VGint dy,
+ struct pipe_resource *dst, VGint dx, VGint dy,
struct pipe_sampler_view *src, VGint sx, VGint sy,
VGint width, VGint height)
{
@@ -217,9 +217,9 @@ void vg_copy_surface(struct vg_context *ctx,
}
-static struct pipe_texture *image_texture(struct vg_image *img)
+static struct pipe_resource *image_texture(struct vg_image *img)
{
- struct pipe_texture *tex = img->sampler_view->texture;
+ struct pipe_resource *tex = img->sampler_view->texture;
return tex;
}
@@ -251,7 +251,7 @@ struct vg_image * image_create(VGImageFormat format,
struct pipe_context *pipe = ctx->pipe;
struct vg_image *image = CALLOC_STRUCT(vg_image);
enum pipe_format pformat = vg_format_to_pipe(format);
- struct pipe_texture pt, *newtex;
+ struct pipe_resource pt, *newtex;
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view;
struct pipe_screen *screen = ctx->pipe->screen;
@@ -270,7 +270,7 @@ struct vg_image * image_create(VGImageFormat format,
image->sampler.normalized_coords = 1;
assert(screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_SAMPLER, 0));
+ PIPE_BIND_SAMPLER_VIEW, 0));
memset(&pt, 0, sizeof(pt));
pt.target = PIPE_TEXTURE_2D;
@@ -279,16 +279,16 @@ struct vg_image * image_create(VGImageFormat format,
pt.width0 = width;
pt.height0 = height;
pt.depth0 = 1;
- pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
+ pt.bind = PIPE_BIND_SAMPLER_VIEW;
- newtex = screen->texture_create(screen, &pt);
+ newtex = screen->resource_create(screen, &pt);
debug_assert(newtex);
u_sampler_view_default_template(&view_templ, newtex, newtex->format);
view = pipe->create_sampler_view(pipe, newtex, &view_templ);
/* want the texture to go away if the view is freed */
- pipe_texture_reference(&newtex, NULL);
+ pipe_resource_reference(&newtex, NULL);
image->sampler_view = view;
@@ -388,7 +388,7 @@ void image_sub_data(struct vg_image *image,
VGint i;
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
- struct pipe_texture *texture = image_texture(image);
+ struct pipe_resource *texture = image_texture(image);
VGint xoffset = 0, yoffset = 0;
if (x < 0) {
@@ -421,7 +421,7 @@ void image_sub_data(struct vg_image *image,
}
{ /* upload color_data */
- struct pipe_transfer *transfer = pipe->get_tex_transfer(
+ struct pipe_transfer *transfer = pipe_get_transfer(
pipe, texture, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0);
src += (dataStride * yoffset);
@@ -431,7 +431,7 @@ void image_sub_data(struct vg_image *image,
y += yStep;
src += dataStride;
}
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
}
@@ -452,7 +452,7 @@ void image_get_sub_data(struct vg_image * image,
{
struct pipe_transfer *transfer =
- pipe->get_tex_transfer(pipe,
+ pipe_get_transfer(pipe,
image->sampler_view->texture, 0, 0, 0,
PIPE_TRANSFER_READ,
0, 0,
@@ -469,7 +469,7 @@ void image_get_sub_data(struct vg_image * image,
dst += dataStride;
}
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
}
@@ -576,7 +576,7 @@ void image_set_pixels(VGint dx, VGint dy,
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
surf = screen->get_tex_surface(screen, image_texture(src), 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_READ);
+ PIPE_BIND_BLIT_SOURCE);
vg_copy_surface(ctx, strb->surface, dx, dy,
surf, sx+src->x, sy+src->y, width, height);
@@ -601,8 +601,8 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
surf = screen->get_tex_surface(screen, image_texture(dst), 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE |
- PIPE_BUFFER_USAGE_GPU_READ);
+ PIPE_BIND_BLIT_SOURCE);
+
vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,
strb->surface, sx, sy, width, height);
diff --git a/src/gallium/state_trackers/vega/image.h b/src/gallium/state_trackers/vega/image.h
index 805b35fab9f..a990c9c5873 100644
--- a/src/gallium/state_trackers/vega/image.h
+++ b/src/gallium/state_trackers/vega/image.h
@@ -30,7 +30,7 @@
#include "vg_context.h"
#include "pipe/p_state.h"
-struct pipe_texture;
+struct pipe_resource;
struct array;
struct vg_context;
struct pipe_surface;
diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c
index 316ea7a9c95..6d627b0e8da 100644
--- a/src/gallium/state_trackers/vega/mask.c
+++ b/src/gallium/state_trackers/vega/mask.c
@@ -143,7 +143,7 @@ static void read_alpha_mask(void * data, VGint dataStride,
struct pipe_surface *surf;
surf = screen->get_tex_surface(screen, strb->texture, 0, 0, 0,
- PIPE_BUFFER_USAGE_CPU_READ);
+ PIPE_BIND_TRANSFER_READ);
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
@@ -217,7 +217,7 @@ static void setup_mask_framebuffer(struct pipe_surface *surf,
static void setup_mask_operation(VGMaskOperation operation)
{
struct vg_context *ctx = vg_current_context();
- struct pipe_buffer **cbuf = &ctx->mask.cbuf;
+ struct pipe_resource **cbuf = &ctx->mask.cbuf;
const VGint param_bytes = 4 * sizeof(VGfloat);
const VGfloat ones[4] = {1.f, 1.f, 1.f, 1.f};
void *shader = 0;
@@ -225,10 +225,10 @@ static void setup_mask_operation(VGMaskOperation operation)
/* We always need to get a new buffer, to keep the drivers simple and
* avoid gratuitous rendering synchronization.
*/
- pipe_buffer_reference(cbuf, NULL);
+ pipe_resource_reference(cbuf, NULL);
- *cbuf = pipe_buffer_create(ctx->pipe->screen, 1,
- PIPE_BUFFER_USAGE_CONSTANT,
+ *cbuf = pipe_buffer_create(ctx->pipe->screen,
+ PIPE_BIND_CONSTANT_BUFFER,
param_bytes);
if (*cbuf) {
st_no_flush_pipe_buffer_write(ctx, *cbuf,
@@ -318,16 +318,16 @@ static void setup_mask_samplers(struct pipe_sampler_view *umask)
static void setup_mask_fill(const VGfloat color[4])
{
struct vg_context *ctx = vg_current_context();
- struct pipe_buffer **cbuf = &ctx->mask.cbuf;
+ struct pipe_resource **cbuf = &ctx->mask.cbuf;
const VGint param_bytes = 4 * sizeof(VGfloat);
/* We always need to get a new buffer, to keep the drivers simple and
* avoid gratuitous rendering synchronization.
*/
- pipe_buffer_reference(cbuf, NULL);
+ pipe_resource_reference(cbuf, NULL);
- *cbuf = pipe_buffer_create(ctx->pipe->screen, 1,
- PIPE_BUFFER_USAGE_CONSTANT,
+ *cbuf = pipe_buffer_create(ctx->pipe->screen,
+ PIPE_BIND_CONSTANT_BUFFER,
param_bytes);
if (*cbuf) {
st_no_flush_pipe_buffer_write(ctx, *cbuf, 0, param_bytes, color);
@@ -415,9 +415,9 @@ static void mask_using_texture(struct pipe_sampler_view *sampler_view,
VGint width, VGint height)
{
struct vg_context *ctx = vg_current_context();
- struct pipe_texture *texture = sampler_view->texture;
+ struct pipe_resource *texture = sampler_view->texture;
struct pipe_surface *surface =
- alpha_mask_surface(ctx, PIPE_BUFFER_USAGE_GPU_WRITE);
+ alpha_mask_surface(ctx, PIPE_BIND_RENDER_TARGET);
VGint offsets[4], loc[4];
if (!surface)
@@ -482,12 +482,12 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height)
mask->height = height;
{
- struct pipe_texture pt;
+ struct pipe_resource pt;
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = ctx->pipe->screen;
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view = NULL;
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
memset(&pt, 0, sizeof(pt));
pt.target = PIPE_TEXTURE_2D;
@@ -496,16 +496,16 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height)
pt.width0 = width;
pt.height0 = height;
pt.depth0 = 1;
- pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
+ pt.bind = PIPE_BIND_SAMPLER_VIEW;
pt.compressed = 0;
- texture = screen->texture_create(screen, &pt);
+ texture = screen->resource_create(screen, &pt);
if (texture) {
u_sampler_view_default_template(&view_templ, texture, texture->format);
view = pipe->create_sampler_view(pipe, texture, &view_templ);
}
- pipe_texture_reference(&texture, NULL);
+ pipe_resource_reference(&texture, NULL);
mask->sampler_view = view;
}
@@ -519,7 +519,7 @@ void mask_layer_destroy(struct vg_mask_layer *layer)
struct vg_context *ctx = vg_current_context();
vg_context_remove_object(ctx, VG_OBJECT_MASK, layer);
- pipe_texture_release(&layer->texture);
+ pipe_resource_release(&layer->texture);
free(layer);
}
@@ -537,7 +537,7 @@ void mask_layer_fill(struct vg_mask_layer *layer,
surface = ctx->pipe->screen->get_tex_surface(
ctx->pipe->screen, layer->sampler_view->texture,
0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_RENDER_TARGET);
surface_fill(surface,
layer->width, layer->height,
@@ -573,7 +573,7 @@ static void mask_layer_render_to(struct vg_mask_layer *layer,
struct pipe_surface *surface;
surface = screen->get_tex_surface(screen, layer->sampler_view->texture, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_RENDER_TARGET);
cso_save_framebuffer(ctx->cso_context);
cso_save_fragment_shader(ctx->cso_context);
@@ -664,7 +664,7 @@ void mask_fill(VGint x, VGint y, VGint width, VGint height,
struct vg_context *ctx = vg_current_context();
VGfloat alpha_color[4] = {.0f, .0f, .0f, value};
struct pipe_surface *surf = alpha_mask_surface(
- ctx, PIPE_BUFFER_USAGE_GPU_WRITE);
+ ctx, PIPE_BIND_RENDER_TARGET);
#if DEBUG_MASKS
debug_printf("mask_fill(%d, %d, %d, %d) with rgba(%f, %f, %f, %f)\n",
diff --git a/src/gallium/state_trackers/vega/mask.h b/src/gallium/state_trackers/vega/mask.h
index 4feacbefda8..c626402c864 100644
--- a/src/gallium/state_trackers/vega/mask.h
+++ b/src/gallium/state_trackers/vega/mask.h
@@ -31,7 +31,7 @@
struct path;
struct vg_image;
-struct pipe_texture;
+struct pipe_resource;
struct vg_mask_layer *mask_layer_create(VGint width, VGint height);
void mask_layer_destroy(struct vg_mask_layer *layer);
diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c
index 508e1863a57..05540e82752 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -79,7 +79,7 @@ struct vg_paint {
} pattern;
/* XXX next 3 all unneded? */
- struct pipe_buffer *cbuf;
+ struct pipe_resource *cbuf;
struct pipe_shader_state fs_state;
void *fs;
};
@@ -143,12 +143,12 @@ static INLINE void create_gradient_data(const VGfloat *ramp_stops,
data[size-1] = last_color;
}
-static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p)
+static INLINE struct pipe_resource *create_gradient_texture(struct vg_paint *p)
{
struct pipe_context *pipe = p->base.ctx->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_texture *tex = 0;
- struct pipe_texture templ;
+ struct pipe_resource *tex = 0;
+ struct pipe_resource templ;
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_1D;
@@ -157,18 +157,18 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p)
templ.width0 = 1024;
templ.height0 = 1;
templ.depth0 = 1;
- templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
+ templ.bind = PIPE_BIND_SAMPLER_VIEW;
- tex = screen->texture_create(screen, &templ);
+ tex = screen->resource_create(screen, &templ);
{ /* upload color_data */
struct pipe_transfer *transfer =
- st_no_flush_get_tex_transfer(p->base.ctx, tex, 0, 0, 0,
+ st_no_flush_get_transfer(p->base.ctx, tex, 0, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, 1024, 1);
void *map = pipe->transfer_map(pipe, transfer);
memcpy(map, p->gradient.color_data, sizeof(VGint)*1024);
pipe->transfer_unmap(pipe, transfer);
- pipe->tex_transfer_destroy(pipe, transfer);
+ pipe->transfer_destroy(pipe, transfer);
}
return tex;
@@ -177,7 +177,7 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p)
static INLINE struct pipe_sampler_view *create_gradient_sampler_view(struct vg_paint *p)
{
struct pipe_context *pipe = p->base.ctx->pipe;
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view;
@@ -189,7 +189,7 @@ static INLINE struct pipe_sampler_view *create_gradient_sampler_view(struct vg_p
u_sampler_view_default_template(&view_templ, texture, texture->format);
view = pipe->create_sampler_view(pipe, texture, &view_templ);
/* want the texture to go away if the view is freed */
- pipe_texture_reference(&texture, NULL);
+ pipe_resource_reference(&texture, NULL);
return view;
}
diff --git a/src/gallium/state_trackers/vega/paint.h b/src/gallium/state_trackers/vega/paint.h
index 9ea67c4b1e6..012cd3e5618 100644
--- a/src/gallium/state_trackers/vega/paint.h
+++ b/src/gallium/state_trackers/vega/paint.h
@@ -35,7 +35,7 @@
struct vg_paint;
struct vg_image;
struct pipe_sampler_state;
-struct pipe_texture;
+struct pipe_resource;
struct vg_paint *paint_create(struct vg_context *ctx);
void paint_destroy(struct vg_paint *paint);
diff --git a/src/gallium/state_trackers/vega/polygon.c b/src/gallium/state_trackers/vega/polygon.c
index eef2c1eb876..d2b7e489124 100644
--- a/src/gallium/state_trackers/vega/polygon.c
+++ b/src/gallium/state_trackers/vega/polygon.c
@@ -58,7 +58,7 @@ struct polygon
VGint num_verts;
VGboolean dirty;
- struct pipe_buffer *vbuf;
+ struct pipe_resource *vbuf;
struct pipe_screen *screen;
};
@@ -110,7 +110,7 @@ struct polygon * polygon_create_from_data(float *data, int size)
void polygon_destroy(struct polygon *poly)
{
if (poly->vbuf)
- pipe_buffer_reference(&poly->vbuf, NULL);
+ pipe_resource_reference(&poly->vbuf, NULL);
free(poly->data);
free(poly);
@@ -272,13 +272,14 @@ static void draw_polygon(struct vg_context *ctx,
if (poly->vbuf == NULL || poly->dirty) {
if (poly->vbuf) {
- pipe_buffer_reference(&poly->vbuf,
+ pipe_resource_reference(&poly->vbuf,
NULL);
}
poly->screen = pipe->screen;
poly->vbuf= pipe_user_buffer_create(poly->screen,
poly->data,
- vert_size);
+ vert_size,
+ PIPE_BIND_VERTEX_BUFFER);
poly->dirty = VG_FALSE;
}
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index 2bb4c8bc756..48fbc3b330e 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -61,7 +61,7 @@ static void setup_shaders(struct renderer *ctx)
ctx->fs = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D);
}
-static struct pipe_buffer *
+static struct pipe_resource *
setup_vertex_data(struct renderer *ctx,
float x0, float y0, float x1, float y1, float z)
{
@@ -91,10 +91,11 @@ setup_vertex_data(struct renderer *ctx,
return pipe_user_buffer_create( ctx->pipe->screen,
ctx->vertices,
- sizeof(ctx->vertices) );
+ sizeof(ctx->vertices),
+ PIPE_BIND_VERTEX_BUFFER);
}
-static struct pipe_buffer *
+static struct pipe_resource *
setup_vertex_data_tex(struct renderer *ctx,
float x0, float y0, float x1, float y1,
float s0, float t0, float s1, float t1,
@@ -126,11 +127,12 @@ setup_vertex_data_tex(struct renderer *ctx,
return pipe_user_buffer_create( ctx->pipe->screen,
ctx->vertices,
- sizeof(ctx->vertices) );
+ sizeof(ctx->vertices),
+ PIPE_BIND_VERTEX_BUFFER);
}
-static struct pipe_buffer *
+static struct pipe_resource *
setup_vertex_data_qtex(struct renderer *ctx,
float x0, float y0, float x1, float y1,
float x2, float y2, float x3, float y3,
@@ -163,7 +165,8 @@ setup_vertex_data_qtex(struct renderer *ctx,
return pipe_user_buffer_create( ctx->pipe->screen,
ctx->vertices,
- sizeof(ctx->vertices) );
+ sizeof(ctx->vertices),
+ PIPE_BIND_VERTEX_BUFFER);
}
struct renderer * renderer_create(struct vg_context *owner)
@@ -206,7 +209,7 @@ void renderer_draw_quad(struct renderer *r,
VGfloat x2, VGfloat y2,
VGfloat depth)
{
- struct pipe_buffer *buf;
+ struct pipe_resource *buf;
buf = setup_vertex_data(r, x1, y1, x2, y2, depth);
@@ -217,20 +220,20 @@ void renderer_draw_quad(struct renderer *r,
4, /* verts */
2); /* attribs/vert */
- pipe_buffer_reference( &buf,
+ pipe_resource_reference( &buf,
NULL );
}
}
void renderer_draw_texture(struct renderer *r,
- struct pipe_texture *tex,
+ struct pipe_resource *tex,
VGfloat x1offset, VGfloat y1offset,
VGfloat x2offset, VGfloat y2offset,
VGfloat x1, VGfloat y1,
VGfloat x2, VGfloat y2)
{
struct pipe_context *pipe = r->pipe;
- struct pipe_buffer *buf;
+ struct pipe_resource *buf;
VGfloat s0, t0, s1, t1;
assert(tex->width0 != 0);
@@ -256,7 +259,7 @@ void renderer_draw_texture(struct renderer *r,
4, /* verts */
2); /* attribs/vert */
- pipe_buffer_reference( &buf,
+ pipe_resource_reference( &buf,
NULL );
}
@@ -267,17 +270,17 @@ void renderer_copy_texture(struct renderer *ctx,
struct pipe_sampler_view *src,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
- struct pipe_texture *dst,
+ struct pipe_resource *dst,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2)
{
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_texture *tex = src->texture;
- struct pipe_buffer *buf;
+ struct pipe_resource *tex = src->texture;
+ struct pipe_resource *buf;
struct pipe_surface *dst_surf = screen->get_tex_surface(
screen, dst, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_RENDER_TARGET);
struct pipe_framebuffer_state fb;
float s0, t0, s1, t1;
@@ -304,7 +307,7 @@ void renderer_copy_texture(struct renderer *ctx,
#endif
assert(screen->is_format_supported(screen, dst_surf->format, PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
+ PIPE_BIND_RENDER_TARGET, 0));
/* save state (restored below) */
cso_save_blend(ctx->cso);
@@ -380,7 +383,7 @@ void renderer_copy_texture(struct renderer *ctx,
4, /* verts */
2); /* attribs/vert */
- pipe_buffer_reference( &buf,
+ pipe_resource_reference( &buf,
NULL );
}
@@ -407,10 +410,10 @@ void renderer_copy_surface(struct renderer *ctx,
{
struct pipe_context *pipe = ctx->pipe;
struct pipe_screen *screen = pipe->screen;
- struct pipe_buffer *buf;
+ struct pipe_resource *buf;
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view;
- struct pipe_texture texTemp, *tex;
+ struct pipe_resource texTemp, *tex;
struct pipe_surface *texSurf;
struct pipe_framebuffer_state fb;
struct st_framebuffer *stfb = ctx->owner->draw_buffer;
@@ -437,11 +440,11 @@ void renderer_copy_surface(struct renderer *ctx,
}
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_SAMPLER, 0));
+ PIPE_BIND_SAMPLER_VIEW, 0));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_SAMPLER, 0));
+ PIPE_BIND_SAMPLER_VIEW, 0));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
- PIPE_TEXTURE_USAGE_RENDER_TARGET, 0));
+ PIPE_BIND_RENDER_TARGET, 0));
/*
* XXX for now we're always creating a temporary texture.
@@ -457,7 +460,7 @@ void renderer_copy_surface(struct renderer *ctx,
texTemp.height0 = srcH;
texTemp.depth0 = 1;
- tex = screen->texture_create(screen, &texTemp);
+ tex = screen->resource_create(screen, &texTemp);
if (!tex)
return;
@@ -468,7 +471,7 @@ void renderer_copy_surface(struct renderer *ctx,
return;
texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_RENDER_TARGET);
/* load temp texture */
if (pipe->surface_copy) {
@@ -554,7 +557,7 @@ void renderer_copy_surface(struct renderer *ctx,
4, /* verts */
2); /* attribs/vert */
- pipe_buffer_reference( &buf,
+ pipe_resource_reference( &buf,
NULL );
}
@@ -568,12 +571,12 @@ void renderer_copy_surface(struct renderer *ctx,
cso_restore_vertex_shader(ctx->cso);
cso_restore_viewport(ctx->cso);
- pipe_texture_reference(&tex, NULL);
+ pipe_resource_reference(&tex, NULL);
pipe_sampler_view_reference(&view, NULL);
}
void renderer_texture_quad(struct renderer *r,
- struct pipe_texture *tex,
+ struct pipe_resource *tex,
VGfloat x1offset, VGfloat y1offset,
VGfloat x2offset, VGfloat y2offset,
VGfloat x1, VGfloat y1,
@@ -582,7 +585,7 @@ void renderer_texture_quad(struct renderer *r,
VGfloat x4, VGfloat y4)
{
struct pipe_context *pipe = r->pipe;
- struct pipe_buffer *buf;
+ struct pipe_resource *buf;
VGfloat s0, t0, s1, t1;
assert(tex->width0 != 0);
@@ -608,7 +611,7 @@ void renderer_texture_quad(struct renderer *r,
4, /* verts */
2); /* attribs/vert */
- pipe_buffer_reference(&buf,
+ pipe_resource_reference(&buf,
NULL);
}
diff --git a/src/gallium/state_trackers/vega/renderer.h b/src/gallium/state_trackers/vega/renderer.h
index 03366f13614..b1a9fb58be6 100644
--- a/src/gallium/state_trackers/vega/renderer.h
+++ b/src/gallium/state_trackers/vega/renderer.h
@@ -32,7 +32,7 @@
struct renderer;
struct vg_context;
-struct pipe_texture;
+struct pipe_resource;
struct pipe_sampler_view;
struct pipe_surface;
@@ -44,13 +44,13 @@ void renderer_draw_quad(struct renderer *,
VGfloat x2, VGfloat y2,
VGfloat depth);
void renderer_draw_texture(struct renderer *,
- struct pipe_texture *texture,
+ struct pipe_resource *texture,
VGfloat x1offset, VGfloat y1offset,
VGfloat x2offset, VGfloat y2offset,
VGfloat x1, VGfloat y1,
VGfloat x2, VGfloat y2);
void renderer_texture_quad(struct renderer *,
- struct pipe_texture *texture,
+ struct pipe_resource *texture,
VGfloat x1offset, VGfloat y1offset,
VGfloat x2offset, VGfloat y2offset,
VGfloat x1, VGfloat y1,
@@ -61,7 +61,7 @@ void renderer_copy_texture(struct renderer *r,
struct pipe_sampler_view *src,
VGfloat sx1, VGfloat sy1,
VGfloat sx2, VGfloat sy2,
- struct pipe_texture *dst,
+ struct pipe_resource *dst,
VGfloat dx1, VGfloat dy1,
VGfloat dx2, VGfloat dy2);
void renderer_copy_surface(struct renderer *r,
diff --git a/src/gallium/state_trackers/vega/shader.c b/src/gallium/state_trackers/vega/shader.c
index f2ec24c57ff..6eef94ce767 100644
--- a/src/gallium/state_trackers/vega/shader.c
+++ b/src/gallium/state_trackers/vega/shader.c
@@ -51,7 +51,7 @@ struct shader {
VGImageMode image_mode;
float constants[MAX_CONSTANTS];
- struct pipe_buffer *cbuf;
+ struct pipe_resource *cbuf;
struct pipe_shader_state fs_state;
void *fs;
};
@@ -96,7 +96,7 @@ static void setup_constant_buffer(struct shader *shader)
{
struct vg_context *ctx = shader->context;
struct pipe_context *pipe = shader->context->pipe;
- struct pipe_buffer **cbuf = &shader->cbuf;
+ struct pipe_resource **cbuf = &shader->cbuf;
VGint param_bytes = paint_constant_buffer_size(shader->paint);
float temp_buf[MAX_CONSTANTS];
@@ -106,12 +106,13 @@ static void setup_constant_buffer(struct shader *shader)
if (*cbuf == NULL ||
memcmp(temp_buf, shader->constants, param_bytes) != 0)
{
- pipe_buffer_reference(cbuf, NULL);
+ pipe_resource_reference(cbuf, NULL);
memcpy(shader->constants, temp_buf, param_bytes);
*cbuf = pipe_user_buffer_create(pipe->screen,
&shader->constants,
- sizeof(shader->constants));
+ sizeof(shader->constants),
+ PIPE_BIND_VERTEX_BUFFER);
}
ctx->pipe->set_constant_buffer(ctx->pipe, PIPE_SHADER_FRAGMENT, 0, *cbuf);
diff --git a/src/gallium/state_trackers/vega/st_inlines.h b/src/gallium/state_trackers/vega/st_inlines.h
index 4d12a4efdd6..7eaa67c76ae 100644
--- a/src/gallium/state_trackers/vega/st_inlines.h
+++ b/src/gallium/state_trackers/vega/st_inlines.h
@@ -42,8 +42,8 @@
#include "pipe/p_state.h"
static INLINE struct pipe_transfer *
-st_cond_flush_get_tex_transfer(struct vg_context *st,
- struct pipe_texture *pt,
+st_cond_flush_get_transfer(struct vg_context *st,
+ struct pipe_resource *pt,
unsigned int face,
unsigned int level,
unsigned int zslice,
@@ -52,20 +52,14 @@ st_cond_flush_get_tex_transfer(struct vg_context *st,
unsigned int w, unsigned int h)
{
struct pipe_context *pipe = st->pipe;
- unsigned referenced =
- pipe->is_texture_referenced(pipe, pt, face, level);
- if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
- (usage & PIPE_TRANSFER_WRITE)))
- vgFlush();
-
- return pipe->get_tex_transfer(pipe, pt, face, level, zslice, usage,
- x, y, w, h);
+ return pipe_get_transfer(pipe, pt, face, level, zslice, usage,
+ x, y, w, h);
}
static INLINE struct pipe_transfer *
-st_no_flush_get_tex_transfer(struct vg_context *st,
- struct pipe_texture *pt,
+st_no_flush_get_transfer(struct vg_context *st,
+ struct pipe_resource *pt,
unsigned int face,
unsigned int level,
unsigned int zslice,
@@ -75,82 +69,53 @@ st_no_flush_get_tex_transfer(struct vg_context *st,
{
struct pipe_context *pipe = st->pipe;
- return pipe->get_tex_transfer(pipe, pt, face, level,
- zslice, usage, x, y, w, h);
-}
-
-static INLINE void *
-st_cond_flush_pipe_buffer_map(struct vg_context *st,
- struct pipe_buffer *buf,
- unsigned int map_flags)
-{
- struct pipe_context *pipe = st->pipe;
- unsigned int referenced = pipe->is_buffer_referenced(pipe, buf);
-
- if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
- (map_flags & PIPE_BUFFER_USAGE_CPU_WRITE)))
- vgFlush();
-
- return pipe_buffer_map(pipe->screen, buf, map_flags);
-}
-
-static INLINE void *
-st_no_flush_pipe_buffer_map(struct vg_context *st,
- struct pipe_buffer *buf,
- unsigned int map_flags)
-{
- return pipe_buffer_map(st->pipe->screen, buf, map_flags);
+ return pipe_get_transfer(pipe, pt, face, level,
+ zslice, usage, x, y, w, h);
}
static INLINE void
st_cond_flush_pipe_buffer_write(struct vg_context *st,
- struct pipe_buffer *buf,
+ struct pipe_resource *buf,
unsigned int offset,
unsigned int size,
const void * data)
{
struct pipe_context *pipe = st->pipe;
- if (pipe->is_buffer_referenced(pipe, buf))
- vgFlush();
-
- pipe_buffer_write(pipe->screen, buf, offset, size, data);
+ pipe_buffer_write(pipe, buf, offset, size, data);
}
static INLINE void
st_no_flush_pipe_buffer_write(struct vg_context *st,
- struct pipe_buffer *buf,
+ struct pipe_resource *buf,
unsigned int offset,
unsigned int size,
const void * data)
{
- pipe_buffer_write(st->pipe->screen, buf, offset, size, data);
+ pipe_buffer_write(st->pipe, buf, offset, size, data);
}
static INLINE void
st_cond_flush_pipe_buffer_read(struct vg_context *st,
- struct pipe_buffer *buf,
+ struct pipe_resource *buf,
unsigned int offset,
unsigned int size,
void * data)
{
struct pipe_context *pipe = st->pipe;
- if (pipe->is_buffer_referenced(pipe, buf) & PIPE_REFERENCED_FOR_WRITE)
- vgFlush();
-
- pipe_buffer_read(pipe->screen, buf, offset, size, data);
+ pipe_buffer_read(pipe, buf, offset, size, data);
}
static INLINE void
st_no_flush_pipe_buffer_read(struct vg_context *st,
- struct pipe_buffer *buf,
+ struct pipe_resource *buf,
unsigned int offset,
unsigned int size,
void * data)
{
- pipe_buffer_read(st->pipe->screen, buf, offset, size, data);
+ pipe_buffer_read(st->pipe, buf, offset, size, data);
}
#endif
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index 11ebbbe5444..1a8952ce34a 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -132,8 +132,8 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
void vg_destroy_context(struct vg_context *ctx)
{
- struct pipe_buffer **cbuf = &ctx->mask.cbuf;
- struct pipe_buffer **vsbuf = &ctx->vs_const_buffer;
+ struct pipe_resource **cbuf = &ctx->mask.cbuf;
+ struct pipe_resource **vsbuf = &ctx->vs_const_buffer;
util_destroy_blit(ctx->blit);
renderer_destroy(ctx->renderer);
@@ -142,10 +142,10 @@ void vg_destroy_context(struct vg_context *ctx)
paint_destroy(ctx->default_paint);
if (*cbuf)
- pipe_buffer_reference(cbuf, NULL);
+ pipe_resource_reference(cbuf, NULL);
if (*vsbuf)
- pipe_buffer_reference(vsbuf, NULL);
+ pipe_resource_reference(vsbuf, NULL);
if (ctx->clear.fs) {
cso_delete_fragment_shader(ctx->cso_context, ctx->clear.fs);
@@ -381,14 +381,14 @@ void vg_validate_state(struct vg_context *ctx)
2.f/fb->width, 2.f/fb->height, 1, 1,
-1, -1, 0, 0
};
- struct pipe_buffer **cbuf = &ctx->vs_const_buffer;
+ struct pipe_resource **cbuf = &ctx->vs_const_buffer;
vg_set_viewport(ctx, VEGA_Y0_BOTTOM);
- pipe_buffer_reference(cbuf, NULL);
- *cbuf = pipe_buffer_create(ctx->pipe->screen, 16,
- PIPE_BUFFER_USAGE_CONSTANT,
- param_bytes);
+ pipe_resource_reference(cbuf, NULL);
+ *cbuf = pipe_buffer_create(ctx->pipe->screen,
+ PIPE_BIND_CONSTANT_BUFFER,
+ param_bytes);
if (*cbuf) {
st_no_flush_pipe_buffer_write(ctx, *cbuf,
@@ -451,7 +451,8 @@ void vg_prepare_blend_surface(struct vg_context *ctx)
dest_surface = pipe->screen->get_tex_surface(pipe->screen,
stfb->blend_texture_view->texture,
0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_BLIT_DESTINATION |
+ PIPE_BIND_RENDER_TARGET);
/* flip it, because we want to use it as a sampler */
util_blit_pixels_tex(ctx->blit,
view,
@@ -487,7 +488,8 @@ void vg_prepare_blend_surface_from_mask(struct vg_context *ctx)
dest_surface = pipe->screen->get_tex_surface(pipe->screen,
stfb->blend_texture_view->texture,
0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_BLIT_DESTINATION |
+ PIPE_BIND_RENDER_TARGET);
/* flip it, because we want to use it as a sampler */
util_blit_pixels_tex(ctx->blit,
diff --git a/src/gallium/state_trackers/vega/vg_context.h b/src/gallium/state_trackers/vega/vg_context.h
index c9e36d7d767..dac67192a54 100644
--- a/src/gallium/state_trackers/vega/vg_context.h
+++ b/src/gallium/state_trackers/vega/vg_context.h
@@ -46,7 +46,7 @@ struct vg_shader;
struct st_renderbuffer {
enum pipe_format format;
struct pipe_surface *surface;
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
VGint width, height;
};
@@ -121,7 +121,7 @@ struct vg_context
} clear;
struct {
- struct pipe_buffer *cbuf;
+ struct pipe_resource *cbuf;
struct pipe_sampler_state sampler;
struct vg_shader *union_fs;
@@ -134,7 +134,7 @@ struct vg_context
struct cso_context *cso_context;
- struct pipe_buffer *stencil_quad;
+ struct pipe_resource *stencil_quad;
VGfloat stencil_vertices[4][2][4];
struct renderer *renderer;
@@ -143,7 +143,7 @@ struct vg_context
struct pipe_sampler_state blend_sampler;
struct {
- struct pipe_buffer *buffer;
+ struct pipe_resource *buffer;
void *color_matrix_fs;
} filter;
struct vg_paint *default_paint;
@@ -153,7 +153,7 @@ struct vg_context
struct vg_shader *plain_vs;
struct vg_shader *clear_vs;
struct vg_shader *texture_vs;
- struct pipe_buffer *vs_const_buffer;
+ struct pipe_resource *vs_const_buffer;
struct pipe_vertex_element velems[2];
};
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index 7bc0006769c..256c23775e0 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -78,7 +78,7 @@ vg_manager_validate_framebuffer(struct vg_context *ctx)
struct pipe_screen *screen = ctx->pipe->screen;
struct st_framebuffer *stfb = ctx->draw_buffer;
struct st_renderbuffer *rb;
- struct pipe_texture *pt;
+ struct pipe_resource *pt;
/* no binding surface */
if (!stfb)
@@ -101,17 +101,19 @@ vg_manager_validate_framebuffer(struct vg_context *ctx)
rb = stfb->strb;
if (rb->texture == pt) {
- pipe_texture_reference(&pt, NULL);
+ pipe_resource_reference(&pt, NULL);
return;
}
/* unreference existing ones */
pipe_surface_reference(&rb->surface, NULL);
- pipe_texture_reference(&rb->texture, NULL);
+ pipe_resource_reference(&rb->texture, NULL);
rb->texture = pt;
rb->surface = screen->get_tex_surface(screen, rb->texture, 0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_BLIT_SOURCE |
+ PIPE_BIND_BLIT_DESTINATION);
rb->width = rb->surface->width;
rb->height = rb->surface->height;
@@ -195,7 +197,7 @@ static void
destroy_renderbuffer(struct st_renderbuffer *strb)
{
pipe_surface_reference(&strb->surface, NULL);
- pipe_texture_reference(&strb->texture, NULL);
+ pipe_resource_reference(&strb->texture, NULL);
free(strb);
}
diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c
index 108dd6a9751..117c6d3977f 100644
--- a/src/gallium/state_trackers/vega/vg_tracker.c
+++ b/src/gallium/state_trackers/vega/vg_tracker.c
@@ -40,11 +40,11 @@
/* advertise OpenVG support */
PUBLIC const int st_api_OpenVG = 1;
-static struct pipe_texture *
+static struct pipe_resource *
create_texture(struct pipe_context *pipe, enum pipe_format format,
VGint width, VGint height)
{
- struct pipe_texture templ;
+ struct pipe_resource templ;
memset(&templ, 0, sizeof(templ));
@@ -62,21 +62,21 @@ create_texture(struct pipe_context *pipe, enum pipe_format format,
templ.last_level = 0;
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
- templ.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL;
+ templ.bind = PIPE_BIND_DEPTH_STENCIL;
} else {
- templ.tex_usage = (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
- PIPE_TEXTURE_USAGE_RENDER_TARGET |
- PIPE_TEXTURE_USAGE_SAMPLER);
+ templ.bind = (PIPE_BIND_DISPLAY_TARGET |
+ PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_SAMPLER_VIEW);
}
- return pipe->screen->texture_create(pipe->screen, &templ);
+ return pipe->screen->resource_create(pipe->screen, &templ);
}
static struct pipe_sampler_view *
create_tex_and_view(struct pipe_context *pipe, enum pipe_format format,
VGint width, VGint height)
{
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view;
@@ -88,7 +88,7 @@ create_tex_and_view(struct pipe_context *pipe, enum pipe_format format,
u_sampler_view_default_template(&view_templ, texture, texture->format);
view = pipe->create_sampler_view(pipe, texture, &view_templ);
/* want the texture to go away if the view is freed */
- pipe_texture_reference(&texture, NULL);
+ pipe_resource_reference(&texture, NULL);
return view;
}
@@ -129,13 +129,14 @@ st_renderbuffer_alloc_storage(struct vg_context * ctx,
/* Free the old surface and texture
*/
pipe_surface_reference(&strb->surface, NULL);
- pipe_texture_reference(&strb->texture, NULL);
+ pipe_resource_reference(&strb->texture, NULL);
/* Probably need dedicated flags for surface usage too:
*/
- surface_usage = (PIPE_BUFFER_USAGE_GPU_READ |
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ surface_usage = (PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_BLIT_SOURCE |
+ PIPE_BIND_BLIT_DESTINATION);
strb->texture = create_texture(pipe, strb->format, width, height);
@@ -255,12 +256,13 @@ static void setup_new_alpha_mask(struct vg_context *ctx,
pipe->screen,
stfb->alpha_mask_view->texture,
0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_WRITE);
+ PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_BLIT_DESTINATION);
struct pipe_surface *old_surface = pipe->screen->get_tex_surface(
pipe->screen,
old_sampler_view->texture,
0, 0, 0,
- PIPE_BUFFER_USAGE_GPU_READ);
+ PIPE_BIND_BLIT_SOURCE);
if (pipe->surface_copy) {
pipe->surface_copy(pipe,
surface,
@@ -360,11 +362,11 @@ void st_set_framebuffer_surface(struct st_framebuffer *stfb,
/* unreference existing surfaces */
pipe_surface_reference( &rb->surface, NULL );
- pipe_texture_reference( &rb->texture, NULL );
+ pipe_resource_reference( &rb->texture, NULL );
/* reference new ones */
pipe_surface_reference( &rb->surface, surf );
- pipe_texture_reference( &rb->texture, surf->texture );
+ pipe_resource_reference( &rb->texture, surf->texture );
rb->width = surf->width;
rb->height = surf->height;
@@ -379,7 +381,7 @@ int st_get_framebuffer_surface(struct st_framebuffer *stfb,
}
int st_get_framebuffer_texture(struct st_framebuffer *stfb,
- uint surfIndex, struct pipe_texture **tex)
+ uint surfIndex, struct pipe_resource **tex)
{
struct st_renderbuffer *rb = stfb->strb;
*tex = rb->texture;
diff --git a/src/gallium/state_trackers/vega/vg_tracker.h b/src/gallium/state_trackers/vega/vg_tracker.h
index 165a6b7a332..c16d55fc349 100644
--- a/src/gallium/state_trackers/vega/vg_tracker.h
+++ b/src/gallium/state_trackers/vega/vg_tracker.h
@@ -90,7 +90,7 @@ int st_get_framebuffer_surface(struct st_framebuffer *stfb,
PUBLIC
int st_get_framebuffer_texture(struct st_framebuffer *stfb,
- uint surfIndex, struct pipe_texture **tex);
+ uint surfIndex, struct pipe_resource **tex);
PUBLIC
void *st_framebuffer_private(struct st_framebuffer *stfb);