Commit graph

3817 commits

Author SHA1 Message Date
Nguyen Dac Nam
a8508f2bc0
clang-format fix 2020-02-19 11:02:59 +07:00
Nguyen Dac Nam
556f3a6e9a
shader_conversion: add conversion I2F for Short 2020-02-19 10:54:37 +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
Fernando Sahmkow
93acfbd3a5
Merge pull request #3409 from ReinUsesLisp/host-queries
query_cache: Implement a query cache and query 21 (samples passed)
2020-02-18 11:31:06 -04: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
bfda5ff3f6 texture_cache: Avoid matches in 3D textures
Code before this commit was trying to match 3D textures with another
target. Fix that.
2020-02-16 04:15:42 -03:00
ReinUsesLisp
fd62bdf377 surface_base: Implement texture buffer flushes
Implement downloads to guest memory from texture buffers on the generic
cache and OpenGL.
2020-02-16 04:13:27 -03:00
bunnei
0f70f68fb3
Revert "video_core: memory_manager: Use GPU interface for cache functions." 2020-02-15 17:47:15 -05:00
ReinUsesLisp
14c2a4a2ec texture: Implement R32I 2020-02-15 16:26:50 -03:00
ReinUsesLisp
6910ade146 shader/texture: Allow 2D shadow arrays and simplify code
Shadow sampler 2D arrays are supported on OpenGL, so there's no reason
to forbid these. Enable textureLod usage on these.

Minor style changes.
2020-02-15 02:36:28 -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
6d3a046caa query_cache: Address feedback 2020-02-14 17:38:27 -03:00
ReinUsesLisp
54a00ee4cf query_cache: Fix ambiguity in CacheAddr getter 2020-02-14 17:38:27 -03:00
ReinUsesLisp
cc0694559f query_cache: Add a recursive mutex for concurrent usage 2020-02-14 17:38:27 -03:00
ReinUsesLisp
bcd348f238 vk_query_cache: Implement generic query cache on Vulkan 2020-02-14 17:38:27 -03:00
ReinUsesLisp
c31382ced5 query_cache: Abstract OpenGL implementation
Abstract the current OpenGL implementation into the VideoCommon
namespace and reimplement it on top of that. Doing this avoids repeating
code and logic in the Vulkan implementation.
2020-02-14 17:38:27 -03:00
ReinUsesLisp
73d2d3342d gl_query_cache: Optimize query cache
Use a custom cache instead of relying on a ranged cache.
2020-02-14 17:38:27 -03:00
ReinUsesLisp
aae8c180cb gl_query_cache: Implement host queries using a deferred cache
Instead of waiting immediately for executed commands, defer the query
until the guest CPU reads it. This way we get closer to what the guest
program is doing.

To archive this we have to build a dependency queue, because host APIs
(like OpenGL and Vulkan) use ranged queries instead of counters like
NVN.

Waiting for queries implicitly uses fences and this requires a command
being queued, otherwise the driver will lock waiting until a timeout. To
fix this when there are no commands queued, we explicitly call glFlush.
2020-02-14 17:33:13 -03:00
ReinUsesLisp
ef9920e164 gl_rasterizer: Sort method declarations 2020-02-14 17:27:17 -03:00
ReinUsesLisp
fe1238be7a gl_rasterizer: Add queued commands counter
Keep track of the queued OpenGL commands that can signal a fence if
waited on. As a side effect, we avoid calls to glFlush when no commands
are queued.
2020-02-14 17:27:17 -03:00
ReinUsesLisp
2b58652f08 maxwell_3d: Slow implementation of passed samples (query 21)
Implements GL_SAMPLES_PASSED by waiting immediately for queries.
2020-02-14 17:27:17 -03:00
bunnei
63a59b9935
Merge pull request #3379 from ReinUsesLisp/cbuf-offset
shader/decode: Fix constant buffer offsets
2020-02-14 13:22:53 -05:00
ReinUsesLisp
3217400dd1 gl_resource_manager: Add managed query class 2020-02-13 22:25:55 -03:00
bunnei
3563af2364
Merge pull request #3395 from FernandoS27/queries
GPU: Refactor queries implementation and correct GPU Clock.
2020-02-13 20:18:26 -05:00
ReinUsesLisp
336a4f8e99 gl_rasterizer: Use the least generic OpenGL draw function possible
This may help some implementations.
2020-02-13 21:55:21 -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
Fernando Sahmkow
d6ed31b9fa GPU: Address Feedback. 2020-02-13 18:16:07 -04:00
bunnei
37f1cf8cbd
Merge pull request #3376 from ReinUsesLisp/point-sprite
gl_rasterizer: Implement GL_POINT_SPRITE
2020-02-11 08:26:07 -05:00
Fernando Sahmkow
8e9a4944db GPU: Implement GPU Clock correctly. 2020-02-10 10:44:54 -04:00
Fernando Sahmkow
0cb3bcfbb7 Maxwell3D: Correct query reporting. 2020-02-10 10:41:43 -04:00
bunnei
84ea9c2b42 Merge pull request #3372 from ReinUsesLisp/fix-back-stencil
maxwell_3d: Fix stencil back mask
2020-02-09 22:29:28 -05:00
bunnei
e210835dd0
Merge pull request #3387 from bunnei/gpu-mpscqueue
gpu_thread: Use MPSCQueue for GPU commands.
2020-02-08 21:15:48 -05:00
bunnei
b5c13ee0eb gpu_thread: Use MPSCQueue for GPU commands.
- Necessary for multiple service threads.
2020-02-07 23:01:23 -05:00
bunnei
7cacb08cdf video_core: memory_manager: Use GPU interface for cache functions. 2020-02-07 22:59:35 -05:00
bunnei
90bda66028
Merge pull request #3378 from ReinUsesLisp/uscaled
maxwell_to_gl: Implement R8G8_USCALED
2020-02-07 22:55:52 -05:00
bunnei
90df4b8e2b
Merge pull request #3369 from ReinUsesLisp/shf
shader/shift: Implement SHF
2020-02-07 22:06:57 -05:00
bunnei
09d766d357
Merge pull request #3362 from ReinUsesLisp/fix-instanced
gl_rasterizer: Fix instanced draw arrays
2020-02-06 21:39:59 -05:00
ReinUsesLisp
bf9a822b87 shader/decode: Fix constant buffer offsets
Some instances were using cbuf34.offset instead of cbuf34.GetOffset().
This returned the an invalid offset. Address those instances and rename
offset to "shifted_offset" to avoid future bugs.
2020-02-05 12:19:09 -03:00
ReinUsesLisp
8bb9eef97b maxwell_to_gl: Implement R8G8_USCALED 2020-02-04 21:32:36 -03:00
ReinUsesLisp
c81c361e82 maxwell_to_gl: Reduce unimplemented formats to LOG_ERROR 2020-02-04 21:32:08 -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
08c508b1c4
Merge pull request #3357 from ReinUsesLisp/bfi-rc
shader/bfi: Implement register-constant buffer variant
2020-02-04 15:14:13 -05:00
ReinUsesLisp
7da52673d0 gl_rasterizer: Implement GL_POINT_SPRITE
OpenGL core defaults to GL_POINT_SPRITE, meanwhile on OpenGL
compatibility we have to explicitly enable it. This fixes
gl_PointCoord's behaviour.
2020-02-04 15:19:45 -03:00
bunnei
bf21aacc74
Merge pull request #3356 from ReinUsesLisp/fcmp
shader/arithmetic: Implement FCMP
2020-02-04 11:36:59 -05:00
bunnei
c31ec00d67
Merge pull request #3337 from ReinUsesLisp/vulkan-staged
yuzu: Implement Vulkan frontend
2020-02-03 16:56:25 -05:00
ReinUsesLisp
4eed744277 maxwell_3d: Fix stencil back mask 2020-02-02 17:50:46 -03:00
ReinUsesLisp
223a89a19f shader: Remove curly braces initializers on shared pointers 2020-02-01 22:52:10 -03: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
729ca120e3 shader/shift: Implement SHIFT_RIGHT_{IMM,R}
Shifts a pair of registers to the right and returns the low register.
2020-02-01 21:20:02 -03:00
ReinUsesLisp
017474c3f8 shader/shift: Implement SHF_LEFT_{IMM,R}
Shifts a pair of registers to the left and returns the high register.
2020-02-01 21:19:44 -03:00
bunnei
c593e45dbd
Merge pull request #3347 from ReinUsesLisp/local-mem
shader/memory: Implement LDL.S16, LDS.S16, STL.S16 and STS.S16
2020-01-30 10:59:52 -05:00
ReinUsesLisp
b69321650e gl_rasterizer: Fix instanced draw arrays
glDrawArrays was being used when the draw had a base instance specified.
This commit removes the draw parameters abstraction and fixes the
mentioned issue.
2020-01-30 02:22:00 -03:00
bunnei
2db7adc42a
Merge pull request #3350 from ReinUsesLisp/atom
shader/memory: Implement ATOM.ADD
2020-01-29 16:49:54 -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
9f0162e4b5 shader/other: Fix skips for SYNC and BRK 2020-01-29 17:53:11 -03:00
ReinUsesLisp
270177f38a shader/other: Stub S2R LaneId 2020-01-29 17:53:11 -03:00
ReinUsesLisp
b35449c85d buffer_cache: Delay buffer destructions
Delay buffer destruction some extra frames to avoid destroying buffers
that are still being used from older frames. This happens on Nvidia's
driver with mailbox.
2020-01-29 17:53:11 -03:00
bunnei
b11aeced18
Merge pull request #3355 from ReinUsesLisp/break-down
texture_cache/surface_base: Fix layered break down
2020-01-29 12:29:56 -05:00
bunnei
91f79225e7
Merge pull request #3358 from ReinUsesLisp/implicit-texture-cache
gl_texture_cache: Silence implicit sign cast warnings
2020-01-29 11:23:50 -05:00
bunnei
c457e47297
Merge pull request #3359 from ReinUsesLisp/assert-point-size
gl_shader_decompiler: Remove UNIMPLEMENTED for gl_PointSize
2020-01-28 15:19:51 -05:00
ReinUsesLisp
8178fe8960 gl_shader_decompiler: Remove UNIMPLEMENTED for gl_PointSize
This was implemented by a previous commit and it's no longer required.
2020-01-28 16:32:30 -03:00
ReinUsesLisp
abae795986 gl_texture_cache: Silence implicit sign cast warnings 2020-01-27 20:59:11 -03:00
ReinUsesLisp
137a8aa55c shader/bfi: Implement register-constant buffer variant
It's the same as the variant that was implemented, but it takes the
operands from another source.
2020-01-27 01:20:38 -03:00
ReinUsesLisp
e3fc3459c8 shader/arithmetic: Implement FCMP
Compares the third operand with zero, then selects between the first and
second.
2020-01-27 01:15:44 -03:00
ReinUsesLisp
f55f6ff9bb texture_cache/surface_base: Fix layered break down
Layered break downs was passing "layer" as a "depth" parameter. This
commit addresses that.
2020-01-26 21:48:07 -03:00
ReinUsesLisp
d17dfa6104 gl_texture_cache: Properly implement depth/stencil sampling
This addresses the long standing issue of compatibility vs. core
profiles on OpenGL, properly implementing depth vs. stencil sampling
depending on the texture swizzle.
2020-01-26 21:44:08 -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
ReinUsesLisp
d26e74f0a3 shader/memory: Implement STL.S16 and STS.S16 2020-01-25 03:16:10 -03:00
ReinUsesLisp
9a2cdf8520 shader/memory: Implement unaligned LDL.S16 and LDS.S16 2020-01-25 03:16:10 -03:00
ReinUsesLisp
531f25a037 shader/memory: Move unaligned load/store to functions 2020-01-25 03:16:10 -03:00
ReinUsesLisp
96638f57c9 shader/memory: Implement LDL.S16 and LDS.S16 2020-01-25 03:15:55 -03:00
bunnei
dfd998216c
Merge pull request #3344 from ReinUsesLisp/vk-botw
vk_shader_decompiler: Disable default values on unwritten render targets
2020-01-24 17:31:55 -05:00
Fernando Sahmkow
806f569143 Shader_IR: Change name of TrackSampler function so it does not confuse with the type. 2020-01-24 16:44:48 -04:00
Fernando Sahmkow
3919b7b8a9 Shader_IR: Corrections, styling and extras. 2020-01-24 16:44:48 -04:00
Fernando Sahmkow
37b8504faa Shader_IR: Correct Custom Variable assignment. 2020-01-24 16:44:47 -04:00
Fernando Sahmkow
7c530e0666 Shader_IR: Propagate bindless index into the GL compiler. 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
Fernando Sahmkow
2b02f29a2d GL Backend: Introduce indexed samplers into the GL backend 2020-01-24 16:43:31 -04:00
Fernando Sahmkow
037ea431ce Shader_IR: deduce size of indexed samplers 2020-01-24 16:43:31 -04:00
Fernando Sahmkow
f4603d23c5 Shader_IR: Setup Indexed Samplers on the IR 2020-01-24 16:43:30 -04:00
Fernando Sahmkow
603c861532 Shader_IR: Implement initial code for tracking indexed samplers. 2020-01-24 16:43:30 -04:00
Fernando Sahmkow
64496f2456 Shader_IR: Address Feedback 2020-01-24 16:43:30 -04:00
Fernando Sahmkow
b97608ca64 Shader_IR: Allow constant access of guest driver. 2020-01-24 16:43:30 -04:00
Fernando Sahmkow
dc5cfa8d28 Shader_IR: Address Feedback 2020-01-24 16:43:29 -04:00
Fernando Sahmkow
74aa7de5e3 Guest_driver: Correct compiling errors in GCC. 2020-01-24 16:43:29 -04:00
Fernando Sahmkow
1e4b6bef6f Shader_IR: Store Bound buffer on Shader Usage 2020-01-24 16:43:29 -04:00
Fernando Sahmkow
c921e496eb GPU: Implement guest driver profile and deduce texture handler sizes. 2020-01-24 16:43:29 -04:00
bunnei
a104b985a8
Merge pull request #3273 from FernandoS27/txd-array
Shader_IR: Implement TXD Array.
2020-01-24 14:02:40 -05:00
ReinUsesLisp
1690f1adba vk_shader_decompiler: Disable default values on unwritten render targets
Some games like The Legend of Zelda: Breath of the Wild assign
render targets without writing them from the fragment shader. This
generates Vulkan validation errors, so silence these I previously
introduced a commit to set "vec4(0, 0, 0, 1)" for these attachments. The
problem is that this is not what games expect. This commit reverts that
change.
2020-01-24 01:16:21 -03:00