if (!size)
return;
- usage |= PIPE_TRANSFER_WRITE |
- PIPE_TRANSFER_DISCARD_RANGE;
+ usage |= PIPE_TRANSFER_WRITE;
+
+ /* PIPE_TRANSFER_MAP_DIRECTLY supresses implicit DISCARD_RANGE. */
+ if (!(usage & PIPE_TRANSFER_MAP_DIRECTLY))
+ usage |= PIPE_TRANSFER_DISCARD_RANGE;
usage = tc_improve_map_buffer_flags(tc, tres, usage, offset, size);
/* the write flag is implicit by the nature of buffer_subdata */
usage |= PIPE_TRANSFER_WRITE;
- /* buffer_subdata implicitly discards the rewritten buffer range */
- if (offset == 0 && size == resource->width0) {
- usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
- } else {
- usage |= PIPE_TRANSFER_DISCARD_RANGE;
+ /* buffer_subdata implicitly discards the rewritten buffer range.
+ * PIPE_TRANSFER_MAP_DIRECTLY supresses that.
+ */
+ if (!(usage & PIPE_TRANSFER_MAP_DIRECTLY)) {
+ if (offset == 0 && size == resource->width0) {
+ usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+ } else {
+ usage |= PIPE_TRANSFER_DISCARD_RANGE;
+ }
}
u_box_1d(offset, size, &box);
struct pipe_box box;
uint8_t *map = NULL;
+ usage |= PIPE_TRANSFER_WRITE;
+
+ if (!(usage & PIPE_TRANSFER_MAP_DIRECTLY))
+ usage |= PIPE_TRANSFER_DISCARD_RANGE;
+
u_box_1d(offset, size, &box);
- map = r600_buffer_transfer_map(ctx, buffer, 0,
- PIPE_TRANSFER_WRITE |
- PIPE_TRANSFER_DISCARD_RANGE |
- usage,
- &box, &transfer);
+ map = r600_buffer_transfer_map(ctx, buffer, 0, usage, &box, &transfer);
if (!map)
return;
struct pipe_box box;
uint8_t *map = NULL;
+ usage |= PIPE_TRANSFER_WRITE;
+
+ if (!(usage & PIPE_TRANSFER_MAP_DIRECTLY))
+ usage |= PIPE_TRANSFER_DISCARD_RANGE;
+
u_box_1d(offset, size, &box);
- map = si_buffer_transfer_map(ctx, buffer, 0,
- PIPE_TRANSFER_WRITE |
- PIPE_TRANSFER_DISCARD_RANGE |
- usage,
- &box, &transfer);
+ map = si_buffer_transfer_map(ctx, buffer, 0, usage, &box, &transfer);
if (!map)
return;
/* the write flag is implicit by the nature of buffer_subdata */
usage |= PIPE_TRANSFER_WRITE;
- if (offset == 0 && size == resource->width0)
- usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
- else
- usage |= PIPE_TRANSFER_DISCARD_RANGE;
+ if (!(usage & PIPE_TRANSFER_MAP_DIRECTLY)) {
+ if (offset == 0 && size == resource->width0)
+ usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
+ else
+ usage |= PIPE_TRANSFER_DISCARD_RANGE;
+ }
u_box_1d(offset, size, &box);
* E.g. the state tracker could have a simpler path which maps textures and
* does read/modify/write cycles on them directly, and a more complicated
* path which uses minimal read and write transfers.
+ *
+ * This flag supresses implicit "DISCARD" for buffer_subdata.
*/
PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2),