diff options
| author | Yong He <yonghe@outlook.com> | 2022-02-03 19:17:30 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-03 19:17:30 -0800 |
| commit | d06a78d935b2743494d47ed5cd3f36e38ac9c5ac (patch) | |
| tree | 7615fd89cb826f2c463b4a221f19139d3a5d4a9d /tools/gfx-unit-test | |
| parent | 5eb835f0332868fd56ac14ce7560e0ae9cfafec9 (diff) | |
Add gfx interop to allow more direct D3D12 usage scenarios. (#2117)
* Add gfx interop to allow more direct D3D12 usage scenarios.
* Fix compile error in win32.
* gfx: Implement IFence::getNativeHandle() on d3d12.
* More GFX-D3D interop interface.
* Fix cuda.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx-unit-test')
| -rw-r--r-- | tools/gfx-unit-test/copy-texture-tests.cpp | 12 | ||||
| -rw-r--r-- | tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp | 6 | ||||
| -rw-r--r-- | tools/gfx-unit-test/get-cmd-queue-handle-test.cpp | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/tools/gfx-unit-test/copy-texture-tests.cpp b/tools/gfx-unit-test/copy-texture-tests.cpp index fa206afda..069d20f02 100644 --- a/tools/gfx-unit-test/copy-texture-tests.cpp +++ b/tools/gfx-unit-test/copy-texture-tests.cpp @@ -222,9 +222,9 @@ namespace gfx_test RefPtr<TextureStuff> generateTextureData(int width, int height, uint32_t mipLevels, uint32_t arrayLayers) { RefPtr<TextureStuff> texture = new TextureStuff(); - for (int layer = 0; layer < arrayLayers; ++layer) + for (uint32_t layer = 0; layer < arrayLayers; ++layer) { - for (int mip = 0; mip < mipLevels; ++mip) + for (uint32_t mip = 0; mip < mipLevels; ++mip) { RefPtr<SubresourceStuff> subresource = new SubresourceStuff(); texture->subresourceObjects.add(subresource); @@ -239,10 +239,10 @@ namespace gfx_test for (int w = 0; w < mipWidth; ++w) { // 4 channels per pixel - subresource->texels[h * mipWidth + w].channels[0] = w; - subresource->texels[h * mipWidth + w].channels[1] = h; - subresource->texels[h * mipWidth + w].channels[2] = mip; - subresource->texels[h * mipWidth + w].channels[3] = layer; + subresource->texels[h * mipWidth + w].channels[0] = (float)w; + subresource->texels[h * mipWidth + w].channels[1] = (float)h; + subresource->texels[h * mipWidth + w].channels[2] = (float)mip; + subresource->texels[h * mipWidth + w].channels[3] = (float)layer; } } diff --git a/tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp b/tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp index 97cb9a808..120c331ed 100644 --- a/tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp +++ b/tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp @@ -31,16 +31,16 @@ namespace gfx_test m_commandBuffer->close(); } } closeCommandBufferRAII{ commandBuffer }; - ICommandBuffer::NativeHandle handle = 0; + InteropHandle handle = {}; GFX_CHECK_CALL_ABORT(commandBuffer->getNativeHandle(&handle)); if (device->getDeviceInfo().deviceType == gfx::DeviceType::Vulkan) { - SLANG_CHECK(handle != NULL); + SLANG_CHECK(handle.handleValue != 0); } #if SLANG_WINDOWS_FAMILY else { - auto d3d12Handle = (ID3D12GraphicsCommandList*)handle; + auto d3d12Handle = (ID3D12GraphicsCommandList*)handle.handleValue; Slang::ComPtr<IUnknown> testHandle1; GFX_CHECK_CALL_ABORT(d3d12Handle->QueryInterface<IUnknown>(testHandle1.writeRef())); Slang::ComPtr<ID3D12GraphicsCommandList> testHandle2; diff --git a/tools/gfx-unit-test/get-cmd-queue-handle-test.cpp b/tools/gfx-unit-test/get-cmd-queue-handle-test.cpp index ad439e946..0dd5ad561 100644 --- a/tools/gfx-unit-test/get-cmd-queue-handle-test.cpp +++ b/tools/gfx-unit-test/get-cmd-queue-handle-test.cpp @@ -17,16 +17,16 @@ namespace gfx_test { ICommandQueue::Desc queueDesc = { ICommandQueue::QueueType::Graphics }; auto queue = device->createCommandQueue(queueDesc); - ICommandQueue::NativeHandle handle; + InteropHandle handle; GFX_CHECK_CALL_ABORT(queue->getNativeHandle(&handle)); if (device->getDeviceInfo().deviceType == gfx::DeviceType::Vulkan) { - SLANG_CHECK(handle != NULL); + SLANG_CHECK(handle.handleValue != NULL); } #if SLANG_WINDOWS_FAMILY else { - auto d3d12Queue = (ID3D12CommandQueue*)handle; + auto d3d12Queue = (ID3D12CommandQueue*)handle.handleValue; Slang::ComPtr<IUnknown> testHandle1; GFX_CHECK_CALL_ABORT(d3d12Queue->QueryInterface<IUnknown>(testHandle1.writeRef())); Slang::ComPtr<ID3D12CommandQueue> testHandle2; |
