diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 48aed6d15..5ca109d1a 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -18,7 +18,7 @@ jobs: matrix: config: - {name: i686-pc-windows-msvc, os: windows-latest, shell: cmd, arch: x86, cmakeArgs: -G Ninja, buildType: Release} - - {name: apple-darwin, os: macos-latest, shell: sh, cmakeArgs: -G Ninja, destDir: osx, buildType: Release} + - {name: apple-darwin, os: macos-latest, shell: sh, cmakeArgs: -G Xcode, destDir: osx, buildType: Release} - {name: apple-ios, os: macos-latest, shell: sh, cmakeArgs: -DCMAKE_SYSTEM_NAME=iOS -G Xcode, destDir: ios, buildType: Release} - {name: x86_64-pc-linux-gnu, os: ubuntu-latest, shell: sh, cmakeArgs: -G Ninja, buildType: Release} - {name: x86_64-pc-windows-msvc, os: windows-latest, shell: cmd, arch: x64, cmakeArgs: -G Ninja, buildType: Release} @@ -30,8 +30,7 @@ jobs: - name: Set up build environment (macOS) run: | brew update - brew install ccache libao ldid libomp ninja pulseaudio - echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH + brew install libao ldid libomp ninja pulseaudio wget https://sdk.lunarg.com/sdk/download/1.3.204.1/mac/vulkansdk-macos-1.3.204.1.dmg hdiutil attach ./vulkansdk-macos-*.dmg sudo /Volumes/vulkansdk-macos-*/InstallVulkan.app/Contents/MacOS/InstallVulkan --root $HOME/VulkanSDK --accept-licenses --default-answer --confirm-command install @@ -73,6 +72,7 @@ jobs: path: ${{ env.CCACHE_DIR }} key: ccache-${{ matrix.config.name }}-${{ github.sha }} restore-keys: ccache-${{ matrix.config.name }}- + if: runner.os != 'macOS' - name: CMake run: | diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 96b06084b..cccf241a7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,10 +52,16 @@ include: - project: 'libretro-infrastructure/ci-templates' file: '/android-cmake.yml' + ################################## CONSOLES ################################ + # Nintendo Switch +# - project: 'libretro-infrastructure/ci-templates' +# file: '/libnx-static.yml' + # Stages for building stages: - build-prepare - build-shared +# - build-static ############################################################################## #################################### STAGES ################################## @@ -116,3 +122,10 @@ android-x86: extends: - .libretro-android-cmake-x86 - .core-defs-android + +################################### CONSOLES ################################# +# Nintendo Switch +#libretro-build-libnx-aarch64: +# extends: +# - .libretro-libnx-static-retroarch-master +# - .core-defs diff --git a/CMakeLists.txt b/CMakeLists.txt index e911fad83..1d853e99f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1056,8 +1056,32 @@ if(USE_VULKAN) endif() if(WIN32 AND NOT LIBRETRO AND NOT WINDOWS_STORE) - add_subdirectory(core/rend/dx9) - target_link_libraries(${PROJECT_NAME} PRIVATE dx9renderer) + set(REND_DX9_FILES + core/rend/dx9/d3d_overlay.h + core/rend/dx9/d3d_overlay.cpp + core/rend/dx9/d3d_renderer.h + core/rend/dx9/d3d_renderer.cpp + core/rend/dx9/d3d_shaders.h + core/rend/dx9/d3d_shaders.cpp + core/rend/dx9/d3d_texture.h + core/rend/dx9/d3d_texture.cpp + core/rend/dx9/dx9_driver.h + core/rend/dx9/dxcontext.cpp + core/rend/dx9/dxcontext.h + core/rend/dx9/imgui_impl_dx9.h + core/rend/dx9/imgui_impl_dx9.cpp) + target_sources(${PROJECT_NAME} PRIVATE ${REND_DX9_FILES}) + + if(NOT MINGW) + set_source_files_properties(${REND_DX9_FILES} PROPERTIES INCLUDE_DIRECTORIES "$ENV{DXSDK_DIR}/Include") + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + target_link_directories(${PROJECT_NAME} PUBLIC "$ENV{DXSDK_DIR}/Lib/x64") + else() + target_link_directories(${PROJECT_NAME} PUBLIC "$ENV{DXSDK_DIR}/Lib/x86") + endif() + endif() + + target_link_libraries(${PROJECT_NAME} PUBLIC d3d9 d3dx9) endif() if(WIN32) @@ -1302,7 +1326,8 @@ if(NOT LIBRETRO) XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES XCODE_ATTRIBUTE_COMBINE_HIDPI_IMAGES NO - XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon") + XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.flyinghead.Flycast") find_library(UIKIT UIKit) find_library(FOUNDATION Foundation) @@ -1356,6 +1381,7 @@ if(NOT LIBRETRO) MACOSX_BUNDLE_BUNDLE_VERSION "1" MACOSX_BUNDLE_COPYRIGHT "Copyright © 2019 Flycast contributors. All rights reserved." XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.flyinghead.Flycast" BUILD_WITH_INSTALL_RPATH TRUE INSTALL_RPATH "@loader_path/../Frameworks" ) diff --git a/core/rend/dx11/dx11context.cpp b/core/rend/dx11/dx11context.cpp index cc2c1a1d6..ed05693f2 100644 --- a/core/rend/dx11/dx11context.cpp +++ b/core/rend/dx11/dx11context.cpp @@ -44,33 +44,21 @@ bool DX11Context::init(bool keepCurrentWindow) #ifdef TARGET_UWP GAMING_DEVICE_MODEL_INFORMATION info {}; GetGamingDeviceModelInformation(&info); - if (info.vendorId == GAMING_DEVICE_VENDOR_ID_MICROSOFT) + if (info.vendorId == GAMING_DEVICE_VENDOR_ID_MICROSOFT && info.deviceId != GAMING_DEVICE_DEVICE_ID_NONE) { - switch (info.deviceId) - { - case GAMING_DEVICE_DEVICE_ID_XBOX_ONE: - case GAMING_DEVICE_DEVICE_ID_XBOX_ONE_S: - case GAMING_DEVICE_DEVICE_ID_XBOX_ONE_X: - case GAMING_DEVICE_DEVICE_ID_XBOX_ONE_X_DEVKIT: - { - Windows::Graphics::Display::Core::HdmiDisplayInformation^ dispInfo = Windows::Graphics::Display::Core::HdmiDisplayInformation::GetForCurrentView(); - Windows::Graphics::Display::Core::HdmiDisplayMode^ displayMode = dispInfo->GetCurrentDisplayMode(); - NOTICE_LOG(RENDERER, "HDMI resolution: %d x %d", displayMode->ResolutionWidthInRawPixels, displayMode->ResolutionHeightInRawPixels); - settings.display.width = displayMode->ResolutionWidthInRawPixels; - settings.display.height = displayMode->ResolutionHeightInRawPixels; - if (settings.display.width == 3840) - // 4K - scaling = 2.8f; - else - scaling = 1.4f; - } - break; - - default: - scaling = 1.f; - break; - } + Windows::Graphics::Display::Core::HdmiDisplayInformation^ dispInfo = Windows::Graphics::Display::Core::HdmiDisplayInformation::GetForCurrentView(); + Windows::Graphics::Display::Core::HdmiDisplayMode^ displayMode = dispInfo->GetCurrentDisplayMode(); + NOTICE_LOG(RENDERER, "HDMI resolution: %d x %d", displayMode->ResolutionWidthInRawPixels, displayMode->ResolutionHeightInRawPixels); + settings.display.width = displayMode->ResolutionWidthInRawPixels; + settings.display.height = displayMode->ResolutionHeightInRawPixels; + if (settings.display.width == 3840) + // 4K + scaling = 2.8f; + else + scaling = 1.4f; } + else + scaling = 1.f; #endif D3D_FEATURE_LEVEL featureLevels[] = diff --git a/core/rend/dx9/CMakeLists.txt b/core/rend/dx9/CMakeLists.txt deleted file mode 100644 index f24bf9445..000000000 --- a/core/rend/dx9/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -project(dx9renderer) - -add_library(${PROJECT_NAME} STATIC dxcontext.cpp) - -target_compile_definitions(${PROJECT_NAME} PRIVATE - $<$:_CRT_NONSTDC_NO_WARNINGS> - $<$:_CRT_SECURE_NO_WARNINGS> - $<$:_USE_MATH_DEFINES> - $<$:NOMINMAX> - $<$:TEST_AUTOMATION> - $<$:DEBUGFAST> - USE_SDL) - -target_sources(${PROJECT_NAME} PRIVATE - d3d_overlay.h - d3d_overlay.cpp - d3d_renderer.h - d3d_renderer.cpp - d3d_shaders.h - d3d_shaders.cpp - d3d_texture.h - d3d_texture.cpp - dx9_driver.h - dxcontext.h - imgui_impl_dx9.h - imgui_impl_dx9.cpp) - -target_include_directories(${PROJECT_NAME} PRIVATE - ../.. - ../../deps - ../../deps/nowide/include - ../../deps/glm - ../../deps/SDL/include) -if(NOT MINGW) - target_include_directories(${PROJECT_NAME} PRIVATE "$ENV{DXSDK_DIR}/Include") - if (CMAKE_SIZEOF_VOID_P EQUAL 8) - target_link_directories(${PROJECT_NAME} PUBLIC "$ENV{DXSDK_DIR}/Lib/x64") - else() - target_link_directories(${PROJECT_NAME} PUBLIC "$ENV{DXSDK_DIR}/Lib/x86") - endif() -endif() - -target_link_libraries(${PROJECT_NAME} PUBLIC d3d9 d3dx9) diff --git a/core/rend/gles/gles.cpp b/core/rend/gles/gles.cpp index 87d30ee55..5c5be65af 100644 --- a/core/rend/gles/gles.cpp +++ b/core/rend/gles/gles.cpp @@ -437,12 +437,10 @@ void termGLCommon() static void gles_term() { -#ifndef GLES2 - glDeleteVertexArrays(1, &gl.vbo.mainVAO); + deleteVertexArray(gl.vbo.mainVAO); gl.vbo.mainVAO = 0; - glDeleteVertexArrays(1, &gl.vbo.modvolVAO); + deleteVertexArray(gl.vbo.modvolVAO); gl.vbo.modvolVAO = 0; -#endif gl.vbo.geometry.reset(); gl.vbo.modvols.reset(); gl.vbo.idxs.reset(); @@ -807,10 +805,7 @@ static void SetupOSDVBO() glDisableVertexAttribArray(VERTEX_COL_OFFS_ARRAY); glCheck(); -#ifndef GLES2 - if (gl.gl_major >= 3) - glBindVertexArray(0); -#endif + bindVertexArray(0); } void gl_load_osd_resources() @@ -857,10 +852,8 @@ void gl_free_osd_resources() } glDeleteBuffers(1, &gl.OSD_SHADER.geometry); gl.OSD_SHADER.geometry = 0; -#ifndef GLES2 - glDeleteVertexArrays(1, &gl.OSD_SHADER.vao); + deleteVertexArray(gl.OSD_SHADER.vao); gl.OSD_SHADER.vao = 0; -#endif } static void create_modvol_shader() @@ -1115,13 +1108,10 @@ void OSD_DRAW(bool clear_screen) glCheck(); imguiDriver->setFrameRendered(); -#ifndef GLES2 - if (gl.gl_major >= 3) - glBindVertexArray(0); -#endif } #endif #endif + bindVertexArray(0); } bool OpenGLRenderer::Process(TA_context* ctx) @@ -1383,10 +1373,7 @@ bool RenderFrame(int width, int height) else render_output_framebuffer(); #endif -#ifndef GLES2 - if (gl.gl_major >= 3) - glBindVertexArray(0); -#endif + bindVertexArray(0); return !is_rtt; } diff --git a/core/rend/gles/gles.h b/core/rend/gles/gles.h index 4cdcb1fc3..77adc89a8 100755 --- a/core/rend/gles/gles.h +++ b/core/rend/gles/gles.h @@ -429,3 +429,19 @@ public: extern "C" struct retro_hw_render_callback hw_render; void termVmuLightgun(); #endif + +inline static void bindVertexArray(GLuint vao) +{ +#ifndef GLES2 + if (gl.gl_major >= 3) + glBindVertexArray(vao); +#endif +} + +inline static void deleteVertexArray(GLuint vao) +{ +#ifndef GLES2 + if (gl.gl_major >= 3) + glDeleteVertexArrays(1, &vao); +#endif +} diff --git a/core/rend/gles/postprocess.cpp b/core/rend/gles/postprocess.cpp index c2a9030ee..6a07049ca 100644 --- a/core/rend/gles/postprocess.cpp +++ b/core/rend/gles/postprocess.cpp @@ -279,10 +279,7 @@ void PostProcessor::term() depthBuffer = 0; glDeleteBuffers(1, &vertexBuffer); vertexBuffer = 0; -#ifndef GLES2 - if (vertexArray != 0) - glDeleteVertexArrays(1, &vertexArray); -#endif + deleteVertexArray(vertexArray); vertexArray = 0; PostProcessShader::term(); glCheck(); @@ -311,11 +308,9 @@ void PostProcessor::render(GLuint output_fbo) glcache.Disable(GL_BLEND); PostProcessShader::select(FB_W_CTRL.fb_dither, SPG_CONTROL.interlace, FB_R_CTRL.vclk_div == 1 && SPG_CONTROL.interlace == 0); -#ifndef GLES2 if (vertexArray != 0) - glBindVertexArray(vertexArray); + bindVertexArray(vertexArray); else -#endif { glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 3, (void*)0); @@ -332,7 +327,5 @@ void PostProcessor::render(GLuint output_fbo) glcache.ClearColor(0.f, 0.f, 0.f, 0.f); glClear(GL_COLOR_BUFFER_BIT); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); -#ifndef GLES2 - glBindVertexArray(0); -#endif + bindVertexArray(0); } diff --git a/core/rend/gles/quad.cpp b/core/rend/gles/quad.cpp index df5412200..bf84035fc 100644 --- a/core/rend/gles/quad.cpp +++ b/core/rend/gles/quad.cpp @@ -51,14 +51,6 @@ static GLuint quadVertexArray; static GLuint quadBuffer; static GLuint quadIndexBuffer; -static void bindVAO(GLuint vao) -{ -#ifndef GLES2 - if (gl.gl_major >= 3) - glBindVertexArray(vao); -#endif -} - static void setupVertexAttribs() { glEnableVertexAttribArray(VERTEX_POS_ARRAY); @@ -112,11 +104,11 @@ void initQuad() #ifndef GLES2 if (gl.gl_major >= 3) { - bindVAO(quadVertexArray); + bindVertexArray(quadVertexArray); glBindBuffer(GL_ARRAY_BUFFER, quadBuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, quadIndexBuffer); setupVertexAttribs(); - bindVAO(0); + bindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } @@ -139,9 +131,7 @@ void termQuad() } if (quadVertexArray != 0) { -#ifndef GLES2 - glDeleteVertexArrays(1, &quadVertexArray); -#endif + deleteVertexArray(quadVertexArray); quadVertexArray = 0; } if (shader != 0) @@ -178,10 +168,10 @@ void drawQuad(GLuint texId, bool rotate, bool swapY) if (gl.gl_major < 3) setupVertexAttribs(); else - bindVAO(quadVertexArray); + bindVertexArray(quadVertexArray); glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STREAM_DRAW); glDrawElements(GL_TRIANGLE_STRIP, 5, GL_UNSIGNED_SHORT, (GLvoid *)0); - bindVAO(0); + bindVertexArray(0); glCheck(); } diff --git a/core/rend/vulkan/texture.h b/core/rend/vulkan/texture.h index 6c75340dc..a5841f721 100644 --- a/core/rend/vulkan/texture.h +++ b/core/rend/vulkan/texture.h @@ -97,7 +97,8 @@ public: vk::SamplerAddressMode vRepeat = tsp.ClampV ? vk::SamplerAddressMode::eClampToEdge : tsp.FlipV ? vk::SamplerAddressMode::eMirroredRepeat : vk::SamplerAddressMode::eRepeat; - bool anisotropicFiltering = config::AnisotropicFiltering > 1 && VulkanContext::Instance()->SupportsSamplerAnisotropy(); + bool anisotropicFiltering = config::AnisotropicFiltering > 1 && VulkanContext::Instance()->SupportsSamplerAnisotropy() + && filter == vk::Filter::eLinear; #ifndef __APPLE__ float mipLodBias = D_Adjust_LoD_Bias[tsp.MipMapD]; #else @@ -107,7 +108,7 @@ public: return samplers.emplace( std::make_pair(samplerHash, VulkanContext::Instance()->GetDevice().createSamplerUnique( vk::SamplerCreateInfo(vk::SamplerCreateFlags(), filter, filter, - vk::SamplerMipmapMode::eNearest, uRepeat, vRepeat, vk::SamplerAddressMode::eClampToEdge, mipLodBias, + vk::SamplerMipmapMode::eLinear, uRepeat, vRepeat, vk::SamplerAddressMode::eClampToEdge, mipLodBias, anisotropicFiltering, std::min((float)config::AnisotropicFiltering, VulkanContext::Instance()->GetMaxSamplerAnisotropy()), false, vk::CompareOp::eNever, 0.0f, 256.0f, vk::BorderColor::eFloatOpaqueBlack)))).first->second.get(); diff --git a/shell/android-studio/build.gradle b/shell/android-studio/build.gradle index 2fcc7ef7e..905d3bd2f 100644 --- a/shell/android-studio/build.gradle +++ b/shell/android-studio/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '7.1.2' apply false - id 'com.android.library' version '7.1.2' apply false + id 'com.android.application' version '7.1.3' apply false + id 'com.android.library' version '7.1.3' apply false } task clean(type: Delete) { diff --git a/shell/apple/emulator-osx/emulator-osx/Images.xcassets/AppIcon.appiconset/Icon-256.png b/shell/apple/emulator-osx/emulator-osx/Images.xcassets/AppIcon.appiconset/Icon-256.png index 9c725d555..3dea29e17 100644 Binary files a/shell/apple/emulator-osx/emulator-osx/Images.xcassets/AppIcon.appiconset/Icon-256.png and b/shell/apple/emulator-osx/emulator-osx/Images.xcassets/AppIcon.appiconset/Icon-256.png differ diff --git a/shell/apple/emulator-osx/emulator-osx/Images.xcassets/AppIcon.appiconset/Icon-512.png b/shell/apple/emulator-osx/emulator-osx/Images.xcassets/AppIcon.appiconset/Icon-512.png index 4725cc681..ee5b3ca28 100644 Binary files a/shell/apple/emulator-osx/emulator-osx/Images.xcassets/AppIcon.appiconset/Icon-512.png and b/shell/apple/emulator-osx/emulator-osx/Images.xcassets/AppIcon.appiconset/Icon-512.png differ