a/d3d: Further namespace the d3d11-specific functions

This commit is contained in:
Ryan Pavlik 2022-05-24 18:17:43 -05:00 committed by Jakob Bornecrantz
parent 79dffbf3f6
commit 596d15a50c
6 changed files with 15 additions and 14 deletions

View file

@ -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_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__) #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 wil::unique_handle
createSharedHandle(const wil::com_ptr<ID3D11Texture2D1> &image) createSharedHandle(const wil::com_ptr<ID3D11Texture2D1> &image)
@ -125,7 +125,7 @@ try {
} }
DEFAULT_CATCH(XRT_ERROR_ALLOCATION) DEFAULT_CATCH(XRT_ERROR_ALLOCATION)
} // namespace xrt::auxiliary::d3d } // namespace xrt::auxiliary::d3d::d3d11
struct d3d11_allocator struct d3d11_allocator
{ {
@ -145,8 +145,8 @@ d3d11_images_allocate(struct xrt_image_native_allocator *xina,
std::vector<wil::com_ptr<ID3D11Texture2D1>> images; std::vector<wil::com_ptr<ID3D11Texture2D1>> images;
std::vector<wil::unique_handle> handles; std::vector<wil::unique_handle> handles;
auto result = xrt::auxiliary::d3d::allocateSharedImages(*(d3da->device), *xsci, image_count, false, auto result = xrt::auxiliary::d3d::d3d11::allocateSharedImages(*(d3da->device), *xsci, image_count,
images, handles); false, images, handles);
if (XRT_SUCCESS != result) { if (XRT_SUCCESS != result) {
return result; return result;
} }

View file

@ -20,7 +20,7 @@
#include <vector> #include <vector>
namespace xrt::auxiliary::d3d { namespace xrt::auxiliary::d3d::d3d11 {
/** /**
* Allocate images (ID3D11Texture2D1) that have a corresponding native handle. * Allocate images (ID3D11Texture2D1) that have a corresponding native handle.
@ -48,4 +48,4 @@ allocateSharedImages(ID3D11Device5 &device,
std::vector<wil::com_ptr<ID3D11Texture2D1>> &out_images, std::vector<wil::com_ptr<ID3D11Texture2D1>> &out_images,
std::vector<wil::unique_handle> &out_handles); std::vector<wil::unique_handle> &out_handles);
}; // namespace xrt::auxiliary::d3d }; // namespace xrt::auxiliary::d3d::d3d11

View file

@ -46,7 +46,7 @@ using namespace std::chrono;
} }
namespace xrt::auxiliary::d3d { namespace xrt::auxiliary::d3d::d3d11 {
xrt_result_t xrt_result_t
createSharedFence(ID3D11Device5 &device, createSharedFence(ID3D11Device5 &device,
@ -116,4 +116,4 @@ waitOnFenceWithTimeout(wil::com_ptr<ID3D11Fence> fence,
return XRT_TIMEOUT; return XRT_TIMEOUT;
} }
} // namespace xrt::auxiliary::d3d } // namespace xrt::auxiliary::d3d::d3d11

View file

@ -17,7 +17,7 @@
#include <chrono> #include <chrono>
namespace xrt::auxiliary::d3d { namespace xrt::auxiliary::d3d::d3d11 {
/** /**
* Allocate a fence (ID3D11Fence) that has a corresponding native handle. * Allocate a fence (ID3D11Fence) that has a corresponding native handle.
@ -56,4 +56,4 @@ waitOnFenceWithTimeout(wil::com_ptr<ID3D11Fence> fence,
uint64_t value, uint64_t value,
std::chrono::milliseconds timeout_ms); std::chrono::milliseconds timeout_ms);
}; // namespace xrt::auxiliary::d3d }; // namespace xrt::auxiliary::d3d::d3d11

View file

@ -441,8 +441,8 @@ try {
std::unique_ptr<struct client_d3d11_swapchain> sc = std::make_unique<struct client_d3d11_swapchain>(); std::unique_ptr<struct client_d3d11_swapchain> sc = std::make_unique<struct client_d3d11_swapchain>();
sc->data = std::make_unique<client_d3d11_swapchain_data>(); sc->data = std::make_unique<client_d3d11_swapchain_data>();
auto &data = sc->data; auto &data = sc->data;
xret = xrt::auxiliary::d3d::allocateSharedImages(*(c->comp_device), xinfo, image_count, true, data->comp_images, xret = xrt::auxiliary::d3d::d3d11::allocateSharedImages(*(c->comp_device), xinfo, image_count, true,
data->handles); data->comp_images, data->handles);
if (xret != XRT_SUCCESS) { if (xret != XRT_SUCCESS) {
return xret; return xret;
} }
@ -736,7 +736,7 @@ client_d3d11_compositor_layer_commit(struct xrt_compositor *xc,
if (c->fence) { if (c->fence) {
// Wait on it ourselves, if we have it and didn't tell the native compositor to wait on it. // 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, xret = xrt::auxiliary::d3d::d3d11::waitOnFenceWithTimeout(c->fence, c->local_wait_event,
c->timeline_semaphore_value, kFenceTimeout); c->timeline_semaphore_value, kFenceTimeout);
if (xret != XRT_SUCCESS) { if (xret != XRT_SUCCESS) {
struct u_pp_sink_stack_only sink; // Not inited, very large. struct u_pp_sink_stack_only sink; // Not inited, very large.

View file

@ -17,6 +17,7 @@
#include <d3d11_4.h> #include <d3d11_4.h>
using namespace xrt::auxiliary::d3d; using namespace xrt::auxiliary::d3d;
using namespace xrt::auxiliary::d3d::d3d11;
using namespace xrt::auxiliary::util; using namespace xrt::auxiliary::util;
TEST_CASE("dxgi_adapter", "[.][needgpu]") TEST_CASE("dxgi_adapter", "[.][needgpu]")