Commit Graph

9549 Commits

Author SHA1 Message Date
emufan4568
238956f773 renderer_vulkan: Implement scaled uploads and downloads
* This commit includes large changes to have textures are handling. Instead of using ImageAlloc, Surface is used instead which provides multiple benefits: automatic recycling on destruction and ability to use the TextureRuntime interface to simplify operations

* Layout tracking is also implemented which allows transitioning of individual mip levels without errors

* This fixes graphical errors in multiple games which relied on framebuffer uploads
2022-12-25 22:20:22 +02:00
emufan4568
a5351bc596 renderer_vulkan: Fix renderpass issues
* The cache didn't take into account the framebuffer and render area used, so if these changed the renderpass wouldn't restart. This caused graphical bugs in Pokemon X/Y
2022-12-25 22:20:22 +02:00
emufan4568
5b6e99b194 renderer_vulkan: Update stencil compare mask 2022-12-25 22:20:22 +02:00
emufan4568
3f3b4a2802 citra_qt: Fix graphics api indicator alignment 2022-12-25 22:20:22 +02:00
emufan4568
c19e8d36c9 renderer_opengl: Fix OpenGLES issues
* Always request a 4.4 context until I figure out how to get Qt to cooperate

* Use RGBA for BGR since the converted table will do that conversion
2022-12-25 22:20:22 +02:00
emufan4568
2ec31f404b renderer_vulkan: Report perf stats 2022-12-25 22:20:21 +02:00
emufan4568
28a2805450 renderer_vulkan: Better error handling 2022-12-25 22:20:21 +02:00
emufan4568
2601a1df6c renderer_vulkan: Allow direct allocation of images 2022-12-25 22:19:26 +02:00
emufan4568
96d5bb553b renderer_vulkan: Fix incorrect depth format detection
* Intel iGPUs don't support blit on all depth/stencil formats which caused issues since the runtime checks for this while the renderpass cache does not
2022-12-25 22:19:26 +02:00
emufan4568
b4d0f442c8 renderer_vulkan: Actually minize state changes
* Keep track of the current state and only update it when needed. Previously games would set the same state over and over cluttering renderdoc logs
2022-12-25 22:19:25 +02:00
emufan4568
2a68cab7d6 renderer_vulkan: Fix broken sync without timeline semaphores 2022-12-25 22:19:25 +02:00
emufan4568
009d73fdf6 renderer_vulkan: Allocate descriptor sets during reinterpretation 2022-12-25 22:19:25 +02:00
emufan4568
42af22f8fd renderer_vulkan: Enable logic ops and fix swapchain resizing 2022-12-25 22:19:25 +02:00
emufan4568
b85d15b035 renderer_vulkan: Clear stencil with renderpass
* Fixes outline retension in pokemon games
2022-12-25 22:19:25 +02:00
emufan4568
130e376c0c renderer_vulkan: Fix pipeline cache crashes 2022-12-25 22:19:25 +02:00
GPUCode
f884986257 renderer_vulkan: Optimize tiled format convertion + fix vertex buffer alignment
* Integrate format convertion to the morton copy function, removing the need for an intermediate copy and convertion pass. This should be beneficial for performance especially since most games use tiled textures

* Also bump vertex buffer size to avoid crashes with hardware shaders and provide correct offset on normal draws which fixes glitches in pokemon Y

* Reduce the local group size to 8 in the D24S8 compute shader which fixes graphical issues in the afformentioned pokemon games at native resolution

* Set LOD to 0 instead of 0.25 to fix another glitch in pokemon y
2022-12-25 22:19:25 +02:00
GPUCode
e23dc3efb1 renderer_opengl: Fix broken texture copy
* Resolves graphical bugs in Professor Layton vs Ace Attorney when using OpenGL
2022-12-25 22:19:25 +02:00
GPUCode
dd5e95d7c6 renderer_vulkan: Pipeline cache fixes
* Delete cache file if found invalid

* Name it after the vendor/device ids so each physical devices gets a separate cache
2022-12-25 22:19:25 +02:00
GPUCode
b72289eadd video_core: Fix renderpass cache bug and introduce RGBA -> BGR converter 2022-12-25 22:19:25 +02:00
GPUCode
7a5d4f03da renderer_opengl: Specify precision in compute shader and add RGB5A1 converter
* Fixes OpenGLES crash
2022-12-25 22:19:25 +02:00
GPUCode
18fa277c71 renderer_vulkan: Complete hardware shader support
* With these changes all commercial games I tested work fine and get a massive performance boost
2022-12-25 22:19:25 +02:00
GPUCode
73cc764091 renderer_vulkan: Begin hardware shader support
* Still experimental and works only with homebrew
2022-12-25 22:19:25 +02:00
GPUCode
9dea514d45 citra: Fix build issues with MinGW and MSVC 2022-12-25 22:19:25 +02:00
GPUCode
0bfaa035b9 renderer_vulkan: Fix warnings and cleanup 2022-12-25 22:19:06 +02:00
GPUCode
85df778785 code: Run clang-format 2022-12-25 22:19:06 +02:00
GPUCode
e54a92c252 code: Address build issues 2022-12-25 22:18:04 +02:00
GPUCode
9145d4cec8 video_core: Re-implement format reinterpretation
* Same as before but D24S8 to RGBA8 is switched to a compute shader which should provide better throughput and is much simpler to implement in Vulkan
2022-12-25 22:18:04 +02:00
GPUCode
c611592db6 citra_qt: Add physical device selection dialog 2022-12-25 22:18:04 +02:00
GPUCode
6aba809da8 renderer_opengl: Unbind unused framebuffer targets
* Fixes graphical glitches in many games for some reason
2022-12-25 22:12:42 +02:00
GPUCode
f0449d79fd renderer_opengl: Emulate texture copy with blit for now 2022-12-25 22:12:42 +02:00
GPUCode
33481ada7f renderer_opengl: Address buffer overflow 2022-12-25 22:12:42 +02:00
GPUCode
67195974e7 video_core: Small code improvements 2022-12-25 22:12:42 +02:00
GPUCode
70c2376fd0 renderer_vulkan: Don't sample from mipmaps when using texture cubes
* Mipmaps for texture cubes are unimplemented in the rasterizer cache, so sampling from mipmaps will return nothing
2022-12-25 22:12:42 +02:00
GPUCode
177c7de4f9 input_common: Small fix 2022-12-25 22:12:42 +02:00
GPUCode
eea914ba84 citra_qt: Improve graphics API intergration
* Add renderer debug option which toggles debug output in OpenGL/validation layers in Vulkan

* Fix many warnings and replace deprecated Qt functionailty with newer alternatives
2022-12-25 22:12:41 +02:00
GPUCode
62e88fbeb3 rasterizer_cache: Code cleanup
* Merge utils and types to a single header
2022-12-25 22:07:46 +02:00
GPUCode
5ce27d8341 texture_decode: Prefer std::memcpy where possible 2022-12-25 22:07:46 +02:00
GPUCode
eaf62eb635 renderer_vulkan: Rework format handling
* This is a pretty large commit that aims to solve some issues with the current format system
* The instance now builds at application initialization an array of format traits for each pixel format
  that includes information such as blit/attachment/storage support and fallback formats
* The runtime doesn't ask the instance for formats but receives these traits and can dedice on its own what to build
  For now we do the same as before, we require both blit and attachment support

* Morton swizzling also sees many bug fixes. The previous code was very hacky and didn't work for partial
  texture updates. It was also inconsistent, as it would take a tiled_buffer and write to the middle of linear
* Now the functions have been greatly simplified and adjusted to work better with std::span. This fixes out of bounds
  errors and texture glitches (like the display in Mario Kart 7)
2022-12-25 22:07:46 +02:00
emufan4568
9675811bbe renderer_vulkan: Add experimental Vulkan renderer 2022-12-25 22:07:46 +02:00
emufan4568
945faf8e92 externals: Add vulkan headers and vma 2022-12-25 22:02:59 +02:00
emufan4568
9403049671 rasterizer_cache: Refactor texture cube interface
* Reuse our Surface class instead of having a separate one, to avoid reimplementing stuff in the backend
2022-12-25 22:02:59 +02:00
emufan4568
40159d9779 gl_texture_runtime: Clean up texture upload/download code
* Improve readability and code clarity
2022-12-25 22:02:59 +02:00
emufan4568
f63653a5b9 rasterizer_cache: Use Common::Rectangle everywhere
* Make a nice alias for it and use it instead of having Rect2D/Region2D. Makes the new design less intrusive to the current cache
2022-12-25 22:02:59 +02:00
emufan4568
c71dbb5d19 rasterizer_cache: Make into template
* This is the final step, now RasterizerCache is compltely decoupled from OpenGL (technically not yet, but that's talking details). For now texture filtering and some GLES paths have been disabled and will be reimplemented in the following commits
2022-12-25 22:02:59 +02:00
emufan4568
0f4df2c012 rasterizer_cache: Use PBO staging buffer cache for texture uploads/downloads 2022-12-25 22:02:11 +02:00
emufan4568
c6fc4f5a87 rasterizer_cache: Reorder methods 2022-12-25 22:02:11 +02:00
emufan4568
916afa194d rasterizer_cache: Remove remnants of cached_pages 2022-12-25 22:02:11 +02:00
emufan4568
6f2cd11a85 rasterizer_cache: Fix texture cube blitting
* The target was GL_TEXTURE_2D instead of GL_TEXTURE_CUBE_MAP_*
2022-12-25 22:02:11 +02:00
emufan4568
14652d52bc morton_swizzle: Implement texture formats in UNSWIZZLE_TABLE
* I can now remove that loop that has been messing with my OCD
2022-12-25 22:02:11 +02:00
emufan4568
a57ee7cdf2 morton_swizzle: Use tiled_buffer instead of reading data from g_memory
* It's much safer and removes hardcoded global state usage
2022-12-25 22:02:11 +02:00