Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raytracing tail call hello world #822

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix crash in the ray tracing miniengine example on a case where one h…
…as several gpus and the first one of them does not support dxr
  • Loading branch information
kingofthebongo2008 committed Feb 4, 2022
commit 1f429b33a8d0e46d4c685462e2151e8cc1f73655
12 changes: 12 additions & 0 deletions MiniEngine/Core/GraphicsCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,17 @@ namespace Graphics
{
return GetVendorIdFromDevice(pDevice) == vendorID_Intel;
}

// Returns bool whether the device supports DirectX Raytracing tier.
bool IsDirectXRaytracingSupported(IDXGIAdapter1* adapter)
{
ComPtr<ID3D12Device> testDevice;
D3D12_FEATURE_DATA_D3D12_OPTIONS5 featureSupportData = {};

return SUCCEEDED(D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&testDevice)))
&& SUCCEEDED(testDevice->CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS5, &featureSupportData, sizeof(featureSupportData)))
&& featureSupportData.RaytracingTier != D3D12_RAYTRACING_TIER_NOT_SUPPORTED;
}
}

// Initialize the DirectX resources required to run.
Expand Down Expand Up @@ -239,6 +250,7 @@ void Graphics::Initialize(void)
continue;

if ((desc.DedicatedVideoMemory > MaxSize || (desc.VendorId == desiredVendor)) &&
IsDirectXRaytracingSupported(pAdapter.Get()) &&
SUCCEEDED(D3D12CreateDevice(pAdapter.Get(), D3D_FEATURE_LEVEL_11_0, MY_IID_PPV_ARGS(&pDevice))))
{
pAdapter->GetDesc1(&desc);
Expand Down