diff --git a/README.md b/README.md index 6d8f4d075..26dafd3f1 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1414. +This is the source code for early-access 1415. ## Legal Notice diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index cd3207a03..71b64e32a 100755 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -104,14 +104,6 @@ __declspec(dllimport) void __stdcall DebugBreak(void); } \ } -/// Evaluates a boolean expression, and returns a result unless that expression is true. -#define R_UNLESS_NOLOG(expr, res) \ - { \ - if (!(expr)) { \ - return res; \ - } \ - } - #define R_SUCCEEDED(res) (res.IsSuccess()) /// Evaluates an expression that returns a result, and returns the result if it would fail. diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 17373c9d1..35dac3a8f 100755 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h @@ -31,8 +31,6 @@ ScopeExitHelper ScopeExit(Func&& func) { } } // namespace detail -#define SCOPE_GUARD(body) detail::ScopeExit([&]() body) - /** * This macro allows you to conveniently specify a block of code that will run on scope exit. Handy * for doing ad-hoc clean-up tasks in a function with multiple returns. @@ -51,3 +49,9 @@ ScopeExitHelper ScopeExit(Func&& func) { * \endcode */ #define SCOPE_EXIT(body) auto CONCAT2(scope_exit_helper_, __LINE__) = detail::ScopeExit([&]() body) + +/** + * This macro is similar to SCOPE_EXIT, except the object is caller managed. This is intended to be + * used when the caller might want to cancel the ScopeExit. + */ +#define SCOPE_GUARD(body) detail::ScopeExit([&]() body) diff --git a/src/core/hle/kernel/k_address_arbiter.cpp b/src/core/hle/kernel/k_address_arbiter.cpp index affc04852..f2f497dc4 100755 --- a/src/core/hle/kernel/k_address_arbiter.cpp +++ b/src/core/hle/kernel/k_address_arbiter.cpp @@ -120,7 +120,10 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32 s32 user_value{}; R_UNLESS(UpdateIfEqual(system, std::addressof(user_value), addr, value, value + 1), Svc::ResultInvalidCurrentMemory); - R_UNLESS_NOLOG(user_value == value, Svc::ResultInvalidState); + + if (user_value != value) { + return Svc::ResultInvalidState; + } auto it = thread_tree.nfind_light({addr, -1}); while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) && @@ -211,7 +214,10 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32 } R_UNLESS(succeeded, Svc::ResultInvalidCurrentMemory); - R_UNLESS_NOLOG(user_value == value, Svc::ResultInvalidState); + + if (user_value != value) { + return Svc::ResultInvalidState; + } while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) && (it->GetAddressArbiterKey() == addr)) { diff --git a/src/core/hle/kernel/k_event.h b/src/core/hle/kernel/k_event.h index c4ac4f883..2fb887129 100755 --- a/src/core/hle/kernel/k_event.h +++ b/src/core/hle/kernel/k_event.h @@ -40,6 +40,14 @@ public: return writable_event; } + const std::shared_ptr& GetReadableEvent() const { + return readable_event; + } + + const std::shared_ptr& GetWritableEvent() const { + return writable_event; + } + private: std::shared_ptr readable_event; std::shared_ptr writable_event; diff --git a/src/core/hle/kernel/k_readable_event.cpp b/src/core/hle/kernel/k_readable_event.cpp index cd15aa529..d8a42dbaf 100755 --- a/src/core/hle/kernel/k_readable_event.cpp +++ b/src/core/hle/kernel/k_readable_event.cpp @@ -46,7 +46,9 @@ ResultCode KReadableEvent::Clear() { ResultCode KReadableEvent::Reset() { KScopedSchedulerLock lk{kernel}; - R_UNLESS_NOLOG(is_signaled, Svc::ResultInvalidState); + if (!is_signaled) { + return Svc::ResultInvalidState; + } is_signaled = false; return RESULT_SUCCESS; diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index 54322fe47..970120acc 100755 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt @@ -19,6 +19,7 @@ set(SHADER_FILES find_program(GLSLANGVALIDATOR "glslangValidator" REQUIRED) set(GLSL_FLAGS "") +set(QUIET_FLAG "--quiet") set(SHADER_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/include) set(SHADER_DIR ${SHADER_INCLUDE}/video_core/host_shaders) @@ -27,6 +28,23 @@ set(HOST_SHADERS_INCLUDE ${SHADER_INCLUDE} PARENT_SCOPE) set(INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/source_shader.h.in) set(HEADER_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/StringShaderHeader.cmake) +# Check if `--quiet` is available on host's glslangValidator version +# glslangValidator prints to STDERR iff an unrecognized flag is passed to it +execute_process( + COMMAND + ${GLSLANGVALIDATOR} ${QUIET_FLAG} + ERROR_VARIABLE + GLSLANG_ERROR + # STDOUT variable defined to silence unnecessary output during CMake configuration + OUTPUT_VARIABLE + GLSLANG_OUTPUT +) + +if (NOT GLSLANG_ERROR STREQUAL "") + message(WARNING "Refusing to use unavailable flag `${QUIET_FLAG}` on `${GLSLANGVALIDATOR}`") + set(QUIET_FLAG "") +endif() + foreach(FILENAME IN ITEMS ${SHADER_FILES}) string(REPLACE "." "_" SHADER_NAME ${FILENAME}) set(SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}) @@ -54,7 +72,7 @@ foreach(FILENAME IN ITEMS ${SHADER_FILES}) OUTPUT ${SPIRV_HEADER_FILE} COMMAND - ${GLSLANGVALIDATOR} -V --quiet ${GLSL_FLAGS} --variable-name ${SPIRV_VARIABLE_NAME} -o ${SPIRV_HEADER_FILE} ${SOURCE_FILE} + ${GLSLANGVALIDATOR} -V ${QUIET_FLAG} ${GLSL_FLAGS} --variable-name ${SPIRV_VARIABLE_NAME} -o ${SPIRV_HEADER_FILE} ${SOURCE_FILE} MAIN_DEPENDENCY ${SOURCE_FILE} ) diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h index 75429c0d2..3da2fdfd2 100755 --- a/src/yuzu/debugger/wait_tree.h +++ b/src/yuzu/debugger/wait_tree.h @@ -18,8 +18,8 @@ class EmuThread; namespace Kernel { class HandleTable; -class KSynchronizationObject; class KReadableEvent; +class KSynchronizationObject; class KThread; } // namespace Kernel