X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fstate_trackers%2Fnine%2Fbuffer9.h;h=b04a0a721bb74db398f9863f2c56e1626ce6937b;hb=83ca6b9d31005a11380f9dbd1b5531294f5c3e92;hp=d8024e4aac2facd9db5a0e5e01e54d39ffffaa21;hpb=22f6d6fbd270333979c282627349eb74c06acd6b;p=mesa.git diff --git a/src/gallium/state_trackers/nine/buffer9.h b/src/gallium/state_trackers/nine/buffer9.h index d8024e4aac2..b04a0a721bb 100644 --- a/src/gallium/state_trackers/nine/buffer9.h +++ b/src/gallium/state_trackers/nine/buffer9.h @@ -25,6 +25,8 @@ #define _NINE_BUFFER9_H_ #include "device9.h" +#include "nine_buffer_upload.h" +#include "nine_state.h" #include "resource9.h" #include "pipe/p_context.h" #include "pipe/p_state.h" @@ -37,6 +39,8 @@ struct pipe_transfer; struct NineTransfer { struct pipe_transfer *transfer; bool is_pipe_secondary; + struct nine_subbuffer *buf; /* NULL unless subbuffer are used */ + bool should_destroy_buf; /* If the subbuffer should be destroyed */ }; struct NineBuffer9 @@ -49,6 +53,10 @@ struct NineBuffer9 UINT size; int16_t bind_count; /* to Device9->state.stream */ + /* Whether only discard and nooverwrite were used so far + * for this buffer. Allows some optimization. */ + boolean discard_nooverwrite_only; + struct nine_subbuffer *buf; /* Specific to managed buffers */ struct { @@ -57,6 +65,7 @@ struct NineBuffer9 struct pipe_box dirty_box; struct list_head list; /* for update_buffers */ struct list_head list2; /* for managed_buffers */ + unsigned pending_upload; /* for uploads */ } managed; }; static inline struct NineBuffer9 * @@ -77,7 +86,7 @@ void NineBuffer9_dtor( struct NineBuffer9 *This ); struct pipe_resource * -NineBuffer9_GetResource( struct NineBuffer9 *This ); +NineBuffer9_GetResource( struct NineBuffer9 *This, unsigned *offset ); HRESULT NINE_WINAPI NineBuffer9_Lock( struct NineBuffer9 *This, @@ -92,13 +101,13 @@ NineBuffer9_Unlock( struct NineBuffer9 *This ); static inline void NineBuffer9_Upload( struct NineBuffer9 *This ) { - struct pipe_context *pipe = NineDevice9_GetPipe(This->base.base.device); + struct NineDevice9 *device = This->base.base.device; assert(This->base.pool == D3DPOOL_MANAGED && This->managed.dirty); - pipe->buffer_subdata(pipe, This->base.resource, 0, - This->managed.dirty_box.x, - This->managed.dirty_box.width, - (char *)This->managed.data + This->managed.dirty_box.x); + nine_context_range_upload(device, &This->managed.pending_upload, This->base.resource, + This->managed.dirty_box.x, + This->managed.dirty_box.width, + (char *)This->managed.data + This->managed.dirty_box.x); This->managed.dirty = FALSE; }