* code: Prepare frontend for vulkan support
* citra_qt: Add vulkan options to the GUI
* vk_instance: Collect tooling info
* renderer_vulkan: Add vulkan backend
* qt: Fix fullscreen and resize issues on macOS. (#47)
* qt: Fix bugged macOS full screen transition.
* renderer/vulkan: Fix swapchain recreation destroying in-use semaphore.
* renderer/vulkan: Make gl_Position invariant. (#48)
This fixes an issue with black artifacts in Pokemon games on Apple GPUs.
If the vertex calculations differ slightly between render passes, it can
cause parts of model faces to fail depth test.
* vk_renderpass_cache: Bump pixel format count
* android: Custom driver code
* vk_instance: Set moltenvk configuration
* rasterizer_cache: Proper surface unregister
* citra_qt: Fix invalid characters
* vk_rasterizer: Correct special unbind
* android: Allow async presentation toggle
* vk_graphics_pipeline: Fix async shader compilation
* We were actually waiting for the pipelines regardless of the setting, oops
* vk_rasterizer: More robust attribute loading
* android: Move PollEvents to OpenGL window
* Vulkan does not need this and it causes problems
* vk_instance: Enable robust buffer access
* Improves stability on mali devices
* vk_renderpass_cache: Bring back renderpass flushing
* externals: Update vulkan-headers
* gl_rasterizer: Separable shaders for everyone
* vk_blit_helper: Corect depth to color convertion
* renderer_vulkan: Implement reinterpretation with copy
* Allows reinterpreteration with simply copy on AMD
* vk_graphics_pipeline: Only fast compile if no shaders are pending
* With this shaders weren't being compiled in parallel
* vk_swapchain: Ensure vsync doesn't lock framerate
* vk_present_window: Match guest swapchain size to vulkan image count
* Less latency and fixes crashes that were caused by images being deleted before free
* vk_instance: Blacklist VK_EXT_pipeline_creation_cache_control with nvidia gpus
* Resolves crashes when async shader compilation is enabled
* vk_rasterizer: Bump async threshold to 6
* Many games have fullscreen quads with 6 vertices. Fixes pokemon textures missing with async shaders
* android: More robust surface recreation
* renderer_vulkan: Fix dynamic state being lost
* vk_pipeline_cache: Skip cache save when no pipeline cache exists
* This is the cache when loading a save state
* sdl: Fix surface initialization on macOS. (#49)
* sdl: Fix surface initialization on macOS.
* sdl: Fix render window events not being handled under Vulkan.
* renderer/vulkan: Fix binding/unbinding of shadow rendering buffer.
* vk_stream_buffer: Respect non coherent access alignment
* Required by nvidia GPUs on MacOS
* renderer/vulkan: Support VK_EXT_fragment_shader_interlock for shadow rendering. (#51)
* renderer_vulkan: Port some recent shader fixes
* vk_pipeline_cache: Improve shadow detection
* vk_swapchain: Add missing check
* renderer_vulkan: Fix hybrid screen
* Revert "gl_rasterizer: Separable shaders for everyone"
Causes crashes on mali GPUs, will need separate PR
This reverts commit d22d556d30.
* renderer_vulkan: Fix flipped screenshot
---------
Co-authored-by: Steveice10 <1269164+Steveice10@users.noreply.github.com>
* sw_framebuffer: Take factors into account for min/max blending
* renderer_gl: Take factors into account for min/max blending
* Address review comments
* gl_shader_gen: Fix frambuffer fetch on qcom and mali
* renderer_opengl: Add fallback path for mesa
* gl_shader_gen: Avoid emitting blend emulation if minmax_factor is present
* renderer_software: Multi-thread processing
* Doubles the performance in most cases
* renderer_software: Move memory access out of the raster loop
* Profiling shows this has a significant impact
* savestates: add a build_name field to the header
* savestates: display build name on save/load menu
* savestates: add zero member to header just in case of UB from an older save state
* savestates: add legacy hash lookup
* savestate_data: update hash database
* rasterizer_cache: Dont consider res_scale during recycle
* rasterizer_cache: Switch to plain erase loop
* rasterizer_cache: Fix crash due to memory corruption
* renderer_gl: Make rasterizer normal class member
* It doesn't need to be heap allocated anymore
* gl_rasterizer: Remove default_texture
* It's unused
* gl_rasterizer: General cleanup
* gl_rasterizer: Lower case lambdas
* Match style with review comments from vulkan backend
* rasterizer_cache: Prevent memory leak
* Since the switch from shared_ptr these surfaces were no longer being destroyed properly. Use our garbage collector for that purpose to destroy it safely for both backends
* rasterizer_cache: Make temp copy of old surface
* The custom surface would override the memory region of the old region resulting in garbage data, this ensures the custom surface is constructed correctly
* citra_qt: Manually create dialog tabs
* Allows for custom constructors which is very useful. While at it, global state is now eliminated from configuration
* citra_qt: Eliminate global system usage
* core: Remove global system usage in memory and HIO
* citra_qt: Use qOverload
* tests: Run clang format
* gl_texture_runtime: Fix surface scaling
* Move mii to own namespace and add checksummed mii data
* Fix compile issues
* Make mii classes trivial and add cast operator
* Fix Android side
* Add new line at the end of files.
* Make miidata a struct and crc16 a u32_be as per switch code.
* Apply suggestions
* Change back crc to u16 and set padding to 0.
* rasterizer_cache: Sentence surfaces
* gl_texture_runtime: Remove runtime side allocation cache
* rasterizer_cache: Adjust surface scale during reinterpreration
* Fixes pixelated outlines. Also allows to remove the d24s8 specific hack and is more generic in general
* rasterizer_cache: Remove Expand flag
* Begone!
* rasterizer_cache: Cache framebuffers with surface id
* rasterizer_cache: Sentence texture cubes
* renderer_opengl: Move texture mailbox to separate file
* Makes renderer_opengl cleaner overall and allows to report removal threshold from runtime instead of hardcoding. Vulkan requires this
* rasterizer_cache: Dont flush cache on layout change
* rasterizer_cache: Overhaul framebuffer management
* video_core: Remove duplicate
* rasterizer_cache: Sentence custom surfaces
* Vulkan cannot destroy images immediately so this ensures we use our garbage collector for that purpose
* service/gsp: Implement saving of framebuffers in SaveVramSysArea.
* Address review comments.
* service/apt: Separate capture info and capture buffer info.
The former is used with the RequestForSysApplet message and GetCaptureInfo.
The latter is used with SendCaptureBufferInfo and ReceiveCaptureBufferInfo.
* service/apt: Add and implement more service commands.
* service/apt: Implement power button.
* Address review comments and fix GetApplicationRunningMode bug.
* kernel: Properly clean up process threads on exit.
* kernel: Track process-owned memory and free on destruction.
* apt: Implement DoApplicationJump via home menu when available.
* kernel: Move TLS allocation management to owning process.
When we targeted API <32, the notification permission would automatically be requested on startup. This restores that behavior temporarily while we work on new UX.
* shader_jit/tests: Add support for multiple inputs
Allows for multiple `Vec4f` inputs for each run
* shader_jit/tests: Add additional shader-jit tests
Add some more expansive tests for each of the shader-instructions for
regression-testing. `MAD`/`MADI` is not added due to an upstream bug in
nihstro:
https://github.com/neobrain/nihstro/issues/68
* android: Migrate to Kotlin DSL
Includes updates to all android dependencies/ndk (minus billing) and adds support for Kotlin, Android 13, and view binding.
* android: Remove unused tests
* android: Remove unused dependencies
Xbyak has a complete utility-class for determining the host-processor's
ISA-features such as SSE4.1, AVX, AVX2, AVX512{F,VL,DQ,VBMI,etc}, and so
on for further potential optimizations.
Was getting an unhandled `invalid_argument` [exception](https://en.cppreference.com/w/cpp/thread/thread/join) during
shutdown on my linux machine. This removes the need for a `StopBackendThread` function entirely since `jthread`
[automatically handles both checking if the thread is joinable and stopping the token before attempting to join](https://en.cppreference.com/w/cpp/thread/jthread/~jthread) in the case that `StartBackendThread` was never called.
Loop on stop_token and remove final_entry in Entry.
Move Backend thread out of Impl Constructor to its own function.
Add Start function for backend thread.
Use stop token in PopWait and check if entry filename is nullptr before logging.
This fixes a lost wakeup in SPSCQueue. If the reader is in just the right position, the writer's notification will be lost and this will be a problem if the writer then does something to wait on the reader.
This was discovered to affect my upcoming stacktrace PR. I don't think any performance decrease will be noticeable because an uncontended mutex is smart enough to skip the syscall. This PR might also resolve some rare deadlocks but I don't know of any examples.
The log filter was being ignored on initialization due to the logging instance being initialized before the config instance, so the log filter was set to its default value.
This fixes that oversight, along with using descriptive exceptions instead of abort() calls.
This implements backtraces so we don't have to tell users how to use gdb anymore.
This prints a backtrace after abort or segfault is detected. It also fixes the log getting cut off with the last line containing only a bracket. This change lets us know what caused a crash not just what happened the few seconds before it.
I only know how to add support for Linux with GCC. Also this doesn't work outside of C/C++ such as in dynarmic or certain parts of graphics drivers. The good thing is that it'll try and just crash again but the stack frames are still there so the core dump will work just like before.
This simplifies the logging system.
This also fixes some lost messages on startup.
The simplification is simple. I removed unused functions and moved most things in the .h to the .cpp. I replaced the unnecessary linked list with its contents laid out as three member variables. Anything that went through the linked list now directly accesses the backends. Generic functions are replaced with those for each specific use case and there aren't many. This change increases coupling but we gain back more KISS and encapsulation.
With those changes it was easy to make it thread-safe. I just removed the mutex and turned a boolean atomic. I was planning to use this thread-safety in my next PR about stacktraces. It was actually async-signal-safety at first but I ended up using a different approach. Anyway getting rid of the linked list is important for that because have the list of backends constantly changing complicates things.
There's no point in keeping the file open after the write limit is exceeded. This allows the file to be committed to the disk shortly after it is closed and avoids redundantly checking whether or not the write limit is exceeded.
* build: Rework CI and move all bundling into new build target.
* ci: Use "mingw" in msys2 release names for compatibility.
* ci: Use "osx" in macOS release names for compatibility.
* ci: Disable macOS upload.
Will be moved to a separate PR for canary merge.
* android: Update UI strings to reflect desktop counterpart
Quick edit to the UI strings to bring the text up to parity with Citra desktop, plus some small QoL changes.
* Update strings.xml
* update graphics api button indicator
This tiny pull request
* update the graphics button indicator when launching or closing a game (graphics button doesn't update with per game configuration)
* Disable graphics button indicator click while in game
* fix crash
* It fixed crash when opening configure dialog in game if the graphics api for the game is different of the global graphics api
* common: Move dynamic library to common
* This is so that video_core can use it
* logging: Add vulkan log target
* common: Allow defered library loading
* Also add some comments to the functions
* renderer_vulkan: Add vulkan initialization code
* renderer_vulkan: Address feedback
* citra_qt: Remove global state usage in GMainWindow
* citra_qt: Add warning when loadings saves for the first time
* citra_qt: Focus window when launching game from cmdline
* citra_qt: Cleanup nullptr checks
* citra_qt: Move setting to UISettings
* renderer_opengl: Remove header
* Enable web services in android
* Fix web services build on android
* clang-format
* Remove unnecessary line
* Set telemetry to be disabled by default on all platforms
* dumping/ffmpeg_backend: Add FPS filter
So that the recorded video can be at 60FPS (which is supported by most encoders) while still maintaining correct speed.
* dumping/ffmpeg_backend: Add HW context support
Required for some HW acceled encoders. Not tested as my devices don't seem to require this.
* CMake: Copy avfilter dll for MSVC
* CMakeLists: Require FFmpeg 4.0
* ffmpeg: Fix dumper compile error on MSVC.
* ffmpeg: Address review comments.
---------
Co-authored-by: zhupengfei <zhupf321@gmail.com>
* rasterizer_cache: Switch to template
* Eliminates all opengl references in the rasterizer cache headers
thus completing the backend abstraction
* rasterizer_cache: Switch to page table
* Surface storage isn't particularly interval sensitive so we can use a page table to make it faster
* rasterizer_cache: Move sampler management out of rasterizer cache
* rasterizer_cache: Remove shared_ptr usage
* Switches to yuzu's slot vector for improved memory locality.
* rasterizer_cache: Rework reinterpretation lookup
* citra_qt: Per game texture filter
* rasterizer_cache: Log additional settings
* gl_texture_runtime: Resolve shadow map comment
* rasterizer_cache: Don't use float for viewport
* gl_texture_runtime: Fix custom allocation recycling
* rasterizer_cache: Minor cleanups
* Cleanup texture cubes when all the faces have been unregistered from the cache
* custom_tex_manager: Allow multiple hash mappings per texture
* code: Move slot vector to common
* rasterizer_cache: Prevent texture cube crashes
* rasterizer_cache: Improve mipmap validation
* CanSubRect now works properly when validating multi-level surfaces, for example Dark Moon validates a 4 level surface from a 3 level one and it works
* gl_blit_handler: Unbind sampler on reinterpretation
* Add a loading screen for the preloading textures
*The PreloadTextures() function is called from the EmuThread to prevent citra to freezing
*Add a the preloading textures loadingscreen in loading_screen.cpp
*Add custom_tex_manager.reset() in core.cpp to release ram memory after exiting a game
* Add custom textures loading in EmuThread
* Remove useless variable
* Revert "Add custom textures loading in EmuThread"
This reverts commit 45ed46fa09.
* Moved include from bootmanager.h to bootmanager.cpp
By only loading data from disk when creating an instance of this new
class instead of on every method call, we save a lot of file open
operations, which due to SAF are very expensive. This should noticeably
speed up game list scanning.
No intended change in what metadata is shown.
* tests: add Sanity test for SplitFilename83
fix test
fix test
* disable `C4715:not all control paths return a value` for nihstro includes
nihstro: no warn
* Chore: Enable warnings as errors on msvc + fix warnings
fixes
some more warnings
clang-format
* more fixes
* Externals: Add target_compile_options `/W0` nihstro-headers and ...
Revert "disable `C4715:not all control paths return a value` for nihstro includes"
This reverts commit 606d79b55d.
* src\citra\config.cpp: ReadSetting: simplify type casting
* settings.cpp: Get*Name: remove superflous logs
* Use IPC:MakeHeader instead of hardcoded values for IPC command tables.
* Use u32 instead of unsigned int in MakeHeader function
Co-authored-by: SachinVin <26602104+SachinVin@users.noreply.github.com>
* Fix clang format
---------
Co-authored-by: SachinVin <26602104+SachinVin@users.noreply.github.com>
* common: Add thread pool from yuzu
* Is really useful for asynchronous operations like shader compilation and custom textures, will be used in following PRs
* core: Improve ImageInterface
* Provide a default implementation so frontends don't have to duplicate code registering the lodepng version
* Add a dds version too which we will use in the next commit
* rasterizer_cache: Rewrite custom textures
* There's just too much to talk about here, look at the PR description for more details
* rasterizer_cache: Implement basic pack configuration file
* custom_tex_manager: Flip dumped textures
* custom_tex_manager: Optimize custom texture hashing
* If no convertions are needed then we can hash the decoded data directly removing the needed for duplicate decode
* custom_tex_manager: Implement asynchronous texture loading
* The file loading and decoding is offloaded into worker threads, while the upload itself still occurs in the main thread to avoid having to manage shared contexts
* Address review comments
* custom_tex_manager: Introduce custom material support
* video_core: Move custom textures to separate directory
* Also split the files to make the code cleaner
* gl_texture_runtime: Generate mipmaps for material
* custom_tex_manager: Prevent memory overflow when preloading
* externals: Add dds-ktx as submodule
* string_util: Return vector from SplitString
* No code benefits from passing it as an argument
* custom_textures: Use json config file
* gl_rasterizer: Only bind material for unit 0
* Address review comments
* texture_codec: Clamp buffer end to tiled buffer size
* Fixes crash on Pokemon Super Mystery Dungeon
* rasterizer_cache: Use rect for duplicate surface
* Fixes broken bloom in fire emblem
* surface_params: Check levels for exact match
* It was removed previously to prevent copies when games used the base level of a multi level surface. FE on the other hand will first use the base level and then use it as a face of a cubemap with many levels. So instead check if the surface equal or more levels and consider it an exact match in that case
* gl_texture_runtime: Bind old tex to 2D target
* Fixes a small error opengl would print when creating texture cubes
* gl_blit_helper: Fix nearest filter
* Use texture unit 2 which has the nearest sampler bound
* 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>
The incorrect background color could appear when the games fragment is not initialized as it is during first boot. Now it appears correctly as colorSurface.
Some versions of clang 14 (macOS+android) don't implement
`string_view(It first, It last)`, so let's use
`string_view(const CharT*, size_type)` instead.
Also remove unused header leftover from old code that uses std::string.