mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 22:22:05 +00:00
Save GPU Vendor and Type in glConfig for use in rendering, e.g. R_UseHiz()
This commit is contained in:
parent
037a000590
commit
361aa00e47
6 changed files with 42 additions and 12 deletions
|
@ -80,7 +80,14 @@ enum graphicsVendor_t
|
|||
VENDOR_NVIDIA,
|
||||
VENDOR_AMD,
|
||||
VENDOR_INTEL,
|
||||
VENDOR_APPLE // SRS - Added support for Apple GPUs
|
||||
VENDOR_APPLE, // SRS - Added support for Apple GPUs
|
||||
VENDOR_OTHER
|
||||
};
|
||||
|
||||
enum graphicsGpuType_t
|
||||
{
|
||||
GPU_TYPE_DISCRETE,
|
||||
GPU_TYPE_OTHER
|
||||
};
|
||||
|
||||
#define ID_MSAA 0
|
||||
|
@ -181,6 +188,7 @@ struct backEndCounters_t
|
|||
struct glconfig_t
|
||||
{
|
||||
graphicsVendor_t vendor;
|
||||
graphicsGpuType_t gpuType;
|
||||
|
||||
// int maxTextureSize; // TODO
|
||||
// int maxTextureCoords; // TODO
|
||||
|
|
|
@ -364,6 +364,13 @@ bool R_UseTemporalAA()
|
|||
bool R_UseHiZ()
|
||||
{
|
||||
// TODO check for driver problems here
|
||||
#if defined(__linux__)
|
||||
if( glConfig.vendor == VENDOR_INTEL && glConfig.gpuType == GPU_TYPE_OTHER )
|
||||
{
|
||||
// SRS - Disable HiZ to work-around Linux driver issues on Intel iGPUs
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return r_useHierarchicalDepthBuffer.GetBool();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,6 +59,23 @@ void DeviceManager::GetWindowDimensions( int& width, int& height )
|
|||
height = m_DeviceParams.backBufferHeight;
|
||||
}
|
||||
|
||||
graphicsVendor_t DeviceManager::getGPUVendor( uint32_t vendorID ) const
|
||||
{
|
||||
switch( vendorID )
|
||||
{
|
||||
case 0x10DE:
|
||||
return VENDOR_NVIDIA;
|
||||
case 0x1002:
|
||||
return VENDOR_AMD;
|
||||
case 0x8086:
|
||||
return VENDOR_INTEL;
|
||||
case 0x106B:
|
||||
return VENDOR_APPLE;
|
||||
default:
|
||||
return VENDOR_OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::BackBufferResizing()
|
||||
{
|
||||
Framebuffer::Shutdown();
|
||||
|
|
|
@ -159,7 +159,6 @@ protected:
|
|||
void* windowInstance;
|
||||
void* windowHandle;
|
||||
bool m_windowVisible = false;
|
||||
bool isNvidia = false;
|
||||
|
||||
DeviceCreationParameters m_DeviceParams;
|
||||
|
||||
|
@ -171,6 +170,8 @@ protected:
|
|||
|
||||
DeviceManager() = default;
|
||||
|
||||
graphicsVendor_t getGPUVendor( uint32_t vendorID ) const;
|
||||
|
||||
void BackBufferResizing();
|
||||
void BackBufferResized();
|
||||
|
||||
|
|
|
@ -106,11 +106,6 @@ private:
|
|||
void ReleaseRenderTargets();
|
||||
};
|
||||
|
||||
static bool IsNvDeviceID( UINT id )
|
||||
{
|
||||
return id == 0x10DE;
|
||||
}
|
||||
|
||||
// Find an adapter whose name contains the given string.
|
||||
static RefCountPtr<IDXGIAdapter> FindAdapter( const std::wstring& targetName )
|
||||
{
|
||||
|
@ -277,7 +272,9 @@ bool DeviceManager_DX12::CreateDeviceAndSwapChain()
|
|||
}
|
||||
m_RendererString = ss.str();
|
||||
|
||||
isNvidia = IsNvDeviceID( aDesc.VendorId );
|
||||
glConfig.vendor = getGPUVendor( aDesc.VendorId );
|
||||
// SRS - Intel iGPUs typically allocate 128 MB for Dedicated UMA, set threshold at 512 MB to potentially handle other iGPUs (e.g. AMD APUs)
|
||||
glConfig.gpuType = aDesc.DedicatedVideoMemory > 0x20000000 ? GPU_TYPE_DISCRETE : GPU_TYPE_OTHER;
|
||||
}
|
||||
/*
|
||||
// SRS - Don't center window here for DX12 only, instead use portable initialization in CreateWindowDeviceAndSwapChain() within win_glimp.cpp
|
||||
|
|
|
@ -781,16 +781,16 @@ bool DeviceManager_VK::pickPhysicalDevice()
|
|||
// pick the first discrete GPU if it exists, otherwise the first integrated GPU
|
||||
if( !discreteGPUs.empty() )
|
||||
{
|
||||
glConfig.vendor = getGPUVendor( discreteGPUs[0].getProperties().vendorID );
|
||||
glConfig.gpuType = GPU_TYPE_DISCRETE;
|
||||
m_VulkanPhysicalDevice = discreteGPUs[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
if( !otherGPUs.empty() )
|
||||
{
|
||||
#if defined(__linux__) && ( defined(__i386__) || defined(__x86_64__) )
|
||||
// SRS - Disable HiZ buffer on Linux + Intel iGPU to work-around device lost crashes - potentially a driver issue?
|
||||
r_useHierarchicalDepthBuffer.SetBool( false );
|
||||
#endif
|
||||
glConfig.vendor = getGPUVendor( otherGPUs[0].getProperties().vendorID );
|
||||
glConfig.gpuType = GPU_TYPE_OTHER;
|
||||
m_VulkanPhysicalDevice = otherGPUs[0];
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue