Skip to content

Commit 731713d

Browse files
committed
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.
1 parent 193767e commit 731713d

11 files changed

+26
-126
lines changed

src/Cafe/GraphicPack/GraphicPack2.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -878,9 +878,6 @@ bool GraphicPack2::Activate()
878878
if (m_gfx_vendor.has_value())
879879
{
880880
auto vendor = g_renderer->GetVendor();
881-
if (vendor == GfxVendor::IntelLegacy || vendor == GfxVendor::IntelNoLegacy)
882-
vendor = GfxVendor::Intel;
883-
884881
if (m_gfx_vendor.value() != vendor)
885882
return false;
886883
}

src/Cafe/HW/Latte/Core/LatteConst.h

-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@
8282
#define GLVENDOR_UNKNOWN (0)
8383
#define GLVENDOR_AMD (1) // AMD/ATI
8484
#define GLVENDOR_NVIDIA (2)
85-
#define GLVENDOR_INTEL_LEGACY (3)
86-
#define GLVENDOR_INTEL_NOLEGACY (4)
8785
#define GLVENDOR_INTEL (5)
8886
#define GLVENDOR_APPLE (6)
8987

src/Cafe/HW/Latte/Core/LatteTextureLegacy.cpp

+8-13
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,16 @@ void LatteTexture_updateTexturesForStage(LatteDecompilerShader* shaderContext, u
229229
// if this texture is bound multiple times then use alternative views
230230
if (textureView->lastTextureBindIndex == LatteGPUState.textureBindCounter)
231231
{
232-
// Intel driver has issues with textures that have multiple views bound and used by a shader, causes a softlock in BotW
233-
// therefore we disable this on Intel
234-
if (LatteGPUState.glVendor != GLVENDOR_INTEL_NOLEGACY)
232+
LatteTextureViewGL* textureViewGL = (LatteTextureViewGL*)textureView;
233+
// get next unused alternative texture view
234+
while (true)
235235
{
236-
LatteTextureViewGL* textureViewGL = (LatteTextureViewGL*)textureView;
237-
// get next unused alternative texture view
238-
while (true)
239-
{
240-
textureViewGL = textureViewGL->GetAlternativeView();
241-
if (textureViewGL->lastTextureBindIndex != LatteGPUState.textureBindCounter)
242-
break;
243-
}
244-
textureView = textureViewGL;
236+
textureViewGL = textureViewGL->GetAlternativeView();
237+
if (textureViewGL->lastTextureBindIndex != LatteGPUState.textureBindCounter)
238+
break;
245239
}
246-
}
240+
textureView = textureViewGL;
241+
}
247242
textureView->lastTextureBindIndex = LatteGPUState.textureBindCounter;
248243
rendererGL->renderstate_updateTextureSettingsGL(shaderContext, textureView, textureIndex + glBackendBaseTexUnit, word4, textureIndex, isDepthSampler);
249244
}

src/Cafe/HW/Latte/Core/LatteThread.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,7 @@ int Latte_ThreadEntry()
140140
case GfxVendor::AMD:
141141
LatteGPUState.glVendor = GLVENDOR_AMD;
142142
break;
143-
case GfxVendor::IntelLegacy:
144-
LatteGPUState.glVendor = GLVENDOR_INTEL_LEGACY;
145-
break;
146-
case GfxVendor::IntelNoLegacy:
147-
LatteGPUState.glVendor = GLVENDOR_INTEL_NOLEGACY;
148-
break;
149-
case GfxVendor::Intel:
143+
case GfxVendor::Intel:
150144
LatteGPUState.glVendor = GLVENDOR_INTEL;
151145
break;
152146
case GfxVendor::Nvidia:

src/Cafe/HW/Latte/Renderer/OpenGL/LatteTextureGL.cpp

+15-47
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
110110
sint32 glInternalFormat;
111111
sint32 glSuppliedFormat;
112112
sint32 glSuppliedFormatType;
113-
// check if compressed textures should be used
114-
bool allowCompressedGLFormat = true;
115-
if (LatteGPUState.glVendor == GLVENDOR_INTEL_LEGACY)
116-
allowCompressedGLFormat = false; // compressed formats seem to cause more harm than good on Intel
117113
// get format information
118114
if (format == Latte::E_GX2SURFFMT::R4_G4_UNORM)
119115
{
@@ -149,20 +145,11 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
149145
else if (format == Latte::E_GX2SURFFMT::BC1_UNORM ||
150146
format == Latte::E_GX2SURFFMT::BC1_SRGB)
151147
{
152-
if (allowCompressedGLFormat)
153-
{
154-
if (format == Latte::E_GX2SURFFMT::BC1_SRGB)
155-
formatInfoOut->setCompressed(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, -1, -1);
156-
else
157-
formatInfoOut->setCompressed(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, -1, -1);
158-
return;
159-
}
148+
if (format == Latte::E_GX2SURFFMT::BC1_SRGB)
149+
formatInfoOut->setCompressed(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, -1, -1);
160150
else
161-
{
162-
formatInfoOut->setFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT);
163-
formatInfoOut->markAsAlternativeFormat();
164-
return;
165-
}
151+
formatInfoOut->setCompressed(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, -1, -1);
152+
return;
166153
}
167154
else if (format == Latte::E_GX2SURFFMT::BC2_UNORM || format == Latte::E_GX2SURFFMT::BC2_SRGB)
168155
{
@@ -173,28 +160,18 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
173160
}
174161
else if (format == Latte::E_GX2SURFFMT::BC3_UNORM || format == Latte::E_GX2SURFFMT::BC3_SRGB)
175162
{
176-
if (allowCompressedGLFormat)
177-
{
178-
if (format == Latte::E_GX2SURFFMT::BC3_SRGB)
179-
formatInfoOut->setCompressed(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, -1, -1);
180-
else
181-
formatInfoOut->setCompressed(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, -1, -1);
182-
return;
183-
}
163+
if (format == Latte::E_GX2SURFFMT::BC3_SRGB)
164+
formatInfoOut->setCompressed(GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, -1, -1);
184165
else
185-
{
186-
// todo: SRGB support
187-
formatInfoOut->setFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT);
188-
formatInfoOut->markAsAlternativeFormat();
189-
return;
190-
}
166+
formatInfoOut->setCompressed(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, -1, -1);
167+
return;
191168
}
192169
else if (format == Latte::E_GX2SURFFMT::BC4_UNORM || format == Latte::E_GX2SURFFMT::BC4_SNORM)
193170
{
171+
bool allowCompressed = true;
194172
if (dim != Latte::E_DIM::DIM_2D && dim != Latte::E_DIM::DIM_2D_ARRAY)
195-
allowCompressedGLFormat = false; // RGTC1 does not support non-2D textures
196-
197-
if (allowCompressedGLFormat)
173+
allowCompressed = false; // RGTC1 does not support non-2D textures
174+
if (allowCompressed)
198175
{
199176
if (format == Latte::E_GX2SURFFMT::BC4_UNORM)
200177
formatInfoOut->setCompressed(GL_COMPRESSED_RED_RGTC1, -1, -1);
@@ -211,20 +188,11 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma
211188
}
212189
else if (format == Latte::E_GX2SURFFMT::BC5_UNORM || format == Latte::E_GX2SURFFMT::BC5_SNORM)
213190
{
214-
if (allowCompressedGLFormat)
215-
{
216-
if (format == Latte::E_GX2SURFFMT::BC5_SNORM)
217-
formatInfoOut->setCompressed(GL_COMPRESSED_SIGNED_RG_RGTC2, -1, -1);
218-
else
219-
formatInfoOut->setCompressed(GL_COMPRESSED_RG_RGTC2, -1, -1);
220-
return;
221-
}
191+
if (format == Latte::E_GX2SURFFMT::BC5_SNORM)
192+
formatInfoOut->setCompressed(GL_COMPRESSED_SIGNED_RG_RGTC2, -1, -1);
222193
else
223-
{
224-
formatInfoOut->setFormat(GL_RG16F, GL_RG, GL_FLOAT);
225-
formatInfoOut->markAsAlternativeFormat();
226-
return;
227-
}
194+
formatInfoOut->setCompressed(GL_COMPRESSED_RG_RGTC2, -1, -1);
195+
return;
228196
}
229197
else if (format == Latte::E_GX2SURFFMT::R32_FLOAT)
230198
{

src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp

+1-43
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,7 @@ void OpenGLRenderer::GetVendorInformation()
407407
}
408408
else if (memcmp(glVendorString, "Intel", 5) == 0)
409409
{
410-
if (LaunchSettings::ForceIntelLegacyEnabled())
411-
m_vendor = GfxVendor::IntelLegacy;
412-
else
413-
m_vendor = GfxVendor::IntelNoLegacy;
410+
m_vendor = GfxVendor::Intel;
414411
return;
415412
}
416413
}
@@ -849,45 +846,6 @@ TextureDecoder* OpenGLRenderer::texture_chooseDecodedFormat(Latte::E_GX2SURFFMT
849846
}
850847
return nullptr;
851848
}
852-
853-
if (LatteGPUState.glVendor == GLVENDOR_INTEL_LEGACY)
854-
{
855-
if (format == Latte::E_GX2SURFFMT::BC1_UNORM)
856-
{
857-
texDecoder = TextureDecoder_BC1_UNORM_uncompress::getInstance();
858-
}
859-
else if (format == Latte::E_GX2SURFFMT::BC1_SRGB)
860-
{
861-
texDecoder = TextureDecoder_BC1_SRGB_uncompress::getInstance();
862-
}
863-
else if (format == Latte::E_GX2SURFFMT::BC3_UNORM)
864-
{
865-
texDecoder = TextureDecoder_BC3_UNORM_uncompress::getInstance();
866-
}
867-
else if (format == Latte::E_GX2SURFFMT::BC3_SRGB)
868-
{
869-
texDecoder = TextureDecoder_BC3_SRGB_uncompress::getInstance();
870-
}
871-
else if (format == Latte::E_GX2SURFFMT::BC4_UNORM)
872-
{
873-
texDecoder = TextureDecoder_BC4_UNORM_uncompress::getInstance();
874-
}
875-
else if (format == Latte::E_GX2SURFFMT::BC4_SNORM)
876-
{
877-
cemu_assert_debug(false); // todo
878-
}
879-
else if (format == Latte::E_GX2SURFFMT::BC5_UNORM)
880-
{
881-
texDecoder = TextureDecoder_BC5_UNORM_uncompress::getInstance();
882-
}
883-
else if (format == Latte::E_GX2SURFFMT::BC5_SNORM)
884-
{
885-
texDecoder = TextureDecoder_BC5_SNORM_uncompress::getInstance();
886-
}
887-
if (texDecoder)
888-
return texDecoder;
889-
}
890-
891849
if (format == Latte::E_GX2SURFFMT::R4_G4_UNORM)
892850
texDecoder = TextureDecoder_R4_G4_UNORM_To_RGBA4::getInstance();
893851
else if (format == Latte::E_GX2SURFFMT::R4_G4_B4_A4_UNORM)

src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ void OpenGLRenderer::draw_genericDrawHandler(uint32 baseVertex, uint32 baseInsta
950950
bool streamoutEnable = LatteGPUState.contextRegister[mmVGT_STRMOUT_EN] != 0;
951951
if (streamoutEnable)
952952
{
953-
if (glBeginTransformFeedback == nullptr || LatteGPUState.glVendor == GLVENDOR_INTEL_NOLEGACY)
953+
if (glBeginTransformFeedback == nullptr)
954954
{
955955
cemu_assert_debug(false);
956956
return; // transform feedback not supported

src/Cafe/HW/Latte/Renderer/Renderer.h

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ enum class GfxVendor
2121
Generic,
2222

2323
AMD,
24-
IntelLegacy,
25-
IntelNoLegacy,
2624
Intel,
2725
Nvidia,
2826
Apple,

src/config/LaunchSettings.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ bool LaunchSettings::HandleCommandline(const std::vector<std::wstring>& args)
174174

175175
if (vm.count("nsight"))
176176
s_nsight_mode = vm["nsight"].as<bool>();
177-
if (vm.count("legacy"))
178-
s_force_intel_legacy = vm["legacy"].as<bool>();
179177

180178
if(vm.count("force-interpreter"))
181179
s_force_interpreter = vm["force-interpreter"].as<bool>();

src/config/LaunchSettings.h

-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class LaunchSettings
2424

2525
static bool GDBStubEnabled() { return s_enable_gdbstub; }
2626
static bool NSightModeEnabled() { return s_nsight_mode; }
27-
static bool ForceIntelLegacyEnabled() { return s_force_intel_legacy; }
2827

2928
static bool ForceInterpreter() { return s_force_interpreter; };
3029

@@ -44,7 +43,6 @@ class LaunchSettings
4443

4544
inline static bool s_enable_gdbstub = false;
4645
inline static bool s_nsight_mode = false;
47-
inline static bool s_force_intel_legacy = false;
4846

4947
inline static bool s_force_interpreter = false;
5048

src/gui/guiWrapper.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,6 @@ void gui_updateWindowTitles(bool isIdle, bool isLoading, double fps)
9393
const char* graphicMode = "[Generic]";
9494
if (LatteGPUState.glVendor == GLVENDOR_AMD)
9595
graphicMode = "[AMD GPU]";
96-
else if (LatteGPUState.glVendor == GLVENDOR_INTEL_LEGACY)
97-
graphicMode = "[Intel GPU - Legacy]";
98-
else if (LatteGPUState.glVendor == GLVENDOR_INTEL_NOLEGACY)
99-
graphicMode = "[Intel GPU]";
10096
else if (LatteGPUState.glVendor == GLVENDOR_INTEL)
10197
graphicMode = "[Intel GPU]";
10298
else if (LatteGPUState.glVendor == GLVENDOR_NVIDIA)

0 commit comments

Comments
 (0)