assert(list_is_empty(&This->managed.list));
This->managed.dirty = TRUE;
This->managed.dirty_box = box;
- if (p_atomic_read(&This->managed.pending_upload))
- nine_csmt_process(This->base.base.device);
+ /* Flush if regions pending to be uploaded would be dirtied */
+ if (p_atomic_read(&This->managed.pending_upload)) {
+ u_box_intersect_1d(&box, &box, &This->managed.upload_pending_regions);
+ if (box.width != 0)
+ nine_csmt_process(This->base.base.device);
+ }
} else
- u_box_union_2d(&This->managed.dirty_box, &This->managed.dirty_box, &box);
+ u_box_union_1d(&This->managed.dirty_box, &This->managed.dirty_box, &box);
/* Tests trying to draw while the buffer is locked show that
* MANAGED buffers are made dirty at Lock time */
BASEBUF_REGISTER_UPDATE(This);
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "util/list.h"
+#include "util/u_box.h"
struct pipe_screen;
struct pipe_context;
struct {
void *data;
boolean dirty;
- struct pipe_box dirty_box;
+ struct pipe_box dirty_box; /* region in the resource to update */
+ struct pipe_box upload_pending_regions; /* region with uploads pending */
struct list_head list; /* for update_buffers */
struct list_head list2; /* for managed_buffers */
unsigned pending_upload; /* for uploads */
struct NineDevice9 *device = This->base.base.device;
assert(This->base.pool != D3DPOOL_DEFAULT && This->managed.dirty);
+ if (This->managed.pending_upload) {
+ u_box_union_1d(&This->managed.upload_pending_regions,
+ &This->managed.upload_pending_regions,
+ &This->managed.dirty_box);
+ } else {
+ This->managed.upload_pending_regions = This->managed.dirty_box;
+ }
nine_context_range_upload(device, &This->managed.pending_upload,
(struct NineUnknown *)This,
This->base.resource,