D3D11: Implement zcomploc for hardware supporting D3D 11.0.

This commit is contained in:
NeoBrainX
2013-07-22 14:38:09 +02:00
committed by degasus
parent 805009abca
commit eed36cbf78
6 changed files with 47 additions and 12 deletions

View File

@ -245,6 +245,13 @@ std::vector<DXGI_SAMPLE_DESC> EnumAAModes(IDXGIAdapter* adapter)
return aa_modes;
}
D3D_FEATURE_LEVEL GetFeatureLevel(IDXGIAdapter* adapter)
{
D3D_FEATURE_LEVEL feat_level = D3D_FEATURE_LEVEL_9_1;
PD3D11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, NULL, D3D11_CREATE_DEVICE_SINGLETHREADED, supported_feature_levels, NUM_SUPPORTED_FEATURE_LEVELS, D3D11_SDK_VERSION, NULL, &feat_level, NULL);
return feat_level;
}
DXGI_SAMPLE_DESC GetAAMode(int index)
{
return aa_modes[index];

View File

@ -31,6 +31,7 @@ void UnloadD3D();
void UnloadD3DX();
void UnloadD3DCompiler();
D3D_FEATURE_LEVEL GetFeatureLevel(IDXGIAdapter* adapter);
std::vector<DXGI_SAMPLE_DESC> EnumAAModes(IDXGIAdapter* adapter);
DXGI_SAMPLE_DESC GetAAMode(int index);

View File

@ -90,7 +90,6 @@ void InitBackendInfo()
g_Config.backend_info.bSupportsFormatReinterpretation = true;
g_Config.backend_info.bSupportsPixelLighting = true;
g_Config.backend_info.bSupportsPrimitiveRestart = true;
g_Config.backend_info.bSupportsEarlyZ = false;
IDXGIFactory* factory;
IDXGIAdapter* ad;
@ -103,11 +102,13 @@ void InitBackendInfo()
g_Config.backend_info.AAModes.clear();
while (factory->EnumAdapters((UINT)g_Config.backend_info.Adapters.size(), &ad) != DXGI_ERROR_NOT_FOUND)
{
const size_t adapter_index = g_Config.backend_info.Adapters.size();
DXGI_ADAPTER_DESC desc;
ad->GetDesc(&desc);
// TODO: These don't get updated on adapter change, yet
if (g_Config.backend_info.Adapters.size() == g_Config.iAdapter)
if (adapter_index == g_Config.iAdapter)
{
char buf[32];
std::vector<DXGI_SAMPLE_DESC> modes;
@ -119,6 +120,9 @@ void InitBackendInfo()
else sprintf_s(buf, 32, _trans("%d samples"), modes[i].Count);
g_Config.backend_info.AAModes.push_back(buf);
}
// Requires the earlydepthstencil attribute (only available in shader model 5)
g_Config.backend_info.bSupportsEarlyZ = (DX11::D3D::GetFeatureLevel(ad) == D3D_FEATURE_LEVEL_11_0);
}
g_Config.backend_info.Adapters.push_back(UTF16ToUTF8(desc.Description));