summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vega/renderer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/vega/renderer.c')
-rw-r--r--src/gallium/state_trackers/vega/renderer.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index 48fbc3b330e..8c023044c45 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -40,6 +40,7 @@
#include "util/u_memory.h"
#include "util/u_rect.h"
#include "util/u_sampler.h"
+#include "util/u_surface.h"
#include "cso_cache/cso_context.h"
@@ -58,7 +59,8 @@ static void setup_shaders(struct renderer *ctx)
{
struct pipe_context *pipe = ctx->pipe;
/* fragment shader */
- ctx->fs = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D);
+ ctx->fs = util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D,
+ TGSI_INTERPOLATE_LINEAR);
}
static struct pipe_resource *
@@ -201,7 +203,7 @@ void renderer_destroy(struct renderer *ctx)
ctx->fs = NULL;
}
#endif
- free(ctx);
+ FREE(ctx);
}
void renderer_draw_quad(struct renderer *r,
@@ -307,7 +309,7 @@ void renderer_copy_texture(struct renderer *ctx,
#endif
assert(screen->is_format_supported(screen, dst_surf->format, PIPE_TEXTURE_2D,
- PIPE_BIND_RENDER_TARGET, 0));
+ 0, PIPE_BIND_RENDER_TARGET, 0));
/* save state (restored below) */
cso_save_blend(ctx->cso);
@@ -414,7 +416,7 @@ void renderer_copy_surface(struct renderer *ctx,
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view;
struct pipe_resource texTemp, *tex;
- struct pipe_surface *texSurf;
+ struct pipe_subresource subsrc, subdst;
struct pipe_framebuffer_state fb;
struct st_framebuffer *stfb = ctx->owner->draw_buffer;
const int srcW = abs(srcX1 - srcX0);
@@ -440,11 +442,11 @@ void renderer_copy_surface(struct renderer *ctx,
}
assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
- PIPE_BIND_SAMPLER_VIEW, 0));
+ 0, PIPE_BIND_SAMPLER_VIEW, 0));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
- PIPE_BIND_SAMPLER_VIEW, 0));
+ 0, PIPE_BIND_SAMPLER_VIEW, 0));
assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
- PIPE_BIND_RENDER_TARGET, 0));
+ 0, PIPE_BIND_RENDER_TARGET, 0));
/*
* XXX for now we're always creating a temporary texture.
@@ -459,6 +461,7 @@ void renderer_copy_surface(struct renderer *ctx,
texTemp.width0 = srcW;
texTemp.height0 = srcH;
texTemp.depth0 = 1;
+ texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
tex = screen->resource_create(screen, &texTemp);
if (!tex)
@@ -470,24 +473,15 @@ void renderer_copy_surface(struct renderer *ctx,
if (!view)
return;
- texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0,
- PIPE_BIND_RENDER_TARGET);
-
- /* load temp texture */
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe,
- texSurf, 0, 0, /* dest */
- src, srcLeft, srcTop, /* src */
- srcW, srcH); /* size */
- } else {
- util_surface_copy(pipe, FALSE,
- texSurf, 0, 0, /* dest */
- src, srcLeft, srcTop, /* src */
- srcW, srcH); /* size */
- }
+ subdst.face = 0;
+ subdst.level = 0;
+ subsrc.face = src->face;
+ subsrc.level = src->level;
- /* free the surface, update the texture if necessary.*/
- screen->tex_surface_destroy(texSurf);
+ pipe->resource_copy_region(pipe,
+ tex, subdst, 0, 0, 0, /* dest */
+ src->texture, subsrc, srcLeft, srcTop, src->zslice, /* src */
+ srcW, srcH); /* size */
/* save state (restored below) */
cso_save_blend(ctx->cso);