Skip to content

Commit

Permalink
Merge commit 'a9544510468740b77cf06ef28daaa65fe247fd32' into upstream…
Browse files Browse the repository at this point in the history
…-merge-2024-06-09
  • Loading branch information
NikhilNarayana committed Jun 9, 2024
2 parents 10bc950 + a954451 commit ac9d173
Show file tree
Hide file tree
Showing 503 changed files with 77,247 additions and 57,380 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Thumbs.db
Externals/mGBA/version.c
Source/Core/Common/scmrev.h
# Ignore files output by build
/cmake-build-debug
/cmake-build-release
/[Bb]uild*/
/out/
/[Bb]inary*/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@
[submodule "hidapi-src"]
path = Externals/hidapi/hidapi-src
url = https://github.com/libusb/hidapi
[submodule "Externals/tinygltf/tinygltf"]
path = Externals/tinygltf/tinygltf
url = https://github.com/syoyo/tinygltf.git
26 changes: 14 additions & 12 deletions CMake/DolphinDisableWarningsMSVC.cmake
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
include(RemoveCompileFlag)

macro(dolphin_disable_warnings_msvc _target)
macro(dolphin_disable_warnings _target)
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
if (_target_cxx_flags)
set(new_flags "")
foreach(flag IN LISTS _target_cxx_flags)
# all warning flags start with "/W" or "/w" or "-W" or "-w"
if (NOT "${flag}" MATCHES "^[-/][Ww]")
list(APPEND new_flags "${flag}")
endif()
endforeach()
set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "${new_flags}")
endif()
if (MSVC)
get_target_property(_target_cxx_flags ${_target} COMPILE_OPTIONS)
if (_target_cxx_flags)
set(new_flags "")
foreach(flag IN LISTS _target_cxx_flags)
# all warning flags start with "/W" or "/w" or "-W" or "-w"
if (NOT "${flag}" MATCHES "^[-/][Ww]")
list(APPEND new_flags "${flag}")
endif()
endforeach()
set_target_properties(${_target} PROPERTIES COMPILE_OPTIONS "${new_flags}")
endif()
target_compile_options(${_target} PRIVATE "/W0")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(${_target} PRIVATE "-w")
endif()
endmacro()
11 changes: 5 additions & 6 deletions CMake/ScmRevGen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ if(GIT_FOUND)
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
OUTPUT_VARIABLE DOLPHIN_WC_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
# defines DOLPHIN_WC_COMMITS_AHEAD_MASTER
execute_process(WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD ^master
OUTPUT_VARIABLE DOLPHIN_WC_COMMITS_AHEAD_MASTER
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

# version number
Expand All @@ -35,12 +39,7 @@ if(NOT DOLPHIN_WC_REVISION)
set(DOLPHIN_WC_DESCRIBE "${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}")
set(DOLPHIN_WC_REVISION "${DOLPHIN_WC_DESCRIBE} (no further info)")
set(DOLPHIN_WC_BRANCH "master")
endif()

if(DOLPHIN_WC_BRANCH STREQUAL "master" OR DOLPHIN_WC_BRANCH STREQUAL "stable")
set(DOLPHIN_WC_IS_STABLE "1")
else()
set(DOLPHIN_WC_IS_STABLE "0")
set(DOLPHIN_WC_COMMITS_AHEAD_MASTER 0)
endif()

configure_file(
Expand Down
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ endif()
# This is inserted into the Info.plist as well.
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15.0" CACHE STRING "")

set(CMAKE_USER_MAKE_RULES_OVERRIDE "CMake/FlagsOverride.cmake")
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FlagsOverride.cmake")

project(dolphin-emu)

Expand Down Expand Up @@ -160,7 +160,7 @@ if(UNIX)
endif()

list(APPEND CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMake
${CMAKE_CURRENT_SOURCE_DIR}/CMake
)

# Support functions
Expand Down Expand Up @@ -649,6 +649,8 @@ add_subdirectory(Externals/glslang)
if(WIN32 OR APPLE)
add_subdirectory(Externals/spirv_cross)
endif()
add_subdirectory(Externals/tinygltf)

# slippi includes
include_directories(Externals/nlohmann)
add_subdirectory(Externals/semver)
Expand Down Expand Up @@ -690,6 +692,8 @@ dolphin_find_optional_system_library_pkgconfig(ZSTD libzstd>=1.4.0 zstd::zstd Ex

dolphin_find_optional_system_library_pkgconfig(ZLIB zlib-ng ZLIB::ZLIB Externals/zlib-ng)

# https://github.com/zlib-ng/minizip-ng/commit/6c5f265a55f1a12a7a016cd2962feff91cff5d2e
add_definitions(-DMZ_COMPAT_VERSION=110) # This macro is for forwards compatibility with 4.0.4+
dolphin_find_optional_system_library_pkgconfig(MINIZIP minizip>=3.0.0 minizip::minizip Externals/minizip)

dolphin_find_optional_system_library(LZO Externals/LZO)
Expand Down Expand Up @@ -804,7 +808,7 @@ if(NOT GIT_FOUND)
endif()
add_custom_target(
dolphin_scmrev
${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -DDISTRIBUTOR=${DISTRIBUTOR} -DDOLPHIN_DEFAULT_UPDATE_TRACK=${DOLPHIN_DEFAULT_UPDATE_TRACK} -DGIT_FOUND=${GIT_FOUND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DDOLPHIN_WC_REVISION=${DOLPHIN_WC_REVISION} -DDOLPHIN_WC_DESCRIBE=${DOLPHIN_WC_DESCRIBE} -DDOLPHIN_WC_BRANCH=${DOLPHIN_WC_BRANCH} -P ${CMAKE_SOURCE_DIR}/CMake/ScmRevGen.cmake
${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} -DDISTRIBUTOR=${DISTRIBUTOR} -DDOLPHIN_DEFAULT_UPDATE_TRACK=${DOLPHIN_DEFAULT_UPDATE_TRACK} -DGIT_FOUND=${GIT_FOUND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DDOLPHIN_WC_REVISION=${DOLPHIN_WC_REVISION} -DDOLPHIN_WC_DESCRIBE=${DOLPHIN_WC_DESCRIBE} -DDOLPHIN_WC_BRANCH=${DOLPHIN_WC_BRANCH} -P ${CMAKE_CURRENT_SOURCE_DIR}/CMake/ScmRevGen.cmake
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Source/Core/Common/scmrev.h
VERBATIM
)
Expand Down
4 changes: 4 additions & 0 deletions Data/Sys/GameSettings/G5B.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# G5BE4Z - Strike Force Bowling
[Video_Hacks]
EFBToTextureEnable = False
DeferEFBCopies = False
4 changes: 4 additions & 0 deletions Data/Sys/GameSettings/REG.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# REGE36, REGP36 - Emergency Mayhem
[Core]
# Dual core causes hang on loading
CPUThread = False
Empty file.
19 changes: 19 additions & 0 deletions Data/Sys/Load/GraphicMods/Skylanders Giants/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"meta":
{
"title": "Bloom Texture Definitions",
"author": "SuperSamus"
},
"groups":
[
{
"name": "Bloom",
"targets": [
{
"type": "efb",
"texture_filename": "efb1_n000007_80x57_6"
}
]
}
]
}
Empty file.
19 changes: 19 additions & 0 deletions Data/Sys/Load/GraphicMods/Skylanders Trap Team/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"meta":
{
"title": "Bloom Texture Definitions",
"author": "SuperSamus"
},
"groups":
[
{
"name": "Bloom",
"targets": [
{
"type": "efb",
"texture_filename": "efb1_n000005_320x228_6"
}
]
}
]
}
13 changes: 13 additions & 0 deletions Data/Sys/Profiles/Wiimote/Wii Remote with MotionPlus Pointing.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ Buttons/2 = `2`
Buttons/- = `-`
Buttons/+ = `+`
Buttons/Home = `HOME`
IRPassthrough/Enabled = False
IRPassthrough/Object 1 X = `IR Object 1 X`
IRPassthrough/Object 1 Y = `IR Object 1 Y`
IRPassthrough/Object 1 Size = `IR Object 1 Size`
IRPassthrough/Object 2 X = `IR Object 2 X`
IRPassthrough/Object 2 Y = `IR Object 2 Y`
IRPassthrough/Object 2 Size = `IR Object 2 Size`
IRPassthrough/Object 3 X = `IR Object 3 X`
IRPassthrough/Object 3 Y = `IR Object 3 Y`
IRPassthrough/Object 3 Size = `IR Object 3 Size`
IRPassthrough/Object 4 X = `IR Object 4 X`
IRPassthrough/Object 4 Y = `IR Object 4 Y`
IRPassthrough/Object 4 Size = `IR Object 4 Size`
IMUAccelerometer/Up = `Accel Up`
IMUAccelerometer/Down = `Accel Down`
IMUAccelerometer/Left = `Accel Left`
Expand Down
129 changes: 129 additions & 0 deletions Data/Sys/Shaders/PerceptualHDR.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/*
[configuration]
[OptionRangeFloat]
GUIName = Amplificiation
OptionName = AMPLIFICATION
MinValue = 1.0
MaxValue = 6.0
StepAmount = 0.25
DefaultValue = 2.5
[/configuration]
*/

// ICtCP Colorspace as defined by Dolby here:
// https://professional.dolby.com/siteassets/pdfs/ictcp_dolbywhitepaper_v071.pdf

/***** Transfer Function *****/

const float a = 0.17883277;
const float b = 1.0 - 4.0 * a;
const float c = 0.5 - a * log(4.0 * a);

float HLG_f(float x)
{
if (x < 0.0) {
return 0.0;
}

else if (x < 1.0 / 12.0) {
return sqrt(3.0 * x);
}

return a * log(12.0 * x - b) + c;
}

float HLG_inv_f(float x)
{
if (x < 0.0) {
return 0.0;
}

else if (x < 1.0 / 2.0) {
return x * x / 3.0;
}

return (exp((x - c) / a) + b) / 12.0;
}

float4 HLG(float4 lms)
{
return float4(HLG_f(lms.x), HLG_f(lms.y), HLG_f(lms.z), lms.w);
}

float4 HLG_inv(float4 lms)
{
return float4(HLG_inv_f(lms.x), HLG_inv_f(lms.y), HLG_inv_f(lms.z), lms.w);
}

/***** Linear <--> ICtCp *****/

const mat4 RGBtoLMS = mat4(
1688.0, 683.0, 99.0, 0.0,
2146.0, 2951.0, 309.0, 0.0,
262.0, 462.0, 3688.0, 0.0,
0.0, 0.0, 0.0, 4096.0)
/ 4096.0;

const mat4 LMStoICtCp = mat4(
+2048.0, +3625.0, +9500.0, 0.0,
+2048.0, -7465.0, -9212.0, 0.0,
+0.0, +3840.0, -288.0, 0.0,
+0.0, +0.0, +0.0, 4096.0)
/ 4096.0;

float4 LinearRGBToICtCP(float4 c)
{
return LMStoICtCp * HLG(RGBtoLMS * c);
}

/***** ICtCp <--> Linear *****/

mat4 ICtCptoLMS = inverse(LMStoICtCp);
mat4 LMStoRGB = inverse(RGBtoLMS);

float4 ICtCpToLinearRGB(float4 c)
{
return LMStoRGB * HLG_inv(ICtCptoLMS * c);
}

void main()
{
float4 color = Sample();

// Nothing to do here, we are in SDR
if (!OptionEnabled(hdr_output) || !OptionEnabled(linear_space_output)) {
SetOutput(color);
return;
}

// Renormalize Color to be in [0.0 - 1.0] SDR Space. We will revert this later.
const float hdr_paper_white = hdr_paper_white_nits / hdr_sdr_white_nits;
color.rgb /= hdr_paper_white;

// Convert Color to Perceptual Color Space. This will allow us to do perceptual
// scaling while also being able to use the luminance channel.
float4 ictcp_color = LinearRGBToICtCP(color);

// Scale the color in perceptual space depending on the percieved luminance.
//
// At low luminances, ~0.0, pow(AMPLIFICATION, ~0.0) ~= 1.0, so the
// color will appear to be unchanged. This is important as we don't want to
// over expose dark colors which would not have otherwise been seen.
//
// At high luminances, ~1.0, pow(AMPLIFICATION, ~1.0) ~= AMPLIFICATION,
// which is equivilant to scaling the color by AMPLIFICATION. This is
// important as we want to get the most out of the display, and we want to
// get bright colors to hit their target brightness.
//
// For more information, see this desmos demonstrating this scaling process:
// https://www.desmos.com/calculator/syjyrjsj5c
float exposure = length(ictcp_color.xyz);
ictcp_color *= pow(HLG_f(AMPLIFICATION), exposure);

// Convert back to Linear RGB and output the color to the display.
// We use hdr_paper_white to renormalize the color to the comfortable
// SDR viewing range.
SetOutput(hdr_paper_white * ICtCpToLinearRGB(ictcp_color));
}
Loading

0 comments on commit ac9d173

Please sign in to comment.