mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 02:33:44 -04:00
Compare commits
5 commits
d9806a04da
...
2c5d2872ac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c5d2872ac | ||
|
|
379649dbce | ||
|
|
c03248f158 | ||
|
|
60be8ced99 | ||
|
|
de15a7c79a |
8 changed files with 54 additions and 33 deletions
9
.gitmodules
vendored
9
.gitmodules
vendored
|
|
@ -55,12 +55,6 @@
|
||||||
[submodule "sdl2"]
|
[submodule "sdl2"]
|
||||||
path = externals/sdl2/SDL
|
path = externals/sdl2/SDL
|
||||||
url = https://github.com/libsdl-org/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"]
|
[submodule "dds-ktx"]
|
||||||
path = externals/dds-ktx
|
path = externals/dds-ktx
|
||||||
url = https://github.com/septag/dds-ktx
|
url = https://github.com/septag/dds-ktx
|
||||||
|
|
@ -109,3 +103,6 @@
|
||||||
[submodule "dllwalker"]
|
[submodule "dllwalker"]
|
||||||
path = externals/dllwalker
|
path = externals/dllwalker
|
||||||
url = https://github.com/azahar-emu/dllwalker
|
url = https://github.com/azahar-emu/dllwalker
|
||||||
|
[submodule "externals/cryptopp"]
|
||||||
|
path = externals/cryptopp
|
||||||
|
url = https://github.com/cryptopp-modern/cryptopp-modern.git
|
||||||
|
|
|
||||||
|
|
@ -411,13 +411,21 @@ if (APPLE)
|
||||||
endif()
|
endif()
|
||||||
find_library(AVFOUNDATION_LIBRARY AVFoundation REQUIRED)
|
find_library(AVFOUNDATION_LIBRARY AVFoundation REQUIRED)
|
||||||
find_library(IOSURFACE_LIBRARY IOSurface REQUIRED)
|
find_library(IOSURFACE_LIBRARY IOSurface REQUIRED)
|
||||||
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOSURFACE_LIBRARY} ${MOLTENVK_LIBRARY})
|
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOSURFACE_LIBRARY})
|
||||||
|
|
||||||
if (ENABLE_VULKAN AND NOT ENABLE_LIBRETRO)
|
if (ENABLE_VULKAN AND NOT ENABLE_LIBRETRO)
|
||||||
if (NOT USE_SYSTEM_MOLTENVK)
|
if (USE_SYSTEM_MOLTENVK)
|
||||||
|
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
|
||||||
|
else()
|
||||||
download_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()
|
endif()
|
||||||
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
|
|
||||||
message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
|
message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
|
||||||
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} ${MOLTENVK_LIBRARY})
|
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} ${MOLTENVK_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -171,15 +171,8 @@ function(download_qt target)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(download_moltenvk)
|
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")
|
set(MOLTENVK_TAR "${CMAKE_BINARY_DIR}/externals/MoltenVK.tar")
|
||||||
if (NOT EXISTS ${MOLTENVK_DIR})
|
if (NOT EXISTS "${CMAKE_BINARY_DIR}/externals/MoltenVK")
|
||||||
if (NOT EXISTS ${MOLTENVK_TAR})
|
if (NOT EXISTS ${MOLTENVK_TAR})
|
||||||
file(DOWNLOAD https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.9/MoltenVK-all.tar
|
file(DOWNLOAD https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.9/MoltenVK-all.tar
|
||||||
${MOLTENVK_TAR} SHOW_PROGRESS)
|
${MOLTENVK_TAR} SHOW_PROGRESS)
|
||||||
|
|
@ -188,10 +181,6 @@ function(download_moltenvk)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${MOLTENVK_TAR}"
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${MOLTENVK_TAR}"
|
||||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
|
||||||
endif()
|
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()
|
endfunction()
|
||||||
|
|
||||||
function(get_external_prefix lib_name prefix_var)
|
function(get_external_prefix lib_name prefix_var)
|
||||||
|
|
|
||||||
10
externals/CMakeLists.txt
vendored
10
externals/CMakeLists.txt
vendored
|
|
@ -69,17 +69,9 @@ if(USE_SYSTEM_CRYPTOPP)
|
||||||
add_library(cryptopp INTERFACE)
|
add_library(cryptopp INTERFACE)
|
||||||
target_link_libraries(cryptopp INTERFACE cryptopp::cryptopp)
|
target_link_libraries(cryptopp INTERFACE cryptopp::cryptopp)
|
||||||
else()
|
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_BUILD_TESTING OFF CACHE BOOL "")
|
||||||
set(CRYPTOPP_INSTALL OFF CACHE BOOL "")
|
set(CRYPTOPP_INSTALL OFF CACHE BOOL "")
|
||||||
set(CRYPTOPP_SOURCES "${CMAKE_SOURCE_DIR}/externals/cryptopp" CACHE STRING "")
|
add_subdirectory(cryptopp EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(cryptopp-cmake EXCLUDE_FROM_ALL)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# dds-ktx
|
# dds-ktx
|
||||||
|
|
|
||||||
2
externals/cryptopp
vendored
2
externals/cryptopp
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit 60f81a77e0c9a0e7ffc1ca1bc438ddfa2e43b78e
|
Subproject commit 8d92d788421483a43e09acf1cd4a2861cb2b8cab
|
||||||
1
externals/cryptopp-cmake
vendored
1
externals/cryptopp-cmake
vendored
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 00a151f8489daaa32434ab1f340e6750793ddf0c
|
|
||||||
|
|
@ -541,6 +541,8 @@ void RasterizerOpenGL::DrawTriangles() {
|
||||||
|
|
||||||
bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
||||||
MICROPROFILE_SCOPE(OpenGL_Drawing);
|
MICROPROFILE_SCOPE(OpenGL_Drawing);
|
||||||
|
const DebugScope scope(runtime, Common::Vec4f{}, "RasterizerOpenGL::Draw");
|
||||||
|
|
||||||
SyncDrawState();
|
SyncDrawState();
|
||||||
|
|
||||||
const bool shadow_rendering = regs.framebuffer.IsShadowRendering();
|
const bool shadow_rendering = regs.framebuffer.IsShadowRendering();
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,11 @@ bool TextureRuntime::Reinterpret(Surface& source, Surface& dest,
|
||||||
const VideoCore::TextureCopy& copy) {
|
const VideoCore::TextureCopy& copy) {
|
||||||
const PixelFormat src_format = source.pixel_format;
|
const PixelFormat src_format = source.pixel_format;
|
||||||
const PixelFormat dst_format = dest.pixel_format;
|
const PixelFormat dst_format = dest.pixel_format;
|
||||||
|
|
||||||
|
const DebugScope scope(*this, Common::Vec4f{}, "TextureRuntime::Reinterpret ({} -> {})",
|
||||||
|
VideoCore::PixelFormatAsString(src_format),
|
||||||
|
VideoCore::PixelFormatAsString(dst_format));
|
||||||
|
|
||||||
ASSERT_MSG(src_format != dst_format, "Reinterpretation with the same format is invalid");
|
ASSERT_MSG(src_format != dst_format, "Reinterpretation with the same format is invalid");
|
||||||
if (src_format == PixelFormat::D24S8 && dst_format == PixelFormat::RGBA8) {
|
if (src_format == PixelFormat::D24S8 && dst_format == PixelFormat::RGBA8) {
|
||||||
blit_helper.ConvertDS24S8ToRGBA8(source, dest, copy);
|
blit_helper.ConvertDS24S8ToRGBA8(source, dest, copy);
|
||||||
|
|
@ -190,6 +195,10 @@ bool TextureRuntime::Reinterpret(Surface& source, Surface& dest,
|
||||||
|
|
||||||
bool TextureRuntime::ClearTextureWithoutFbo(Surface& surface,
|
bool TextureRuntime::ClearTextureWithoutFbo(Surface& surface,
|
||||||
const VideoCore::TextureClear& clear) {
|
const VideoCore::TextureClear& clear) {
|
||||||
|
const DebugScope scope(
|
||||||
|
*this, Common::Vec4f{}, "TextureRuntime::ClearTextureWithoutFbo ({}, {}, {}, {})",
|
||||||
|
clear.value.color.r(), clear.value.color.g(), clear.value.color.b(), clear.value.color.a());
|
||||||
|
|
||||||
if (!driver.HasArbClearTexture() || driver.HasBug(DriverBug::BrokenClearTexture)) {
|
if (!driver.HasArbClearTexture() || driver.HasBug(DriverBug::BrokenClearTexture)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -219,6 +228,10 @@ bool TextureRuntime::ClearTextureWithoutFbo(Surface& surface,
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureRuntime::ClearTexture(Surface& surface, const VideoCore::TextureClear& clear) {
|
void TextureRuntime::ClearTexture(Surface& surface, const VideoCore::TextureClear& clear) {
|
||||||
|
const DebugScope scope(*this, Common::Vec4f{}, "TextureRuntime::ClearTexture ({}, {}, {}, {})",
|
||||||
|
clear.value.color.r(), clear.value.color.g(), clear.value.color.b(),
|
||||||
|
clear.value.color.a());
|
||||||
|
|
||||||
if (ClearTextureWithoutFbo(surface, clear)) {
|
if (ClearTextureWithoutFbo(surface, clear)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -262,6 +275,9 @@ void TextureRuntime::ClearTexture(Surface& surface, const VideoCore::TextureClea
|
||||||
|
|
||||||
bool TextureRuntime::CopyTextures(Surface& source, Surface& dest,
|
bool TextureRuntime::CopyTextures(Surface& source, Surface& dest,
|
||||||
std::span<const VideoCore::TextureCopy> copies) {
|
std::span<const VideoCore::TextureCopy> copies) {
|
||||||
|
const DebugScope scope(*this, Common::Vec4f{}, "TextureRuntime::CopyTexture ({} copies)",
|
||||||
|
copies.size());
|
||||||
|
|
||||||
const GLenum src_textarget = source.texture_type == VideoCore::TextureType::CubeMap
|
const GLenum src_textarget = source.texture_type == VideoCore::TextureType::CubeMap
|
||||||
? GL_TEXTURE_CUBE_MAP
|
? GL_TEXTURE_CUBE_MAP
|
||||||
: GL_TEXTURE_2D;
|
: GL_TEXTURE_2D;
|
||||||
|
|
@ -279,6 +295,8 @@ bool TextureRuntime::CopyTextures(Surface& source, Surface& dest,
|
||||||
|
|
||||||
bool TextureRuntime::BlitTextures(Surface& source, Surface& dest,
|
bool TextureRuntime::BlitTextures(Surface& source, Surface& dest,
|
||||||
const VideoCore::TextureBlit& blit) {
|
const VideoCore::TextureBlit& blit) {
|
||||||
|
const DebugScope scope(*this, Common::Vec4f{}, "TextureRuntime::BlitTextures");
|
||||||
|
|
||||||
OpenGLState state = OpenGLState::GetCurState();
|
OpenGLState state = OpenGLState::GetCurState();
|
||||||
state.scissor.enabled = false;
|
state.scissor.enabled = false;
|
||||||
state.draw.read_framebuffer = read_fbos[FboIndex(source.type)].handle;
|
state.draw.read_framebuffer = read_fbos[FboIndex(source.type)].handle;
|
||||||
|
|
@ -302,6 +320,8 @@ bool TextureRuntime::BlitTextures(Surface& source, Surface& dest,
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureRuntime::GenerateMipmaps(Surface& surface) {
|
void TextureRuntime::GenerateMipmaps(Surface& surface) {
|
||||||
|
const DebugScope scope(*this, Common::Vec4f{}, "TextureRuntime::GenerateMipmaps");
|
||||||
|
|
||||||
OpenGLState state = OpenGLState::GetCurState();
|
OpenGLState state = OpenGLState::GetCurState();
|
||||||
|
|
||||||
const auto generate = [&](u32 index) {
|
const auto generate = [&](u32 index) {
|
||||||
|
|
@ -373,6 +393,8 @@ GLuint Surface::Handle(u32 index) const noexcept {
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint Surface::CopyHandle() noexcept {
|
GLuint Surface::CopyHandle() noexcept {
|
||||||
|
const DebugScope scope(*runtime, Common::Vec4f{}, "Surface::CopyHandle");
|
||||||
|
|
||||||
if (!copy_texture.handle) {
|
if (!copy_texture.handle) {
|
||||||
copy_texture = MakeHandle(GL_TEXTURE_2D, GetScaledWidth(), GetScaledHeight(), levels, tuple,
|
copy_texture = MakeHandle(GL_TEXTURE_2D, GetScaledWidth(), GetScaledHeight(), levels, tuple,
|
||||||
DebugName(true));
|
DebugName(true));
|
||||||
|
|
@ -390,6 +412,8 @@ GLuint Surface::CopyHandle() noexcept {
|
||||||
|
|
||||||
void Surface::Upload(const VideoCore::BufferTextureCopy& upload,
|
void Surface::Upload(const VideoCore::BufferTextureCopy& upload,
|
||||||
const VideoCore::StagingData& staging) {
|
const VideoCore::StagingData& staging) {
|
||||||
|
const DebugScope scope(*runtime, Common::Vec4f{}, "Surface::Upload");
|
||||||
|
|
||||||
ASSERT(stride * GetFormatBytesPerPixel(pixel_format) % 4 == 0);
|
ASSERT(stride * GetFormatBytesPerPixel(pixel_format) % 4 == 0);
|
||||||
|
|
||||||
const u32 unscaled_width = upload.texture_rect.GetWidth();
|
const u32 unscaled_width = upload.texture_rect.GetWidth();
|
||||||
|
|
@ -417,6 +441,8 @@ void Surface::Upload(const VideoCore::BufferTextureCopy& upload,
|
||||||
}
|
}
|
||||||
|
|
||||||
void Surface::UploadCustom(const VideoCore::Material* material, u32 level) {
|
void Surface::UploadCustom(const VideoCore::Material* material, u32 level) {
|
||||||
|
const DebugScope scope(*runtime, Common::Vec4f{}, "Surface::UploadCustom");
|
||||||
|
|
||||||
const u32 width = material->width;
|
const u32 width = material->width;
|
||||||
const u32 height = material->height;
|
const u32 height = material->height;
|
||||||
const auto color = material->textures[0];
|
const auto color = material->textures[0];
|
||||||
|
|
@ -459,6 +485,8 @@ void Surface::UploadCustom(const VideoCore::Material* material, u32 level) {
|
||||||
|
|
||||||
void Surface::Download(const VideoCore::BufferTextureCopy& download,
|
void Surface::Download(const VideoCore::BufferTextureCopy& download,
|
||||||
const VideoCore::StagingData& staging) {
|
const VideoCore::StagingData& staging) {
|
||||||
|
const DebugScope scope(*runtime, Common::Vec4f{}, "Surface::Download");
|
||||||
|
|
||||||
ASSERT(stride * GetFormatBytesPerPixel(pixel_format) % 4 == 0);
|
ASSERT(stride * GetFormatBytesPerPixel(pixel_format) % 4 == 0);
|
||||||
|
|
||||||
const u32 unscaled_width = download.texture_rect.GetWidth();
|
const u32 unscaled_width = download.texture_rect.GetWidth();
|
||||||
|
|
@ -498,6 +526,8 @@ void Surface::Download(const VideoCore::BufferTextureCopy& download,
|
||||||
|
|
||||||
bool Surface::DownloadWithoutFbo(const VideoCore::BufferTextureCopy& download,
|
bool Surface::DownloadWithoutFbo(const VideoCore::BufferTextureCopy& download,
|
||||||
const VideoCore::StagingData& staging) {
|
const VideoCore::StagingData& staging) {
|
||||||
|
const DebugScope scope(*runtime, Common::Vec4f{}, "Surface::DownloadWithoutFbo");
|
||||||
|
|
||||||
if (driver->IsOpenGLES()) {
|
if (driver->IsOpenGLES()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -557,6 +587,8 @@ void Surface::Attach(GLenum target, u32 level, u32 layer, bool scaled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Surface::ScaleUp(u32 new_scale) {
|
void Surface::ScaleUp(u32 new_scale) {
|
||||||
|
const DebugScope scope(*runtime, Common::Vec4f{}, "Surface::ScaleUp (NewScale:{})", new_scale);
|
||||||
|
|
||||||
if (res_scale == new_scale || new_scale == 1) {
|
if (res_scale == new_scale || new_scale == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -585,6 +617,8 @@ u32 Surface::GetInternalBytesPerPixel() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Surface::BlitScale(const VideoCore::TextureBlit& blit, bool up_scale) {
|
void Surface::BlitScale(const VideoCore::TextureBlit& blit, bool up_scale) {
|
||||||
|
const DebugScope scope(*runtime, Common::Vec4f{}, "Surface::BlitScale (UpScale:{})", up_scale);
|
||||||
|
|
||||||
const u32 fbo_index = FboIndex(type);
|
const u32 fbo_index = FboIndex(type);
|
||||||
|
|
||||||
OpenGLState state = OpenGLState::GetCurState();
|
OpenGLState state = OpenGLState::GetCurState();
|
||||||
|
|
@ -682,7 +716,7 @@ Sampler::Sampler(TextureRuntime&, VideoCore::SamplerParams params) {
|
||||||
Sampler::~Sampler() = default;
|
Sampler::~Sampler() = default;
|
||||||
|
|
||||||
DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f, std::string_view label)
|
DebugScope::DebugScope(TextureRuntime& runtime, Common::Vec4f, std::string_view label)
|
||||||
: local_scope_depth{global_scope_depth++} {
|
: local_scope_depth{Settings::values.renderer_debug ? global_scope_depth++ : 0} {
|
||||||
if (!Settings::values.renderer_debug) {
|
if (!Settings::values.renderer_debug) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue