Skip to content

Request: WARP support and fix WARP rendering bugs.. #2

Open
@oscarbg

Description

@oscarbg

Hi,
I tested sample on warp 1.0.15 which supports cooperative vectors and is rendering incorrectly..
note I have sample correctly rendering on NVidia..

see screenshot of rendering incorrectly on WARP:
Image

for testing although sample says you can select adapter it isn't used..

--adapter-id Integer that allows to pick the desired GPU.

I launch:

dino_danger.exe --data-dir ../../.. --adapter-id 1

and still selects GPU (adapter 0)..

to fix I changed code in two places (to allow software renderer) and to pass adapterIndex:

fix1 (allow software renderer):

--- a/sdk/src/dx12/dx12_backend_graphics_device.cpp
+++ b/sdk/src/dx12/dx12_backend_graphics_device.cpp
@@ -133,7 +133,7 @@ namespace d3d12
                 dxgiAdapter1->GetDesc1(&dxgiAdapterDesc1);
 
                 // First is it usable?
-                bool usableGPU = (dxgiAdapterDesc1.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) == 0 && SUCCEEDED(D3D12CreateDevice(dxgiAdapter1, D3D_FEATURE_LEVEL_12_1, __uuidof(ID3D12Device), nullptr));
+                bool usableGPU = /*(dxgiAdapterDesc1.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) == 0 &&*/ SUCCEEDED(D3D12CreateDevice(dxgiAdapter1, D3D_FEATURE_LEVEL_12_1, __uuidof(ID3D12Device), nullptr));
 
                 // Is it the right vendor?
                 if (usableGPU && adapterIdx == adapterID)

fix2 (pass adapterIndex):

--- a/sdk/src/render_pipeline/dino_renderer.cpp
+++ b/sdk/src/render_pipeline/dino_renderer.cpp
@@ -56,7 +56,10 @@ void DinoRenderer::initialize(uint64_t hInstance, const CommandLineOptions& opti
     graphics::setup_graphics_api(GraphicsAPI::DX12);
     // graphics::device::enable_debug_layer();
     graphics::device::enable_experimental_features();
-    m_Device = graphics::device::create_graphics_device();
+    if(options.adapterIndex==0)
+        m_Device = graphics::device::create_graphics_device();
+    else
+        m_Device = graphics::device::create_graphics_device(DevicePickStrategy::AdapterID, options.adapterIndex);
     m_Window = graphics::window::create_window(m_Device, (uint64_t)hInstance, 1920, 1080, "Intel TSNC (DX12)");
     m_CmdQueue = graphics::command_queue::create_command_queue(m_Device);
     m_SwapChain = graphics::swap_chain::create_swap_chain(m_Window, m_Device, m_CmdQueue, FRAME_BUFFER_FORMAT);

with that I was getting also a crash with WARP and was fixed with that:

--- a/sdk/src/dx12/dx12_backend_window.cpp
+++ b/sdk/src/dx12/dx12_backend_window.cpp
@@ -113,12 +113,12 @@ namespace d3d12
 				windowClass.cbClsExtra = 0;
 				windowClass.cbWndExtra = 0;
 				windowClass.hInstance = hInst;
-				windowClass.hIcon = LoadIcon(hInst, NULL);
+				windowClass.hIcon = NULL;// LoadIcon(hInst, NULL);
 				windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
 				windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
 				windowClass.lpszMenuName = NULL;
 				windowClass.lpszClassName = windowClassName;
-				windowClass.hIconSm = LoadIcon(hInst, NULL);
+				windowClass.hIconSm = NULL;// LoadIcon(hInst, NULL);
 				assert_msg(RegisterClassExA(&windowClass) > 0, "RegisterClassExA failed.");
 				classRegistered = true;
 			}

finally launches but renders incorrectly don't know if WARP bug or not..
also perhaps you can "massage" code to make it work on WARP similar to have fixed recently for other GPUs in( for Nvidia ?):
ec738e6

EDIT: also note WARP without coop vector hangs:

dino_danger.exe --data-dir ../../.. --adapter-id 1 --disable-coop

it's strange but as said using --disable-coop on WARP seems to hang.. or maybe is much slower and didn't wait for long as needed..

screenshot of rendering correctly on NV:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions