From 596d15a50c34ac0fd704346f5a8fd537ef38e395 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 24 May 2022 18:17:43 -0500 Subject: [PATCH] a/d3d: Further namespace the d3d11-specific functions --- src/xrt/auxiliary/d3d/d3d_d3d11_allocator.cpp | 8 ++++---- src/xrt/auxiliary/d3d/d3d_d3d11_allocator.hpp | 4 ++-- src/xrt/auxiliary/d3d/d3d_d3d11_fence.cpp | 4 ++-- src/xrt/auxiliary/d3d/d3d_d3d11_fence.hpp | 4 ++-- src/xrt/compositor/client/comp_d3d11_client.cpp | 8 ++++---- tests/tests_aux_d3d.cpp | 1 + 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/xrt/auxiliary/d3d/d3d_d3d11_allocator.cpp b/src/xrt/auxiliary/d3d/d3d_d3d11_allocator.cpp index 7408099bf..00fa19024 100644 --- a/src/xrt/auxiliary/d3d/d3d_d3d11_allocator.cpp +++ b/src/xrt/auxiliary/d3d/d3d_d3d11_allocator.cpp @@ -52,7 +52,7 @@ DEBUG_GET_ONCE_LOG_OPTION(d3d11_log, "DXGI_LOG", U_LOGGING_WARN) #define D3DA_WARN(...) U_LOG_IFL_W(debug_get_log_option_d3d11_log(), __VA_ARGS__) #define D3DA_ERROR(...) U_LOG_IFL_E(debug_get_log_option_d3d11_log(), __VA_ARGS__) -namespace xrt::auxiliary::d3d { +namespace xrt::auxiliary::d3d::d3d11 { wil::unique_handle createSharedHandle(const wil::com_ptr &image) @@ -125,7 +125,7 @@ try { } DEFAULT_CATCH(XRT_ERROR_ALLOCATION) -} // namespace xrt::auxiliary::d3d +} // namespace xrt::auxiliary::d3d::d3d11 struct d3d11_allocator { @@ -145,8 +145,8 @@ d3d11_images_allocate(struct xrt_image_native_allocator *xina, std::vector> images; std::vector handles; - auto result = xrt::auxiliary::d3d::allocateSharedImages(*(d3da->device), *xsci, image_count, false, - images, handles); + auto result = xrt::auxiliary::d3d::d3d11::allocateSharedImages(*(d3da->device), *xsci, image_count, + false, images, handles); if (XRT_SUCCESS != result) { return result; } diff --git a/src/xrt/auxiliary/d3d/d3d_d3d11_allocator.hpp b/src/xrt/auxiliary/d3d/d3d_d3d11_allocator.hpp index f72997b0d..dd469cc44 100644 --- a/src/xrt/auxiliary/d3d/d3d_d3d11_allocator.hpp +++ b/src/xrt/auxiliary/d3d/d3d_d3d11_allocator.hpp @@ -20,7 +20,7 @@ #include -namespace xrt::auxiliary::d3d { +namespace xrt::auxiliary::d3d::d3d11 { /** * Allocate images (ID3D11Texture2D1) that have a corresponding native handle. @@ -48,4 +48,4 @@ allocateSharedImages(ID3D11Device5 &device, std::vector> &out_images, std::vector &out_handles); -}; // namespace xrt::auxiliary::d3d +}; // namespace xrt::auxiliary::d3d::d3d11 diff --git a/src/xrt/auxiliary/d3d/d3d_d3d11_fence.cpp b/src/xrt/auxiliary/d3d/d3d_d3d11_fence.cpp index 3f9e6fc4f..c2e3204e8 100644 --- a/src/xrt/auxiliary/d3d/d3d_d3d11_fence.cpp +++ b/src/xrt/auxiliary/d3d/d3d_d3d11_fence.cpp @@ -46,7 +46,7 @@ using namespace std::chrono; } -namespace xrt::auxiliary::d3d { +namespace xrt::auxiliary::d3d::d3d11 { xrt_result_t createSharedFence(ID3D11Device5 &device, @@ -116,4 +116,4 @@ waitOnFenceWithTimeout(wil::com_ptr fence, return XRT_TIMEOUT; } -} // namespace xrt::auxiliary::d3d +} // namespace xrt::auxiliary::d3d::d3d11 diff --git a/src/xrt/auxiliary/d3d/d3d_d3d11_fence.hpp b/src/xrt/auxiliary/d3d/d3d_d3d11_fence.hpp index 5181edef4..8798afd8a 100644 --- a/src/xrt/auxiliary/d3d/d3d_d3d11_fence.hpp +++ b/src/xrt/auxiliary/d3d/d3d_d3d11_fence.hpp @@ -17,7 +17,7 @@ #include -namespace xrt::auxiliary::d3d { +namespace xrt::auxiliary::d3d::d3d11 { /** * Allocate a fence (ID3D11Fence) that has a corresponding native handle. @@ -56,4 +56,4 @@ waitOnFenceWithTimeout(wil::com_ptr fence, uint64_t value, std::chrono::milliseconds timeout_ms); -}; // namespace xrt::auxiliary::d3d +}; // namespace xrt::auxiliary::d3d::d3d11 diff --git a/src/xrt/compositor/client/comp_d3d11_client.cpp b/src/xrt/compositor/client/comp_d3d11_client.cpp index bb4dbaa42..91affcffd 100644 --- a/src/xrt/compositor/client/comp_d3d11_client.cpp +++ b/src/xrt/compositor/client/comp_d3d11_client.cpp @@ -441,8 +441,8 @@ try { std::unique_ptr sc = std::make_unique(); sc->data = std::make_unique(); auto &data = sc->data; - xret = xrt::auxiliary::d3d::allocateSharedImages(*(c->comp_device), xinfo, image_count, true, data->comp_images, - data->handles); + xret = xrt::auxiliary::d3d::d3d11::allocateSharedImages(*(c->comp_device), xinfo, image_count, true, + data->comp_images, data->handles); if (xret != XRT_SUCCESS) { return xret; } @@ -736,8 +736,8 @@ client_d3d11_compositor_layer_commit(struct xrt_compositor *xc, if (c->fence) { // Wait on it ourselves, if we have it and didn't tell the native compositor to wait on it. - xret = xrt::auxiliary::d3d::waitOnFenceWithTimeout(c->fence, c->local_wait_event, - c->timeline_semaphore_value, kFenceTimeout); + xret = xrt::auxiliary::d3d::d3d11::waitOnFenceWithTimeout(c->fence, c->local_wait_event, + c->timeline_semaphore_value, kFenceTimeout); if (xret != XRT_SUCCESS) { struct u_pp_sink_stack_only sink; // Not inited, very large. u_pp_delegate_t dg = u_pp_sink_stack_only_init(&sink); diff --git a/tests/tests_aux_d3d.cpp b/tests/tests_aux_d3d.cpp index e61246139..74c1c2558 100644 --- a/tests/tests_aux_d3d.cpp +++ b/tests/tests_aux_d3d.cpp @@ -17,6 +17,7 @@ #include using namespace xrt::auxiliary::d3d; +using namespace xrt::auxiliary::d3d::d3d11; using namespace xrt::auxiliary::util; TEST_CASE("dxgi_adapter", "[.][needgpu]")