Commit c24c3b94 authored by Marek Olšák's avatar Marek Olšák
Browse files

gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes

parent fe437882
......@@ -408,8 +408,8 @@ void cso_destroy_context( struct cso_context *ctx )
util_unreference_framebuffer_state(&ctx->fb);
util_unreference_framebuffer_state(&ctx->fb_saved);
pipe_resource_reference(&ctx->aux_vertex_buffer_current.buffer, NULL);
pipe_resource_reference(&ctx->aux_vertex_buffer_saved.buffer, NULL);
pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_current);
pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_saved);
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
pipe_resource_reference(&ctx->aux_constbuf_current[i].buffer, NULL);
......@@ -1150,15 +1150,9 @@ void cso_set_vertex_buffers(struct cso_context *ctx,
const struct pipe_vertex_buffer *vb =
buffers + (ctx->aux_vertex_buffer_index - start_slot);
pipe_resource_reference(&ctx->aux_vertex_buffer_current.buffer,
vb->buffer);
memcpy(&ctx->aux_vertex_buffer_current, vb,
sizeof(struct pipe_vertex_buffer));
}
else {
pipe_resource_reference(&ctx->aux_vertex_buffer_current.buffer,
NULL);
ctx->aux_vertex_buffer_current.user_buffer = NULL;
pipe_vertex_buffer_reference(&ctx->aux_vertex_buffer_current, vb);
} else {
pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_current);
}
}
......@@ -1175,10 +1169,8 @@ cso_save_aux_vertex_buffer_slot(struct cso_context *ctx)
return;
}
pipe_resource_reference(&ctx->aux_vertex_buffer_saved.buffer,
ctx->aux_vertex_buffer_current.buffer);
memcpy(&ctx->aux_vertex_buffer_saved, &ctx->aux_vertex_buffer_current,
sizeof(struct pipe_vertex_buffer));
pipe_vertex_buffer_reference(&ctx->aux_vertex_buffer_saved,
&ctx->aux_vertex_buffer_current);
}
static void
......@@ -1193,7 +1185,7 @@ cso_restore_aux_vertex_buffer_slot(struct cso_context *ctx)
cso_set_vertex_buffers(ctx, ctx->aux_vertex_buffer_index, 1,
&ctx->aux_vertex_buffer_saved);
pipe_resource_reference(&ctx->aux_vertex_buffer_saved.buffer, NULL);
pipe_vertex_buffer_unreference(&ctx->aux_vertex_buffer_saved);
}
unsigned cso_get_aux_vertex_buffer_slot(struct cso_context *ctx)
......
......@@ -206,9 +206,8 @@ void draw_destroy( struct draw_context *draw )
}
}
for (i = 0; i < draw->pt.nr_vertex_buffers; i++) {
pipe_resource_reference(&draw->pt.vertex_buffer[i].buffer, NULL);
}
for (i = 0; i < draw->pt.nr_vertex_buffers; i++)
pipe_vertex_buffer_unreference(&draw->pt.vertex_buffer[i]);
/* Not so fast -- we're just borrowing this at the moment.
*
......
......@@ -352,9 +352,9 @@ create_jit_vertex_buffer_type(struct gallivm_state *gallivm,
LLVMTypeRef elem_types[4];
LLVMTypeRef vb_type;
elem_types[0] =
elem_types[1] = LLVMInt32TypeInContext(gallivm->context);
elem_types[2] =
elem_types[0] = LLVMInt16TypeInContext(gallivm->context);
elem_types[1] = LLVMInt8TypeInContext(gallivm->context);
elem_types[2] = LLVMInt32TypeInContext(gallivm->context);
elem_types[3] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0);
vb_type = LLVMStructTypeInContext(gallivm->context, elem_types,
......@@ -363,8 +363,12 @@ create_jit_vertex_buffer_type(struct gallivm_state *gallivm,
(void) target; /* silence unused var warning for non-debug build */
LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, stride,
target, vb_type, 0);
LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer_offset,
LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, is_user_buffer,
target, vb_type, 1);
LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer_offset,
target, vb_type, 2);
LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer.resource,
target, vb_type, 3);
LP_CHECK_STRUCT_SIZE(struct pipe_vertex_buffer, target, vb_type);
......@@ -1699,6 +1703,8 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *variant)
vbuffer_ptr = LLVMBuildGEP(builder, vbuffers_ptr, &vb_index, 1, "");
vb_info = LLVMBuildGEP(builder, vb_ptr, &vb_index, 1, "");
vb_stride[j] = draw_jit_vbuffer_stride(gallivm, vb_info);
vb_stride[j] = LLVMBuildZExt(gallivm->builder, vb_stride[j],
LLVMInt32TypeInContext(context), "");
vb_buffer_offset = draw_jit_vbuffer_offset(gallivm, vb_info);
map_ptr[j] = draw_jit_dvbuffer_map(gallivm, vbuffer_ptr);
buffer_size = draw_jit_dvbuffer_size(gallivm, vbuffer_ptr);
......
......@@ -172,7 +172,7 @@ enum {
lp_build_struct_get(_gallivm, _ptr, 0, "stride")
#define draw_jit_vbuffer_offset(_gallivm, _ptr) \
lp_build_struct_get(_gallivm, _ptr, 1, "buffer_offset")
lp_build_struct_get(_gallivm, _ptr, 2, "buffer_offset")
enum {
DRAW_JIT_DVBUFFER_MAP = 0,
......
......@@ -579,15 +579,15 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
hud->whitelines.buffer_size +
hud->text.buffer_size +
hud->color_prims.buffer_size,
16, &hud->bg.vbuf.buffer_offset, &hud->bg.vbuf.buffer,
16, &hud->bg.vbuf.buffer_offset, &hud->bg.vbuf.buffer.resource,
(void**)&hud->bg.vertices);
if (!hud->bg.vertices) {
goto out;
}
pipe_resource_reference(&hud->whitelines.vbuf.buffer, hud->bg.vbuf.buffer);
pipe_resource_reference(&hud->text.vbuf.buffer, hud->bg.vbuf.buffer);
pipe_resource_reference(&hud->color_prims.vbuf.buffer, hud->bg.vbuf.buffer);
pipe_resource_reference(&hud->whitelines.vbuf.buffer.resource, hud->bg.vbuf.buffer.resource);
pipe_resource_reference(&hud->text.vbuf.buffer.resource, hud->bg.vbuf.buffer.resource);
pipe_resource_reference(&hud->color_prims.vbuf.buffer.resource, hud->bg.vbuf.buffer.resource);
hud->whitelines.vbuf.buffer_offset = hud->bg.vbuf.buffer_offset +
hud->bg.buffer_size;
......@@ -654,7 +654,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
&hud->bg.vbuf);
cso_draw_arrays(cso, PIPE_PRIM_QUADS, 0, hud->bg.num_vertices);
}
pipe_resource_reference(&hud->bg.vbuf.buffer, NULL);
pipe_resource_reference(&hud->bg.vbuf.buffer.resource, NULL);
/* draw accumulated vertices for white lines */
cso_set_blend(cso, &hud->no_blend);
......@@ -675,7 +675,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
cso_set_fragment_shader_handle(hud->cso, hud->fs_color);
cso_draw_arrays(cso, PIPE_PRIM_LINES, 0, hud->whitelines.num_vertices);
}
pipe_resource_reference(&hud->whitelines.vbuf.buffer, NULL);
pipe_resource_reference(&hud->whitelines.vbuf.buffer.resource, NULL);
/* draw accumulated vertices for text */
cso_set_blend(cso, &hud->alpha_blend);
......@@ -685,7 +685,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
cso_set_fragment_shader_handle(hud->cso, hud->fs_text);
cso_draw_arrays(cso, PIPE_PRIM_QUADS, 0, hud->text.num_vertices);
}
pipe_resource_reference(&hud->text.vbuf.buffer, NULL);
pipe_resource_reference(&hud->text.vbuf.buffer.resource, NULL);
/* draw the rest */
cso_set_rasterizer(cso, &hud->rasterizer_aa_lines);
......
......@@ -539,7 +539,7 @@ void util_blitter_restore_vertex_states(struct blitter_context *blitter)
/* Vertex buffer. */
pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1,
&ctx->base.saved_vertex_buffer);
pipe_resource_reference(&ctx->base.saved_vertex_buffer.buffer, NULL);
pipe_vertex_buffer_unreference(&ctx->base.saved_vertex_buffer);
/* Vertex elements. */
pipe->bind_vertex_elements_state(pipe, ctx->base.saved_velem_state);
......@@ -1209,15 +1209,15 @@ static void blitter_draw(struct blitter_context_priv *ctx,
vb.stride = 8 * sizeof(float);
u_upload_data(pipe->stream_uploader, 0, sizeof(ctx->vertices), 4, ctx->vertices,
&vb.buffer_offset, &vb.buffer);
if (!vb.buffer)
&vb.buffer_offset, &vb.buffer.resource);
if (!vb.buffer.resource)
return;
u_upload_unmap(pipe->stream_uploader);
pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, &vb);
util_draw_arrays_instanced(pipe, PIPE_PRIM_TRIANGLE_FAN, 0, 4,
0, num_instances);
pipe_resource_reference(&vb.buffer, NULL);
pipe_resource_reference(&vb.buffer.resource, NULL);
}
void util_blitter_draw_rectangle(struct blitter_context *blitter,
......@@ -2199,7 +2199,8 @@ void util_blitter_copy_buffer(struct blitter_context *blitter,
blitter_check_saved_vertex_states(ctx);
blitter_disable_render_cond(ctx);
vb.buffer = src;
vb.is_user_buffer = false;
vb.buffer.resource = src;
vb.buffer_offset = srcx;
vb.stride = 4;
......@@ -2259,8 +2260,8 @@ void util_blitter_clear_buffer(struct blitter_context *blitter,
}
u_upload_data(pipe->stream_uploader, 0, num_channels*4, 4, clear_value,
&vb.buffer_offset, &vb.buffer);
if (!vb.buffer)
&vb.buffer_offset, &vb.buffer.resource);
if (!vb.buffer.resource)
goto out;
vb.stride = 0;
......@@ -2291,7 +2292,7 @@ out:
util_blitter_restore_render_cond(blitter);
util_blitter_unset_running_flag(blitter);
pipe_so_target_reference(&so_target, NULL);
pipe_resource_reference(&vb.buffer, NULL);
pipe_resource_reference(&vb.buffer.resource, NULL);
}
/* probably radeon specific */
......
......@@ -503,10 +503,8 @@ static inline void
util_blitter_save_vertex_buffer_slot(struct blitter_context *blitter,
struct pipe_vertex_buffer *vertex_buffers)
{
pipe_resource_reference(&blitter->saved_vertex_buffer.buffer,
vertex_buffers[blitter->vb_slot].buffer);
memcpy(&blitter->saved_vertex_buffer, &vertex_buffers[blitter->vb_slot],
sizeof(struct pipe_vertex_buffer));
pipe_vertex_buffer_reference(&blitter->saved_vertex_buffer,
&vertex_buffers[blitter->vb_slot]);
}
static inline void
......
......@@ -62,13 +62,13 @@ util_draw_max_index(
const struct util_format_description *format_desc;
unsigned format_size;
if (!buffer->buffer) {
if (buffer->is_user_buffer || !buffer->buffer.resource) {
continue;
}
assert(buffer->buffer->height0 == 1);
assert(buffer->buffer->depth0 == 1);
buffer_size = buffer->buffer->width0;
assert(buffer->buffer.resource->height0 == 1);
assert(buffer->buffer.resource->depth0 == 1);
buffer_size = buffer->buffer.resource->width0;
format_desc = util_format_description(element->src_format);
assert(format_desc->block.width == 1);
......
......@@ -54,7 +54,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
/* tell pipe about the vertex buffer */
memset(&vbuffer, 0, sizeof(vbuffer));
vbuffer.buffer = vbuf;
vbuffer.buffer.resource = vbuf;
vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
vbuffer.buffer_offset = offset;
......@@ -82,7 +82,8 @@ util_draw_user_vertex_buffer(struct cso_context *cso, void *buffer,
assert(num_attribs <= PIPE_MAX_ATTRIBS);
vbuffer.user_buffer = buffer;
vbuffer.is_user_buffer = true;
vbuffer.buffer.user = buffer;
vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
/* note: vertex elements already set by caller */
......
......@@ -863,9 +863,9 @@ util_dump_vertex_buffer(FILE *stream, const struct pipe_vertex_buffer *state)
util_dump_struct_begin(stream, "pipe_vertex_buffer");
util_dump_member(stream, uint, state, stride);
util_dump_member(stream, bool, state, is_user_buffer);
util_dump_member(stream, uint, state, buffer_offset);
util_dump_member(stream, ptr, state, buffer);
util_dump_member(stream, ptr, state, user_buffer);
util_dump_member(stream, ptr, state, buffer.resource);
util_dump_struct_end(stream);
}
......
......@@ -51,10 +51,13 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst,
if (src) {
for (i = 0; i < count; i++) {
if (src[i].buffer || src[i].user_buffer) {
if (src[i].buffer.resource)
bitmask |= 1 << i;
}
pipe_resource_reference(&dst[i].buffer, src[i].buffer);
pipe_vertex_buffer_unreference(&dst[i]);
if (!src[i].is_user_buffer)
pipe_resource_reference(&dst[i].buffer.resource, src[i].buffer.resource);
}
/* Copy over the other members of pipe_vertex_buffer. */
......@@ -65,10 +68,8 @@ void util_set_vertex_buffers_mask(struct pipe_vertex_buffer *dst,
}
else {
/* Unreference the buffers. */
for (i = 0; i < count; i++) {
pipe_resource_reference(&dst[i].buffer, NULL);
dst[i].user_buffer = NULL;
}
for (i = 0; i < count; i++)
pipe_vertex_buffer_unreference(&dst[i]);
*enabled_buffers &= ~(((1ull << count) - 1) << start_slot);
}
......@@ -87,7 +88,7 @@ void util_set_vertex_buffers_count(struct pipe_vertex_buffer *dst,
uint32_t enabled_buffers = 0;
for (i = 0; i < *dst_count; i++) {
if (dst[i].buffer || dst[i].user_buffer)
if (dst[i].buffer.resource)
enabled_buffers |= (1ull << i);
}
......
......@@ -187,6 +187,25 @@ pipe_so_target_reference(struct pipe_stream_output_target **ptr,
*ptr = target;
}
static inline void
pipe_vertex_buffer_unreference(struct pipe_vertex_buffer *dst)
{
if (dst->is_user_buffer)
dst->buffer.user = NULL;
else
pipe_resource_reference(&dst->buffer.resource, NULL);
}
static inline void
pipe_vertex_buffer_reference(struct pipe_vertex_buffer *dst,
const struct pipe_vertex_buffer *src)
{
pipe_vertex_buffer_unreference(dst);
if (!src->is_user_buffer)
pipe_resource_reference(&dst->buffer.resource, src->buffer.resource);
memcpy(dst, src, sizeof(*src));
}
static inline void
pipe_surface_reset(struct pipe_context *ctx, struct pipe_surface* ps,
struct pipe_resource *pt, unsigned level, unsigned layer)
......
......@@ -377,13 +377,12 @@ void u_vbuf_destroy(struct u_vbuf *mgr)
mgr->pipe->set_vertex_buffers(mgr->pipe, 0, num_vb, NULL);
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
pipe_resource_reference(&mgr->vertex_buffer[i].buffer, NULL);
}
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
pipe_resource_reference(&mgr->real_vertex_buffer[i].buffer, NULL);
}
pipe_resource_reference(&mgr->aux_vertex_buffer_saved.buffer, NULL);
for (i = 0; i < PIPE_MAX_ATTRIBS; i++)
pipe_vertex_buffer_unreference(&mgr->vertex_buffer[i]);
for (i = 0; i < PIPE_MAX_ATTRIBS; i++)
pipe_vertex_buffer_unreference(&mgr->real_vertex_buffer[i]);
pipe_vertex_buffer_unreference(&mgr->aux_vertex_buffer_saved);
translate_cache_destroy(mgr->translate_cache);
cso_cache_delete(mgr->cso_cache);
......@@ -417,17 +416,17 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
vb = &mgr->vertex_buffer[i];
offset = vb->buffer_offset + vb->stride * start_vertex;
if (vb->user_buffer) {
map = (uint8_t*)vb->user_buffer + offset;
if (vb->is_user_buffer) {
map = (uint8_t*)vb->buffer.user + offset;
} else {
unsigned size = vb->stride ? num_vertices * vb->stride
: sizeof(double)*4;
if (offset+size > vb->buffer->width0) {
size = vb->buffer->width0 - offset;
if (offset+size > vb->buffer.resource->width0) {
size = vb->buffer.resource->width0 - offset;
}
map = pipe_buffer_map_range(mgr->pipe, vb->buffer, offset, size,
map = pipe_buffer_map_range(mgr->pipe, vb->buffer.resource, offset, size,
PIPE_TRANSFER_READ, &vb_transfer[i]);
}
......@@ -510,8 +509,8 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
/* Move the buffer reference. */
pipe_resource_reference(
&mgr->real_vertex_buffer[out_vb].buffer, NULL);
mgr->real_vertex_buffer[out_vb].buffer = out_buffer;
&mgr->real_vertex_buffer[out_vb].buffer.resource, NULL);
mgr->real_vertex_buffer[out_vb].buffer.resource = out_buffer;
return PIPE_OK;
}
......@@ -721,7 +720,7 @@ static void u_vbuf_translate_end(struct u_vbuf *mgr)
for (i = 0; i < VB_NUM; i++) {
unsigned vb = mgr->fallback_vbs[i];
if (vb != ~0u) {
pipe_resource_reference(&mgr->real_vertex_buffer[vb].buffer, NULL);
pipe_resource_reference(&mgr->real_vertex_buffer[vb].buffer.resource, NULL);
mgr->fallback_vbs[i] = ~0;
/* This will cause the buffer to be unbound in the driver later. */
......@@ -830,8 +829,8 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr,
for (i = 0; i < count; i++) {
unsigned dst_index = start_slot + i;
pipe_resource_reference(&mgr->vertex_buffer[dst_index].buffer, NULL);
pipe_resource_reference(&mgr->real_vertex_buffer[dst_index].buffer,
pipe_vertex_buffer_unreference(&mgr->vertex_buffer[dst_index]);
pipe_resource_reference(&mgr->real_vertex_buffer[dst_index].buffer.resource,
NULL);
}
......@@ -845,18 +844,13 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr,
struct pipe_vertex_buffer *orig_vb = &mgr->vertex_buffer[dst_index];
struct pipe_vertex_buffer *real_vb = &mgr->real_vertex_buffer[dst_index];
if (!vb->buffer && !vb->user_buffer) {
pipe_resource_reference(&orig_vb->buffer, NULL);
pipe_resource_reference(&real_vb->buffer, NULL);
real_vb->user_buffer = NULL;
if (!vb->buffer.resource) {
pipe_vertex_buffer_unreference(orig_vb);
pipe_vertex_buffer_unreference(real_vb);
continue;
}
pipe_resource_reference(&orig_vb->buffer, vb->buffer);
orig_vb->user_buffer = vb->user_buffer;
real_vb->buffer_offset = orig_vb->buffer_offset = vb->buffer_offset;
real_vb->stride = orig_vb->stride = vb->stride;
pipe_vertex_buffer_reference(orig_vb, vb);
if (vb->stride) {
nonzero_stride_vb_mask |= 1 << dst_index;
......@@ -866,18 +860,23 @@ void u_vbuf_set_vertex_buffers(struct u_vbuf *mgr,
if ((!mgr->caps.buffer_offset_unaligned && vb->buffer_offset % 4 != 0) ||
(!mgr->caps.buffer_stride_unaligned && vb->stride % 4 != 0)) {
incompatible_vb_mask |= 1 << dst_index;
pipe_resource_reference(&real_vb->buffer, NULL);
real_vb->buffer_offset = vb->buffer_offset;
real_vb->stride = vb->stride;
pipe_vertex_buffer_unreference(real_vb);
real_vb->is_user_buffer = false;
continue;
}
if (!mgr->caps.user_vertex_buffers && vb->user_buffer) {
if (!mgr->caps.user_vertex_buffers && vb->is_user_buffer) {
user_vb_mask |= 1 << dst_index;
pipe_resource_reference(&real_vb->buffer, NULL);
real_vb->buffer_offset = vb->buffer_offset;
real_vb->stride = vb->stride;
pipe_vertex_buffer_unreference(real_vb);
real_vb->is_user_buffer = false;
continue;
}
pipe_resource_reference(&real_vb->buffer, vb->buffer);
real_vb->user_buffer = vb->user_buffer;
pipe_vertex_buffer_reference(real_vb, vb);
}
mgr->user_vb_mask |= user_vb_mask;
......@@ -933,7 +932,7 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
continue;
}
if (!vb->user_buffer) {
if (!vb->is_user_buffer) {
continue;
}
......@@ -983,11 +982,11 @@ u_vbuf_upload_buffers(struct u_vbuf *mgr,
assert(start < end);
real_vb = &mgr->real_vertex_buffer[i];
ptr = mgr->vertex_buffer[i].user_buffer;
ptr = mgr->vertex_buffer[i].buffer.user;
u_upload_data(mgr->pipe->stream_uploader, start, end - start, 4, ptr + start,
&real_vb->buffer_offset, &real_vb->buffer);
if (!real_vb->buffer)
u_upload_data(mgr->pipe->stream_uploader, start, end - start, 4,
ptr + start, &real_vb->buffer_offset, &real_vb->buffer.resource);
if (!real_vb->buffer.resource)
return PIPE_ERROR_OUT_OF_MEMORY;
real_vb->buffer_offset -= start;
......@@ -1320,16 +1319,13 @@ void u_vbuf_restore_vertex_elements(struct u_vbuf *mgr)
void u_vbuf_save_aux_vertex_buffer_slot(struct u_vbuf *mgr)
{
struct pipe_vertex_buffer *vb =
&mgr->vertex_buffer[mgr->aux_vertex_buffer_slot];
pipe_resource_reference(&mgr->aux_vertex_buffer_saved.buffer, vb->buffer);
memcpy(&mgr->aux_vertex_buffer_saved, vb, sizeof(*vb));
pipe_vertex_buffer_reference(&mgr->aux_vertex_buffer_saved,
&mgr->vertex_buffer[mgr->aux_vertex_buffer_slot]);
}
void u_vbuf_restore_aux_vertex_buffer_slot(struct u_vbuf *mgr)
{
u_vbuf_set_vertex_buffers(mgr, mgr->aux_vertex_buffer_slot, 1,
&mgr->aux_vertex_buffer_saved);
pipe_resource_reference(&mgr->aux_vertex_buffer_saved.buffer, NULL);
pipe_vertex_buffer_unreference(&mgr->aux_vertex_buffer_saved);
}
......@@ -295,7 +295,7 @@ vl_bicubic_filter_init(struct vl_bicubic_filter *filter, struct pipe_context *pi
goto error_sampler;
filter->quad = vl_vb_upload_quads(pipe);
if(!filter->quad.buffer)
if(!filter->quad.buffer.resource)
goto error_quad;
memset(&ve, 0, sizeof(ve));
......@@ -349,7 +349,7 @@ error_vs:
pipe->delete_vertex_elements_state(pipe, filter->ves);
error_ves:
pipe_resource_reference(&filter->quad.buffer, NULL);
pipe_resource_reference(&filter->quad.buffer.resource, NULL);
error_quad:
pipe->delete_sampler_state(pipe, filter->sampler);
......@@ -373,7 +373,7 @@ vl_bicubic_filter_cleanup(struct vl_bicubic_filter *filter)
filter->pipe->delete_blend_state(filter->pipe, filter->blend);
filter->pipe->delete_rasterizer_state(filter->pipe, filter->rs_state);
filter->pipe->delete_vertex_elements_state(filter->pipe, filter->ves);
pipe_resource_reference(&filter->quad.buffer, NULL);
pipe_resource_reference(&filter->quad.buffer.resource, NULL);
filter->pipe->delete_vs_state(filter->pipe, filter->vs);
filter->pipe->delete_fs_state(filter->pipe, filter->fs);
......
......@@ -605,7 +605,8 @@ init_buffers(struct vl_compositor *c)
*/
c->vertex_buf.stride = sizeof(struct vertex2f) + sizeof(struct vertex4f) * 2;
c->vertex_buf.buffer_offset = 0;
c->vertex_buf.buffer = NULL;
c->vertex_buf.buffer.resource = NULL;
c->vertex_buf.is_user_buffer = false;
vertex_elems[0].src_offset = 0;
vertex_elems[0].instance_divisor = 0;
......@@ -630,7 +631,7 @@ cleanup_buffers(struct vl_compositor *c)
assert(c);
c->pipe->delete_vertex_elements_state(c->pipe, c->vertex_elems_state);
pipe_resource_reference(&c->vertex_buf.buffer, NULL);
pipe_resource_reference(&c->vertex_buf.buffer.resource, NULL);
}
static inline struct u_rect
......@@ -812,7 +813,7 @@ gen_vertex_data(struct vl_compositor *c, struct vl_compositor_state *s, struct u
u_upload_alloc(c->pipe->stream_uploader, 0,
c->vertex_buf.stride * VL_COMPOSITOR_MAX_LAYERS * 4, /* size */
4, /* alignment */
&c->vertex_buf.buffer_offset, &c->vertex_buf.buffer,
&c->vertex_buf.buffer_offset, &c->vertex_buf.buffer.resource,
(void**)&vb);
for (i = 0; i < VL_COMPOSITOR_MAX_LAYERS; i++) {
......
......@@ -308,7 +308,7 @@ vl_deint_filter_init(struct vl_deint_filter *filter, struct pipe_context *pipe,
goto error_sampler;
filter->quad = vl_vb_upload_quads(pipe);
if(!filter->quad.buffer)
if(!filter->quad.buffer.resource)
goto error_quad;
memset(&ve, 0, sizeof(ve));
......@@ -361,7 +361,7 @@ error_vs:
pipe->delete_vertex_elements_state(pipe, filter->ves);
error_ves:
pipe_resource_reference(&filter->quad.buffer, NULL);
pipe_resource_reference(&filter->quad.buffer.resource, NULL);
error_quad:
pipe->delete_sampler_state(pipe, filter->sampler);
......@@ -396,7 +396,7 @@ vl_deint_filter_cleanup(struct vl_deint_filter *filter)
filter->pipe->delete_blend_state(filter->pipe, filter->blend[2]);
filter->pipe->delete_rasterizer_state(filter->pipe, filter->rs_state);
filter->pipe->delete_vertex_elements_state(filter->pipe, filter