17ec681f3Smrg/* 27ec681f3Smrg * Copyright © Microsoft Corporation 37ec681f3Smrg * 47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 57ec681f3Smrg * copy of this software and associated documentation files (the "Software"), 67ec681f3Smrg * to deal in the Software without restriction, including without limitation 77ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 87ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the 97ec681f3Smrg * Software is furnished to do so, subject to the following conditions: 107ec681f3Smrg * 117ec681f3Smrg * The above copyright notice and this permission notice (including the next 127ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the 137ec681f3Smrg * Software. 147ec681f3Smrg * 157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 167ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 177ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 187ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 197ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 207ec681f3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 217ec681f3Smrg * IN THE SOFTWARE. 227ec681f3Smrg */ 237ec681f3Smrg 247ec681f3Smrg#include "d3d12_context.h" 257ec681f3Smrg#include "d3d12_format.h" 267ec681f3Smrg#include "d3d12_resource.h" 277ec681f3Smrg#include "d3d12_screen.h" 287ec681f3Smrg#include "d3d12_surface.h" 297ec681f3Smrg 307ec681f3Smrg#include "util/format/u_format.h" 317ec681f3Smrg#include "util/u_inlines.h" 327ec681f3Smrg#include "util/u_memory.h" 337ec681f3Smrg 347ec681f3Smrgstatic D3D12_DSV_DIMENSION 357ec681f3Smrgview_dsv_dimension(enum pipe_texture_target target, unsigned samples) 367ec681f3Smrg{ 377ec681f3Smrg switch (target) { 387ec681f3Smrg case PIPE_TEXTURE_1D: return D3D12_DSV_DIMENSION_TEXTURE1D; 397ec681f3Smrg case PIPE_TEXTURE_1D_ARRAY: return D3D12_DSV_DIMENSION_TEXTURE1DARRAY; 407ec681f3Smrg 417ec681f3Smrg case PIPE_TEXTURE_2D: 427ec681f3Smrg case PIPE_TEXTURE_RECT: 437ec681f3Smrg return samples > 1 ? D3D12_DSV_DIMENSION_TEXTURE2DMS : 447ec681f3Smrg D3D12_DSV_DIMENSION_TEXTURE2D; 457ec681f3Smrg 467ec681f3Smrg case PIPE_TEXTURE_2D_ARRAY: 477ec681f3Smrg case PIPE_TEXTURE_CUBE: 487ec681f3Smrg return samples > 1 ? D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY : 497ec681f3Smrg D3D12_DSV_DIMENSION_TEXTURE2DARRAY; 507ec681f3Smrg 517ec681f3Smrg default: 527ec681f3Smrg unreachable("unexpected target"); 537ec681f3Smrg } 547ec681f3Smrg} 557ec681f3Smrg 567ec681f3Smrgstatic D3D12_RTV_DIMENSION 577ec681f3Smrgview_rtv_dimension(enum pipe_texture_target target, unsigned samples) 587ec681f3Smrg{ 597ec681f3Smrg switch (target) { 607ec681f3Smrg case PIPE_BUFFER: return D3D12_RTV_DIMENSION_BUFFER; 617ec681f3Smrg case PIPE_TEXTURE_1D: return D3D12_RTV_DIMENSION_TEXTURE1D; 627ec681f3Smrg case PIPE_TEXTURE_1D_ARRAY: return D3D12_RTV_DIMENSION_TEXTURE1DARRAY; 637ec681f3Smrg 647ec681f3Smrg case PIPE_TEXTURE_2D: 657ec681f3Smrg case PIPE_TEXTURE_RECT: 667ec681f3Smrg return samples > 1 ? D3D12_RTV_DIMENSION_TEXTURE2DMS : 677ec681f3Smrg D3D12_RTV_DIMENSION_TEXTURE2D; 687ec681f3Smrg 697ec681f3Smrg case PIPE_TEXTURE_2D_ARRAY: 707ec681f3Smrg case PIPE_TEXTURE_CUBE: 717ec681f3Smrg return samples > 1 ? D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY : 727ec681f3Smrg D3D12_RTV_DIMENSION_TEXTURE2DARRAY; 737ec681f3Smrg 747ec681f3Smrg case PIPE_TEXTURE_3D: return D3D12_RTV_DIMENSION_TEXTURE3D; 757ec681f3Smrg 767ec681f3Smrg default: 777ec681f3Smrg unreachable("unexpected target"); 787ec681f3Smrg } 797ec681f3Smrg} 807ec681f3Smrg 817ec681f3Smrgstatic void 827ec681f3Smrginitialize_dsv(struct pipe_context *pctx, 837ec681f3Smrg struct pipe_resource *pres, 847ec681f3Smrg const struct pipe_surface *tpl, 857ec681f3Smrg struct d3d12_descriptor_handle *handle, 867ec681f3Smrg DXGI_FORMAT dxgi_format) 877ec681f3Smrg{ 887ec681f3Smrg struct d3d12_resource *res = d3d12_resource(pres); 897ec681f3Smrg struct d3d12_screen *screen = d3d12_screen(pctx->screen); 907ec681f3Smrg 917ec681f3Smrg D3D12_DEPTH_STENCIL_VIEW_DESC desc; 927ec681f3Smrg desc.Format = dxgi_format; 937ec681f3Smrg desc.Flags = D3D12_DSV_FLAG_NONE; 947ec681f3Smrg 957ec681f3Smrg desc.ViewDimension = view_dsv_dimension(pres->target, pres->nr_samples); 967ec681f3Smrg switch (desc.ViewDimension) { 977ec681f3Smrg case D3D12_DSV_DIMENSION_TEXTURE1D: 987ec681f3Smrg if (tpl->u.tex.first_layer > 0) 997ec681f3Smrg debug_printf("D3D12: can't create 1D DSV from layer %d\n", 1007ec681f3Smrg tpl->u.tex.first_layer); 1017ec681f3Smrg 1027ec681f3Smrg desc.Texture1D.MipSlice = tpl->u.tex.level; 1037ec681f3Smrg break; 1047ec681f3Smrg 1057ec681f3Smrg case D3D12_DSV_DIMENSION_TEXTURE1DARRAY: 1067ec681f3Smrg desc.Texture1DArray.MipSlice = tpl->u.tex.level; 1077ec681f3Smrg desc.Texture1DArray.FirstArraySlice = tpl->u.tex.first_layer; 1087ec681f3Smrg desc.Texture1DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1; 1097ec681f3Smrg break; 1107ec681f3Smrg 1117ec681f3Smrg case D3D12_DSV_DIMENSION_TEXTURE2DMS: 1127ec681f3Smrg if (tpl->u.tex.first_layer > 0) 1137ec681f3Smrg debug_printf("D3D12: can't create 2DMS DSV from layer %d\n", 1147ec681f3Smrg tpl->u.tex.first_layer); 1157ec681f3Smrg 1167ec681f3Smrg break; 1177ec681f3Smrg 1187ec681f3Smrg case D3D12_DSV_DIMENSION_TEXTURE2D: 1197ec681f3Smrg if (tpl->u.tex.first_layer > 0) 1207ec681f3Smrg debug_printf("D3D12: can't create 2D DSV from layer %d\n", 1217ec681f3Smrg tpl->u.tex.first_layer); 1227ec681f3Smrg 1237ec681f3Smrg desc.Texture2D.MipSlice = tpl->u.tex.level; 1247ec681f3Smrg break; 1257ec681f3Smrg 1267ec681f3Smrg case D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY: 1277ec681f3Smrg desc.Texture2DMSArray.FirstArraySlice = tpl->u.tex.first_layer; 1287ec681f3Smrg desc.Texture2DMSArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1; 1297ec681f3Smrg break; 1307ec681f3Smrg 1317ec681f3Smrg case D3D12_DSV_DIMENSION_TEXTURE2DARRAY: 1327ec681f3Smrg desc.Texture2DArray.MipSlice = tpl->u.tex.level; 1337ec681f3Smrg desc.Texture2DArray.FirstArraySlice = tpl->u.tex.first_layer; 1347ec681f3Smrg desc.Texture2DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1; 1357ec681f3Smrg break; 1367ec681f3Smrg 1377ec681f3Smrg default: 1387ec681f3Smrg unreachable("Unhandled DSV dimension"); 1397ec681f3Smrg } 1407ec681f3Smrg 1417ec681f3Smrg mtx_lock(&screen->descriptor_pool_mutex); 1427ec681f3Smrg d3d12_descriptor_pool_alloc_handle(screen->dsv_pool, handle); 1437ec681f3Smrg mtx_unlock(&screen->descriptor_pool_mutex); 1447ec681f3Smrg 1457ec681f3Smrg screen->dev->CreateDepthStencilView(d3d12_resource_resource(res), &desc, 1467ec681f3Smrg handle->cpu_handle); 1477ec681f3Smrg} 1487ec681f3Smrg 1497ec681f3Smrgstatic void 1507ec681f3Smrginitialize_rtv(struct pipe_context *pctx, 1517ec681f3Smrg struct pipe_resource *pres, 1527ec681f3Smrg const struct pipe_surface *tpl, 1537ec681f3Smrg struct d3d12_descriptor_handle *handle, 1547ec681f3Smrg DXGI_FORMAT dxgi_format) 1557ec681f3Smrg{ 1567ec681f3Smrg struct d3d12_resource *res = d3d12_resource(pres); 1577ec681f3Smrg struct d3d12_screen *screen = d3d12_screen(pctx->screen); 1587ec681f3Smrg 1597ec681f3Smrg D3D12_RENDER_TARGET_VIEW_DESC desc; 1607ec681f3Smrg desc.Format = dxgi_format; 1617ec681f3Smrg 1627ec681f3Smrg desc.ViewDimension = view_rtv_dimension(pres->target, pres->nr_samples); 1637ec681f3Smrg switch (desc.ViewDimension) { 1647ec681f3Smrg case D3D12_RTV_DIMENSION_BUFFER: 1657ec681f3Smrg desc.Buffer.FirstElement = 0; 1667ec681f3Smrg desc.Buffer.NumElements = pres->width0 / util_format_get_blocksize(tpl->format); 1677ec681f3Smrg break; 1687ec681f3Smrg 1697ec681f3Smrg case D3D12_RTV_DIMENSION_TEXTURE1D: 1707ec681f3Smrg if (tpl->u.tex.first_layer > 0) 1717ec681f3Smrg debug_printf("D3D12: can't create 1D RTV from layer %d\n", 1727ec681f3Smrg tpl->u.tex.first_layer); 1737ec681f3Smrg 1747ec681f3Smrg desc.Texture1D.MipSlice = tpl->u.tex.level; 1757ec681f3Smrg break; 1767ec681f3Smrg 1777ec681f3Smrg case D3D12_RTV_DIMENSION_TEXTURE1DARRAY: 1787ec681f3Smrg desc.Texture1DArray.MipSlice = tpl->u.tex.level; 1797ec681f3Smrg desc.Texture1DArray.FirstArraySlice = tpl->u.tex.first_layer; 1807ec681f3Smrg desc.Texture1DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1; 1817ec681f3Smrg break; 1827ec681f3Smrg 1837ec681f3Smrg case D3D12_RTV_DIMENSION_TEXTURE2DMS: 1847ec681f3Smrg if (tpl->u.tex.first_layer > 0) 1857ec681f3Smrg debug_printf("D3D12: can't create 2DMS RTV from layer %d\n", 1867ec681f3Smrg tpl->u.tex.first_layer); 1877ec681f3Smrg break; 1887ec681f3Smrg 1897ec681f3Smrg case D3D12_RTV_DIMENSION_TEXTURE2D: 1907ec681f3Smrg if (tpl->u.tex.first_layer > 0) 1917ec681f3Smrg debug_printf("D3D12: can't create 2D RTV from layer %d\n", 1927ec681f3Smrg tpl->u.tex.first_layer); 1937ec681f3Smrg 1947ec681f3Smrg desc.Texture2D.MipSlice = tpl->u.tex.level; 1957ec681f3Smrg desc.Texture2D.PlaneSlice = 0; 1967ec681f3Smrg break; 1977ec681f3Smrg 1987ec681f3Smrg case D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY: 1997ec681f3Smrg desc.Texture2DMSArray.FirstArraySlice = tpl->u.tex.first_layer; 2007ec681f3Smrg desc.Texture2DMSArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1; 2017ec681f3Smrg break; 2027ec681f3Smrg 2037ec681f3Smrg case D3D12_RTV_DIMENSION_TEXTURE2DARRAY: 2047ec681f3Smrg desc.Texture2DArray.MipSlice = tpl->u.tex.level; 2057ec681f3Smrg desc.Texture2DArray.FirstArraySlice = tpl->u.tex.first_layer; 2067ec681f3Smrg desc.Texture2DArray.ArraySize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1; 2077ec681f3Smrg desc.Texture2DArray.PlaneSlice = 0; 2087ec681f3Smrg break; 2097ec681f3Smrg 2107ec681f3Smrg case D3D12_RTV_DIMENSION_TEXTURE3D: 2117ec681f3Smrg desc.Texture3D.MipSlice = tpl->u.tex.level; 2127ec681f3Smrg desc.Texture3D.FirstWSlice = tpl->u.tex.first_layer; 2137ec681f3Smrg desc.Texture3D.WSize = tpl->u.tex.last_layer - tpl->u.tex.first_layer + 1; 2147ec681f3Smrg break; 2157ec681f3Smrg 2167ec681f3Smrg default: 2177ec681f3Smrg unreachable("Unhandled RTV dimension"); 2187ec681f3Smrg } 2197ec681f3Smrg 2207ec681f3Smrg mtx_lock(&screen->descriptor_pool_mutex); 2217ec681f3Smrg d3d12_descriptor_pool_alloc_handle(screen->rtv_pool, handle); 2227ec681f3Smrg mtx_unlock(&screen->descriptor_pool_mutex); 2237ec681f3Smrg 2247ec681f3Smrg screen->dev->CreateRenderTargetView(d3d12_resource_resource(res), &desc, 2257ec681f3Smrg handle->cpu_handle); 2267ec681f3Smrg} 2277ec681f3Smrg 2287ec681f3Smrgstatic struct pipe_surface * 2297ec681f3Smrgd3d12_create_surface(struct pipe_context *pctx, 2307ec681f3Smrg struct pipe_resource *pres, 2317ec681f3Smrg const struct pipe_surface *tpl) 2327ec681f3Smrg{ 2337ec681f3Smrg bool is_depth_or_stencil = util_format_is_depth_or_stencil(tpl->format); 2347ec681f3Smrg unsigned bind = is_depth_or_stencil ? PIPE_BIND_DEPTH_STENCIL : PIPE_BIND_RENDER_TARGET; 2357ec681f3Smrg 2367ec681f3Smrg /* Don't bother if we don't support the requested format as RT or DS */ 2377ec681f3Smrg if (!pctx->screen->is_format_supported(pctx->screen, tpl->format, PIPE_TEXTURE_2D, 2387ec681f3Smrg tpl->nr_samples, tpl->nr_samples,bind)) 2397ec681f3Smrg return NULL; 2407ec681f3Smrg 2417ec681f3Smrg struct d3d12_surface *surface = CALLOC_STRUCT(d3d12_surface); 2427ec681f3Smrg if (!surface) 2437ec681f3Smrg return NULL; 2447ec681f3Smrg 2457ec681f3Smrg pipe_resource_reference(&surface->base.texture, pres); 2467ec681f3Smrg pipe_reference_init(&surface->base.reference, 1); 2477ec681f3Smrg surface->base.context = pctx; 2487ec681f3Smrg surface->base.format = tpl->format; 2497ec681f3Smrg surface->base.width = u_minify(pres->width0, tpl->u.tex.level); 2507ec681f3Smrg surface->base.height = u_minify(pres->height0, tpl->u.tex.level); 2517ec681f3Smrg surface->base.u.tex.level = tpl->u.tex.level; 2527ec681f3Smrg surface->base.u.tex.first_layer = tpl->u.tex.first_layer; 2537ec681f3Smrg surface->base.u.tex.last_layer = tpl->u.tex.last_layer; 2547ec681f3Smrg 2557ec681f3Smrg DXGI_FORMAT dxgi_format = d3d12_get_resource_rt_format(tpl->format); 2567ec681f3Smrg if (is_depth_or_stencil) 2577ec681f3Smrg initialize_dsv(pctx, pres, tpl, &surface->desc_handle, dxgi_format); 2587ec681f3Smrg else 2597ec681f3Smrg initialize_rtv(pctx, pres, tpl, &surface->desc_handle, dxgi_format); 2607ec681f3Smrg 2617ec681f3Smrg return &surface->base; 2627ec681f3Smrg} 2637ec681f3Smrg 2647ec681f3Smrgstatic void 2657ec681f3Smrgd3d12_surface_destroy(struct pipe_context *pctx, 2667ec681f3Smrg struct pipe_surface *psurf) 2677ec681f3Smrg{ 2687ec681f3Smrg struct d3d12_surface *surface = (struct d3d12_surface*) psurf; 2697ec681f3Smrg struct d3d12_screen *screen = d3d12_screen(pctx->screen); 2707ec681f3Smrg 2717ec681f3Smrg mtx_lock(&screen->descriptor_pool_mutex); 2727ec681f3Smrg d3d12_descriptor_handle_free(&surface->desc_handle); 2737ec681f3Smrg if (d3d12_descriptor_handle_is_allocated(&surface->uint_rtv_handle)) 2747ec681f3Smrg d3d12_descriptor_handle_free(&surface->uint_rtv_handle); 2757ec681f3Smrg mtx_unlock(&screen->descriptor_pool_mutex); 2767ec681f3Smrg 2777ec681f3Smrg pipe_resource_reference(&psurf->texture, NULL); 2787ec681f3Smrg pipe_resource_reference(&surface->rgba_texture, NULL); 2797ec681f3Smrg FREE(surface); 2807ec681f3Smrg} 2817ec681f3Smrg 2827ec681f3Smrgstatic void 2837ec681f3Smrgblit_surface(struct d3d12_surface *surface, bool pre) 2847ec681f3Smrg{ 2857ec681f3Smrg struct pipe_blit_info info = {}; 2867ec681f3Smrg 2877ec681f3Smrg info.src.resource = pre ? surface->base.texture : surface->rgba_texture; 2887ec681f3Smrg info.dst.resource = pre ? surface->rgba_texture : surface->base.texture; 2897ec681f3Smrg info.src.format = pre ? surface->base.texture->format : PIPE_FORMAT_R8G8B8A8_UNORM; 2907ec681f3Smrg info.dst.format = pre ? PIPE_FORMAT_R8G8B8A8_UNORM : surface->base.texture->format; 2917ec681f3Smrg info.src.level = info.dst.level = 0; 2927ec681f3Smrg info.src.box.x = info.dst.box.x = 0; 2937ec681f3Smrg info.src.box.y = info.dst.box.y = 0; 2947ec681f3Smrg info.src.box.z = info.dst.box.z = 0; 2957ec681f3Smrg info.src.box.width = info.dst.box.width = surface->base.width; 2967ec681f3Smrg info.src.box.height = info.dst.box.height = surface->base.height; 2977ec681f3Smrg info.src.box.depth = info.dst.box.depth = 0; 2987ec681f3Smrg info.mask = PIPE_MASK_RGBA; 2997ec681f3Smrg 3007ec681f3Smrg d3d12_blit(surface->base.context, &info); 3017ec681f3Smrg} 3027ec681f3Smrg 3037ec681f3Smrgenum d3d12_surface_conversion_mode 3047ec681f3Smrgd3d12_surface_update_pre_draw(struct d3d12_surface *surface, 3057ec681f3Smrg DXGI_FORMAT format) 3067ec681f3Smrg{ 3077ec681f3Smrg struct d3d12_screen *screen = d3d12_screen(surface->base.context->screen); 3087ec681f3Smrg struct d3d12_resource *res = d3d12_resource(surface->base.texture); 3097ec681f3Smrg DXGI_FORMAT dxgi_format = d3d12_get_resource_rt_format(surface->base.format); 3107ec681f3Smrg enum d3d12_surface_conversion_mode mode; 3117ec681f3Smrg 3127ec681f3Smrg if (dxgi_format == format) 3137ec681f3Smrg return D3D12_SURFACE_CONVERSION_NONE; 3147ec681f3Smrg 3157ec681f3Smrg if (dxgi_format == DXGI_FORMAT_B8G8R8A8_UNORM || 3167ec681f3Smrg dxgi_format == DXGI_FORMAT_B8G8R8X8_UNORM) 3177ec681f3Smrg mode = D3D12_SURFACE_CONVERSION_BGRA_UINT; 3187ec681f3Smrg else 3197ec681f3Smrg mode = D3D12_SURFACE_CONVERSION_RGBA_UINT; 3207ec681f3Smrg 3217ec681f3Smrg if (mode == D3D12_SURFACE_CONVERSION_BGRA_UINT) { 3227ec681f3Smrg if (!surface->rgba_texture) { 3237ec681f3Smrg struct pipe_resource templ = {}; 3247ec681f3Smrg struct pipe_resource *src = surface->base.texture; 3257ec681f3Smrg 3267ec681f3Smrg templ.format = PIPE_FORMAT_R8G8B8A8_UNORM; 3277ec681f3Smrg templ.width0 = src->width0; 3287ec681f3Smrg templ.height0 = src->height0; 3297ec681f3Smrg templ.depth0 = src->depth0; 3307ec681f3Smrg templ.array_size = src->array_size; 3317ec681f3Smrg templ.nr_samples = src->nr_samples; 3327ec681f3Smrg templ.nr_storage_samples = src->nr_storage_samples; 3337ec681f3Smrg templ.usage = PIPE_USAGE_DEFAULT | PIPE_USAGE_STAGING; 3347ec681f3Smrg templ.bind = src->bind; 3357ec681f3Smrg templ.target = src->target; 3367ec681f3Smrg 3377ec681f3Smrg surface->rgba_texture = screen->base.resource_create(&screen->base, &templ); 3387ec681f3Smrg } 3397ec681f3Smrg 3407ec681f3Smrg blit_surface(surface, true); 3417ec681f3Smrg res = d3d12_resource(surface->rgba_texture); 3427ec681f3Smrg } 3437ec681f3Smrg 3447ec681f3Smrg if (!d3d12_descriptor_handle_is_allocated(&surface->uint_rtv_handle)) { 3457ec681f3Smrg initialize_rtv(surface->base.context, &res->base, &surface->base, 3467ec681f3Smrg &surface->uint_rtv_handle, DXGI_FORMAT_R8G8B8A8_UINT); 3477ec681f3Smrg } 3487ec681f3Smrg 3497ec681f3Smrg return mode; 3507ec681f3Smrg} 3517ec681f3Smrg 3527ec681f3Smrgvoid 3537ec681f3Smrgd3d12_surface_update_post_draw(struct d3d12_surface *surface, 3547ec681f3Smrg enum d3d12_surface_conversion_mode mode) 3557ec681f3Smrg{ 3567ec681f3Smrg if (mode == D3D12_SURFACE_CONVERSION_BGRA_UINT) 3577ec681f3Smrg blit_surface(surface, false); 3587ec681f3Smrg} 3597ec681f3Smrg 3607ec681f3SmrgD3D12_CPU_DESCRIPTOR_HANDLE 3617ec681f3Smrgd3d12_surface_get_handle(struct d3d12_surface *surface, 3627ec681f3Smrg enum d3d12_surface_conversion_mode mode) 3637ec681f3Smrg{ 3647ec681f3Smrg if (mode != D3D12_SURFACE_CONVERSION_NONE) 3657ec681f3Smrg return surface->uint_rtv_handle.cpu_handle; 3667ec681f3Smrg return surface->desc_handle.cpu_handle; 3677ec681f3Smrg} 3687ec681f3Smrg 3697ec681f3Smrgvoid 3707ec681f3Smrgd3d12_context_surface_init(struct pipe_context *context) 3717ec681f3Smrg{ 3727ec681f3Smrg context->create_surface = d3d12_create_surface; 3737ec681f3Smrg context->surface_destroy = d3d12_surface_destroy; 3747ec681f3Smrg} 375