rend: force Native Depth Interpolation for AMD gpus

This commit is contained in:
Flyinghead 2023-12-28 17:48:33 +01:00
parent 06529b63f7
commit 9f9b29b833
10 changed files with 39 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#include "hw/pvr/pvr.h"
#include "profiler/fc_profiler.h"
#include "oslib/storage.h"
#include "wsi/context.h"
#include <chrono>
settings_t settings;
@ -327,6 +328,8 @@ static void loadSpecialSettings()
config::ForceFreePlay.override(false);
}
}
if (GraphicsContext::Instance()->isAMD())
config::NativeDepthInterpolation.override(true);
}
void dc_reset(bool hard)

View File

@ -55,6 +55,9 @@ public:
bool isIntel() const {
return vendorId == VENDOR_INTEL;
}
bool isAMD() override {
return vendorId == VENDOR_ATI || vendorId == VENDOR_AMD;
}
void setFrameRendered() {
frameRendered = true;
@ -97,6 +100,8 @@ private:
pD3DCompile d3dcompiler = nullptr;
static constexpr UINT VENDOR_INTEL = 0x8086;
static constexpr UINT VENDOR_ATI = 0x1002;
static constexpr UINT VENDOR_AMD = 0x1022;
};
extern DX11Context theDX11Context;
#endif

View File

@ -50,6 +50,9 @@ public:
bool isIntel() const {
return vendorId == VENDOR_INTEL;
}
bool isAMD() override {
return vendorId == VENDOR_ATI || vendorId == VENDOR_AMD;
}
DX11Shaders& getShaders() {
return shaders;
@ -90,6 +93,8 @@ private:
bool supportedTexFormats[5] {}; // indexed by TextureType enum
static constexpr UINT VENDOR_INTEL = 0x8086;
static constexpr UINT VENDOR_ATI = 0x1002;
static constexpr UINT VENDOR_AMD = 0x1022;
};
extern DX11Context theDX11Context;
#endif

View File

@ -89,6 +89,7 @@ bool DXContext::init(bool keepCurrentWindow)
driverName = std::string(id.Description);
driverVersion = std::to_string(id.DriverVersion.HighPart >> 16) + "." + std::to_string((u16)id.DriverVersion.HighPart)
+ "." + std::to_string(id.DriverVersion.LowPart >> 16) + "." + std::to_string((u16)id.DriverVersion.LowPart);
amd = id.VendorId == 0x1002 || id.VendorId == 0x1022;
deviceReady = true;
return true;

View File

@ -50,6 +50,9 @@ public:
std::string getDriverVersion() override {
return driverVersion;
}
bool isAMD() override {
return amd;
}
void setFrameRendered() {
frameRendered = true;
}
@ -69,6 +72,7 @@ private:
bool frameRendered = false;
std::string driverName;
std::string driverVersion;
bool amd = false;
bool deviceReady = false;
};
extern DXContext theDXContext;

View File

@ -82,6 +82,9 @@ public:
+ "." + std::to_string(VK_API_VERSION_MINOR(props.driverVersion))
+ "." + std::to_string(VK_API_VERSION_PATCH(props.driverVersion));
}
bool isAMD() override {
return vendorID == VENDOR_ATI || vendorID == VENDOR_AMD;
}
vk::Format GetDepthFormat() const { return depthFormat; }
static VulkanContext *Instance() { return contextInstance; }
bool SupportsSamplerAnisotropy() const { return samplerAnisotropy; }

View File

@ -95,6 +95,9 @@ public:
std::string getDriverVersion() override {
return driverVersion;
}
bool isAMD() override {
return vendorID == VENDOR_ATI || vendorID == VENDOR_AMD;
}
vk::Format GetDepthFormat() const { return depthFormat; }
static VulkanContext *Instance() { return contextInstance; }
bool SupportsSamplerAnisotropy() const { return samplerAnisotropy; }

View File

@ -33,6 +33,7 @@ public:
virtual void resize() {}
virtual std::string getDriverName() = 0;
virtual std::string getDriverVersion() = 0;
virtual bool isAMD() = 0;
virtual bool hasPerPixel() { return false; }
void setWindow(void *window, void *display = nullptr) {

View File

@ -46,6 +46,16 @@ void GLGraphicsContext::findGLVersion()
driverName = p != nullptr ? p : "unknown";
p = (const char *)glGetString(GL_VERSION);
driverVersion = p != nullptr ? p : "unknown";
p = (const char *)glGetString(GL_VENDOR);
std::string vendor = p != nullptr ? p : "";
if (vendor.substr(0, 4) == "ATI ")
amd = true;
else if (driverName.find(" ATI ") != std::string::npos
|| driverName.find(" AMD ") != std::string::npos)
// mesa
amd = true;
else
amd = false;
}
void GLGraphicsContext::postInit()

View File

@ -50,6 +50,9 @@ public:
std::string getDriverVersion() override {
return driverVersion;
}
bool isAMD() override {
return amd;
}
void resetUIDriver();
bool hasPerPixel() override
@ -70,6 +73,7 @@ private:
bool _isGLES = false;
std::string driverName;
std::string driverVersion;
bool amd = false;
};
#if defined(LIBRETRO)