summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/vega/vg_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/vega/vg_context.c')
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index 5b072655c7..5479edc861 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -44,6 +44,7 @@
#include "util/u_memory.h"
#include "util/u_blit.h"
#include "util/u_sampler.h"
+#include "util/u_surface.h"
#include "util/u_format.h"
struct vg_context *_vg_context = 0;
@@ -241,6 +242,7 @@ create_texture(struct pipe_context *pipe, enum pipe_format format,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.last_level = 0;
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
@@ -310,22 +312,18 @@ vg_context_update_surface_mask_view(struct vg_context *ctx,
/* if we had an old surface copy it over */
if (old_sampler_view) {
- struct pipe_subresource subsurf, subold_surf;
- subsurf.face = 0;
- subsurf.level = 0;
- subold_surf.face = 0;
- subold_surf.level = 0;
+ struct pipe_box src_box;
+ u_box_origin_2d(MIN2(old_sampler_view->texture->width0,
+ stfb->surface_mask_view->texture->width0),
+ MIN2(old_sampler_view->texture->height0,
+ stfb->surface_mask_view->texture->height0),
+ &src_box);
+
pipe->resource_copy_region(pipe,
stfb->surface_mask_view->texture,
- subsurf,
- 0, 0, 0,
+ 0, 0, 0, 0,
old_sampler_view->texture,
- subold_surf,
- 0, 0, 0,
- MIN2(old_sampler_view->texture->width0,
- stfb->surface_mask_view->texture->width0),
- MIN2(old_sampler_view->texture->height0,
- stfb->surface_mask_view->texture->height0));
+ 0, &src_box);
}
/* Free the old texture
@@ -359,7 +357,7 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx,
{
struct st_renderbuffer *dsrb = ctx->draw_buffer->dsrb;
struct pipe_context *pipe = ctx->pipe;
- unsigned surface_usage;
+ struct pipe_surface surf_tmpl;
if ((dsrb->width == width && dsrb->height == height) && dsrb->texture)
return FALSE;
@@ -369,18 +367,16 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx,
pipe_resource_reference(&dsrb->texture, NULL);
dsrb->width = dsrb->height = 0;
- /* Probably need dedicated flags for surface usage too:
- */
- surface_usage = PIPE_BIND_DEPTH_STENCIL; /* XXX: was: RENDER_TARGET */
-
dsrb->texture = create_texture(pipe, dsrb->format, width, height);
if (!dsrb->texture)
return TRUE;
- dsrb->surface = pipe->screen->get_tex_surface(pipe->screen,
- dsrb->texture,
- 0, 0, 0,
- surface_usage);
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, dsrb->texture,
+ PIPE_BIND_DEPTH_STENCIL);
+ dsrb->surface = pipe->create_surface(pipe,
+ dsrb->texture,
+ &surf_tmpl);
if (!dsrb->surface) {
pipe_resource_reference(&dsrb->texture, NULL);
return TRUE;
@@ -439,11 +435,16 @@ static void vg_prepare_blend_texture(struct vg_context *ctx,
{
struct st_framebuffer *stfb = ctx->draw_buffer;
struct pipe_surface *surf;
+ struct pipe_surface surf_tmpl;
vg_context_update_blend_texture_view(ctx, stfb->width, stfb->height);
- surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen,
- stfb->blend_texture_view->texture, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, stfb->blend_texture_view->texture,
+ PIPE_BIND_RENDER_TARGET);
+ surf = ctx->pipe->create_surface(ctx->pipe,
+ stfb->blend_texture_view->texture,
+ &surf_tmpl);
if (surf) {
util_blit_pixels_tex(ctx->blit,
src, 0, 0, stfb->width, stfb->height,