1
0
Fork 0
Commit Graph

294 Commits

Author SHA1 Message Date
GPUCode 26d6f9d1c6
Rasterizer cache refactor (#6375)
* rasterizer_cache: Remove custom texture code

* It's a hacky buggy mess, will be reimplemented later when the cache is in a better state

* rasterizer_cache: Refactor surface upload/download

* Switch to the texture_codec header which was written as part of the vulkan backend by steveice and me

* Move most of the upload logic to the rasterizer cache and out of the surface object

* Scaled uploads/downloads have been disabled for now since they require more runtime infrastructure

* rasterizer_cache: Refactor runtime interface

* Remove aspect enum which is the same as SurfaceType

* Replace Subresource with specific structures for each operation (blit/copy/clear). This mimics moderns APIs vulkan much better

* Pass the surface to the runtime instead of the texture

* Implement CopyTextures with glCopyImageSubData which is available on 4.3 and gles.
  This function also has an overload for cubes which will be removed later.

* rasterizer_cache: Move texture allocation to the runtime

* renderer_opengl: Remove TextureDownloaderES

* It's overly compilcated and unused at the moment. Will be replaced with a simple compute shader in a later commit

* rasterizer_cache: Split CachedSurface

* This commit splits CachedSurface into two classes, SurfaceBase which contains the backend agnostic functions and Surface which is the opengl specific part

* For now the cache uses the opengl surface directly and there are a few ugly casts with watchers, those will be taken care of when the template convertion and watcher removal are added respectively

* rasterizer_cache: Move reinterpreters to the runtime

* rasterizer_cache: Move some pixel format function to the cpp file

* rasterizer_cache: Common texture acceleration functions

* They don't contain any backend specific code so they shouldn't be duplicated

* rasterizer_cache: Remove BlitSurfaces

* It's better to prefer copy/blit in the caller anyway

* rasterizer_cache: Only allocate needed levels

* rasterizer_cache: Move texture runtime out of common dir

* Also shorten the util header filename

* surface_params: Cleanup code

* Add more comments, organize it a bit etc

* rasterizer_cache: Move texture filtering to the runtime

* rasterizer_cache: Move to VideoCore

* renderer_opengl: Reimplement scaled uploads/downloads

* Instead of looking up for temporary textures, each allocation now contains both a scaled and unscaled handle
  This allows the scale operations to be done inside the surface object itself and improves performance in general

* In particular the scaled download code has been expanded to use ARB_get_texture_sub_image when possible
  which is faster and more convenient than glReadPixels. The latter is still relevant for OpenGLES though.

* Finally allocations are now given a handy debug name that can be viewed from renderdoc.

* rasterizer_cache: Remove global state

* gl_rasterizer: Abstract common draw operations to Framebuffer

* This also allows to cache framebuffer objects instead of always swapping the textures, something that particularly benefits mali gpus

* rasterizer_cache: Implement multi-level surfaces

* With this commit the cache can now directly upload and use mipmaps
  without needing to sync them with watchers. By using native mimaps
  directly this also adds support for mipmap for cube

* Texture cubes have also been updated to drop the watcher requirement

* host_shaders: Add CMake integration for string shaders

* Improves build time shader generation making it much less prone to errors.
  Also moves the presentation shaders here to avoid embedding them to the cpp file.

* Texture filter shaders now make explicit use of uniform bindings for better vulkan compatibility

* renderer_opengl: Emulate lod bias in the shader

* This way opengles can emulate it correctly

* gl_rasterizer: Respect GL_MAX_TEXTURE_BUFFER_SIZE

* Older Bifrost Mali GPUs only support up to 64kb texture buffers. Citra would try to allocate a much larger buffer the first 64kb of which would work fine but after that the driver starts misbehaving and showing various graphical glitches

* rasterizer_cache: Cleanup CopySurface

* renderer_opengl: Keep frames synchronized when using a GPU debugger

* rasterizer_cache: Rename Surface to SurfaceRef

* Makes it clear that surface is a shared_ptr and not an object

* rasterizer_cache: Cleanup

* Move constructor to the top of the file

* Move FindMatch to the top as well and remove the Invalid flag which was redudant;
  all FindMatch calls used it expect from MatchFlags::Copy which ignores it anyway

* gl_texture_runtime: Make driver const

* gl_texture_runtime: Fix RGB8 format handling

* The texture_codec header, being written with vulkan in mind converts RGB8 to RGBA8. The backend wasn't adjusted to account for this though and treated the data as RGB8.

* Also remove D16 convertions, both opengl and vulkan are required to support this format so these are not needed

* gl_texture_runtime: Reduce state switches during FBO blits

* glBlitFramebuffer is only affected by the scissor rectangle so just disable scissor testing instead of resetting our entire state

* surface_params: Prevent texcopy that spans multiple levels

* It would have failed before as well, with multi-level surfaces it triggers the assert though

* renderer_opengl: Centralize texture filters

* A lot of code is shared between the filters thus is makes it sense to centralize them

* Also fix an issue with partial texture uploads

* Address review comments

* rasterizer_cache: Use leading return types

* rasterizer_cache: Cleanup null checks

* renderer_opengl: Add additional logging

* externals: Actually downgrade glad

* For some reason I missed adding the files to git

* surface_params: Do not check for levels in exact match

* Some games will try to use the base level of a multi level surface. Checking for levels forces another surface to be created and a copy to be made which is both unncessary and breaks custom textures

---------

Co-authored-by: bunnei <bunneidev@gmail.com>
2023-04-21 10:14:55 +03:00
SachinVin 5f81940e63
Merge pull request #6419 from vitor-k/states
Update zstd and improve savestates logging
2023-04-15 10:11:40 +05:30
Vitor Kiguchi 7b8832cebb externals: update zstd to v1.5.5 2023-04-10 00:51:01 -03:00
SachinVin 8d19483b7e
externals: bump dynarmic to 6.4.6 (#6423) 2023-04-09 21:03:48 +02:00
SachinVin 9c81dc0dd8
externals\CMakeLists.txt: dynarmic, fmt, xbyak: add `EXCLUDE_FROM_ALL` property (#6398) 2023-04-06 14:31:28 +02:00
GPUCode ffc95eb59b
Frontend PR fixes (#6378)
* citra_qt: Check if renderer is null

* core: Fix dynarmic use-after-free error

* bootmanager: Add current context check in DoneCurrent

* Loading a save state would destroy the frame dumper class, which contains a shared context. That context would call DoneCurrent without checking if it was actually bound or not, resulting in crashes when calling opengl functions

* externals: Correct glad readme

* common: Log renderer debug setting

* citra: Make lambda lower case

* Consistency with review comments on the PR

* video_core: Kill more global state

* GetResolutionScaleFactor would be called somewhere in the renderer constructor chain but it relies on the yet unitialized g_renderer, resulting in crashes when the resolution scale is set to auto. Rather than adding a workaround, let's kill this global state to fix this for good
2023-03-30 14:24:49 +03:00
GPUCode b5d6f645bd
Prepare frontend for multiple graphics APIs (#6347)
* externals: Update dynarmic

* settings: Introduce GraphicsAPI enum

* For now it's OpenGL only but will be expanded upon later

* citra_qt: Introduce backend agnostic context management

* Mostly a direct port from yuzu

* core: Simplify context acquire

* settings: Add option to create debug contexts

* renderer_opengl: Abstract initialization to Driver

* This commit also updates glad and adds some useful extensions which we will use in part 2

* Rasterizer construction is moved to the specific renderer instead of RendererBase.
  Software rendering has been disable to achieve this but will be brought back in the next commit.

* video_core: Remove Init/Shutdown methods from renderer

* The constructor and destructor can do the same job

* In addition move opengl function loading to Qt since SDL already does this. Also remove ErrorVideoCore which is never reached

* citra_qt: Decouple software renderer from opengl part 1

* citra: Decouple software renderer from opengl part 2

* android: Decouple software renderer from opengl part 3

* swrasterizer: Decouple software renderer from opengl part 4

* This commit simply enforces the renderer naming conventions in the software renderer

* video_core: Move RendererBase to VideoCore

* video_core: De-globalize screenshot state

* video_core: Pass system to the renderers

* video_core: Commonize shader uniform data

* video_core: Abstract backend agnostic rasterizer operations

* bootmanager: Remove references to OpenGL for macOS

OpenGL macOS headers definitions clash heavily with each other

* citra_qt: Proper title for api settings

* video_core: Reduce boost usage

* bootmanager: Fix hide mouse option

Remove event handlers from RenderWidget for events that are
already handled by the parent GRenderWindow.
Also enable mouse tracking on the RenderWidget.

* android: Remove software from graphics api list

* code: Address review comments

* citra: Port per-game settings read

* Having to update the default value for all backends is a pain so lets centralize it

* android: Rename to OpenGLES

---------

Co-authored-by: MerryMage <MerryMage@users.noreply.github.com>
Co-authored-by: Vitor Kiguchi <vitor-kiguchi@hotmail.com>
2023-03-27 14:29:17 +03:00
hank121314 8d563d37b4
citra_android: Storage Access Framework implementation (#6313) 2023-03-23 14:30:52 +01:00
Steveice10 8b116aaa04
externals: Fix mismatched CryptoPP definitions between compile time and header use. (#6314) 2023-02-25 12:58:38 +02:00
Steveice10 3a6a17c708
externals: Bundle cryptopp as submodule. (#6272)
fix https://github.com/citra-emu/citra/issues/6271
2023-02-02 16:26:21 +01:00
Steveice10 a298e4969b
externals: Switch to newer cryptopp-cmake. (#6242) 2023-01-15 21:45:42 +05:30
Steveice10 a8848cce43 build: Update to support multi-arch builds. 2023-01-07 01:09:32 -08:00
SachinVin 0e325255f3 externals: point to upstream dynarmic 2023-01-06 06:41:51 -08:00
SachinVin 21fe65c29c externals: bump xbyak to v6.68 2023-01-06 06:41:51 -08:00
Merry 2238e6c3ef externals: Update dynarmic to 7a926d689bcc1cc39dd26d5bba379dffcc6815a3 2022-11-22 22:52:37 +00:00
Vitor K 3b6ffd9c27
Add MSVC binaries for Windows on releases (#6190)
* Improve directory creation in WindowsCopyFiles.cmake

* Release msvc compiled binaries as an alternative to mingw releases

* msvc: do not ship .pdb files

* msvc: Copy necessary files to the release

* windows-msvc: enable compatibility reporting

translation was disabled because the bundled qt doesn't have
the necessary component

Co-authored-by: Michał Janiszewski <janisozaur@users.noreply.github.com>
2022-11-19 22:22:10 +02:00
Tobias bb05d8c12a
src/CMakeLists: Enforce multiple warnings on MSVC (#5692) 2022-11-09 23:14:28 +01:00
Steven Smith 7801907288
externals: Update dynarmic (#6175) 2022-11-05 11:19:50 +05:30
Tobias 1ddea27ac8
code: Cleanup and warning fixes from the Vulkan PR (#6163)
Co-authored-by: emufan4568 <geoster3d@gmail.com>
Co-authored-by: Kyle Kienapfel <Docteh@users.noreply.github.com>
2022-11-04 23:32:57 +01:00
SachinVin 0fb792d216 bump dynarmic: fix moving imm to fpr 2022-10-27 18:47:52 +05:30
SachinVin fbe06234b1 Core: Port Exclusive memory impl from yuzu
core\arm\dynarmic\arm_dynarmic.cpp: fix build

core\arm\dynarmic\arm_dynarmic.cpp: Fixes

CPP 20
2022-10-23 13:19:33 +05:30
SachinVin 98d3b9c776 externals\CMakeLists.txt: add fmt before dynarmic 2022-10-23 13:19:32 +05:30
SachinVin 4a590d1fcb xbyak: Correct xbyak include directory
xbyak is intended to be installed in /usr/local/include/xbyak.
Since we desire not to install xbyak before using it, we copy the headers
to the appropriate directory structure and use that instead
Co-authored-by: merry <git@mary.rs>
2022-10-23 13:19:32 +05:30
SachinVin 726964ff20 bump xbyak 2022-10-23 13:19:32 +05:30
SachinVin e5f30fdbf8 bump dynarmic
bump dynarmic

bump dynarmic

bump dynarmic
2022-10-23 13:19:32 +05:30
Vitor K 76f8d08d66
externals: track a stable version of sdl, 2.24.1 (#6150) 2022-10-06 03:06:12 +02:00
liushuyu 3e692eb383
externals: Upgrade httplib (#6147) 2022-10-06 03:01:37 +02:00
GPUCode cbd5d1c15c
Upgrade codebase to C++ 20 + fix warnings + update submodules (#6115) 2022-09-21 18:36:12 +02:00
SachinVin 9268b7d48e
Merge branch 'master' into tex-cache 2022-09-01 19:50:32 +05:30
emufan4568 12f84e18dc externals: Upgrade glad to latest version
* Also change some mentions to OpenGL 3.3 to 4.3
2022-08-22 23:44:03 +03:00
Ian Chamberlain a90b0daebe
Look at version_major.h when for newer ffmpeg libs
In ffmpeg 5.1, it seems most (or all) of these libraries use a separate
version_major.h, so the logic to check minimum version didn't work
without looking at the major version file.
2022-08-20 20:40:26 -04:00
SachinVin 243548afc4 bump dynarmic
workaround MSCV compile error
2022-07-03 13:56:33 +05:30
Morph f71e853054
externals: Update cpp-jwt to e12ef062 (#6051)
Resolves compilation errors when compiling with C++20
2022-06-25 14:41:57 +05:30
Morph 46c6e5c4c0
externals: Update libressl to 3.5.2 (#6021)
Resolves compiler errors in VS 2022
2022-05-15 11:01:54 +05:30
SachinVin d65f50e512 Bump libressl to latest commit 2022-03-26 10:00:34 +05:30
Trung Lê 25ad002e6e
Update teakra (#5961)
Co-authored-by: Trung Le <trung.le@ruby-joural.com>
2022-02-24 21:02:40 +05:30
pkubaj cdbd72e79c
Fix build on powerpc64le (#5947)
After cryptopp update, build again fails.
2022-02-08 22:07:21 +05:30
bunnei bae1c31406
Merge pull request #5718 from liushuyu/httpc
externals: update httplib and libressl
2022-02-05 02:59:18 -07:00
SachinVin d35a7a8e23
Merge pull request #5804 from weihuoya/minorfx
Minor fx
2022-01-30 21:51:11 +05:30
weihuoya 7fa64af3d6 externals: update enet 2022-01-14 10:36:49 +08:00
liushuyu af24f75c18
externals: update httplib and libressl ...
* In older `httplib`, SSL connections were not handled correctly and
  will have issues with proxy servers. Also, keep alive directives were
  not available back then, which is probably necessary to implement
  HTTP_C service correctly.
* Another reason being `httplib` now requires OpenSSL 1.1+ API while
  LibreSSL 2.x provided OpenSSL 1.0 compatible API.
* The bundled LibreSSL has been updated to 3.2.2 so it now provides
  OpenSSL 1.1 compatible API now.
* Also the path hint has been added so that it will find the correct
  path to the CA certs on *nix systems.
* An option is provided so that *nix system distributions/providers can
  use their own SSL implementations when compiling Yuzu/Citra to
  (hopefully) complies with their maintenance guidelines.
* LURLParse is also removed since `httplib` can handle
  `scheme:host:port` string itself now.
2022-01-13 19:32:50 -07:00
Jan Beich 4b04175c5d cryptopp: enable SIMD flags on i386
externals/cryptopp/cryptopp/rijndael_simd.cpp:460:20: error: always_inline function '_mm_loadu_si128' requires target feature 'sse2', but would be inlined into function 'Rijndael_UncheckedSetKey_SSE4_AESNI' that is compiled without support for 'sse2'
    __m128i temp = _mm_loadu_si128(M128_CAST(userKey+keyLen-16));
                   ^
externals/cryptopp/cryptopp/rijndael_simd.cpp:469:50: error: '__builtin_ia32_aeskeygenassist128' needs target feature aes
        rk[keyLen/4] = rk[0] ^ _mm_extract_epi32(_mm_aeskeygenassist_si128(temp, 0), 3) ^ *(rc++);
                                                 ^
externals/cryptopp/cryptopp/rijndael_simd.cpp:481:20: error: '__builtin_ia32_vec_set_v4si' needs target feature sse4.1
            temp = _mm_insert_epi32(temp, rk[11], 3);
                   ^
[...]
2022-01-06 23:57:05 +00:00
Vitor K 60d1def6f8
Update cryptopp to 8.5.0 (#5669)
* Update cryptopp to 8.3.0

Modified the CMakeLists.txt based on the noloader/cryptopp-cmake
8.3.0 CMakeLists.txt.

* Update cryptopp to version 8.5.0
2022-01-05 20:05:07 +05:30
xperia64 1911c9791e
Add libyuv (#5623)
* Add libyuv

* Only use libyuv on Android

Co-authored-by: Marshall Mohror <mohror64@gmail.com>
2021-12-12 20:22:30 +05:30
SachinVin 64b502aad3
Merge pull request #5810 from vitor-k/discord
Port yuzu-emu/yuzu#6484: "update submodule discord-rpc to latest [now deprecated]"
2021-11-20 21:01:27 +05:30
pkubaj 219eaabbcf
Fix build on powerpc64le (#5884)
Without compiling ppc-simd.cpp, linking fails with:
: && /usr/bin/c++ -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -Wl,--as-needed -fstack-protector-strong -L/usr/local/lib src/tests/CMakeFiles/tests.dir/common/bit_field.cpp.o src/tests/CMakeFiles/tests.dir/common/param_package.cpp.o src/tests/CMakeFiles/tests.dir/core/arm/arm_test_common.cpp.o src/tests/CMakeFiles/tests.dir/core/arm/dyncom/arm_dyncom_vfp_tests.cpp.o src/tests/CMakeFiles/tests.dir/core/core_timing.cpp.o src/tests/CMakeFiles/tests.dir/core/file_sys/path_parser.cpp.o src/tests/CMakeFiles/tests.dir/core/hle/kernel/hle_ipc.cpp.o src/tests/CMakeFiles/tests.dir/core/memory/memory.cpp.o src/tests/CMakeFiles/tests.dir/core/memory/vm_manager.cpp.o src/tests/CMakeFiles/tests.dir/audio_core/decoder_tests.cpp.o src/tests/CMakeFiles/tests.dir/tests.cpp.o -o bin/Release/tests  src/common/libcommon.a  src/core/libcore.a  src/video_core/libvideo_core.a  src/audio_core/libaudio_core.a  src/core/libcore.a  src/video_core/libvideo_core.a  src/audio_core/libaudio_core.a  externals/soundtouch/libSoundTouch.a  externals/teakra/src/libteakra.a  /usr/local/lib/libSDL2main.a  /usr/local/lib/libSDL2.so  externals/cubeb/libcubeb.a  -lpthread  externals/cryptopp/libcryptopp.a  src/web_service/libweb_service.a  src/network/libnetwork.a  externals/enet/libenet.a  externals/libressl/tls/libtls.a  externals/libressl/ssl/libssl.a  externals/libressl/crypto/libcrypto.a  externals/lurlparser/liblurlparser.a  /usr/local/lib/libavformat.so  /usr/local/lib/libavcodec.so  /usr/local/lib/libswscale.so  /usr/local/lib/libswresample.so  /usr/local/lib/libavutil.so  src/common/libcommon.a  externals/fmt/libfmt.a  externals/zstd/build/cmake/lib/libzstd.a
 -pthread  /usr/local/lib/libboost_serialization.a  externals/glad/libglad.a && :
ld: error: undefined symbol: CryptoPP::CPU_ProbeAltivec()
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(CryptoPP::DetectPowerpcFeatures()) in archive externals/cryptopp/libcryptopp.a
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(_GLOBAL__I_000260) in archive externals/cryptopp/libcryptopp.a

ld: error: undefined symbol: CryptoPP::CPU_ProbePower7()
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(CryptoPP::DetectPowerpcFeatures()) in archive externals/cryptopp/libcryptopp.a
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(_GLOBAL__I_000260) in archive externals/cryptopp/libcryptopp.a

ld: error: undefined symbol: CryptoPP::CPU_ProbePower8()
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(CryptoPP::DetectPowerpcFeatures()) in archive externals/cryptopp/libcryptopp.a
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(_GLOBAL__I_000260) in archive externals/cryptopp/libcryptopp.a

ld: error: undefined symbol: CryptoPP::CPU_ProbeAES()
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(CryptoPP::DetectPowerpcFeatures()) in archive externals/cryptopp/libcryptopp.a
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(_GLOBAL__I_000260) in archive externals/cryptopp/libcryptopp.a

ld: error: undefined symbol: CryptoPP::CPU_ProbeSHA256()
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(CryptoPP::DetectPowerpcFeatures()) in archive externals/cryptopp/libcryptopp.a
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(_GLOBAL__I_000260) in archive externals/cryptopp/libcryptopp.a

ld: error: undefined symbol: CryptoPP::CPU_ProbeSHA512()
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(CryptoPP::DetectPowerpcFeatures()) in archive externals/cryptopp/libcryptopp.a
>>> referenced by cpu.cpp
>>>               cpu.cpp.o:(_GLOBAL__I_000260) in archive externals/cryptopp/libcryptopp.a
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
2021-10-31 14:47:20 -05:00
Idesmi a5d01c0c15
fix build on glibc 2.34 (#5872)
* fix build on glibc 2.34

* bump Catch to latest tag and update dynarmic
2021-10-23 18:54:36 +05:30
SachinVin 62236b7257
Update dynarmic (#5814) 2021-07-11 20:16:10 +05:30
Vortex de9d640de4 update submodule discord-rpc to latest [now deprecated] 2021-07-06 23:56:27 -03:00
Vitor Kiguchi 18ad3bafb6 Update dynarmic
this should allow the cpu jit to run on builds compiled for the M1
2021-05-12 17:30:19 -03:00