Commit graph

335 commits

Author SHA1 Message Date
ReinUsesLisp
d8d392b39a renderer_vulkan/wrapper: Add owning handle templated class 2020-03-27 03:21:04 -03:00
ReinUsesLisp
60f351084a renderer_vulkan/wrapper: Add destroy and free overload set 2020-03-27 03:21:04 -03:00
ReinUsesLisp
a9e4528d10 renderer_vulkan/wrapper: Add dispatch table and loaders 2020-03-27 03:21:04 -03:00
ReinUsesLisp
3f0b7673f0 renderer_vulkan/wrapper: Add exception class 2020-03-27 03:21:04 -03:00
ReinUsesLisp
f5cee0e885 renderer_vulkan/wrapper: Add ToString function for VkResult 2020-03-27 03:21:03 -03:00
ReinUsesLisp
92c8d783b3 renderer_vulkan/wrapper: Add Vulakn wrapper and a span helper
The intention behind a Vulkan wrapper is to drop Vulkan-Hpp.

The issues with Vulkan-Hpp are:
- Regular breaks of the API.
- Copy constructors that do the same as the aggregates (fixed recently)
- External dynamic dispatch that is hard to remove
- Alias KHR handles with non-KHR handles making it impossible to use
smart handles on Vulkan 1.0 instances with extensions that were included
on Vulkan 1.1.
- Dynamic dispatchers silently change size depending on preprocessor
definitions. Different files will have different dispatch definitions,
generating all kinds of hard to debug memory issues.

In other words, Vulkan-Hpp is not "production ready" for our needs and
this wrapper aims to replace it without losing RAII and exception
safety.
2020-03-27 03:13:18 -03:00
Dan
744b207d92 maxwell_to_vk: implement signedscaled vertex formats 2020-03-27 00:14:19 +01:00
James Rowe
282adfc70b Frontend/GPU: Refactor context management
Changes the GraphicsContext to be managed by the GPU core. This
eliminates the need for the frontends to fool around with tricky
MakeCurrent/DoneCurrent calls that are dependent on the settings (such
as async gpu option).

This also refactors out the need to use QWidget::fromWindowContainer as
that caused issues with focus and input handling. Now we use a regular
QWidget and just access the native windowHandle() directly.

Another change is removing the debug tool setting in FrameMailbox.
Instead of trying to block the frontend until a new frame is ready, the
core will now take over presentation and draw directly to the window if
the renderer detects that its hooked by NSight or RenderDoc

Lastly, since it was in the way, I removed ScopeAcquireWindowContext and
replaced it with a simple subclass in GraphicsContext that achieves the
same result
2020-03-24 21:03:42 -06:00
ReinUsesLisp
38c1e77f01 vk_texture_cache: Silence misc warnings 2020-03-18 20:03:19 -03:00
ReinUsesLisp
b6b2e31e5e vk_staging_buffer_pool: Silence unused constant warning 2020-03-18 20:03:19 -03:00
ReinUsesLisp
fc51ece7bf vk_rasterizer: Remove unused variable 2020-03-18 20:03:19 -03:00
ReinUsesLisp
98d85cdc20 vk_pipeline_cache: Remove unused variable 2020-03-18 20:03:19 -03:00
ReinUsesLisp
dab450ec46 maxwell_to_vk: Sielence -Wswitch warning 2020-03-18 20:03:19 -03:00
Mat M
edb9cccb36
Merge pull request #3510 from FernandoS27/dirty-write
DirtyFlags: relax need to set render_targets as dirty
2020-03-17 17:29:22 -04:00
Mat M
d787856621
Merge pull request #3518 from ReinUsesLisp/scissor-clears
vk_rasterizer: Implement scissor clears and layered clears
2020-03-17 17:27:15 -04:00
Mat M
9fdfd58f9f
Merge pull request #3519 from ReinUsesLisp/int-formats
maxwell_to_vk: Implement RG32 and RGB32 integer vertex formats
2020-03-17 17:26:16 -04:00
Rodrigo Locatti
b16c8e0e8d
Merge pull request #3515 from ReinUsesLisp/vertex-vk-assert
vk_rasterizer: Fix vertex range assert
2020-03-15 21:26:54 -03:00
Rodrigo Locatti
7cc46a6faa
Merge pull request #3501 from ReinUsesLisp/rgba16-snorm
video_core: Implement RGBA16_SNORM
2020-03-15 21:24:53 -03:00
Rodrigo Locatti
d64edf21bb
Merge pull request #3503 from makigumo/patch-2
maxwell_to_vk: add vertex format eA2B10G10R10UnormPack32
2020-03-15 21:21:38 -03:00
ReinUsesLisp
52acb7f9a0 maxwell_to_vk: Implement RG32 and RGB32 integer vertex formats 2020-03-15 18:51:49 -03:00
ReinUsesLisp
71cc772988 vk_rasterizer: Implement layered clears 2020-03-15 18:37:19 -03:00
makigumo
f91046bf8d
vk_shader_decompiler: fix linux build 2020-03-15 18:00:14 +01:00
ReinUsesLisp
a7131af7d6 vk_rasterizer: Fix vertex range assert
End can be equal to start in CalculateVertexArraysSize. This is quite
common when the vertex size is zero.
2020-03-15 04:04:17 -03:00
ReinUsesLisp
8baf98e439 vk_rasterizer: Reimplement clears with vkCmdClearAttachments 2020-03-15 03:40:41 -03:00
Fernando Sahmkow
380fc8d2e1 DirtyFlags: relax need to set render_targets as dirty
The texture cache already takes care of setting a render target to dirty 
when invalidated.
2020-03-14 11:47:33 -04:00
ReinUsesLisp
69c7a01f88 vk/gl_shader_decompiler: Silence assertion on compute 2020-03-13 18:33:05 -03:00
ReinUsesLisp
62560f1e63 vk_shader_decompiler: Fix default varying regression 2020-03-13 18:33:05 -03:00
Rodrigo Locatti
47459f6a36 vk_shader_decompiler: Fix implicit type conversion
Co-Authored-By: Mat M. <mathew1800@gmail.com>
2020-03-13 18:33:05 -03:00
ReinUsesLisp
2fae1e6205 vk_rasterizer: Implement transform feedback binding zero 2020-03-13 18:33:05 -03:00
ReinUsesLisp
b67360c0f8 vk_shader_decompiler: Add XFB decorations to generic varyings 2020-03-13 18:33:05 -03:00
ReinUsesLisp
8d5bdcb17b vk_device: Enable VK_EXT_transform_feedback when available 2020-03-13 18:33:05 -03:00
ReinUsesLisp
c320702092 vk_device: Shrink formatless capability name size 2020-03-13 18:33:05 -03:00
ReinUsesLisp
7acebd7eb6 vk_shader_decompiler: Use registry for specialization 2020-03-13 18:33:05 -03:00
Rodrigo Locatti
244fe13219
Merge branch 'master' into shader-purge 2020-03-13 16:44:06 -03:00
makigumo
753bc2026f
fix formatting 2020-03-13 11:37:24 +01:00
makigumo
54681909be
maxwell_to_vk: add vertex format eA2B10G10R10UnormPack32 2020-03-13 11:26:13 +01:00
Fernando Sahmkow
00e9ba0603
Merge pull request #3483 from namkazt/patch-1
vk_rasterizer: fix mistype on SetupGraphicsImages
2020-03-12 22:10:48 -04:00
Fernando Sahmkow
f159a12820
Merge pull request #3480 from ReinUsesLisp/vk-disabled-ubo
vk_rasterizer: Support disabled uniform buffers
2020-03-12 22:09:49 -04:00
ReinUsesLisp
4dcca90ef4 video_core: Implement RGBA16_SNORM
Implement RGBA16_SNORM with the current API. Nothing special here.
2020-03-12 21:42:33 -03:00
ReinUsesLisp
e8efd5a901 video_core: Rename "const buffer locker" to "registry" 2020-03-09 18:40:06 -03:00
Rodrigo Locatti
22e825a3bc
Merge pull request #3301 from ReinUsesLisp/state-tracker
video_core: Remove gl_state and use a state tracker based on dirty flags
2020-03-09 18:34:37 -03:00
Nguyen Dac Nam
16cfbb068c
vk_reasterizer: fix mistype on SetupGraphicsImages
This should use Maxwell3D engine. Fixed some GPU error on Kirby and maybe other games.
2020-03-08 10:06:59 +07:00
bunnei
662feb8c1c
Merge pull request #3481 from ReinUsesLisp/abgr5-storage
maxwell_to_vk: Remove Storage capability for A1B5G5R5U
2020-03-07 19:51:33 -05:00
ReinUsesLisp
e4f9ce0379 vk_rasterizer: Support disabled uniform buffers 2020-03-06 18:47:51 -03:00
ReinUsesLisp
aa6fe3f1aa maxwell_to_vk: Remove Storage capability for A1B5G5R5U 2020-03-06 18:47:27 -03:00
bunnei
49eff536d0
Merge pull request #3463 from ReinUsesLisp/vk-toctou
vk_swapchain: Silence TOCTOU race condition
2020-03-05 19:38:42 -05:00
bunnei
0361aa1915
Merge pull request #3451 from ReinUsesLisp/indexed-textures
vk_shader_decompiler: Implement indexed textures
2020-03-05 11:42:46 -05:00
bunnei
67e7186d79
Merge pull request #3455 from ReinUsesLisp/attr-scaled
video_core: Implement more scaled attribute formats
2020-03-03 22:46:20 -05:00
ReinUsesLisp
ac204754d4 dirty_flags: Deduplicate code between OpenGL and Vulkan 2020-02-28 17:56:43 -03:00
ReinUsesLisp
6669b359a3 vk_rasterizer: Pass Maxwell registers to dynamic updates 2020-02-28 17:56:43 -03:00
ReinUsesLisp
042256c6bb state_tracker: Remove type traits with named structures 2020-02-28 17:56:43 -03:00
ReinUsesLisp
6ac3eb4d87 vk_state_tracker: Implement dirty flags for stencil properties 2020-02-28 17:56:43 -03:00
ReinUsesLisp
f9df2c6bcd vk_state_tracker: Implement dirty flags for depth bounds 2020-02-28 17:56:43 -03:00
ReinUsesLisp
cd0e28c9ec vk_state_tracker: Implement dirty flags for blend constants 2020-02-28 17:56:43 -03:00
ReinUsesLisp
a33870996b vk_state_tracker: Implement dirty flags for depth bias 2020-02-28 17:56:43 -03:00
ReinUsesLisp
42f1874965 vk_state_tracker: Implement dirty flags for scissors 2020-02-28 17:56:43 -03:00
ReinUsesLisp
1bd95a314f vk_state_tracker: Initial implementation
Add support for render targets and viewports.
2020-02-28 17:56:43 -03:00
ReinUsesLisp
9e74e6988b maxwell_3d: Flatten cull and front face registers 2020-02-28 17:56:41 -03:00
ReinUsesLisp
96ac3d518a gl_rasterizer: Remove dirty flags 2020-02-28 16:39:27 -03:00
ReinUsesLisp
0aaa69e4d7 vk_swapchain: Silence TOCTOU race condition
It's possible that the window is resized from the moment we ask for its
size to the moment a swapchain is created, causing validation issues.

To workaround this Vulkan issue request the capabilities again just
before creating the swapchain, making the race condition less likely.
2020-02-26 17:07:18 -03:00
bunnei
e25297536f frontend: qt: bootmanager: Vulkan: Restore support for VK backend. 2020-02-25 21:23:01 -05:00
bunnei
78ab2e0474
Merge pull request #3417 from ReinUsesLisp/r32i
texture: Implement R32I
2020-02-25 14:08:45 -05:00
bunnei
e22ad52cdb
Merge pull request #3425 from ReinUsesLisp/layered-framebuffer
texture_cache: Implement layered framebuffer attachments
2020-02-24 10:14:50 -05:00
ReinUsesLisp
1e9213632a 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).
2020-02-24 01:26:07 -03:00
ReinUsesLisp
e2dd59e341 video_core: Implement more scaler attribute formats
While changing this, fix assert in vk_shader_decompiler. We now know
scaled formats are expected to be float in shaders attributes.
2020-02-24 00:27:37 -03:00
bunnei
2b4cdb73b6
Merge pull request #3424 from ReinUsesLisp/spirv-layer
vk_shader_decompiler: Implement Layer output attribute
2020-02-22 23:45:16 -05:00
Rodrigo Locatti
4a6a1aeab4
Merge pull request #3433 from namkazt/patch-1
renderer_vulkan: Add the rest of case for TryConvertBorderColor
2020-02-21 15:56:09 -03:00
Rodrigo Locatti
ef27b4b7b5
Merge pull request #3434 from namkazt/patch-2
vk_shader: Implement ImageLoad
2020-02-21 15:55:05 -03:00
Rodrigo Locatti
6b2719c0bb
Merge pull request #3435 from namkazt/patch-3
vulkan: add DXT23_SRGB
2020-02-21 15:48:19 -03:00
Nguyen Dac Nam
c0c4da27d9
vk_device: remove left over from other branch 2020-02-21 08:56:18 +07:00
Nguyen Dac Nam
ecf275887b
clang-format 2020-02-20 09:39:30 +07:00
Nguyen Dac Nam
fbbad95845
shader_decompiler: only add StorageImageReadWithoutFormat when available 2020-02-20 09:28:13 +07:00
bunnei
b2bc7682b4
Merge pull request #3414 from ReinUsesLisp/maxwell-3d-draw
maxwell_3d: Unify draw methods
2020-02-19 16:13:50 -05:00
Nguyen Dac Nam
88cb05e6e7
shader_decompiler: add check in case of device not support ShaderStorageImageReadWithoutFormat 2020-02-19 12:57:22 +07:00
Nguyen Dac Nam
e61c7e9310
vk_device: setup shaderStorageImageReadWithoutFormat 2020-02-19 12:56:36 +07:00
Nguyen Dac Nam
47106ab152
vk_device: add check for shaderStorageImageReadWithoutFormat 2020-02-19 12:55:56 +07:00
bunnei
e545c2322c
Merge pull request #3410 from ReinUsesLisp/vk-draw-index
vk_shader_decompiler: Fix vertex id and instance id
2020-02-18 22:37:33 -05:00
Nguyen Dac Nam
2ef8af93aa
vk_shader: add Capability StorageImageReadWithoutFormat 2020-02-19 10:16:51 +07:00
Nguyen Dac Nam
f6f0762e81 vk_shader: Implement function ImageLoad (Used by Kirby Start Allies)
Please enter the commit message for your changes. Lines starting
2020-02-19 08:39:01 +07:00
Nguyen Dac Nam
ec206f7f95
fixups mistake auto commit. 2020-02-19 01:24:32 +07:00
Nguyen Dac Nam
eaf60ca5d8
Update code structure
Co-Authored-By: Mat M. <mathew1800@gmail.com>
2020-02-19 01:23:08 +07:00
Nguyen Dac Nam
9295966d26
add vertex UnsignedInt size RGBA 2020-02-18 21:52:51 +07:00
Nguyen Dac Nam
9fc42fffd9
add eBc2SrgbBlock to formats 2020-02-18 21:44:09 +07:00
Nguyen Dac Nam
493f0ad904
vulkan: add DXT23_SRGB 2020-02-18 21:39:50 +07:00
Nguyen Dac Nam
ba84f0988f
renderer_vulkan: Add the rest of case for TryConvertBorderColor 2020-02-18 16:52:54 +07:00
ReinUsesLisp
6a0220b2e1 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.
2020-02-16 04:19:32 -03:00
ReinUsesLisp
1caf3f11c8 vk_shader_decompiler: Implement Layer output attribute
SPIR-V's Layer is GLSL's gl_Layer. It lets the application choose from a
shader stage (vertex, tessellation or geometry) which framebuffer layer
write the output fragments to.
2020-02-16 04:17:37 -03:00
ReinUsesLisp
14c2a4a2ec texture: Implement R32I 2020-02-15 16:26:50 -03:00
ReinUsesLisp
91aa58e410 maxwell_3d: Unify draw methods
Pass instanced state of a draw invocation as an argument instead of
having two separate virtual methods.
2020-02-14 18:09:40 -03:00
ReinUsesLisp
bcd348f238 vk_query_cache: Implement generic query cache on Vulkan 2020-02-14 17:38:27 -03:00
ReinUsesLisp
cbea8c74de vk_shader_decompiler: Fix vertex id and instance id
Vulkan's VertexIndex and InstanceIndex don't match with hardware. This
is because Nvidia implements gl_VertexID and gl_InstanceID. The math
that relates these is:

gl_VertexIndex = gl_BaseVertex + gl_VertexID
gl_InstanceIndex = gl_InstanceIndex + gl_InstanceID

To emulate it using what Vulkan's SPIR-V offers (the *Index variants)
this commit substracts gl_Base* from gl_*Index to obtain the OpenGL and
hardware's equivalent.
2020-02-13 20:25:28 -03:00
ReinUsesLisp
0eb36c90f4 vk_rasterizer: Use noexcept variants of std::bitset
Removes bounds checking from "texceptions" instances.
2020-02-04 18:04:24 -03:00
bunnei
c31ec00d67
Merge pull request #3337 from ReinUsesLisp/vulkan-staged
yuzu: Implement Vulkan frontend
2020-02-03 16:56:25 -05:00
bunnei
b5bbe7e752
Merge pull request #3282 from FernandoS27/indexed-samplers
Partially implement Indexed samplers in general and specific code in GLSL
2020-02-01 20:41:40 -05:00
ReinUsesLisp
f92cbc5501 yuzu: Implement Vulkan frontend
Adds a Qt and SDL2 frontend for Vulkan. It also finishes the missing
bits on Vulkan initialization.
2020-01-29 17:53:11 -03:00
ReinUsesLisp
788d57d723 settings: Add settings for graphics backend 2020-01-29 17:53:11 -03:00
ReinUsesLisp
d95d4ac843 shader/memory: Implement ATOM.ADD
ATOM operates atomically on global memory. For now only add ATOM.ADD
since that's what was found in commercial games.

This asserts for ATOM.ADD.S32 (handling the others as unimplemented),
although ATOM.ADD.U32 shouldn't be any different.

This change forces us to change the default type on SPIR-V storage
buffers from float to uint. We could also alias the buffers, but it's
simpler for now to just use uint. While we are at it, abstract the code
to avoid repetition.
2020-01-26 01:54:24 -03:00
Fernando Sahmkow
bb8eb15d39 Shader_IR: Address feedback. 2020-01-25 09:04:59 -04:00
Fernando Sahmkow
37b8504faa Shader_IR: Correct Custom Variable assignment. 2020-01-24 16:44:47 -04:00
Fernando Sahmkow
3c34678627 Shader_IR: Implement Injectable Custom Variables to the IR. 2020-01-24 16:43:31 -04:00