mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
gallium: add an interface for memory allocations.
In order to support vulkan over gallium for the sw renderers, there needs to be a vulkan-like memory allocation API. It doesn't need to be overly complicated for the needs of the sw renderers. The vallium layer will allocate resources and memory separately and bind them via this API. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6082>
This commit is contained in:
parent
50b039590e
commit
e6c7ca218d
2 changed files with 45 additions and 0 deletions
|
|
@ -511,6 +511,47 @@ struct pipe_screen {
|
|||
* should be.
|
||||
*/
|
||||
void (*finalize_nir)(struct pipe_screen *screen, void *nir, bool optimize);
|
||||
|
||||
/*Separated memory/resource allocations interfaces for Vulkan */
|
||||
|
||||
/**
|
||||
* Create a resource, and retrieve the required size for it but don't allocate
|
||||
* any backing memory.
|
||||
*/
|
||||
struct pipe_resource * (*resource_create_unbacked)(struct pipe_screen *,
|
||||
const struct pipe_resource *templat,
|
||||
uint64_t *size_required);
|
||||
|
||||
/**
|
||||
* Allocate backing memory to be bound to resources.
|
||||
*/
|
||||
struct pipe_memory_allocation *(*allocate_memory)(struct pipe_screen *screen,
|
||||
uint64_t size);
|
||||
/**
|
||||
* Free previously allocated backing memory.
|
||||
*/
|
||||
void (*free_memory)(struct pipe_screen *screen,
|
||||
struct pipe_memory_allocation *);
|
||||
|
||||
/**
|
||||
* Bind memory to a resource.
|
||||
*/
|
||||
void (*resource_bind_backing)(struct pipe_screen *screen,
|
||||
struct pipe_resource *pt,
|
||||
struct pipe_memory_allocation *pmem,
|
||||
uint64_t offset);
|
||||
|
||||
/**
|
||||
* Map backing memory.
|
||||
*/
|
||||
void *(*map_memory)(struct pipe_screen *screen,
|
||||
struct pipe_memory_allocation *pmem);
|
||||
|
||||
/**
|
||||
* Unmap backing memory.
|
||||
*/
|
||||
void (*unmap_memory)(struct pipe_screen *screen,
|
||||
struct pipe_memory_allocation *pmem);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -574,6 +574,10 @@ struct pipe_resource
|
|||
struct pipe_screen *screen; /**< screen that this texture belongs to */
|
||||
};
|
||||
|
||||
/**
|
||||
* Opaque object used for separate resource/memory allocations.
|
||||
*/
|
||||
struct pipe_memory_allocation;
|
||||
|
||||
/**
|
||||
* Transfer object. For data transfer to/from a resource.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue