2019-09-07 15:28:32 -06:00
|
|
|
# Add a custom command to generate a new shader_cache_version hash when any of the following files change
|
|
|
|
# NOTE: This is an approximation of what files affect shader generation, its possible something else
|
|
|
|
# could affect the result, but much more unlikely than the following files. Keeping a list of files
|
|
|
|
# like this allows for much better caching since it doesn't force the user to recompile binary shaders every update
|
|
|
|
set(VIDEO_CORE "${CMAKE_SOURCE_DIR}/src/video_core")
|
2020-01-15 23:52:41 -07:00
|
|
|
|
|
|
|
# Pass the path to git to the GenerateSCMRev.cmake as well
|
|
|
|
find_package(Git QUIET)
|
|
|
|
|
2019-09-07 15:28:32 -06:00
|
|
|
add_custom_command(OUTPUT scm_rev.cpp
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DSRC_DIR="${CMAKE_SOURCE_DIR}"
|
2020-01-15 23:52:41 -07:00
|
|
|
-DGIT_EXECUTABLE="${GIT_EXECUTABLE}"
|
2019-09-07 15:28:32 -06:00
|
|
|
-P "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
|
|
|
|
DEPENDS
|
|
|
|
# WARNING! It was too much work to try and make a common location for this list,
|
|
|
|
# so if you need to change it, please update CMakeModules/GenerateSCMRev.cmake as well
|
|
|
|
"${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.cpp"
|
|
|
|
"${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.h"
|
2022-09-03 14:44:40 +02:00
|
|
|
"${VIDEO_CORE}/renderer_opengl/gl_shader_util.cpp"
|
|
|
|
"${VIDEO_CORE}/renderer_opengl/gl_shader_util.h"
|
2023-09-30 02:06:06 -07:00
|
|
|
"${VIDEO_CORE}/renderer_vulkan/vk_shader_util.cpp"
|
|
|
|
"${VIDEO_CORE}/renderer_vulkan/vk_shader_util.h"
|
2023-11-06 22:26:28 +02:00
|
|
|
"${VIDEO_CORE}/shader/generator/glsl_fs_shader_gen.cpp"
|
|
|
|
"${VIDEO_CORE}/shader/generator/glsl_fs_shader_gen.h"
|
2023-09-30 02:06:06 -07:00
|
|
|
"${VIDEO_CORE}/shader/generator/glsl_shader_decompiler.cpp"
|
|
|
|
"${VIDEO_CORE}/shader/generator/glsl_shader_decompiler.h"
|
|
|
|
"${VIDEO_CORE}/shader/generator/glsl_shader_gen.cpp"
|
|
|
|
"${VIDEO_CORE}/shader/generator/glsl_shader_gen.h"
|
2023-11-06 22:26:28 +02:00
|
|
|
"${VIDEO_CORE}/shader/generator/pica_fs_config.cpp"
|
|
|
|
"${VIDEO_CORE}/shader/generator/pica_fs_config.h"
|
2023-09-30 02:06:06 -07:00
|
|
|
"${VIDEO_CORE}/shader/generator/shader_gen.cpp"
|
|
|
|
"${VIDEO_CORE}/shader/generator/shader_gen.h"
|
|
|
|
"${VIDEO_CORE}/shader/generator/shader_uniforms.cpp"
|
|
|
|
"${VIDEO_CORE}/shader/generator/shader_uniforms.h"
|
2023-11-06 22:26:28 +02:00
|
|
|
"${VIDEO_CORE}/shader/generator/spv_fs_shader_gen.cpp"
|
|
|
|
"${VIDEO_CORE}/shader/generator/spv_fs_shader_gen.h"
|
2019-09-07 15:28:32 -06:00
|
|
|
"${VIDEO_CORE}/shader/shader.cpp"
|
|
|
|
"${VIDEO_CORE}/shader/shader.h"
|
2023-12-28 12:46:57 +02:00
|
|
|
"${VIDEO_CORE}/pica/regs_framebuffer.h"
|
|
|
|
"${VIDEO_CORE}/pica/regs_lighting.h"
|
|
|
|
"${VIDEO_CORE}/pica/regs_pipeline.h"
|
|
|
|
"${VIDEO_CORE}/pica/regs_rasterizer.h"
|
|
|
|
"${VIDEO_CORE}/pica/regs_shader.h"
|
|
|
|
"${VIDEO_CORE}/pica/regs_texturing.h"
|
|
|
|
"${VIDEO_CORE}/pica/regs_internal.cpp"
|
|
|
|
"${VIDEO_CORE}/pica/regs_internal.h"
|
2019-09-07 15:28:32 -06:00
|
|
|
# and also check that the scm_rev files haven't changed
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
|
|
|
|
# technically we should regenerate if the git version changed, but its not worth the effort imo
|
|
|
|
"${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
|
|
|
|
)
|
2014-04-23 18:43:57 -07:00
|
|
|
|
2023-04-28 13:02:53 -07:00
|
|
|
add_library(citra_common STATIC
|
2023-01-06 07:28:02 -08:00
|
|
|
aarch64/cpu_detect.cpp
|
|
|
|
aarch64/cpu_detect.h
|
video_core: Implement an arm64 shader-jit backend (#7002)
* externals: Add oaksim submodule
Used for emitting ARM64 assembly
* common: Implement aarch64 ABI
Utilize oaknut to implement a stack frame.
* tests: Allow shader-jit tests for x64 and a64
Run the shader-jit tests for both x86_64 and arm64 targets
* video_core: Initialize arm64 shader-jit backend
Passes all current unit tests!
* shader_jit_a64: protect/unprotect memory when jit-ing
Required on MacOS. Memory needs to be fully unprotected and then
re-protected when writing or there will be memory access errors on
MacOS.
* shader_jit_a64: Fix ARM64-Imm overflow
These conditionals were throwing exceptions since the immediate values
were overflowing the available space in the `EOR` instructions. Instead
they are generated from `MOV` and then `EOR`-ed after.
* shader_jit_a64: Fix Geometry shader conditional
* shader_jit_a64: Replace `ADRL` with `MOVP2R`
Fixes some immediate-generation exceptions.
* common/aarch64: Fix CallFarFunction
* shader_jit_a64: Optimize `SantitizedMul`
Co-authored-by: merryhime <merryhime@users.noreply.github.com>
* shader_jit_a64: Fix address register offset behavior
Based on https://github.com/citra-emu/citra/pull/6942
Passes unit tests.
* shader_jit_a64: Fix `RET` address offset
A64 stack is 16-byte aligned rather than 8. So a direct port of the x64
code won't work. Fixes weird branches into invalid memory for any
shaders with subroutines.
* shader_jit_a64: Increase max program size
Tuned for A64 program size.
* shader_jit_a64: Use `UBFX` for extracting loop-state
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Optimize `SUB+CMP` to `SUBS`
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Optimize `CMP+B` to `CBNZ`
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Use `FMOV` for `ONE` vector
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Remove x86-specific documentation
* shader_jit_a64: Use `UBFX` to extract exponent
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Remove redundant MIN/MAX `SRC2`-NaN check
Special handling only needs to check SRC1 for NaN, not SRC2.
It would work as follows in the four possible cases:
No NaN: No special handling needed.
Only SRC1 is NaN: The special handling is triggered because SRC1 is NaN, and SRC2 is picked.
Only SRC2 is NaN: FMAX automatically picks SRC2 because it always picks the NaN if there is one.
Both SRC1 and SRC2 are NaN: The special handling is triggered because SRC1 is NaN, and SRC2 is picked.
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit/tests:: Add catch-stringifier for vec2f/vec3f
* shader_jit/tests: Add Dest Mask unit test
* shader_jit_a64: Fix Dest-Mask `BSL` operand order
Passes the dest-mask unit tests now.
* shader_jit_a64: Use `MOVI` for DestEnable mask
Accelerate certain cases of masking with MOVI as well
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit/tests: Add source-swizzle unit test
This is not expansive. Generating all `4^4` cases seems to make Catch2
crash. So I've added some component-masking(non-reordering) tests based
on the Dest-Mask unit-test and some additional ones to test
broadcasts/splats and component re-ordering.
* shader_jit_a64: Fix swizzle index generation
This was still generating `SHUFPS` indices and not the ones that we wanted for the `TBL` instruction. Passes all unit tests now.
* shader_jit/tests: Add `ShaderSetup` constructor to `ShaderTest`
Rather than using the direct output of `CompileShaderSetup` allow a
`ShaderSetup` object to be passed in directly. This enabled the ability
emit assembly that is not directly supported by nihstro.
* shader_jit/tests: Add `CALL` unit-test
Tests nested `CALL` instructions to eventually reach an `EX2`
instruction.
EX2 is picked in particular since it is implemented as an even deeper
dispatch and ensures subroutines are properly implemented between `CALL`
instructions and implementation-calls.
* shader_jit_a64: Fix nested `BL` subroutines
`lr` was getting writen over by nested calls to `BL`, causing undefined
behavior with mixtures of `CALL`, `EX2`, and `LG2` instructions.
Each usage of `BL` is now protected with a stach push/pop to preserve
and restore teh `lr` register to allow nested subroutines to work
properly.
* shader_jit/tests: Allocate generated tests on heap
Each of these generated shader-test objects were causing the stack to
overflow. Allocate each of the generated tests on the heap and use
unique_ptr so they only exist within the life-time of the `REQUIRE`
statement.
* shader_jit_a64: Preserve `lr` register from external function calls
`EMIT` makes an external function call, and should be preserving `lr`
* shader_jit/tests: Add `MAD` unit-test
The Inline Asm version requires an upstream fix:
https://github.com/neobrain/nihstro/issues/68
Instead, the program code is manually configured and added.
* shader_jit/tests: Fix uninitialized instructions
These `union`-type instruction-types were uninitialized, causing tests
to indeterminantly fail at times.
* shader_jit_a64: Remove unneeded `MOV`
Residue from the direct-port of x64 code.
* shader_jit_a64: Use `std::array` for `instr_table`
Add some type-safety and const-correctness around this type as well.
* shader_jit_a64: Avoid c-style offset casting
Add some more const-correctness to this function as well.
* video_core: Add arch preprocessor comments
* common/aarch64: Use X16 as the veneer register
https://developer.arm.com/documentation/102374/0101/Procedure-Call-Standard
* shader_jit/tests: Add uniform reading unit-test
Particularly to ensure that addresses are being properly truncated
* common/aarch64: Use `X0` as `ABI_RETURN`
`X8` is used as the indirect return result value in the case that the
result is bigger than 128-bits. Principally `X0` is the general-case
return register though.
* common/aarch64: Add veneer register note
`LR` is generally overwritten by `BLR` anyways, and would also be a safe
veneer to utilize for far-calls.
* shader_jit_a64: Remove unneeded scratch register from `SanitizedMul`
* shader_jit_a64: Fix CALLU condition
Should be `EQ` not `NE`. Fixes the regression on Kid Icarus.
No known regressions anymore!
---------
Co-authored-by: merryhime <merryhime@users.noreply.github.com>
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
2023-11-05 12:40:31 -08:00
|
|
|
aarch64/oaknut_abi.h
|
|
|
|
aarch64/oaknut_util.h
|
2017-12-10 18:55:03 -05:00
|
|
|
alignment.h
|
2023-03-23 21:30:52 +08:00
|
|
|
android_storage.h
|
|
|
|
android_storage.cpp
|
2017-10-31 10:02:42 +01:00
|
|
|
announce_multiplayer_room.h
|
2023-03-21 21:36:28 +05:30
|
|
|
arch.h
|
2019-12-27 18:52:33 +00:00
|
|
|
archives.h
|
2017-12-10 18:55:03 -05:00
|
|
|
assert.h
|
2022-06-22 00:29:36 +05:30
|
|
|
atomic_ops.h
|
2018-09-12 12:22:48 -04:00
|
|
|
detached_tasks.cpp
|
|
|
|
detached_tasks.h
|
2017-12-10 18:55:03 -05:00
|
|
|
bit_field.h
|
|
|
|
bit_set.h
|
2023-06-24 11:54:18 +03:00
|
|
|
bounded_threadsafe_queue.h
|
2018-01-15 01:03:08 -08:00
|
|
|
cityhash.cpp
|
|
|
|
cityhash.h
|
2017-12-10 18:55:03 -05:00
|
|
|
color.h
|
|
|
|
common_funcs.h
|
|
|
|
common_paths.h
|
2022-12-17 16:06:38 +01:00
|
|
|
common_precompiled_headers.h
|
2017-12-10 18:55:03 -05:00
|
|
|
common_types.h
|
2019-12-27 18:52:33 +00:00
|
|
|
construct.h
|
2023-06-16 16:06:18 -07:00
|
|
|
dynamic_library/dynamic_library.cpp
|
|
|
|
dynamic_library/dynamic_library.h
|
|
|
|
dynamic_library/ffmpeg.cpp
|
|
|
|
dynamic_library/ffmpeg.h
|
2023-04-27 07:38:28 +03:00
|
|
|
error.cpp
|
|
|
|
error.h
|
2023-07-03 03:23:53 +03:00
|
|
|
expected.h
|
2017-12-10 18:55:03 -05:00
|
|
|
file_util.cpp
|
|
|
|
file_util.h
|
|
|
|
hash.h
|
2022-11-15 11:16:45 +01:00
|
|
|
literals.h
|
2017-12-10 18:55:03 -05:00
|
|
|
logging/backend.cpp
|
|
|
|
logging/backend.h
|
|
|
|
logging/filter.cpp
|
|
|
|
logging/filter.h
|
2022-11-04 23:32:57 +01:00
|
|
|
logging/formatter.h
|
2017-12-10 18:55:03 -05:00
|
|
|
logging/log.h
|
2023-06-24 10:01:54 +03:00
|
|
|
logging/log_entry.h
|
2017-12-10 18:55:03 -05:00
|
|
|
logging/text_formatter.cpp
|
|
|
|
logging/text_formatter.h
|
2023-06-24 02:27:24 +03:00
|
|
|
logging/types.h
|
2017-12-10 18:55:03 -05:00
|
|
|
math_util.h
|
2020-05-17 14:45:12 -04:00
|
|
|
memory_detect.cpp
|
|
|
|
memory_detect.h
|
2020-01-04 22:39:54 +00:00
|
|
|
memory_ref.h
|
|
|
|
memory_ref.cpp
|
2017-12-10 18:55:03 -05:00
|
|
|
microprofile.cpp
|
|
|
|
microprofile.h
|
|
|
|
microprofileui.h
|
|
|
|
param_package.cpp
|
|
|
|
param_package.h
|
2023-04-27 07:38:28 +03:00
|
|
|
polyfill_thread.h
|
2022-12-17 16:06:38 +01:00
|
|
|
precompiled_headers.h
|
2017-12-10 18:55:03 -05:00
|
|
|
quaternion.h
|
2018-09-08 20:42:25 +01:00
|
|
|
ring_buffer.h
|
2017-12-10 18:55:03 -05:00
|
|
|
scm_rev.cpp
|
|
|
|
scm_rev.h
|
|
|
|
scope_exit.h
|
2022-12-08 13:27:25 +02:00
|
|
|
settings.cpp
|
|
|
|
settings.h
|
2023-05-07 02:34:28 +03:00
|
|
|
slot_vector.h
|
2019-08-11 00:20:09 +01:00
|
|
|
serialization/atomic.h
|
2019-12-27 18:52:33 +00:00
|
|
|
serialization/boost_discrete_interval.hpp
|
2019-08-12 17:01:33 +01:00
|
|
|
serialization/boost_flat_set.h
|
2020-01-06 20:03:40 +00:00
|
|
|
serialization/boost_small_vector.hpp
|
2023-12-08 23:34:44 -08:00
|
|
|
serialization/boost_std_variant.hpp
|
2019-08-11 00:20:09 +01:00
|
|
|
serialization/boost_vector.hpp
|
2023-11-03 01:19:00 +01:00
|
|
|
static_lru_cache.h
|
2022-11-19 22:44:16 +00:00
|
|
|
string_literal.h
|
2017-12-10 18:55:03 -05:00
|
|
|
string_util.cpp
|
|
|
|
string_util.h
|
|
|
|
swap.h
|
2019-08-06 11:54:12 -04:00
|
|
|
texture.cpp
|
|
|
|
texture.h
|
2017-12-10 18:55:03 -05:00
|
|
|
thread.cpp
|
|
|
|
thread.h
|
|
|
|
thread_queue_list.h
|
2023-04-27 07:38:28 +03:00
|
|
|
thread_worker.h
|
2017-12-10 18:55:03 -05:00
|
|
|
threadsafe_queue.h
|
|
|
|
timer.cpp
|
|
|
|
timer.h
|
2023-04-27 07:38:28 +03:00
|
|
|
unique_function.h
|
2017-12-10 18:55:03 -05:00
|
|
|
vector_math.h
|
2018-10-26 17:01:00 +02:00
|
|
|
web_result.h
|
2023-01-06 07:28:02 -08:00
|
|
|
x64/cpu_detect.cpp
|
|
|
|
x64/cpu_detect.h
|
|
|
|
x64/xbyak_abi.h
|
|
|
|
x64/xbyak_util.h
|
2019-09-07 15:28:32 -06:00
|
|
|
zstd_compression.cpp
|
|
|
|
zstd_compression.h
|
2017-12-10 18:55:03 -05:00
|
|
|
)
|
2014-08-23 22:22:05 -03:00
|
|
|
|
2023-12-20 15:08:07 +01:00
|
|
|
if (UNIX AND NOT APPLE)
|
|
|
|
target_sources(citra_common PRIVATE
|
|
|
|
linux/gamemode.cpp
|
|
|
|
linux/gamemode.h
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(citra_common PRIVATE gamemode)
|
|
|
|
endif()
|
|
|
|
|
2023-06-19 15:50:26 -07:00
|
|
|
if (APPLE)
|
|
|
|
target_sources(citra_common PUBLIC
|
|
|
|
apple_authorization.h
|
|
|
|
apple_authorization.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2023-05-02 01:08:58 +05:30
|
|
|
if (MSVC)
|
|
|
|
target_compile_options(citra_common PRIVATE
|
|
|
|
/W4
|
|
|
|
|
|
|
|
/we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data
|
|
|
|
/we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data
|
|
|
|
/we4800 # Implicit conversion from 'type' to bool. Possible information loss
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(citra_common PRIVATE
|
|
|
|
$<$<CXX_COMPILER_ID:Clang>:-fsized-deallocation>
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2023-04-28 13:02:53 -07:00
|
|
|
create_target_directory_groups(citra_common)
|
2014-04-28 19:40:39 -07:00
|
|
|
|
2023-10-08 00:00:02 +01:00
|
|
|
target_link_libraries(citra_common PUBLIC fmt library-headers microprofile Boost::boost Boost::serialization Boost::iostreams)
|
2023-10-22 00:10:02 +01:00
|
|
|
target_link_libraries(citra_common PRIVATE zstd)
|
2022-09-21 19:36:12 +03:00
|
|
|
|
2023-01-06 07:28:02 -08:00
|
|
|
if ("x86_64" IN_LIST ARCHITECTURE)
|
2023-04-28 13:02:53 -07:00
|
|
|
target_link_libraries(citra_common PRIVATE xbyak)
|
2016-12-12 01:23:08 -08:00
|
|
|
endif()
|
2022-12-17 16:06:38 +01:00
|
|
|
|
video_core: Implement an arm64 shader-jit backend (#7002)
* externals: Add oaksim submodule
Used for emitting ARM64 assembly
* common: Implement aarch64 ABI
Utilize oaknut to implement a stack frame.
* tests: Allow shader-jit tests for x64 and a64
Run the shader-jit tests for both x86_64 and arm64 targets
* video_core: Initialize arm64 shader-jit backend
Passes all current unit tests!
* shader_jit_a64: protect/unprotect memory when jit-ing
Required on MacOS. Memory needs to be fully unprotected and then
re-protected when writing or there will be memory access errors on
MacOS.
* shader_jit_a64: Fix ARM64-Imm overflow
These conditionals were throwing exceptions since the immediate values
were overflowing the available space in the `EOR` instructions. Instead
they are generated from `MOV` and then `EOR`-ed after.
* shader_jit_a64: Fix Geometry shader conditional
* shader_jit_a64: Replace `ADRL` with `MOVP2R`
Fixes some immediate-generation exceptions.
* common/aarch64: Fix CallFarFunction
* shader_jit_a64: Optimize `SantitizedMul`
Co-authored-by: merryhime <merryhime@users.noreply.github.com>
* shader_jit_a64: Fix address register offset behavior
Based on https://github.com/citra-emu/citra/pull/6942
Passes unit tests.
* shader_jit_a64: Fix `RET` address offset
A64 stack is 16-byte aligned rather than 8. So a direct port of the x64
code won't work. Fixes weird branches into invalid memory for any
shaders with subroutines.
* shader_jit_a64: Increase max program size
Tuned for A64 program size.
* shader_jit_a64: Use `UBFX` for extracting loop-state
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Optimize `SUB+CMP` to `SUBS`
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Optimize `CMP+B` to `CBNZ`
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Use `FMOV` for `ONE` vector
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Remove x86-specific documentation
* shader_jit_a64: Use `UBFX` to extract exponent
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit_a64: Remove redundant MIN/MAX `SRC2`-NaN check
Special handling only needs to check SRC1 for NaN, not SRC2.
It would work as follows in the four possible cases:
No NaN: No special handling needed.
Only SRC1 is NaN: The special handling is triggered because SRC1 is NaN, and SRC2 is picked.
Only SRC2 is NaN: FMAX automatically picks SRC2 because it always picks the NaN if there is one.
Both SRC1 and SRC2 are NaN: The special handling is triggered because SRC1 is NaN, and SRC2 is picked.
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit/tests:: Add catch-stringifier for vec2f/vec3f
* shader_jit/tests: Add Dest Mask unit test
* shader_jit_a64: Fix Dest-Mask `BSL` operand order
Passes the dest-mask unit tests now.
* shader_jit_a64: Use `MOVI` for DestEnable mask
Accelerate certain cases of masking with MOVI as well
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
* shader_jit/tests: Add source-swizzle unit test
This is not expansive. Generating all `4^4` cases seems to make Catch2
crash. So I've added some component-masking(non-reordering) tests based
on the Dest-Mask unit-test and some additional ones to test
broadcasts/splats and component re-ordering.
* shader_jit_a64: Fix swizzle index generation
This was still generating `SHUFPS` indices and not the ones that we wanted for the `TBL` instruction. Passes all unit tests now.
* shader_jit/tests: Add `ShaderSetup` constructor to `ShaderTest`
Rather than using the direct output of `CompileShaderSetup` allow a
`ShaderSetup` object to be passed in directly. This enabled the ability
emit assembly that is not directly supported by nihstro.
* shader_jit/tests: Add `CALL` unit-test
Tests nested `CALL` instructions to eventually reach an `EX2`
instruction.
EX2 is picked in particular since it is implemented as an even deeper
dispatch and ensures subroutines are properly implemented between `CALL`
instructions and implementation-calls.
* shader_jit_a64: Fix nested `BL` subroutines
`lr` was getting writen over by nested calls to `BL`, causing undefined
behavior with mixtures of `CALL`, `EX2`, and `LG2` instructions.
Each usage of `BL` is now protected with a stach push/pop to preserve
and restore teh `lr` register to allow nested subroutines to work
properly.
* shader_jit/tests: Allocate generated tests on heap
Each of these generated shader-test objects were causing the stack to
overflow. Allocate each of the generated tests on the heap and use
unique_ptr so they only exist within the life-time of the `REQUIRE`
statement.
* shader_jit_a64: Preserve `lr` register from external function calls
`EMIT` makes an external function call, and should be preserving `lr`
* shader_jit/tests: Add `MAD` unit-test
The Inline Asm version requires an upstream fix:
https://github.com/neobrain/nihstro/issues/68
Instead, the program code is manually configured and added.
* shader_jit/tests: Fix uninitialized instructions
These `union`-type instruction-types were uninitialized, causing tests
to indeterminantly fail at times.
* shader_jit_a64: Remove unneeded `MOV`
Residue from the direct-port of x64 code.
* shader_jit_a64: Use `std::array` for `instr_table`
Add some type-safety and const-correctness around this type as well.
* shader_jit_a64: Avoid c-style offset casting
Add some more const-correctness to this function as well.
* video_core: Add arch preprocessor comments
* common/aarch64: Use X16 as the veneer register
https://developer.arm.com/documentation/102374/0101/Procedure-Call-Standard
* shader_jit/tests: Add uniform reading unit-test
Particularly to ensure that addresses are being properly truncated
* common/aarch64: Use `X0` as `ABI_RETURN`
`X8` is used as the indirect return result value in the case that the
result is bigger than 128-bits. Principally `X0` is the general-case
return register though.
* common/aarch64: Add veneer register note
`LR` is generally overwritten by `BLR` anyways, and would also be a safe
veneer to utilize for far-calls.
* shader_jit_a64: Remove unneeded scratch register from `SanitizedMul`
* shader_jit_a64: Fix CALLU condition
Should be `EQ` not `NE`. Fixes the regression on Kid Icarus.
No known regressions anymore!
---------
Co-authored-by: merryhime <merryhime@users.noreply.github.com>
Co-authored-by: JosJuice <JosJuice@users.noreply.github.com>
2023-11-05 12:40:31 -08:00
|
|
|
if ("arm64" IN_LIST ARCHITECTURE)
|
|
|
|
target_link_libraries(citra_common PRIVATE oaknut)
|
|
|
|
endif()
|
|
|
|
|
2022-12-17 16:06:38 +01:00
|
|
|
if (CITRA_USE_PRECOMPILED_HEADERS)
|
2023-04-28 13:02:53 -07:00
|
|
|
target_precompile_headers(citra_common PRIVATE precompiled_headers.h)
|
2022-12-17 16:06:38 +01:00
|
|
|
endif()
|
2023-07-31 14:24:27 -07:00
|
|
|
|
|
|
|
find_library(BACKTRACE_LIBRARY backtrace)
|
|
|
|
if (BACKTRACE_LIBRARY AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
|
|
|
target_link_libraries(citra_common PRIVATE ${BACKTRACE_LIBRARY} dl)
|
|
|
|
target_compile_definitions(citra_common PRIVATE CITRA_LINUX_GCC_BACKTRACE)
|
2021-08-13 18:58:35 +00:00
|
|
|
endif()
|