Skip to content

Commit

Permalink
Merge pull request #19040 from GermanAizek/fix-core-gpu-always-true
Browse files Browse the repository at this point in the history
[Core/GPU] Fixed condition blocks where result always true
  • Loading branch information
hrydgard authored Sep 17, 2024
2 parents 496ccfe + ed8f0c5 commit 635ff79
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
6 changes: 2 additions & 4 deletions Common/GPU/D3D9/D3DCompilerLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ bool UnloadD3DCompiler() {
if (!g_D3DCompileModule)
return false;

if (g_D3DCompileModule) {
FreeLibrary(g_D3DCompileModule);
g_D3DCompileModule = nullptr;
}
FreeLibrary(g_D3DCompileModule);
g_D3DCompileModule = nullptr;

return true;
}
Expand Down
18 changes: 6 additions & 12 deletions Common/GPU/OpenGL/GLFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,16 @@ bool CheckGLExtensions() {
gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN;
}

INFO_LOG(Log::G3D, "GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor ? cvendor : "N/A", renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A");
INFO_LOG(Log::G3D, "GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor ? cvendor : "N/A", renderer, versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A");

if (renderer) {
strncpy(gl_extensions.model, renderer, sizeof(gl_extensions.model));
gl_extensions.model[sizeof(gl_extensions.model) - 1] = 0;
}
strncpy(gl_extensions.model, renderer, sizeof(gl_extensions.model));
gl_extensions.model[sizeof(gl_extensions.model) - 1] = 0;

// Start by assuming we're at 2.0.
int parsed[2] = {2, 0};
{ // Grab the version and attempt to parse.
char buffer[128] = { 0 };
if (versionStr) {
strncpy(buffer, versionStr, sizeof(buffer) - 1);
}
strncpy(buffer, versionStr, sizeof(buffer) - 1);

int len = (int)strlen(buffer);
bool beforeDot = true;
Expand Down Expand Up @@ -353,10 +349,8 @@ bool CheckGLExtensions() {

// Check the desktop extension instead of the OES one. They are very similar.
// Also explicitly check those ATI devices that claims to support npot
if (renderer) {
gl_extensions.OES_texture_npot = g_set_gl_extensions.count("GL_ARB_texture_non_power_of_two") != 0
&& !(((strncmp(renderer, "ATI RADEON X", 12) == 0) || (strncmp(renderer, "ATI MOBILITY RADEON X", 21) == 0)));
}
gl_extensions.OES_texture_npot = g_set_gl_extensions.count("GL_ARB_texture_non_power_of_two") != 0
&& !(((strncmp(renderer, "ATI RADEON X", 12) == 0) || (strncmp(renderer, "ATI MOBILITY RADEON X", 21) == 0)));

gl_extensions.ARB_conservative_depth = g_set_gl_extensions.count("GL_ARB_conservative_depth") != 0;
gl_extensions.ARB_shader_image_load_store = (g_set_gl_extensions.count("GL_ARB_shader_image_load_store") != 0) || (g_set_gl_extensions.count("GL_EXT_shader_image_load_store") != 0);
Expand Down
2 changes: 1 addition & 1 deletion Common/GPU/OpenGL/thin3d_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ OpenGLContext::OpenGLContext(bool canChangeSwapInterval) : renderManager_(frameT

if (gl_extensions.EXT_shader_framebuffer_fetch) {
shaderLanguageDesc_.framebufferFetchExtension = "#extension GL_EXT_shader_framebuffer_fetch : require";
shaderLanguageDesc_.lastFragData = gl_extensions.GLES3 ? "fragColor0" : "gl_LastFragData[0]";
shaderLanguageDesc_.lastFragData = "fragColor0";
} else if (gl_extensions.ARM_shader_framebuffer_fetch) {
shaderLanguageDesc_.framebufferFetchExtension = "#extension GL_ARM_shader_framebuffer_fetch : require";
shaderLanguageDesc_.lastFragData = "gl_LastFragColorARM";
Expand Down
2 changes: 1 addition & 1 deletion Core/Util/DisArm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ static void DataProcessingRegister(uint32_t w, uint64_t addr, Instruction *instr
int imm3 = (w >> 10) & 0x7;
if (Rd == 31 && sub && S) {
// It's a CMP
snprintf(instr->text, sizeof(instr->text), "%s%s %c%d, %c%d, %s", "cmp", S ? "s" : "", r, Rn, r, Rm, extendnames[option]);
snprintf(instr->text, sizeof(instr->text), "%s%s %c%d, %c%d, %s", "cmp", "s", r, Rn, r, Rm, extendnames[option]);
} else {
snprintf(instr->text, sizeof(instr->text), "%s%s %c%d, %c%d, %c%d, %s", sub ? "sub" : "add", S ? "s" : "", r, Rd, r, Rn, r, Rm, extendnames[option]);
}
Expand Down

0 comments on commit 635ff79

Please sign in to comment.