Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/fast/backends/gfx_dxgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class GfxWindowBackendDXGI final : public GfxWindowBackend {
#ifdef DECLARE_GFX_DXGI_FUNCTIONS
void ThrowIfFailed(HRESULT res);
void ThrowIfFailed(HRESULT res, HWND h_wnd, const char* message);
void ThrowWithMessage(HWND h_wnd, const char* message);
#endif

#endif
9 changes: 8 additions & 1 deletion src/fast/backends/gfx_direct3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ void GfxRenderingAPIDX11::Init() {
mWindowBackend->GetWindowHandle(), "Failed to create per-draw constant buffer.");

// Create compute shader that can be used to retrieve depth buffer values
D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS features;
mDevice->CheckFeatureSupport(D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, &features,
sizeof(D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS));
if (features.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x == false) {
ThrowWithMessage(mWindowBackend->GetWindowHandle(),
"D3D device doesn't support compute shaders 4.0 or greater.");
}

const char* shader_source = R"(
sampler my_sampler : register(s0);
Expand All @@ -236,7 +243,7 @@ void CSMain(uint3 DTid : SV_DispatchThreadID) {

const char* shader_source_msaa = R"(
sampler my_sampler : register(s0);
Texture2DMS<float, 2> tex : register(t0);
Texture2DMS<float> tex : register(t0);
StructuredBuffer<int2> coord : register(t1);
RWStructuredBuffer<float> output : register(u0);

Expand Down
6 changes: 6 additions & 0 deletions src/fast/backends/gfx_dxgi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,5 +1089,11 @@ void ThrowIfFailed(HRESULT res, HWND h_wnd, const char* message) {
throw res;
}
}
void ThrowWithMessage(HWND h_wnd, const char* message) {
char full_message[256];
sprintf(full_message, message);
MessageBoxA(h_wnd, full_message, "Error", MB_OK | MB_ICONERROR);
throw;
}

#endif
Loading