aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
AgeCommit message (Collapse)Author
2021-02-13vk_resource_pool: Load GPU tick once and compare with itReinUsesLisp
Other minor style improvements. Rename free_iterator to hint_iterator, to describe better what it does.
2021-02-13vk_master_semaphore: Mark gpu_tick atomic operations with relaxed orderReinUsesLisp
2021-02-13vk_staging_buffer_pool: Inline tick testsReinUsesLisp
Load the current tick to a local variable, moving it out of an atomic and allowing us to compare the value without going through a pointer each time. This should make the loop more optimizable.
2021-02-13gl_stream_buffer/vk_staging_buffer_pool: Fix size checkReinUsesLisp
Fix a tragic off-by-one condition that causes Vulkan's stream buffer to think it's always full, using fallback memory. The OpenGL was also affected by this bug to a lesser extent.
2021-02-13video_core: Fix clang build issuesReinUsesLisp
2021-02-13vk_staging_buffer_pool: Fix softlock when stream buffer overflowsReinUsesLisp
There was still a code path that could wait on a timeline semaphore tick that would never be signalled. While we are at it, make use of more STL algorithms.
2021-02-13vk_buffer_cache: Add support for null index buffersReinUsesLisp
Games can bind a null index buffer (size=0) where all indices are evaluated as zero. VK_EXT_robustness2 doesn't support this and all drivers segfault when a null index buffer is passed to vkCmdBindIndexBuffer. Workaround this by creating a 4 byte buffer and filling it with zeroes. If it's read out of bounds, robustness takes care of returning zeroes as indices.
2021-02-13vk_staging_buffer_pool: Get a staging buffer instead of waitingReinUsesLisp
Avoids waiting idle while the GPU finishes to do work, and fixes an issue where we'd wait forever if a single command buffer (logic tick) all the data.
2021-02-13buffer_cache: Skip cache on small uploads on VulkanReinUsesLisp
Ports from OpenGL the optimization to skip small 3D uniform buffer uploads. This will take advantage of the previously introduced stream buffer. Fixes instances where the staging buffer offset was being ignored.
2021-02-13vk_staging_buffer_pool: Add stream buffer for small uploadsReinUsesLisp
This uses a ring buffer similar to OpenGL's stream buffer for small uploads. This stops us from allocating several small buffers, reducing memory fragmentation and cache locality. It uses dedicated allocations when possible.
2021-02-13video_core: Reimplement the buffer cacheReinUsesLisp
Reimplement the buffer cache using cached bindings and page level granularity for modification tracking. This also drops the usage of shared pointers and virtual functions from the cache. - Bindings are cached, allowing to skip work when the game changes few bits between draws. - OpenGL Assembly shaders no longer copy when a region has been modified from the GPU to emulate constant buffers, instead GL_EXT_memory_object is used to alias sub-buffers within the same allocation. - OpenGL Assembly shaders stream constant buffer data using glProgramBufferParametersIuivNV, from NV_parameter_buffer_object. In theory this should save one hash table resolve inside the driver compared to glBufferSubData. - A new OpenGL stream buffer is implemented based on fences for drivers that are not Nvidia's proprietary, due to their low performance on partial glBufferSubData calls synchronized with 3D rendering (that some games use a lot). - Most optimizations are shared between APIs now, allowing Vulkan to cache more bindings than before, skipping unnecesarry work. This commit adds the necessary infrastructure to use Vulkan object from OpenGL. Overall, it improves performance and fixes some bugs present on the old cache. There are still some edge cases hit by some games that harm performance on some vendors, this are planned to be fixed in later commits.
2021-02-13gpu: Report renderer errors with exceptionsReinUsesLisp
Instead of using a two step initialization to report errors, initialize the GPU renderer and rasterizer on the constructor and report errors through std::runtime_error.
2021-01-27vk_scheduler: Fix unaligned placement new expressionsReinUsesLisp
We were accidentaly creating an object in an unaligned memory address. Fix this by manually aligning the offset.
2021-01-24vk_graphics_pipeline: Fix narrowing conversion on MSVCReinUsesLisp
2021-01-24Merge pull request #5807 from ReinUsesLisp/vc-warningsLC
video_core: Silence the remaining gcc warnings and enforce them
2021-01-24Merge pull request #5363 from ReinUsesLisp/vk-image-usageRodrigo Locatti
vk_texture_cache: Support image store on sRGB images with VkImageViewUsageCreateInfo
2021-01-24vk_texture_cache: Support image store on sRGB images with ↵ReinUsesLisp
VkImageViewUsageCreateInfo Vulkan 1.0 didn't support creating sRGB image views on an ABGR8 VkImage with storage usage bits. VK_KHR_maintenance2 addressed this allowing to reduce the usage bits on a VkImageView. To allow image store on non-sRGB image views when the VkImage is created with sRGB, always create VkImages without sRGB and add the sRGB format on the view.
2021-01-24video_core: Silence -Wmissing-field-initializers warningsReinUsesLisp
2021-01-24maxwell_to_vk: Silence -Wextra warnings about using different enum typesReinUsesLisp
2021-01-23vk_pipeline_cache: Properly bypass VertexA shadersReinUsesLisp
The VertexA stage is not yet implemented, but Vulkan is adding its descriptors, causing a discrepancy in the pushed descriptors and the template. This generally ends up in a driver side crash. Bypass the VertexA stage for now.
2021-01-20Merge pull request #5361 from ReinUsesLisp/vk-shader-commentbunnei
vk_shader_decompiler: Show comments as OpUndef with a type
2021-01-15vk_shader_decompiler: Show comments as OpUndef with a typeReinUsesLisp
Silence the new validation layer error about SPIR-V not allowing OpUndef on a OpTypeVoid, even when the SPIR-V spec doesn't say anything against it. They will be inserted as an undefined int to avoid SPIRV-Cross and validation errors, but only when a debugging tool is attached.
2021-01-15vk_texture_cache: Use Download memory types for texture flushesReinUsesLisp
Use the Download memory type where it matters.
2021-01-15vulkan_memory_allocator: Add "download" memory usage hintReinUsesLisp
Allow users of the allocator to hint memory usage for downloads. This removes the non-descriptive boolean passed for "host visible" or not host visible memory commits, and uses an enum to hint device local, upload and download usages.
2021-01-15vulkan_common: Move allocator to the common directoryReinUsesLisp
Allow using the abstraction from the OpenGL backend.
2021-01-15renderer_vulkan: Rename Vulkan memory manager to memory allocatorReinUsesLisp
"Memory manager" collides with the guest GPU memory manager, and a memory allocator sounds closer to what the abstraction aims to be.
2021-01-15vk_memory_manager: Improve memory manager and its APIReinUsesLisp
Fix a bug where the memory allocator could leave gaps between commits. To fix this the allocation algorithm was reworked, although it's still short in number of lines of code. Rework the allocation API to self-contained movable objects instead of naively using an unique_ptr to do the job for us. Remove the VK prefix.
2021-01-15vk_buffer_cache: Remove unused functionReinUsesLisp
2021-01-12Merge pull request #5311 from ReinUsesLisp/fence-waitbunnei
vk_fence_manager: Use timeline semaphores instead of spin waits
2021-01-08Merge pull request #5231 from ReinUsesLisp/dyn-bindingsbunnei
renderer_vulkan/fixed_pipeline_state: Move enabled bindings to static state
2021-01-08vk_fence_manager: Use timeline semaphores instead of spin waitsReinUsesLisp
With timeline semaphores we can avoid creating objects. Instead of creating an event, grab the current tick from the scheduler and flush the current command buffer. When the fence has to be queried/waited, we can do so against the master semaphore instead of spinning on an event. If Vulkan supported NVN like events or fences, we could signal from the command buffer and wait for that without splitting things in two separate command buffers.
2021-01-06Merge pull request #5288 from ReinUsesLisp/workaround-garbageMorph
gl_texture_cache: Avoid format views on Intel and AMD
2021-01-05Merge pull request #5289 from ReinUsesLisp/vulkan-devicebunnei
vulkan_common: Move device abstraction to the common directory and allow surfaceless devices
2021-01-04Merge pull request #5292 from ReinUsesLisp/empty-setLC
vk_rasterizer: Skip binding empty descriptor sets on compute
2021-01-04vk_rasterizer: Skip binding empty descriptor sets on computeReinUsesLisp
Fixes unit tests where compute shaders had no descriptors in the set, making Vulkan drivers crash when binding an empty set.
2021-01-04renderer_vulkan/nsight_aftermath_tracker: Move to vulkan_commonReinUsesLisp
2021-01-04renderer_vulkan: Move device abstraction to vulkan_commonReinUsesLisp
2021-01-04gl_texture_cache: Avoid format views on Intel and AMDReinUsesLisp
Intel and AMD proprietary drivers are incapable of rendering to texture views of different formats than the original texture. Avoid creating these at a cache level. This will consume more memory, emulating them with copies.
2021-01-03renderer_vulkan: Rename VKDevice to DeviceReinUsesLisp
The "VK" prefix predates the "Vulkan" namespace. It was carried around the codebase for consistency. "VKDevice" currently is a bad alias with "VkDevice" (only an upcase character of difference) that can cause confusion. Rename all instances of it.
2021-01-03Merge pull request #5230 from ReinUsesLisp/vulkan-commonRodrigo Locatti
vulkan_common: Move reusable Vulkan abstractions to a separate directory
2021-01-02general: Fix various spelling errorsMorph
2020-12-31vulkan_instance: Allow different Vulkan versions and enforce 1.1ReinUsesLisp
For listing the available physical devices we can use Vulkan 1.0. Now that MoltenVK supports 1.1 we can require it for running games. Add missing documentation.
2020-12-31vk_device: Use an array to report lacking device limitsReinUsesLisp
This makes easier to add and tune the required device limits.
2020-12-31vk_device: Stop initialization when device is not suitableReinUsesLisp
VKDevice::IsSuitable was not being called. To address this issue, check suitability before initialization and throw an exception if it fails. By doing this, we can deduplicate some code on queue searches. Previosuly we would first search if a present and graphics queue existed, then on initialization we would search again to find the index.
2020-12-31renderer_vulkan: Remove two step initialization on VKDeviceReinUsesLisp
The Vulkan device abstraction either initializes successfully on the constructor or throws a Vulkan exception.
2020-12-31renderer_vulkan: Throw when enumerating devices failsReinUsesLisp
Report device enumeration errors with exceptions to be consistent with other initialization related function calls. Reduces the amount of code to maintain.
2020-12-31renderer_vulkan: Initialize surface in separate fileReinUsesLisp
Move surface initialization code to a separate file. It's unlikely to use this code outside of Vulkan, but keeping platform-specific code (Win32, Xlib, Wayland) in its own translation unit keeps things cleaner.
2020-12-31renderer_vulkan: Catch and report exceptionsReinUsesLisp
Move more Vulkan code to report errors with exceptions and report them through a log before notifying it with an error boolean for backwards compatibility. In the future we can replace the rasterizer two-step initialization to always use exceptions.
2020-12-31renderer_vulkan: Create debug callback on separate file and throwReinUsesLisp
Initialize debug callbacks (messenger) from a separate file. This allows sharing code with different backends. Change our Vulkan error handling to use exceptions instead of error codes, simplifying the initialization process.
2020-12-31renderer_vulkan: Move instance initialization to a separate fileReinUsesLisp
Simplify Vulkan's backend initialization code by moving it to a separate file, allowing us to initialize a Vulkan instance from different backends.