Commit Graph

1769 Commits

Author SHA1 Message Date
5c0e4a839d Fix SW BC2 decoding pitch 2022-11-02 17:46:07 +00:00
60863fa162 Make viewports fallback to viewport 0 when their dimensions are invalid
OpenGL games use a zero width/height for viewports 1-15 when they're unused
2022-11-02 17:46:07 +00:00
586f872655 Update indexed quad conversion for new API 2022-11-02 17:46:07 +00:00
498b4966d3 Avoid crashing on unmapped buffers
Just log a warning instead
2022-11-02 17:46:07 +00:00
9f2b20443b Implement Maxwell3D draws 2022-11-02 17:46:07 +00:00
5020478ace Always rebind pipeline if it has changed from the previous draw 2022-11-02 17:46:07 +00:00
af1b4ca4f8 Skip clears if attachments are invalid 2022-11-02 17:46:07 +00:00
01a5e95ce1 Implement non-indexed quad conversion support in new GPU
Uses memory::Buffer directly to allow for cleaner recreation and allow for removing host-only buffers from Buffer in the future.
2022-11-02 17:46:07 +00:00
d42814bdc1 Add callback for when non-Maxwell3D engines alter pipeline state
This is required so that Maxwell3D knows to restore all dynamic state before the next draw
2022-11-02 17:46:07 +00:00
7133c5d6b3 Drop exclusiveSubpass in favour of only ending RPs when attachments change
Significantly helps Mali performance by avoiding creating an excessive number of RPs.
2022-11-02 17:46:07 +00:00
a3f38c0cf7 Add perfetto tracepoints to async record 2022-11-02 17:46:07 +00:00
6dfef095e8 Up default record slot count to 6 2022-11-02 17:46:07 +00:00
7d3a117a6f Use a spinlock for descriptor set allocator 2022-11-02 17:46:07 +00:00
78ddd03d1f Mark newly allocated descriptor slots as active 2022-11-02 17:46:07 +00:00
0867c593be Support binding pipelines in state updater 2022-11-02 17:46:07 +00:00
f42a0df72c Use ctSelect register for colour targets and impl null color attachments
Some games have invalid colour attachments sandwiched inbetween valid ones, these need to be skipped in Vulkan with UNUSED_ATTACHMENT
2022-11-02 17:46:07 +00:00
38aad21d29 Share single flag variable for Maxwell3D batch draw/constant buffer update
Slightly cheaper
2022-11-02 17:46:07 +00:00
bd7eee8e2b Optimise GPFIFO command processing
GPFIFO code is very high throughput due to the sheer number of commands used for rendering. Adjust some types and switch to a if statement with hints to slightly increase processing speed.
2022-11-02 17:46:07 +00:00
2cdf6c1fe6 Add branch hint attributes to a couple branches 2022-11-02 17:46:07 +00:00
b310b99bdc Handle unmapped ranges in TranslateRange 2022-11-02 17:46:07 +00:00
acfa58ea8c State uopdater MERGEBACK desC 2022-11-02 17:46:07 +00:00
68b6b20f78 Bunch of cleanup/bugfixes for initial pipeline desc set impl
Cleans up code slightly, fixes keeping track of per-stage descriptor counts and fixes storage buffer caching + more random stuff.
2022-11-02 17:46:07 +00:00
eb4a9bab11 Mark freshly allocated descriptor slots as active 2022-11-02 17:46:07 +00:00
f3184cdff1 Reorder active descriptor set slots to end of list
Speeds up allocations by significantly reducing the number of needed atomic ops per alloc. Could be optimised further in the future if needed.
2022-11-02 17:46:07 +00:00
128b68d8b2 Avoid resetting command buffers manually it's implicit
Somewhat costly on adreno, and with the one time submit flag the reset is implicit for the next beginCommandBuffers call.
2022-11-02 17:46:07 +00:00
e1717ed811 Implement Maxwell samplers 2022-11-02 17:46:07 +00:00
f1600f5ad0 Support allocating into spans in the linear allocator 2022-11-02 17:46:07 +00:00
04cea9239f Implement descriptor set updating through StateUpdater
Will automatically resolve buffer views at record-time into descriptor write/copy structures then apply the write and bind the set.
2022-11-02 17:46:07 +00:00
d174ca950b Revert "Reset executor command buffers asynchronously"
This reverts commit fc7956df4ff56fdb2afc4b2bb0bbca82196179ca.
2022-11-02 17:46:07 +00:00
2bbe975ea7 Reset executor command buffers asynchronously
This took a little while to do on qcom drivers, moving it to the cycle waiter thread gives a tiny speedup.
2022-11-02 17:46:07 +00:00
054d32567d Allow mutation of input data by callback in CircularQueue::AppendTranform 2022-11-02 17:46:07 +00:00
7c9212743c Implement asynchronous command recording
Recording of command nodes into Vulkan command buffers is very easily parallelisable as it can effectively be treated as part of the GPU execution, which is inherently async. By moving it to a seperate thread we can shave off about 20% of GPFIFO execution time. It should be noted that the command scheduler command buffer infra is no longer used, since we need to record texture updates on the GPFIFO thread (while another slot is being recorded on the record thread) and then use the same command buffer on the record thread later. This ends up requiring a pool per slot, which is reasonable considering we only have four slots by default.
2022-11-02 17:46:07 +00:00
a197dd2b28 Allow for creating signalled fence cycles 2022-11-02 17:46:07 +00:00
542651232b Add a mutex to allow preventing buffer recreation 2022-11-02 17:46:07 +00:00
379b4f163d Implement popping from CircularQueue 2022-11-02 17:46:07 +00:00
6d9dc9c6fb Implement some more of Draw
Now performs VK state updates on execution and takes advantage of quick descriptor binding.
2022-11-02 17:46:07 +00:00
3b26f4f48a Expose way to check inter-pipeline descriptor compatibility
Allows users to skip/use quick descriptor sync even after switching pipelines.
2022-11-02 17:46:07 +00:00
943a38e168 Implement StateUpdater for rapid recording of VK state updates
Using command executor for each state individual update was found to be infeasible due to the shear number of state updates per draw and it relying on per-node heap allocations. Instead this commit takes advantage of each state update being used only once to implement a system of linearly-allocated state update commands that are linked together. After setting up all draw state with StateUpdateBuilder, the built StateUpdater can then be used in the execution phase to record all of the draw state into the command buffer with almost zero ovehead.
2022-11-02 17:46:07 +00:00
7b4da52445 Add a fast binding sync path for when only one cbuf has changed
SMO implements instanced draws by repeating the same draw just with a different constant buffer bound. Reduce the cost of this significantly by detecting such cases and instead of processing every descriptor, copy the previous descriptor set and update only the ones affected by the bound constant buffer.

Credits to ripinperiperi for the initial idea and making me aware of how SMO does these draws
2022-11-02 17:46:07 +00:00
89edd9b303 Reset megabuffer binding for disabled vertex buffers 2022-11-02 17:46:07 +00:00
6a1615a104 Expose color and depth attachments to Draw 2022-11-02 17:46:07 +00:00
aae957819e Simplify BufferView locking by requiring buffer manager be locked
Avoids the need to repeat the lookup after locking since recreations are impossible if buffer manager is locked.
2022-11-02 17:46:07 +00:00
9449b52f36 Reduce minimum megabuffer alignment to 128 bytes 2022-11-02 17:46:07 +00:00
b3cf9c40ba Update megabuffer execution/sequence numbers after updating an allocation 2022-11-02 17:46:07 +00:00
4b2b6fc6e9 Avoid calling SynchronizeGuest when attempting to megabuffer unless necessary 2022-11-02 17:46:07 +00:00
e5919e84a1 Pipeline state if statment cleanups 2022-11-02 17:46:07 +00:00
bf536aa168 Sync pipeline descriptors every draw 2022-11-02 17:46:07 +00:00
9223d7f524 Fix descriptor initialisation order
They need to be setup before the pipeline is created to avoid passing in garbage data.
2022-11-02 17:46:07 +00:00
4652cc5a0a Avoid parsing descriptors for disabled shader stages 2022-11-02 17:46:07 +00:00
3456fb39fa Fix pipeline to shader stage conversion when filling in shader infos
The two vertex pipeline stages need to be both treated as a single stage, and all subsequent stages need to be offset by -1
2022-11-02 17:46:07 +00:00