(util_format_is_srgb(templ->format) ==
util_format_is_srgb(resource->format)));
- res->clean[0] = FALSE;
+ virgl_resource_dirty(res, 0);
handle = virgl_object_assign_handle();
pipe_reference_init(&surf->base.reference, 1);
pipe_resource_reference(&surf->base.texture, resource);
struct virgl_screen *vs = virgl_screen(ctx->screen);
struct virgl_resource *grres = virgl_resource(res);
- grres->clean[0] = FALSE;
+ virgl_resource_dirty(grres, 0);
if (virgl_res_needs_flush_wait(vctx, grres, usage)) {
ctx->flush(ctx, NULL, 0);
struct virgl_resource *dres = virgl_resource(dst);
struct virgl_resource *sres = virgl_resource(src);
- dres->clean[0] = FALSE;
+ virgl_resource_dirty(dres, 0);
virgl_encode_resource_copy_region(vctx, dres,
dst_level, dstx, dsty, dstz,
sres, src_level,
(util_format_is_srgb(blit->dst.resource->format) ==
util_format_is_srgb(blit->dst.format)));
- dres->clean[0] = FALSE;
+ virgl_resource_dirty(dres, 0);
virgl_encode_blit(vctx, dres, sres,
blit);
}
}
}
-static void virgl_dirty_res(struct virgl_resource *res)
-{
- if (res)
- res->clean[0] = FALSE;
-}
-
int virgl_encode_bind_object(struct virgl_context *ctx,
uint32_t handle, uint32_t object)
{
if (res->u.b.target == PIPE_BUFFER) {
virgl_encoder_write_dword(ctx->cbuf, state->u.buf.offset / elem_size);
virgl_encoder_write_dword(ctx->cbuf, (state->u.buf.offset + state->u.buf.size) / elem_size - 1);
- virgl_dirty_res(res);
+ virgl_resource_dirty(res, 0);
} else {
virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_layer | state->u.tex.last_layer << 16);
virgl_encoder_write_dword(ctx->cbuf, state->u.tex.first_level | state->u.tex.last_level << 8);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_offset);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_size);
virgl_encoder_write_res(ctx, res);
- virgl_dirty_res(res);
+ virgl_resource_dirty(res, 0);
} else {
virgl_encoder_write_dword(ctx->cbuf, 0);
virgl_encoder_write_dword(ctx->cbuf, 0);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_offset);
virgl_encoder_write_dword(ctx->cbuf, buffers[i].buffer_size);
virgl_encoder_write_res(ctx, res);
- virgl_dirty_res(res);
+ virgl_resource_dirty(res, 0);
} else {
virgl_encoder_write_dword(ctx->cbuf, 0);
virgl_encoder_write_dword(ctx->cbuf, 0);
virgl_encoder_write_dword(ctx->cbuf, images[i].u.buf.offset);
virgl_encoder_write_dword(ctx->cbuf, images[i].u.buf.size);
virgl_encoder_write_res(ctx, res);
- virgl_dirty_res(res);
+ virgl_resource_dirty(res, 0);
} else {
virgl_encoder_write_dword(ctx->cbuf, 0);
virgl_encoder_write_dword(ctx->cbuf, 0);
struct virgl_context *vctx = virgl_context(ctx);
struct virgl_query *query = virgl_query(q);
- query->buf->clean[0] = FALSE;
+ virgl_resource_dirty(query->buf, 0);
virgl_encoder_begin_query(vctx, query->handle);
return true;
}
res->metadata.stride[0],
whandle);
}
+
+void virgl_resource_dirty(struct virgl_resource *res, uint32_t level)
+{
+ if (res)
+ res->clean[0] = FALSE;
+}
boolean virgl_resource_get_handle(struct pipe_screen *screen,
struct pipe_resource *resource,
struct winsys_handle *whandle);
+
+void virgl_resource_dirty(struct virgl_resource *res, uint32_t level);
+
#endif
t->base.buffer_offset = buffer_offset;
t->base.buffer_size = buffer_size;
t->handle = handle;
- res->clean[0] = FALSE;
+ virgl_resource_dirty(res, 0);
virgl_encoder_create_so_target(vctx, handle, res, buffer_offset, buffer_size);
return &t->base;
}