diff --git a/include/bgfx.h b/include/bgfx.h index a2ec0ecd..a27a0136 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -137,7 +137,8 @@ namespace bgfx { enum Enum { - D3D9_UnableToCreateInterface = 1, + MinimumRequiredSpecs = 1, + D3D9_UnableToCreateInterface, D3D9_UnableToCreateDevice, D3D9_UnableToCreateRenderTarget, }; diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index a8df8eac..83e6b62e 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -184,6 +184,13 @@ namespace bgfx DX_CHECK(m_device->GetDeviceCaps(&m_caps) ); + // For shit GPUs that can create DX9 device but can't do simple stuff. GTFO! + BGFX_FATAL( (D3DPTEXTURECAPS_SQUAREONLY & m_caps.TextureCaps) == 0, bgfx::Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_SQUAREONLY"); + BGFX_FATAL( (D3DPTEXTURECAPS_MIPMAP & m_caps.TextureCaps) == D3DPTEXTURECAPS_MIPMAP, bgfx::Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_MIPMAP"); + BGFX_FATAL( (D3DPTEXTURECAPS_ALPHA & m_caps.TextureCaps) == D3DPTEXTURECAPS_ALPHA, bgfx::Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_ALPHA"); + BGFX_FATAL( (m_caps.VertexShaderVersion&0x300) == 0x300 && (m_caps.PixelShaderVersion&0x300) == 0x300, bgfx::Fatal::MinimumRequiredSpecs, "Shader Version is not 3.0."); + BGFX_FATAL(m_caps.MaxTextureWidth >= 2048 && m_caps.MaxTextureHeight >= 2048, bgfx::Fatal::MinimumRequiredSpecs, "Maximum texture size is below 2048."); + m_fmtNULL = SUCCEEDED(m_d3d9->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_NULL) ); m_fmtDF16 = SUCCEEDED(m_d3d9->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_DF16) ); m_fmtDF24 = SUCCEEDED(m_d3d9->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, D3DFMT_DF24) );