| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
This formats all copyright comments according to SPDX formatting guidelines.
Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This function was incorrectly using the stencil_two_side_enable register when dynamically updating the StencilOp.
|
|
|
|
| |
Silences validation errors for clearing the depth/stencil buffers of framebuffer attachments that were not specified to have depth/stencil usage.
|
| |
|
|
|
|
|
| |
Matches OpenGL's behavior. I don't believe this register flips geometry,
but we have to try to match behavior on both backends.
|
| |
|
|
|
|
|
| |
Workaround potential bug on Nvidia's driver where only updating high
attributes leaves low attributes out dated.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Reduces the number of total pipelines generated on Vulkan.
Tested on Super Smash Bros. Ultimate.
|
| |
|
| |
|
| |
|
|
|
|
| |
Intel devices pre-Xe don't support this.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes how Scheduler::Flush works. It queues the current command
buffer to be sent to the GPU but does not do it immediately. The Vulkan
worker thread takes care of that. Users will have to use
Scheduler::Flush + Scheduler::WaitWorker to get the previous behavior.
Scheduler::Finish is unchanged.
To avoid waiting on work never queued, Scheduler::Wait sends the current
command buffer if that's what the caller wants to wait.
|
|
|
|
|
|
|
|
|
| |
Move code to separate files to be able to reuse it from OpenGL. This
greatly simplifies the pipeline cache logic on Vulkan.
Transform feedback state is not yet abstracted and it's still
intrusively stored inside vk_pipeline_cache. It will be moved when
needed on OpenGL.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Wait from the worker thread for a pipeline to build before binding it to
the command buffer. This allows queueing pipelines to multiple threads.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
DMAEngine: Accelerate BufferClear [accelerateDMA Part 2]
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
- Removes a dependency on core and input_common from common.
|
|
|
|
| |
Co-Authored-By: Rodrigo Locatti <reinuseslisp@airmail.cc>
|
|
|
|
| |
This was recently introduced on a wrongly rebased commit.
|
|
|
|
|
| |
Use dirty flags to avoid building pipeline key from scratch on each draw
call. This saves a bit of unnecesary work on each draw call.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
"Memory manager" collides with the guest GPU memory manager, and a
memory allocator sounds closer to what the abstraction aims to be.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| | |
vulkan_common: Move device abstraction to the common directory and allow surfaceless devices
|
| | |
|
|\ \
| |/
|/| |
vk_rasterizer: Skip binding empty descriptor sets on compute
|
| |
| |
| |
| |
| | |
Fixes unit tests where compute shaders had no descriptors in the set,
making Vulkan drivers crash when binding an empty set.
|
|/
|
|
|
|
|
| |
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.
|
|
|
|
| |
Allows sharing Vulkan wrapper code between different rendering backends.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current texture cache has several points that hurt maintainability
and performance. It's easy to break unrelated parts of the cache
when doing minor changes. The cache can easily forget valuable
information about the cached textures by CPU writes or simply by its
normal usage.The current texture cache has several points that hurt
maintainability and performance. It's easy to break unrelated parts
of the cache when doing minor changes. The cache can easily forget
valuable information about the cached textures by CPU writes or simply
by its normal usage.
This commit aims to address those issues.
|
|
|
|
|
| |
Cleans out the rest of the occurrences of variable shadowing and makes
any further occurrences of shadowing compiler errors.
|
|
|
|
|
|
|
| |
Migrates the video core code closer to enabling variable shadowing
warnings as errors.
This primarily sorts out shadowing occurrences within the Vulkan code.
|
|
|
|
|
|
|
|
|
| |
Vulkan has requirements for primitive topologies that don't play nicely
with yuzu's. Since it's only 4 bits, we can move it to fixed state
without changing the size of the pipeline key.
- Fixes a regression on recent Nvidia drivers on Fire Emblem: Three
Houses.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reworks how host<->device synchronization works on the Vulkan
backend. Instead of "protecting" resources with a fence and signalling
these as free when the fence is known to be signalled by the host GPU,
use timeline semaphores.
Vulkan timeline semaphores allow use to work on a subset of D3D12
fences. As far as we are concerned, timeline semaphores are a value set
by the host or the device that can be waited by either of them.
Taking advantange of this, we can have a monolithically increasing
atomic value for each submission to the graphics queue. Instead of
protecting resources with a fence, we simply store the current logical
tick (the atomic value stored in CPU memory). When we want to know if a
resource is free, it can be compared to the current GPU tick.
This greatly simplifies resource management code and the free status of
resources should have less false negatives.
To workaround bugs in validation layers, when these are attached there's
a thread waiting for timeline semaphores.
|
|
|
|
|
|
|
|
|
| |
Now that the GPU is initialized when video backends are initialized,
it's no longer needed to query components once the game is running: it
can be done when yuzu is booting.
This allows us to pass components between constructors and in the
process remove all Core::System references in the video backend.
|
|
|
|
|
|
|
|
|
| |
State track the current primitive topology with a regular comparison
instead of using dirty flags.
This fixes a bug in dirty flags for this particular state and it also
avoids unnecessary state changes as this property is stored in a
frequently changed bit field.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
The relevant values are already assigned further down in the lambda, so
this can be removed entirely.
|
| |
|
|
|
|
|
| |
This has been fixed in Nvidia's public beta driver 451.74. The previous
beta driver will be broken, people using these will have to update.
|
|
|
|
| |
Disable this temporarily.
|
|
|
|
|
|
| |
With extended dynamic states, some bytes don't have to be collected from
the pipeline key, hence we can avoid hashing and comparing them on
lookups.
|
| |
|
|
|
|
|
|
|
| |
This moves dynamic state present in VK_EXT_extended_dynamic_state to a
separate structure in FixedPipelineState. This is structure is at the
bottom allowing us to hash and memcmp only when the extension is not
supported.
|
|\
| |
| | |
vk_rasterizer: Don't preserve contents on full screen clears
|
| |
| |
| |
| |
| |
| | |
There's no need to load contents from the CPU when a clear resets all
the contents of the underlying memory. This is already implemented on
OpenGL and the texture cache.
|
| |
| |
| |
| |
| |
| | |
Make stream buffer and cached buffers as resident and query their
address. This allows us to use GPU addresses for several proprietary
Nvidia extensions.
|
|\ \
| | |
| | | |
vk_update_descriptor: Upload descriptor sets data directly
|
| |/
| |
| |
| |
| | |
Instead of copying to a temporary payload before sending the update task
to the worker thread, insert elements to the payload directly.
|
|/ |
|
|\
| |
| | |
shader/texture: Join separate image and sampler pairs offline
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Games using D3D idioms can join images and samplers when a shader
executes, instead of baking them into a combined sampler image. This is
also possible on Vulkan.
One approach to this solution would be to use separate samplers on
Vulkan and leave this unimplemented on OpenGL, but we can't do this
because there's no consistent way of determining which constant buffer
holds a sampler and which one an image. We could in theory find the
first bit and if it's in the TIC area, it's an image; but this falls
apart when an image or sampler handle use an index of zero.
The used approach is to track for a LOP.OR operation (this is done at an
IR level, not at an ISA level), track again the constant buffers used as
source and store this pair. Then, outside of shader execution, join
the sample and image pair with a bitwise or operation.
This approach won't work on games that truly use separate samplers in a
meaningful way. For example, pooling textures in a 2D array and
determining at runtime what sampler to use.
This invalidates OpenGL's disk shader cache :)
- Used mostly by D3D ports to Switch
|
|\ \
| | |
| | | |
shader_cache: Implement a generic runtime shader cache
|
| | |
| | |
| | |
| | | |
Trivial port the generic shader cache to Vulkan.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This allows rendering to 3D textures with more than one slice.
Applications are allowed to render to more than one slice of a texture
using gl_Layer from a VTG shader.
This also requires reworking how 3D texture collisions are handled, for
now, this commit allows rendering to slices but not to miplevels. When a
render target attempts to write to a mipmap, we fallback to the previous
implementation (copying or flushing as needed).
- Fixes color correction 3D textures on UE4 games (rainbow effects).
- Allows Xenoblade games to render to 3D textures directly.
|
|\ \ \
| |/ /
|/| | |
vk_rasterizer: Implement storage texels and atomic image operations
|
| |/
| |
| |
| |
| |
| | |
This is the equivalent of an image buffer on OpenGL.
- Used by Octopath Traveler
|
|\ \
| |/
|/| |
vk_rasterizer: Skip transform feedbacks when extension is unavailable
|
| |
| |
| |
| |
| | |
Avoids calling transform feedback procedures when
VK_EXT_transform_feedback is not available.
|
|\ \
| |/
|/| |
vk_rasterizer: Implement constant attributes
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Constant attributes (in OpenGL known disabled attributes) are not
supported on Vulkan, even with extensions. To emulate this behavior we
return zero on reads from disabled vertex attributes in shader code.
This has no caching cost because attribute formats are not dynamic state
on Vulkan and we have to store it in the pipeline cache anyway.
- Fixes Animal Crossing: New Horizons terrain borders
|
| |
| |
| |
| |
| |
| | |
This was a left over from OpenGL when disabled buffers where not properly
emulated. We no longer have to assert this as it is checked in vertex
buffer initialization.
|
|\ \
| | |
| | | |
Correct a series of crashes and intructions on Async GPU and Vulkan Pipeline
|
| |/ |
|
|/
|
|
|
| |
Match OpenGL's behavior. This can fix or simplify bisecting issues on
Vulkan.
|
|\
| |
| | |
{maxwell_3d,buffer_cache}: Implement memory barriers using 3D registers
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Drop MemoryBarrier from the buffer cache and use Maxwell3D's register
WaitForIdle.
To implement this on OpenGL we just call glMemoryBarrier with the
necessary bits.
Vulkan lacks this synchronization primitive, so we set an event and
immediately wait for it. This is not a pretty solution, but it's what
Vulkan can do without submitting the current command buffer to the queue
(which ends up being more expensive on the CPU).
|
|\ \
| | |
| | | |
vulkan: Remove unnecessary includes
|
| |/
| |
| |
| |
| |
| |
| | |
Reduces some header churn and reduces rebuilds when some header
internals change.
While we're at it we can also resolve a missing include in buffer_cache.
|
|\ \
| | |
| | | |
vk_rasterizer: Skip index buffer setup when vertices are zero
|
| |/
| |
| |
| |
| |
| |
| |
| |
| | |
Xenoblade 2 invokes a draw call with zero vertices.
This is likely due to indirect drawing (glDrawArraysIndirect).
This causes a crash in the staging buffer pool when trying to create a
buffer with a size of zero. To workaround this, skip index buffer setup
entirely when the number of indices is zero.
|
|\ \
| | |
| | | |
shader/texture: Support multiple unknown sampler properties
|
| | | |
|
|\ \ \
| |_|/
|/| | |
texture_cache: Reintroduce preserve_contents accurately
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This reverts commit 94b0e2e5dae4e0bd0021ac2d8fe1ff904a93ee69.
preserve_contents proved to be a meaningful optimization. This commit
reintroduces it but properly implemented on OpenGL.
We have to make sure the clear removes all the previous contents of the
image.
It's not currently implemented on Vulkan because we can do smart things
there that's preferred to be introduced in a separate commit.
|
|\ \ \
| |/ /
|/| | |
vk_renderpass_cache: Pack renderpass cache key and unify keys
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Sometimes for unknown reasons NVN games can bind a render target format
of 0. This may be a yuzu bug.
With the commits before this the formats were specified without being
"packed", assuming all formats and texceptions will be written like in
the color_attachments vector.
To address this issue, iterate all render targets and pack them as they
are valid. This way they will match color_attachments.
- Fixes validation errors and graphical issues on Breath of the Wild.
|
| | |
| | |
| | |
| | | |
Framebuffer creation was ignoring the number of color attachments.
|
| | |
| | |
| | |
| | |
| | | |
This allows us to call Common::CityHash and std::memcmp only once for
GraphicsPipelineCacheKey. While we are at it, do the same for compute.
|
| |/ |
|
|\ \
| |/
|/| |
{gl,vk}_rasterizer: Add lazy default buffer maker and use it for empty buffers
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Introduce a default buffer getter that lazily constructs an empty
buffer. This is intended to match OpenGL's buffer 0.
Use this for disabled vertex and uniform buffers.
While we are at it, include vertex buffer usages for staging buffers to
silence validation errors.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On NVN buffers can be enabled but have no size. According to deko3d and
the behavior we see in Animal Crossing: New Horizons these buffers get
the special address of 0x1000 and limit themselves to 0xfff.
Implement buffers without a size by binding a null buffer to OpenGL
without a side.
https://github.com/devkitPro/deko3d/blob/1d1930beea093b5a663419e93b0649719a3ca5da/source/maxwell/gpu_3d_vbo.cpp#L62-L63
|
|\ \
| | |
| | | |
Introduce Predictive Flushing and Improve ASYNC GPU
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| |/ |
|
|\ \
| |/
|/| |
renderer_vulkan: Integrate Nvidia Nsight Aftermath on Windows
|
| | |
|
|\ \
| | |
| | | |
fixed_pipeline_state: Pack structure, use memcmp and CityHash on it
|
| | |
| | |
| | |
| | | |
Reduce FixedPipelineState's size from 1384 to 664 bytes
|
| | |
| | |
| | | |
Fixes Werror=reorder in gcc
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implement indexed quads (GL_QUADS used with glDrawElements*) with a
compute pass conversion.
The compute shader converts from uint8/uint16/uint32 indices to uint32.
The format is passed through push constants to avoid having different
variants of the same shader.
- Used by Fast RMX
- Used by Xenoblade Chronicles 2 (it still has graphical due to
synchronization issues on Vulkan)
|
|\ \
| | |
| | | |
buffer_cache: Return handles instead of pointer to handles
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The original idea of returning pointers is that handles can be moved.
The problem is that the implementation didn't take that in mind and made
everything harder to work with. This commit drops pointer to handles and
returns the handles themselves. While it is still true that handles can
be invalidated, this way we get an old handle instead of a dangling
pointer.
This problem can be solved in the future with sparse buffers.
|
|/
|
|
| |
Silence validation layer errors.
|
|\
| |
| | |
renderer_vulkan: Drop Vulkan-Hpp
|
| | |
|
|/
|
|
|
|
|
| |
preserve_contents was always true. We can't assume we don't have to
preserve clears because scissored and color masked clears exist.
This removes preserve_contents and assumes it as true at all times.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
vk_rasterizer: Implement scissor clears and layered clears
|
| | |
|
| | |
|
|/
|
|
|
| |
End can be equal to start in CalculateVertexArraysSize. This is quite
common when the vertex size is zero.
|
| |
|
|\
| |
| | |
vk_rasterizer: fix mistype on SetupGraphicsImages
|
| |
| |
| | |
This should use Maxwell3D engine. Fixed some GPU error on Kirby and maybe other games.
|
|\ \
| | |
| | | |
vk_rasterizer: Support disabled uniform buffers
|
| |/ |
|
|\ \
| |/
|/| |
video_core: Remove gl_state and use a state tracker based on dirty flags
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
Add support for render targets and viewports.
|
| | |
|
|\ \
| |/
|/| |
vk_shader_decompiler: Implement indexed textures
|
| |
| |
| |
| |
| |
| |
| | |
Implement accessing textures through an index. It uses the same
interface as OpenGL, the main difference is that Vulkan bindings are
forced to be arrayed (the binding index doesn't change for stacked
textures in SPIR-V).
|
|\ \
| |/
|/| |
texture_cache: Implement layered framebuffer attachments
|
| |
| |
| |
| |
| |
| | |
Layered framebuffer attachments is a feature that allows applications to
write attach layered textures to a single attachment. What layer the
fragments are written to is decided from the shader using gl_Layer.
|
|\ \
| | |
| | | |
maxwell_3d: Unify draw methods
|
| |/
| |
| |
| |
| | |
Pass instanced state of a draw invocation as an argument instead of
having two separate virtual methods.
|
|/ |
|
|
|
|
| |
Removes bounds checking from "texceptions" instances.
|
| |
|
|
This abstraction is Vulkan's equivalent to OpenGL's rasterizer. It takes
care of joining all parts of the backend and rendering accordingly on
demand.
|