struct svga_3d_update_gb_image;
+/**
+ * This structure describes the bind flags and cache key associated
+ * with the host surface.
+ */
+struct svga_buffer_surface
+{
+ struct list_head list;
+ unsigned bind_flags;
+ struct svga_host_surface_cache_key key;
+ struct svga_winsys_surface *handle;
+};
+
/**
* SVGA pipe buffer.
*/
*/
struct svga_winsys_surface *handle;
+ /**
+ * List of surfaces created for this buffer resource to support
+ * incompatible bind flags.
+ */
+ struct list_head surfaces;
+
/**
* Information about ongoing and past map operations.
*/
unsigned size; /**< Approximate size in bytes */
boolean dirty; /**< Need to do a readback before mapping? */
+
+ /** In some cases we try to keep the results of the translate_indices()
+ * function from svga_draw_elements.c
+ */
+ struct {
+ enum pipe_prim_type orig_prim, new_prim;
+ struct pipe_resource *buffer;
+ unsigned index_size;
+ unsigned offset; /**< first index */
+ unsigned count; /**< num indices */
+ } translated_indices;
};
static inline struct svga_buffer *
-svga_buffer(struct pipe_resource *buffer)
+svga_buffer(struct pipe_resource *resource)
{
- if (buffer) {
- assert(((struct svga_buffer *)buffer)->b.vtbl == &svga_buffer_vtbl);
- return (struct svga_buffer *)buffer;
- }
- return NULL;
+ struct svga_buffer *buf = (struct svga_buffer *) resource;
+ assert(buf == NULL || buf->b.vtbl == &svga_buffer_vtbl);
+ return buf;
}
/**
* Map the hardware storage of a buffer.
+ * \param flags bitmask of PIPE_TRANSFER_* flags
*/
static inline void *
svga_buffer_hw_storage_map(struct svga_context *svga,
{
struct svga_winsys_screen *sws = svga_buffer_winsys_screen(sbuf);
- svga->hud.num_resources_mapped++;
+ svga->hud.num_buffers_mapped++;
if (sws->have_gb_objects) {
return svga->swc->surface_map(svga->swc, sbuf->handle, flags, retry);
*/
struct svga_winsys_surface *
svga_buffer_handle(struct svga_context *svga,
- struct pipe_resource *buf);
+ struct pipe_resource *buf,
+ unsigned tobind_flags);
void
svga_context_flush_buffers(struct svga_context *svga);