diff options
Diffstat (limited to 'src/gallium/state_trackers/vega/renderer.c')
-rw-r--r-- | src/gallium/state_trackers/vega/renderer.c | 61 |
1 files changed, 32 insertions, 29 deletions
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); } |