mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
d3d12: Support WINSYS_HANDLE_TYPE_D3D12_RES
Reviewed-by: Charmaine Lee <charmainel@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7535>
This commit is contained in:
parent
7145cd6e73
commit
fd361dde65
1 changed files with 23 additions and 2 deletions
|
|
@ -278,7 +278,21 @@ d3d12_resource_from_handle(struct pipe_screen *pscreen,
|
|||
const struct pipe_resource *templ,
|
||||
struct winsys_handle *handle, unsigned usage)
|
||||
{
|
||||
return NULL;
|
||||
if (handle->type != WINSYS_HANDLE_TYPE_D3D12_RES)
|
||||
return NULL;
|
||||
|
||||
struct d3d12_resource *res = CALLOC_STRUCT(d3d12_resource);
|
||||
if (!res)
|
||||
return NULL;
|
||||
|
||||
res->base = *templ;
|
||||
pipe_reference_init(&res->base.reference, 1);
|
||||
res->base.screen = pscreen;
|
||||
res->dxgi_format = templ->target == PIPE_BUFFER ? DXGI_FORMAT_UNKNOWN :
|
||||
d3d12_get_format(templ->format);
|
||||
res->bo = d3d12_bo_wrap_res((ID3D12Resource *)handle->com_obj, templ->format);
|
||||
init_valid_range(res);
|
||||
return &res->base;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -288,7 +302,14 @@ d3d12_resource_get_handle(struct pipe_screen *pscreen,
|
|||
struct winsys_handle *handle,
|
||||
unsigned usage)
|
||||
{
|
||||
return false;
|
||||
struct d3d12_screen *screen = d3d12_screen(pscreen);
|
||||
struct d3d12_resource *res = d3d12_resource(pres);
|
||||
|
||||
if (handle->type != WINSYS_HANDLE_TYPE_D3D12_RES)
|
||||
return false;
|
||||
|
||||
handle->com_obj = d3d12_resource_resource(res);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue