From c2e142520925f06adb4a8405cc2e8c387ce730ab Mon Sep 17 00:00:00 2001 From: Edward Li Date: Wed, 21 Sep 2022 02:10:41 +0800 Subject: [PATCH] Stop Apple fanboys from asking where is Metal --- CMakeLists.txt | 2 +- core/rend/TexCache.h | 4 ++-- core/rend/gl4/glsl.h | 2 +- core/rend/gles/gles.cpp | 2 +- core/rend/gles/gltex.cpp | 2 +- core/rend/gui.cpp | 10 ++++++++-- core/rend/transform_matrix.h | 2 +- core/wsi/switcher.cpp | 8 ++++---- core/wsi/wgl.cpp | 2 +- core/wsi/xgl.cpp | 4 ++-- 10 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5774d5aaa..fed3a262c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ option(USE_HOST_LIBZIP "Use host libzip" ON) option(USE_OPENMP "Use OpenMP if available" ON) option(USE_VULKAN "Build with Vulkan support" ON) option(LIBRETRO "Build libretro core" OFF) -option(USE_OPENGL "Use Open GL API" ON) +option(USE_OPENGL "Use OpenGL API" ON) option(USE_VIDEOCORE "RPI: use the legacy Broadcom GLES libraries" OFF) option(APPLE_BREAKPAD "macOS: Build breakpad client and dump symbols" OFF) diff --git a/core/rend/TexCache.h b/core/rend/TexCache.h index 93a9ff83b..78a7000ac 100644 --- a/core/rend/TexCache.h +++ b/core/rend/TexCache.h @@ -125,7 +125,7 @@ public: #define clamp(minv, maxv, x) ((x) < (minv) ? (minv) : (x) > (maxv) ? (maxv) : (x)) -// Open GL +// OpenGL struct RGBAPacker { static u32 pack(u8 r, u8 g, u8 b, u8 a) { return r | (g << 8) | (b << 16) | (a << 24); @@ -485,7 +485,7 @@ constexpr TexConvFP32 texPAL4_VQ32 = texture_VQ>>; namespace opengl { -// Open GL +// OpenGL //Planar constexpr TexConvFP tex1555_PL = texture_PL>; diff --git a/core/rend/gl4/glsl.h b/core/rend/gl4/glsl.h index de8bcc70f..4eb50c354 100644 --- a/core/rend/gl4/glsl.h +++ b/core/rend/gl4/glsl.h @@ -18,7 +18,7 @@ */ #pragma once -// GLSL code for poly params handling, used by Open GL and Vulkan per-pixel renderers +// GLSL code for poly params handling, used by OpenGL and Vulkan per-pixel renderers #define OIT_POLY_PARAM " \n\ struct Pixel { \n\ diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 077f0c0aa..bd31370a2 100644 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -541,7 +541,7 @@ void findGLVersion() } #endif gl.mesa_nouveau = strstr((const char *)glGetString(GL_VERSION), "Mesa") != nullptr && !strcmp((const char *)glGetString(GL_VENDOR), "nouveau"); - NOTICE_LOG(RENDERER, "Open GL%s version %d.%d", gl.is_gles ? "ES" : "", gl.gl_major, gl.gl_minor); + NOTICE_LOG(RENDERER, "OpenGL%s version %d.%d", gl.is_gles ? " ES" : "", gl.gl_major, gl.gl_minor); while (glGetError() != GL_NO_ERROR) ; } diff --git a/core/rend/gles/gltex.cpp b/core/rend/gles/gltex.cpp index a94637e9b..e6deaacd8 100644 --- a/core/rend/gles/gltex.cpp +++ b/core/rend/gles/gltex.cpp @@ -52,7 +52,7 @@ void TextureCacheData::UploadToGPU(int width, int height, u8 *temp_tex_buffer, b dim >>= 1; } #if !defined(GLES2) && (!defined(__APPLE__) || defined(TARGET_IPHONE)) - // Open GL 4.2 or GLES 3.0 min + // OpenGL 4.2 or GLES 3.0 min if (gl.gl_major > 4 || (gl.gl_major == 4 && gl.gl_minor >= 2) || (gl.is_gles && gl.gl_major >= 3)) { diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index b3b8d8d62..8b9555f1e 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -1785,11 +1785,17 @@ static void gui_display_settings() ImGui::Text("Graphics API:"); ImGui::Columns(apiCount, "renderApi", false); #ifdef USE_OPENGL - ImGui::RadioButton("Open GL", &renderApi, 0); + ImGui::RadioButton("OpenGL", &renderApi, 0); ImGui::NextColumn(); #endif #ifdef USE_VULKAN +#ifdef __APPLE__ + ImGui::RadioButton("Vulkan (Metal)", &renderApi, 1); + ImGui::SameLine(0, style.ItemInnerSpacing.x); + ShowHelpMarker("MoltenVK: An implementation of Vulkan that runs on Apple's Metal graphics framework"); +#else ImGui::RadioButton("Vulkan", &renderApi, 1); +#endif // __APPLE__ ImGui::NextColumn(); #endif #ifdef USE_DX9 @@ -2251,7 +2257,7 @@ static void gui_display_settings() } ImGui::Spacing(); if (isOpenGL(config::RendererType)) - header("Open GL"); + header("OpenGL"); else if (isVulkan(config::RendererType)) header("Vulkan"); else if (isDirectX(config::RendererType)) diff --git a/core/rend/transform_matrix.h b/core/rend/transform_matrix.h index 7567ad826..6fc25deb8 100644 --- a/core/rend/transform_matrix.h +++ b/core/rend/transform_matrix.h @@ -28,7 +28,7 @@ // Dreamcast: // +Y is down -// Open GL: +// OpenGL: // +Y is up in clip, NDC and framebuffer coordinates // Vulkan: // +Y is down in clip, NDC and framebuffer coordinates diff --git a/core/wsi/switcher.cpp b/core/wsi/switcher.cpp index 13c024c28..117ef09e1 100644 --- a/core/wsi/switcher.cpp +++ b/core/wsi/switcher.cpp @@ -41,8 +41,8 @@ void initRenderApi(void *window, void *display) theVulkanContext.setWindow(window, display); if (theVulkanContext.init()) return; - // Fall back to Open GL - WARN_LOG(RENDERER, "Vulkan init failed. Falling back to Open GL."); + // Fall back to OpenGL + WARN_LOG(RENDERER, "Vulkan init failed. Falling back to OpenGL."); config::RendererType = RenderType::OpenGL; } #endif @@ -62,8 +62,8 @@ void initRenderApi(void *window, void *display) theDXContext.setWindow(window, display); if (theDXContext.init()) return; - // Fall back to Open GL - WARN_LOG(RENDERER, "DirectX 9 init failed. Falling back to Open GL."); + // Fall back to OpenGL + WARN_LOG(RENDERER, "DirectX 9 init failed. Falling back to OpenGL."); config::RendererType = RenderType::OpenGL; } #endif diff --git a/core/wsi/wgl.cpp b/core/wsi/wgl.cpp index 014c0dee5..2ef204128 100644 --- a/core/wsi/wgl.cpp +++ b/core/wsi/wgl.cpp @@ -90,7 +90,7 @@ bool WGLGraphicsContext::init() if (!ourOpenGLRenderingContext) { - INFO_LOG(RENDERER, "Open GL 4.3 not supported"); + INFO_LOG(RENDERER, "OpenGL 4.3 not supported"); // Try Gl 3.1 attribs[1] = 3; attribs[3] = 1; diff --git a/core/wsi/xgl.cpp b/core/wsi/xgl.cpp index dec9b1b0f..a87514b97 100644 --- a/core/wsi/xgl.cpp +++ b/core/wsi/xgl.cpp @@ -60,14 +60,14 @@ bool XGLGraphicsContext::init() context = glXCreateContextAttribsARB((Display *)display, *framebufferConfigs, 0, True, context_attribs); if (!context) { - INFO_LOG(RENDERER, "Open GL 4.3 not supported"); + INFO_LOG(RENDERER, "OpenGL 4.3 not supported"); // Try GL 3.0 context_attribs[1] = 3; context_attribs[3] = 0; context = glXCreateContextAttribsARB((Display *)display, *framebufferConfigs, 0, True, context_attribs); if (!context) { - ERROR_LOG(RENDERER, "Open GL 3.0 not supported\n"); + ERROR_LOG(RENDERER, "OpenGL 3.0 not supported\n"); return false; } }