#include "util/u_draw_quad.h"
#include "util/u_math.h"
#include "util/u_memory.h"
-#include "util/u_rect.h"
#include "util/u_sampler.h"
#include "util/u_inlines.h"
+#include "util/u_box.h"
#include <math.h>
if (buf) {
cso_set_vertex_elements(r->cso, r->attrs_per_vertex, r->velems);
- util_draw_vertex_buffer(pipe, buf, 0,
+ util_draw_vertex_buffer(pipe, r->cso, buf, 0,
PIPE_PRIM_QUADS,
num_verts, /* verts */
r->attrs_per_vertex); /* attribs/vert */
/* XXX: move to renderer_init_state? */
memset(&raster, 0, sizeof(struct pipe_rasterizer_state));
raster.gl_rasterization_rules = 1;
+ raster.depth_clip = 1;
cso_set_rasterizer(r->cso, &raster);
/* vertex elements state */
pipe_resource_reference(cbuf, NULL);
*cbuf = pipe_buffer_create(r->pipe->screen,
PIPE_BIND_CONSTANT_BUFFER,
+ PIPE_USAGE_STATIC,
param_bytes);
if (*cbuf) {
pipe_buffer_write(r->pipe, *cbuf,
0, param_bytes, params);
}
- r->pipe->set_constant_buffer(r->pipe, shader_type, 0, *cbuf);
+ pipe_set_constant_buffer(r->pipe, shader_type, 0, *cbuf);
}
struct xorg_shader shader;
assert(screen->is_format_supported(screen, dst_surface->format,
- PIPE_TEXTURE_2D,
- PIPE_BIND_RENDER_TARGET,
- 0));
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_RENDER_TARGET));
(void) screen;
struct pipe_resource *pt;
struct pipe_resource templ;
- if (pipe->is_resource_referenced(pipe, src, 0, 0) &
- PIPE_REFERENCED_FOR_WRITE)
- pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
-
/* the coming in texture should already have that invariance */
debug_assert(screen->is_format_supported(screen, src->format,
- PIPE_TEXTURE_2D,
- PIPE_BIND_SAMPLER_VIEW, 0));
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW));
format = src->format;
templ.width0 = src->width0;
templ.height0 = src->height0;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.bind = PIPE_BIND_SAMPLER_VIEW;
pt = screen->resource_create(screen, &templ);
{
/* copy source framebuffer surface into texture */
- struct pipe_surface *ps_read = screen->get_tex_surface(
- screen, src, 0, 0, 0, PIPE_BIND_BLIT_SOURCE);
- struct pipe_surface *ps_tex = screen->get_tex_surface(
- screen, pt, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION );
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe,
- ps_tex, /* dest */
- 0, 0, /* destx/y */
- ps_read,
- 0, 0, src->width0, src->height0);
- } else {
- util_surface_copy(pipe, FALSE,
- ps_tex, /* dest */
- 0, 0, /* destx/y */
- ps_read,
- 0, 0, src->width0, src->height0);
- }
- pipe_surface_reference(&ps_read, NULL);
- pipe_surface_reference(&ps_tex, NULL);
+ struct pipe_box src_box;
+ u_box_origin_2d(src->width0, src->height0, &src_box);
+
+ pipe->resource_copy_region(pipe,
+ pt, /* dest */
+ 0, /* dest_level */
+ 0, 0, 0, /* destx/y/z */
+ src,
+ 0, &src_box);
}
return pt;
void renderer_draw_yuv(struct xorg_renderer *r,
- int src_x, int src_y, int src_w, int src_h,
+ float src_x, float src_y, float src_w, float src_h,
int dst_x, int dst_y, int dst_w, int dst_h,
struct pipe_resource **textures)
{
cso_set_vertex_elements(r->cso, num_attribs, r->velems);
- util_draw_vertex_buffer(pipe, buf, 0,
+ util_draw_vertex_buffer(pipe, r->cso, buf, 0,
PIPE_PRIM_QUADS,
4, /* verts */
num_attribs); /* attribs/vert */