Merge remote-tracking branch 'origin/master' into dev

This commit is contained in:
Flyinghead 2022-04-13 16:29:41 +02:00
commit ddfc00ed9f
13 changed files with 93 additions and 122 deletions

View File

@ -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: |

View File

@ -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

View File

@ -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"
)

View File

@ -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[] =

View File

@ -1,43 +0,0 @@
project(dx9renderer)
add_library(${PROJECT_NAME} STATIC dxcontext.cpp)
target_compile_definitions(${PROJECT_NAME} PRIVATE
$<$<BOOL:MSVC>:_CRT_NONSTDC_NO_WARNINGS>
$<$<BOOL:MSVC>:_CRT_SECURE_NO_WARNINGS>
$<$<BOOL:MSVC>:_USE_MATH_DEFINES>
$<$<BOOL:MSVC>:NOMINMAX>
$<$<BOOL:${TEST_AUTOMATION}>:TEST_AUTOMATION>
$<$<BOOL:${ENABLE_LOG}>: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)

View File

@ -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;
}

View File

@ -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
}

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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();

View File

@ -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) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 97 KiB