Compare commits

..

29 commits

Author SHA1 Message Date
Wunkolo
6b62f8ec19 renderer_gl: Add layer/level specifier to MSAA resolves 2026-06-02 15:33:37 -07:00
Wunkolo
773c086dca renderer_gl: Fix MakeHandle string-view hazard
`glObjectLabel` expects a null-terminated string, but an `std::string_view` is not necessarily null-terminated
2026-06-02 15:33:37 -07:00
Wunkolo
31c9b8d4a9 renderer_gl: Implement TextureRuntime::ClearTexture MSAA clears
When ArbClearTexture is not available, ensure the fallback implementation also clears the MSAA texture as well.
2026-06-02 15:33:37 -07:00
Wunkolo
71179b1e9c renderer_gl: Resolve framebuffer after each draw
Brute force approach while trying to determine a better heuristic. Framebuffer changes are not enough to determine the end of a "render pass". An 'msaa dirty flag' is likely the better way here.
2026-06-02 15:33:37 -07:00
Wunkolo
d78f719bf7 renderer_gl: Implement multisample Convert{DS24S8ToRGBA8,RGBA4ToRGB5A1} 2026-06-02 15:33:37 -07:00
Wunkolo
9660492f99 renderer_gl: Fix surface ScaleUp implementation
Should assign the new `res_scale` and `sample_count`
2026-06-02 15:33:37 -07:00
Wunkolo
86c05a27e8 renderer_gl: Initial MSAA implementation
Basically copied over some of the paradigms over from Vulkan. Covers most rendering uses-cases except for conversions such as `ConvertDS24S8ToRGBA8` and `ConvertRGBA4ToRGB5A1`
2026-06-02 15:33:37 -07:00
Wunkolo
63a52b9dc3 config: Refactor sample_count to antialiasing setting
Intended to allow for other anti-aliasing methods to be introduced
2026-06-02 15:33:37 -07:00
Wunkolo
a922cdaa45 renderer_vulkan: Fix Multisample ConvertDS24S8ToRGBA8
Migrate `ResolveTexture` to `BlitHelper`.
If the conversion was multi-sample, do a final resolve at the end of the conversion to ensure the non-multisample textures are updated as well.

Fixes Pokemon!
2026-06-02 15:33:37 -07:00
Wunkolo
4c4c75cd1b renderer_vulkan: Fix MSAA image debug name 2026-06-02 15:33:37 -07:00
Wunkolo
844939d372 renderer_vulkan: Fix multisample framebuffer creation
MSAA renderpasses require the "current" image as the main resolve target, and the MSAA image as the second attachment.
2026-06-02 15:33:37 -07:00
Wunkolo
7eac2ec7af renderer_vulkan: Fix multisample ClearTextureWithRenderpass
Ensure that the multisample framebuffer is used rather than the usual one when using a render pass to clear the textures.

That way, a MSAA-render AND resolve is used to clear the textures at the same time.
2026-06-02 15:33:36 -07:00
Wunkolo
bad3313f04 renderer_vulkan: Fix ConvertDS24S8ToRGBA8 image targets
Ensure that the Multi-Sample texture is used for the destination color image as well. Should the dest image be MSAA too? Or should all the values be resolved into a minimum depth and some combination of stencil-values here?
2026-06-02 15:33:36 -07:00
Wunkolo
808cf2c7d2 renderer_vulkan: Fix Surface::ScaleUp scale/sample increase
This should be checking the _new_ value to possibly cull upscaled texture creation rather than the current value of the surface. Fixes broken up render passes when drawing UI in some games.
2026-06-02 15:33:36 -07:00
Wunkolo
e90cbba7e2 renderer_vulkan: Fix MSAA framebuffer target resolve surface
Use the specified type rather than defaulting to the surface's current one(implicit `ImageView` argument).
2026-06-02 15:33:36 -07:00
Wunkolo
a73c8c7c86 renderer_vulkan: Fix narrowing byte conversion
Fixes a compilation error on Unix platforms.
2026-06-02 15:33:36 -07:00
Wunkolo
5ded99d326 renderer_vulkan: Add TextureRuntime::ResolveTexture
Rather than use a big lambda, just rip this out into a proper function for other blit functions to utilize.
2026-06-02 15:33:36 -07:00
Wunkolo
7ce88bc63b renderer_vulkan: Fix cleanup and debug-naming for d24s8_to_rgba8_ms_comp 2026-06-02 15:33:36 -07:00
Wunkolo
216952b8cd renderer_vulkan: Fix initialization of image handles
Try to optimally create the new image handles when a change in res scale or sample-count has actually occured. MSAA images need to be updated too in the case that the resolution scale has changed
2026-06-02 15:33:36 -07:00
Wunkolo
0b12a881c9 renderer_vulkan: Derive framebuffer sample-count from attachments
Derive the framebuffer sample-count from the input color and depth operands. Similar to how `res_scale` is determined.
2026-06-02 15:33:36 -07:00
Wunkolo
326d658757 renderer_vulkan: Fix dangling surface reference during msaa resolve
These individual parameters need to be copied as the reference to the surface-object only lasts within the scope of this function.
2026-06-02 15:33:36 -07:00
Wunkolo
e74ebf65a6 renderer_vulkan: Fix Framebuffer::sample_count move-operator
`sample_count` needs to be move/copied over.

Also reorder the accessor order to match the declaration of variables.
2026-06-02 15:33:36 -07:00
Wunkolo
63e25b2206 renderer_vulkan: Fix multisample texture init barrier
Should address the MultiSampled image directly since the multisampled image is just a transient image and not the leading state of the image.
2026-06-02 15:33:36 -07:00
Wunkolo
fdfe63f76c renderer_vulkan: Implement multisample texture runtime
This seems to be enough for simple programs to render with MSAA enabled!
2026-06-02 15:33:36 -07:00
Wunkolo
950803c2b7 renderer_vulkan: Implement multisample pipeline/renderpass support
Allows multi-sample render passes and graphics pipelines to be created, using sample-rate shading rather than coverage-based MSAA.
2026-06-02 15:33:36 -07:00
Wunkolo
ddc81c390c rasterizer_cache: Initial support for multi-sample surfaces 2026-06-02 15:33:36 -07:00
Wunkolo
29eb887d90 vk_instance: Add detection of MSAA features
Full multi-sample support is when renderpass-2 and depth-stencil-resolve extensions are available and when sample-rate-shading and msaa-storage-images are supported.
2026-06-02 15:33:36 -07:00
Wunkolo
a0eea7bb4d vk_blit_helper: Add d24s8_to_rgba8_ms_comp
Helper host-shader for blitting multi-sampled DS24S8 textures to multi-sampled RGBA8
2026-06-02 15:33:36 -07:00
Wunkolo
14736c7065 config: Add sample_count renderer option
Option is only enabled when the renderer is set to Vulkan, for now.
2026-06-02 15:33:36 -07:00
6 changed files with 32 additions and 17 deletions

9
.gitmodules vendored
View file

@ -55,6 +55,12 @@
[submodule "sdl2"]
path = externals/sdl2/SDL
url = https://github.com/libsdl-org/SDL
[submodule "cryptopp-cmake"]
path = externals/cryptopp-cmake
url = https://github.com/abdes/cryptopp-cmake.git
[submodule "cryptopp"]
path = externals/cryptopp
url = https://github.com/weidai11/cryptopp.git
[submodule "dds-ktx"]
path = externals/dds-ktx
url = https://github.com/septag/dds-ktx
@ -103,6 +109,3 @@
[submodule "dllwalker"]
path = externals/dllwalker
url = https://github.com/azahar-emu/dllwalker
[submodule "externals/cryptopp"]
path = externals/cryptopp
url = https://github.com/cryptopp-modern/cryptopp-modern.git

View file

@ -411,21 +411,13 @@ if (APPLE)
endif()
find_library(AVFOUNDATION_LIBRARY AVFoundation REQUIRED)
find_library(IOSURFACE_LIBRARY IOSurface REQUIRED)
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOSURFACE_LIBRARY})
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOSURFACE_LIBRARY} ${MOLTENVK_LIBRARY})
if (ENABLE_VULKAN AND NOT ENABLE_LIBRETRO)
if (USE_SYSTEM_MOLTENVK)
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
else()
if (NOT USE_SYSTEM_MOLTENVK)
download_moltenvk()
if (IOS)
set(MOLTENVK_RELATIVE_LIBPATH "static/MoltenVK.xcframework/ios-arm64/libMoltenVK.a")
else()
set(MOLTENVK_RELATIVE_LIBPATH "dynamic/dylib/macOS/libMoltenVK.dylib")
endif()
set(MOLTENVK_LIBRARY "${CMAKE_BINARY_DIR}/externals/MoltenVK/MoltenVK/${MOLTENVK_RELATIVE_LIBPATH}")
endif()
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} ${MOLTENVK_LIBRARY})
endif()

View file

@ -171,8 +171,15 @@ function(download_qt target)
endfunction()
function(download_moltenvk)
if (IOS)
set(MOLTENVK_PLATFORM "static/MoltenVK.xcframework/ios-arm64")
else()
set(MOLTENVK_PLATFORM "dynamic/dylib/macOS")
endif()
set(MOLTENVK_DIR "${CMAKE_BINARY_DIR}/externals/MoltenVK")
set(MOLTENVK_TAR "${CMAKE_BINARY_DIR}/externals/MoltenVK.tar")
if (NOT EXISTS "${CMAKE_BINARY_DIR}/externals/MoltenVK")
if (NOT EXISTS ${MOLTENVK_DIR})
if (NOT EXISTS ${MOLTENVK_TAR})
file(DOWNLOAD https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.9/MoltenVK-all.tar
${MOLTENVK_TAR} SHOW_PROGRESS)
@ -181,6 +188,10 @@ function(download_moltenvk)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${MOLTENVK_TAR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
endif()
# Add the MoltenVK library path to the prefix so find_library can locate it.
list(APPEND CMAKE_PREFIX_PATH "${MOLTENVK_DIR}/MoltenVK/${MOLTENVK_PLATFORM}")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
endfunction()
function(get_external_prefix lib_name prefix_var)

View file

@ -69,9 +69,17 @@ if(USE_SYSTEM_CRYPTOPP)
add_library(cryptopp INTERFACE)
target_link_libraries(cryptopp INTERFACE cryptopp::cryptopp)
else()
if (WIN32 AND NOT MSVC AND "arm64" IN_LIST ARCHITECTURE)
# TODO: CryptoPP ARM64 ASM does not seem to support Windows unless compiled with MSVC.
# TODO: See https://github.com/weidai11/cryptopp/issues/1260
set(CRYPTOPP_DISABLE_ASM ON CACHE BOOL "")
endif()
set(CRYPTOPP_BUILD_DOCUMENTATION OFF CACHE BOOL "")
set(CRYPTOPP_BUILD_TESTING OFF CACHE BOOL "")
set(CRYPTOPP_INSTALL OFF CACHE BOOL "")
add_subdirectory(cryptopp EXCLUDE_FROM_ALL)
set(CRYPTOPP_SOURCES "${CMAKE_SOURCE_DIR}/externals/cryptopp" CACHE STRING "")
add_subdirectory(cryptopp-cmake EXCLUDE_FROM_ALL)
endif()
# dds-ktx

2
externals/cryptopp vendored

@ -1 +1 @@
Subproject commit 8d92d788421483a43e09acf1cd4a2861cb2b8cab
Subproject commit 60f81a77e0c9a0e7ffc1ca1bc438ddfa2e43b78e

1
externals/cryptopp-cmake vendored Submodule

@ -0,0 +1 @@
Subproject commit 00a151f8489daaa32434ab1f340e6750793ddf0c