OpenGL: Remove "-legacy" flag

"Intel legacy mode" was a special mode to workaround various Intel OpenGL driver limitations during the earlier years of Cemu. It's been unmaintained for years and no longer serves a purpose.

If we ever bring back compatibility with ancient Intel GPUs it should be done in a more structured way than a blunt yes/no flag.
This commit is contained in:
Exzap 2024-03-14 03:10:10 +01:00
parent 193767e6cc
commit 731713de3a
11 changed files with 26 additions and 126 deletions

View File

@ -878,9 +878,6 @@ bool GraphicPack2::Activate()
if (m_gfx_vendor.has_value()) if (m_gfx_vendor.has_value())
{ {
auto vendor = g_renderer->GetVendor(); auto vendor = g_renderer->GetVendor();
if (vendor == GfxVendor::IntelLegacy || vendor == GfxVendor::IntelNoLegacy)
vendor = GfxVendor::Intel;
if (m_gfx_vendor.value() != vendor) if (m_gfx_vendor.value() != vendor)
return false; return false;
} }

View File

@ -82,8 +82,6 @@
#define GLVENDOR_UNKNOWN (0) #define GLVENDOR_UNKNOWN (0)
#define GLVENDOR_AMD (1) // AMD/ATI #define GLVENDOR_AMD (1) // AMD/ATI
#define GLVENDOR_NVIDIA (2) #define GLVENDOR_NVIDIA (2)
#define GLVENDOR_INTEL_LEGACY (3)
#define GLVENDOR_INTEL_NOLEGACY (4)
#define GLVENDOR_INTEL (5) #define GLVENDOR_INTEL (5)
#define GLVENDOR_APPLE (6) #define GLVENDOR_APPLE (6)

View File

@ -229,21 +229,16 @@ void LatteTexture_updateTexturesForStage(LatteDecompilerShader* shaderContext, u
// if this texture is bound multiple times then use alternative views // if this texture is bound multiple times then use alternative views
if (textureView->lastTextureBindIndex == LatteGPUState.textureBindCounter) if (textureView->lastTextureBindIndex == LatteGPUState.textureBindCounter)
{ {
// Intel driver has issues with textures that have multiple views bound and used by a shader, causes a softlock in BotW LatteTextureViewGL* textureViewGL = (LatteTextureViewGL*)textureView;
// therefore we disable this on Intel // get next unused alternative texture view
if (LatteGPUState.glVendor != GLVENDOR_INTEL_NOLEGACY) while (true)
{ {
LatteTextureViewGL* textureViewGL = (LatteTextureViewGL*)textureView; textureViewGL = textureViewGL->GetAlternativeView();
// get next unused alternative texture view if (textureViewGL->lastTextureBindIndex != LatteGPUState.textureBindCounter)
while (true) break;
{
textureViewGL = textureViewGL->GetAlternativeView();
if (textureViewGL->lastTextureBindIndex != LatteGPUState.textureBindCounter)
break;
}
textureView = textureViewGL;
} }
} textureView = textureViewGL;
}
textureView->lastTextureBindIndex = LatteGPUState.textureBindCounter; textureView->lastTextureBindIndex = LatteGPUState.textureBindCounter;
rendererGL->renderstate_updateTextureSettingsGL(shaderContext, textureView, textureIndex + glBackendBaseTexUnit, word4, textureIndex, isDepthSampler); rendererGL->renderstate_updateTextureSettingsGL(shaderContext, textureView, textureIndex + glBackendBaseTexUnit, word4, textureIndex, isDepthSampler);
} }

View File

@ -140,13 +140,7 @@ int Latte_ThreadEntry()
case GfxVendor::AMD: case GfxVendor::AMD:
LatteGPUState.glVendor = GLVENDOR_AMD; LatteGPUState.glVendor = GLVENDOR_AMD;
break; break;
case GfxVendor::IntelLegacy: case GfxVendor::Intel:
LatteGPUState.glVendor = GLVENDOR_INTEL_LEGACY;
break;
case GfxVendor::IntelNoLegacy:
LatteGPUState.glVendor = GLVENDOR_INTEL_NOLEGACY;
break;
case GfxVendor::Intel:
LatteGPUState.glVendor = GLVENDOR_INTEL; LatteGPUState.glVendor = GLVENDOR_INTEL;
break; break;
case GfxVendor::Nvidia: case GfxVendor::Nvidia:

View File

@ -110,10 +110,6 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
sint32 glInternalFormat; sint32 glInternalFormat;
sint32 glSuppliedFormat; sint32 glSuppliedFormat;
sint32 glSuppliedFormatType; sint32 glSuppliedFormatType;
// check if compressed textures should be used
bool allowCompressedGLFormat = true;
if (LatteGPUState.glVendor == GLVENDOR_INTEL_LEGACY)
allowCompressedGLFormat = false; // compressed formats seem to cause more harm than good on Intel
// get format information // get format information
if (format == Latte::E_GX2SURFFMT::R4_G4_UNORM) if (format == Latte::E_GX2SURFFMT::R4_G4_UNORM)
{ {
@ -149,20 +145,11 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
else if (format == Latte::E_GX2SURFFMT::BC1_UNORM || else if (format == Latte::E_GX2SURFFMT::BC1_UNORM ||
format == Latte::E_GX2SURFFMT::BC1_SRGB) format == Latte::E_GX2SURFFMT::BC1_SRGB)
{ {
if (allowCompressedGLFormat) if (format == Latte::E_GX2SURFFMT::BC1_SRGB)
{ formatInfoOut->setCompressed(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, -1, -1);
if (format == Latte::E_GX2SURFFMT::BC1_SRGB)
formatInfoOut->setCompressed(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, -1, -1);
else
formatInfoOut->setCompressed(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, -1, -1);
return;
}
else else
{ formatInfoOut->setCompressed(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, -1, -1);
formatInfoOut->setFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT); return;
formatInfoOut->markAsAlternativeFormat();
return;
}
} }
else if (format == Latte::E_GX2SURFFMT::BC2_UNORM || format == Latte::E_GX2SURFFMT::BC2_SRGB) else if (format == Latte::E_GX2SURFFMT::BC2_UNORM || format == Latte::E_GX2SURFFMT::BC2_SRGB)
{ {
@ -173,28 +160,18 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
} }
else if (format == Latte::E_GX2SURFFMT::BC3_UNORM || format == Latte::E_GX2SURFFMT::BC3_SRGB) else if (format == Latte::E_GX2SURFFMT::BC3_UNORM || format == Latte::E_GX2SURFFMT::BC3_SRGB)
{ {
if (allowCompressedGLFormat) if (format == Latte::E_GX2SURFFMT::BC3_SRGB)
{ formatInfoOut->setCompressed(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, -1, -1);
if (format == Latte::E_GX2SURFFMT::BC3_SRGB)
formatInfoOut->setCompressed(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, -1, -1);
else
formatInfoOut->setCompressed(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, -1, -1);
return;
}
else else
{ formatInfoOut->setCompressed(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, -1, -1);
// todo: SRGB support return;
formatInfoOut->setFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT);
formatInfoOut->markAsAlternativeFormat();
return;
}
} }
else if (format == Latte::E_GX2SURFFMT::BC4_UNORM || format == Latte::E_GX2SURFFMT::BC4_SNORM) else if (format == Latte::E_GX2SURFFMT::BC4_UNORM || format == Latte::E_GX2SURFFMT::BC4_SNORM)
{ {
bool allowCompressed = true;
if (dim != Latte::E_DIM::DIM_2D && dim != Latte::E_DIM::DIM_2D_ARRAY) if (dim != Latte::E_DIM::DIM_2D && dim != Latte::E_DIM::DIM_2D_ARRAY)
allowCompressedGLFormat = false; // RGTC1 does not support non-2D textures allowCompressed = false; // RGTC1 does not support non-2D textures
if (allowCompressed)
if (allowCompressedGLFormat)
{ {
if (format == Latte::E_GX2SURFFMT::BC4_UNORM) if (format == Latte::E_GX2SURFFMT::BC4_UNORM)
formatInfoOut->setCompressed(GL_COMPRESSED_RED_RGTC1, -1, -1); formatInfoOut->setCompressed(GL_COMPRESSED_RED_RGTC1, -1, -1);
@ -211,20 +188,11 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
} }
else if (format == Latte::E_GX2SURFFMT::BC5_UNORM || format == Latte::E_GX2SURFFMT::BC5_SNORM) else if (format == Latte::E_GX2SURFFMT::BC5_UNORM || format == Latte::E_GX2SURFFMT::BC5_SNORM)
{ {
if (allowCompressedGLFormat) if (format == Latte::E_GX2SURFFMT::BC5_SNORM)
{ formatInfoOut->setCompressed(GL_COMPRESSED_SIGNED_RG_RGTC2, -1, -1);
if (format == Latte::E_GX2SURFFMT::BC5_SNORM)
formatInfoOut->setCompressed(GL_COMPRESSED_SIGNED_RG_RGTC2, -1, -1);
else
formatInfoOut->setCompressed(GL_COMPRESSED_RG_RGTC2, -1, -1);
return;
}
else else
{ formatInfoOut->setCompressed(GL_COMPRESSED_RG_RGTC2, -1, -1);
formatInfoOut->setFormat(GL_RG16F, GL_RG, GL_FLOAT); return;
formatInfoOut->markAsAlternativeFormat();
return;
}
} }
else if (format == Latte::E_GX2SURFFMT::R32_FLOAT) else if (format == Latte::E_GX2SURFFMT::R32_FLOAT)
{ {

View File

@ -407,10 +407,7 @@ void OpenGLRenderer::GetVendorInformation()
} }
else if (memcmp(glVendorString, "Intel", 5) == 0) else if (memcmp(glVendorString, "Intel", 5) == 0)
{ {
if (LaunchSettings::ForceIntelLegacyEnabled()) m_vendor = GfxVendor::Intel;
m_vendor = GfxVendor::IntelLegacy;
else
m_vendor = GfxVendor::IntelNoLegacy;
return; return;
} }
} }
@ -849,45 +846,6 @@ TextureDecoder* OpenGLRenderer::texture_chooseDecodedFormat(Latte::E_GX2SURFFMT
} }
return nullptr; return nullptr;
} }
if (LatteGPUState.glVendor == GLVENDOR_INTEL_LEGACY)
{
if (format == Latte::E_GX2SURFFMT::BC1_UNORM)
{
texDecoder = TextureDecoder_BC1_UNORM_uncompress::getInstance();
}
else if (format == Latte::E_GX2SURFFMT::BC1_SRGB)
{
texDecoder = TextureDecoder_BC1_SRGB_uncompress::getInstance();
}
else if (format == Latte::E_GX2SURFFMT::BC3_UNORM)
{
texDecoder = TextureDecoder_BC3_UNORM_uncompress::getInstance();
}
else if (format == Latte::E_GX2SURFFMT::BC3_SRGB)
{
texDecoder = TextureDecoder_BC3_SRGB_uncompress::getInstance();
}
else if (format == Latte::E_GX2SURFFMT::BC4_UNORM)
{
texDecoder = TextureDecoder_BC4_UNORM_uncompress::getInstance();
}
else if (format == Latte::E_GX2SURFFMT::BC4_SNORM)
{
cemu_assert_debug(false); // todo
}
else if (format == Latte::E_GX2SURFFMT::BC5_UNORM)
{
texDecoder = TextureDecoder_BC5_UNORM_uncompress::getInstance();
}
else if (format == Latte::E_GX2SURFFMT::BC5_SNORM)
{
texDecoder = TextureDecoder_BC5_SNORM_uncompress::getInstance();
}
if (texDecoder)
return texDecoder;
}
if (format == Latte::E_GX2SURFFMT::R4_G4_UNORM) if (format == Latte::E_GX2SURFFMT::R4_G4_UNORM)
texDecoder = TextureDecoder_R4_G4_UNORM_To_RGBA4::getInstance(); texDecoder = TextureDecoder_R4_G4_UNORM_To_RGBA4::getInstance();
else if (format == Latte::E_GX2SURFFMT::R4_G4_B4_A4_UNORM) else if (format == Latte::E_GX2SURFFMT::R4_G4_B4_A4_UNORM)

View File

@ -950,7 +950,7 @@ void OpenGLRenderer::draw_genericDrawHandler(uint32 baseVertex, uint32 baseInsta
bool streamoutEnable = LatteGPUState.contextRegister[mmVGT_STRMOUT_EN] != 0; bool streamoutEnable = LatteGPUState.contextRegister[mmVGT_STRMOUT_EN] != 0;
if (streamoutEnable) if (streamoutEnable)
{ {
if (glBeginTransformFeedback == nullptr || LatteGPUState.glVendor == GLVENDOR_INTEL_NOLEGACY) if (glBeginTransformFeedback == nullptr)
{ {
cemu_assert_debug(false); cemu_assert_debug(false);
return; // transform feedback not supported return; // transform feedback not supported

View File

@ -21,8 +21,6 @@ enum class GfxVendor
Generic, Generic,
AMD, AMD,
IntelLegacy,
IntelNoLegacy,
Intel, Intel,
Nvidia, Nvidia,
Apple, Apple,

View File

@ -174,8 +174,6 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
if (vm.count("nsight")) if (vm.count("nsight"))
s_nsight_mode = vm["nsight"].as<bool>(); s_nsight_mode = vm["nsight"].as<bool>();
if (vm.count("legacy"))
s_force_intel_legacy = vm["legacy"].as<bool>();
if(vm.count("force-interpreter")) if(vm.count("force-interpreter"))
s_force_interpreter = vm["force-interpreter"].as<bool>(); s_force_interpreter = vm["force-interpreter"].as<bool>();

View File

@ -24,7 +24,6 @@ public:
static bool GDBStubEnabled() { return s_enable_gdbstub; } static bool GDBStubEnabled() { return s_enable_gdbstub; }
static bool NSightModeEnabled() { return s_nsight_mode; } static bool NSightModeEnabled() { return s_nsight_mode; }
static bool ForceIntelLegacyEnabled() { return s_force_intel_legacy; }
static bool ForceInterpreter() { return s_force_interpreter; }; static bool ForceInterpreter() { return s_force_interpreter; };
@ -44,7 +43,6 @@ private:
inline static bool s_enable_gdbstub = false; inline static bool s_enable_gdbstub = false;
inline static bool s_nsight_mode = false; inline static bool s_nsight_mode = false;
inline static bool s_force_intel_legacy = false;
inline static bool s_force_interpreter = false; inline static bool s_force_interpreter = false;

View File

@ -93,10 +93,6 @@ void gui_updateWindowTitles(bool isIdle, bool isLoading, double fps)
const char* graphicMode = "[Generic]"; const char* graphicMode = "[Generic]";
if (LatteGPUState.glVendor == GLVENDOR_AMD) if (LatteGPUState.glVendor == GLVENDOR_AMD)
graphicMode = "[AMD GPU]"; graphicMode = "[AMD GPU]";
else if (LatteGPUState.glVendor == GLVENDOR_INTEL_LEGACY)
graphicMode = "[Intel GPU - Legacy]";
else if (LatteGPUState.glVendor == GLVENDOR_INTEL_NOLEGACY)
graphicMode = "[Intel GPU]";
else if (LatteGPUState.glVendor == GLVENDOR_INTEL) else if (LatteGPUState.glVendor == GLVENDOR_INTEL)
graphicMode = "[Intel GPU]"; graphicMode = "[Intel GPU]";
else if (LatteGPUState.glVendor == GLVENDOR_NVIDIA) else if (LatteGPUState.glVendor == GLVENDOR_NVIDIA)