Ejemplo n.º 1
0
void VideoBackend::InitBackendInfo()
{
    HRESULT hr = D3D::LoadDXGI();
    if (FAILED(hr))
        return;

    hr = D3D::LoadD3D();
    if (FAILED(hr))
    {
        D3D::UnloadDXGI();
        return;
    }

    g_Config.backend_info.api_type = APIType::D3D;
    g_Config.backend_info.bSupportsExclusiveFullscreen = false;
    g_Config.backend_info.bSupportsDualSourceBlend = true;
    g_Config.backend_info.bSupportsPrimitiveRestart = true;
    g_Config.backend_info.bSupportsOversizedViewports = false;
    g_Config.backend_info.bSupportsGeometryShaders = true;
    g_Config.backend_info.bSupports3DVision = true;
    g_Config.backend_info.bSupportsPostProcessing = false;
    g_Config.backend_info.bSupportsPaletteConversion = true;
    g_Config.backend_info.bSupportsClipControl = true;
    g_Config.backend_info.bSupportsDepthClamp = true;
    g_Config.backend_info.bSupportsReversedDepthRange = false;
    g_Config.backend_info.bSupportsMultithreading = false;
    g_Config.backend_info.bSupportsInternalResolutionFrameDumps = false;

    IDXGIFactory* factory;
    IDXGIAdapter* ad;
    hr = create_dxgi_factory(__uuidof(IDXGIFactory), (void**)&factory);
    if (FAILED(hr))
    {
        PanicAlert("Failed to create IDXGIFactory object");
        D3D::UnloadD3D();
        D3D::UnloadDXGI();
        return;
    }

    // adapters
    g_Config.backend_info.Adapters.clear();
    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 (adapter_index == g_Config.iAdapter)
        {
            ID3D12Device* temp_device;
            hr = d3d12_create_device(ad, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&temp_device));
            if (SUCCEEDED(hr))
            {
                std::string samples;
                std::vector<DXGI_SAMPLE_DESC> modes = D3D::EnumAAModes(temp_device);
                // First iteration will be 1. This equals no AA.
                for (unsigned int i = 0; i < modes.size(); ++i)
                {
                    g_Config.backend_info.AAModes.push_back(modes[i].Count);
                }

                // Requires the earlydepthstencil attribute (only available in shader model 5)
                g_Config.backend_info.bSupportsEarlyZ = true;

                // Requires full UAV functionality (only available in shader model 5)
                g_Config.backend_info.bSupportsBBox = true;

                // Requires the instance attribute (only available in shader model 5)
                g_Config.backend_info.bSupportsGSInstancing = true;

                // Sample shading requires shader model 5
                g_Config.backend_info.bSupportsSSAA = true;

                temp_device->Release();
            }
        }

        g_Config.backend_info.Adapters.push_back(UTF16ToUTF8(desc.Description));
        ad->Release();
    }
    factory->Release();

    // Clear ppshaders string vector
    g_Config.backend_info.PPShaders.clear();
    g_Config.backend_info.AnaglyphShaders.clear();

    D3D::UnloadD3D();
    D3D::UnloadDXGI();
}
Ejemplo n.º 2
0
void InitBackendInfo()
{
	HRESULT hr = D3D::LoadDXGI();
	if (FAILED(hr))
		return;

	hr = D3D::LoadD3D();
	
	if (FAILED(hr))
	{
		D3D::UnloadDXGI();
		return;
	}

	g_Config.backend_info.APIType = API_D3D11;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_BGRA32] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_RGBA32] = true;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_I4_AS_I8] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_IA4_AS_IA8] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_I8] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_IA8] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_RGB565] = false;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_DXT1] = true;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_DXT3] = true;
	g_Config.backend_info.bSupportedFormats[PC_TEX_FMT_DXT5] = true;
	
	g_Config.backend_info.bSupportsScaling = false;
	g_Config.backend_info.bSupportsExclusiveFullscreen = false;
	g_Config.backend_info.bSupportsDualSourceBlend = true;
	g_Config.backend_info.bSupportsPixelLighting = true;
	g_Config.backend_info.bNeedBlendIndices = false;
	g_Config.backend_info.bSupportsOversizedViewports = false;
	g_Config.backend_info.bSupportsGeometryShaders = true;
	g_Config.backend_info.bSupports3DVision = true;
	g_Config.backend_info.bSupportsPostProcessing = true;
	g_Config.backend_info.bSupportsClipControl = false;
	g_Config.backend_info.bSupportsNormalMaps = true;
	g_Config.backend_info.bSupportsEarlyZ = true;
	g_Config.backend_info.bSupportsBBox = true;
	g_Config.backend_info.bSupportsBBox = true;
	g_Config.backend_info.bSupportsGSInstancing = true;
	g_Config.backend_info.bSupportsTessellation = true;
	g_Config.backend_info.bSupportsSSAA = true;
	g_Config.backend_info.bSupportsComputeTextureDecoding = false;
	g_Config.backend_info.bSupportsComputeTextureEncoding = false;

	IDXGIFactory* factory;
	IDXGIAdapter* ad;
	hr = create_dxgi_factory(__uuidof(IDXGIFactory), (void**)&factory);
	if (FAILED(hr))
	{
		PanicAlert("Failed to create IDXGIFactory object");
		D3D::UnloadD3D();
		D3D::UnloadDXGI();
		return;
	}

	// adapters
	g_Config.backend_info.Adapters.clear();
	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 (adapter_index == g_Config.iAdapter)
		{
			ID3D12Device* temp_device;
			hr = d3d12_create_device(ad, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&temp_device));
			if (FAILED(hr))
				continue;

			std::string samples;
			std::vector<DXGI_SAMPLE_DESC> modes = D3D::EnumAAModes(temp_device);
			// First iteration will be 1. This equals no AA.
			for (unsigned int i = 0; i < modes.size(); ++i)
			{
				g_Config.backend_info.AAModes.push_back(modes[i].Count);
			}
		}
		g_Config.backend_info.Adapters.push_back(UTF16ToUTF8(desc.Description));
		ad->Release();
	}
	factory->Release();

	D3D::UnloadDXGI();
	D3D::UnloadD3D();
}