Commit graph

4977 commits

Author SHA1 Message Date
ReinUsesLisp 9764c13d6d video_core: Rewrite the texture cache
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.
2020-12-30 03:38:50 -03:00
ReinUsesLisp 9106ac1e6b video_core: Add a delayed destruction ring abstraction 2020-12-30 02:10:19 -03:00
ReinUsesLisp 21b18057f7 host_shaders: Add Vulkan assembler compute shaders 2020-12-30 02:03:50 -03:00
ReinUsesLisp 87ff58b1d7 host_shaders: Add helper to blit depth stencil fragment shader 2020-12-30 02:02:07 -03:00
ReinUsesLisp ae5725b709 host_shaders: Add texture color blit fragment shader 2020-12-30 02:00:48 -03:00
ReinUsesLisp 64fbf319f1 host_shaders: Add shaders to present to the swapchain 2020-12-30 01:59:12 -03:00
ReinUsesLisp 82b7daed9c host_shaders: Add shaders to convert between depth and color images 2020-12-30 01:48:44 -03:00
ReinUsesLisp dc81a90640 host_shaders: Add compute shader to copy BC4 as RG32UI to RGBA8 2020-12-30 01:47:08 -03:00
ReinUsesLisp 5169ce9fcd host_shaders: Add shader to render a full screen triangle 2020-12-30 01:44:09 -03:00
ReinUsesLisp 59c46f9de9 host_shaders: Add pitch linear upload compute shader 2020-12-30 01:41:42 -03:00
ReinUsesLisp 12d16248dd host_shaders: Add block linear upload compute shaders 2020-12-30 01:39:35 -03:00
ReinUsesLisp f20e18f60d host_shaders: Add copyright headers to OpenGL present shaders 2020-12-30 01:35:56 -03:00
ReinUsesLisp 95d156a150 video_core/host_shaders: Add support for prebuilt SPIR-V shaders
Add support for building SPIR-V shaders from GLSL and generating headers
to include the text of those same GLSL shaders to consume from OpenGL.
2020-12-30 01:29:07 -03:00
bunnei 954341763a gpu: gpu_thread: Ensure MicroProfile is shutdown on exit. 2020-12-28 21:33:34 -08:00
bunnei 4991620f89 video_core: gpu_thread: Do not wait when system is powered down. 2020-12-28 16:33:48 -08:00
bunnei 40571c073f video_core: gpu: Implement synchronous mode using threaded GPU. 2020-12-28 16:33:48 -08:00
bunnei 14c825bd1c video_core: gpu: Refactor out synchronous/asynchronous GPU implementations.
- We must always use a GPU thread now, even with synchronous GPU.
2020-12-28 16:33:48 -08:00
ReinUsesLisp 661483f313 renderer_vulkan/fixed_pipeline_state: Move enabled bindings to static state
Without using VK_EXT_robustness2, we can't consider the 'enabled' (not
null) vertex buffers as dynamic state, as this leads to invalid Vulkan
state. Move this to static state that is always hashed and compared in
the pipeline key.

The bits for enabled vertex buffers are moved into the attribute state
bitfield. This is not 'correct' as it's not an attribute state, but that
struct has bits to spare, and it's used in an array of 32 elements (the
exact same number of vertex buffer bindings).
2020-12-25 23:34:38 -03:00
Rodrigo Locatti 0dc4ab42cc
Merge pull request #5226 from ReinUsesLisp/c4715-vc
video_core: Enforce C4715 (not all control paths return a value)
2020-12-25 03:11:47 -03:00
ReinUsesLisp 1b9e08ab78 cmake: Always enable Vulkan
Removes the unnecesary burden of maintaining separate #ifdef paths and
allows us sharing generic Vulkan code across APIs.
2020-12-24 21:07:24 -03:00
ReinUsesLisp 1e191cc837 video_core: Enforce C4715 (not all control paths return a value)
Most of the time people write code that always returns a value,
terminates execution, throws an exception, or uses an unconventional
jump primitive.

This is not always true when we build without asserts on mainline builds.
To avoid introducing undefined behavior on our most used builds, enforce
this warning signalling an error and stopping the build from shipping.
2020-12-24 21:01:23 -03:00
ReinUsesLisp 5dbda22659 vk_shader_decompiler: Silence warning when compiling without asserts 2020-12-24 21:01:09 -03:00
bunnei 37bec068c2
Merge pull request #5157 from lioncash/array-dirty
maxwell_3d: Remove unused dirty_pointer array
2020-12-15 00:35:47 -08:00
bunnei d1a2b3fb18
Merge pull request #5162 from lioncash/copy-shader
gl_shader_decompiler: Elide unnecessary copies within DeclareConstantBuffers()
2020-12-10 00:11:11 -08:00
Rodrigo Locatti 3415890dd5
Merge pull request #5164 from lioncash/contains
video_core: Make use of ordered container contains() where applicable
2020-12-07 21:55:51 -03:00
Lioncash 09fa1d6a73 video_core: Make use of ordered container contains() where applicable
With C++20, we can use the more concise contains() member function
instead of comparing the result of the find() call with the end
iterator.
2020-12-07 16:30:39 -05:00
Lioncash 45c5b084fd ast: Improve string concat readability in operator()
Provides an in-place format string to make it more pleasant to read.
2020-12-07 16:15:28 -05:00
Lioncash edcbd47800 gl_shader_decompiler: Elide unnecessary copies within DeclareConstantBuffers()
Resolves a -Wrange-loop-analysis warning.
2020-12-07 14:01:52 -05:00
bunnei 5cd051eced
Merge pull request #5149 from comex/xx-map-interval
map_interval: Change field order to address uninitialized field warning
2020-12-07 10:14:02 -08:00
Rodrigo Locatti 12f3b13995
Merge pull request #5159 from lioncash/move-amend
shader_ir: std::move node within DeclareAmend()
2020-12-07 04:58:01 -03:00
Lioncash 5d2f18fbcd buffer_block: Mark interface as nodiscard where applicable
Prevents logic errors from occurring from unused values.
2020-12-07 01:53:40 -05:00
Lioncash 3954f14c6d buffer_block: Remove unnecessary includes
Reduces the amount of dependencies the header pulls in.
2020-12-07 01:52:16 -05:00
Lioncash 7234f436aa shader_ir: std::move node within DeclareAmend()
Same behavior, but elides an unnecessary atomic reference count
increment and decrement.
2020-12-07 00:51:03 -05:00
Lioncash 4c5f5c9bf3 video_core: Remove unnecessary enum class casting in logging messages
fmt now automatically prints the numeric value of an enum class member
by default, so we don't need to use casts any more.

Reduces the line noise a bit.
2020-12-07 00:41:50 -05:00
LC 23aabe85e6
Merge pull request #5152 from comex/xx-override
renderer_vulkan: Add missing `override` specifier
2020-12-07 00:07:17 -05:00
LC 69af6ada2f
Merge pull request #5136 from lioncash/video-shadow3
video_core: Resolve more variable shadowing scenarios pt.3
2020-12-07 00:06:53 -05:00
Lioncash 9e7a1f1351 maxwell_3d: Move member variables to end of class
Follows our established coding style.
2020-12-06 20:56:00 -05:00
Lioncash ce0712bf95 maxwell_3d: Resolve -Wdocumentation warning
Removes a documentation comment for a non-existent member.
2020-12-06 20:48:12 -05:00
Lioncash bcc5c4403a maxwell_3d: Remove unused dirty_pointer array
This is unused and removing it shrinks the structure by 3584 bytes.
2020-12-06 20:46:57 -05:00
comex eea5122d1b renderer_vulkan: Add missing override specifier 2020-12-06 18:38:52 -05:00
comex b8fbf6969c map_interval: Change field order to address uninitialized field warning
Clang complains about `new_chunk`'s constructor using the
then-uninitialized `first_chunk` (even though it's just to get a pointer
into it).
2020-12-06 18:37:23 -05:00
comex d637114c17 video_core: Adjust NUM macro to avoid Clang warning
The previous definition was:

    #define NUM(field_name) (sizeof(Maxwell3D::Regs::field_name) / sizeof(u32))

In cases where `field_name` happens to refer to an array, Clang thinks
`sizeof(an array value) / sizeof(a type)` is an instance of the idiom
where `sizeof` is used to compute an array length.  So it thinks the
type in the denominator ought to be the array element type, and warns if
it isn't, assuming this is a mistake.

In reality, `NUM` is not used to get array lengths at all, so there is no
mistake.  Silence the warning by applying Clang's suggested workaround
of parenthesizing the denominator.
2020-12-06 18:24:16 -05:00
comex a6e6cd5788 maxwell_dma: Rename RenderEnable::Mode::FALSE and TRUE to avoid name conflict
On Apple platforms, FALSE and TRUE are defined as macros by
<mach/boolean.h>, which is included by various system headers.

Note that there appear to be no actual users of the names to fix up.
2020-12-05 17:59:02 -05:00
Lioncash f95602f152 video_core: Resolve more variable shadowing scenarios pt.3
Cleans out the rest of the occurrences of variable shadowing and makes
any further occurrences of shadowing compiler errors.
2020-12-05 16:02:23 -05:00
Lioncash 414a87a4f4 video_core: Resolve more variable shadowing scenarios pt.2
Migrates the video core code closer to enabling variable shadowing
warnings as errors.

This primarily sorts out shadowing occurrences within the Vulkan code.
2020-12-05 06:39:35 -05:00
bunnei e6a896c4bd
Merge pull request #5124 from lioncash/video-shadow
video_core: Resolve more variable shadowing scenarios
2020-12-05 00:48:08 -08:00
bunnei 63419e144f
Merge pull request #5127 from FearlessTobi/port-5617
Port citra-emu/citra#5617: "Fix telemetry-related exit crash from use-after-free"
2020-12-04 21:57:40 -08:00
FearlessTobi 37d672bf08 Fix telemetry-related exit crash from use-after-free
Co-Authored-By: xperia64 <xperia64@users.noreply.github.com>
2020-12-05 02:42:50 +01:00
Lioncash 94af77aa7c codec: Remove deprecated usage of AVCodecContext::refcounted_frames
This was only necessary for use with the
avcodec_decode_video2/avcoded_decode_audio4 APIs which are also
deprecated.

Given we use avcodec_send_packet/avcodec_receive_frame, this isn't
necessary, this is even indicated directly within the FFmpeg API changes
document here on 2017-09-26:

https://github.com/FFmpeg/FFmpeg/blob/master/doc/APIchanges#L410

This prevents our code from breaking whenever we update to a newer
version of FFmpeg in the future if they ever decide to fully remove this
API member.
2020-12-04 16:23:13 -05:00
Lioncash 677a8b208d video_core: Resolve more variable shadowing scenarios
Resolves variable shadowing scenarios up to the end of the OpenGL code
to make it nicer to review. The rest will be resolved in a following
commit.
2020-12-04 16:19:09 -05:00
bunnei fad38ec6e8
Merge pull request #5064 from lioncash/node-shadow
node: Eliminate variable shadowing
2020-12-04 00:45:33 -08:00
Lioncash edd8208779 node: Mark member functions as [[nodiscard]] where applicable
Prevents logic bugs from accidentally ignoring the return value.
2020-12-03 16:03:34 -05:00
Lioncash 7cf34c3637 node: Eliminate variable shadowing 2020-12-03 15:59:38 -05:00
Lioncash cf9767c608 vp9/vic: Resolve pessimizing moves
Removes the usage of moves that don't result in behavior different from
a copy, or otherwise would prevent copy elision from occurring.
2020-12-03 12:33:07 -05:00
bunnei 9abb23cd27
Merge pull request #5002 from ameerj/nvdec-frameskip
nvdec: Queue and display all decoded frames, cleanup decoders
2020-12-02 15:55:15 -08:00
bunnei 7b4a213603
Merge pull request #5013 from ReinUsesLisp/vk-early-z
vk_shader_decompiler: Implement force early fragment tests
2020-11-30 11:11:07 -08:00
comex 4681e1ea9e codec: Fix pragma GCC diagnostic pop missing corresponding push 2020-11-26 16:35:42 -05:00
ReinUsesLisp 2ccf85a910 vk_shader_decompiler: Implement force early fragment tests
Force early fragment tests when the 3D method is enabled.
The established pipeline cache takes care of recompiling if needed.

This is implemented only on Vulkan to avoid invalidating the shader
cache on OpenGL.
2020-11-26 17:52:26 -03:00
ameerj 979b602738 Limit queue size to 10 frames
Workaround for ZLA, which seems to decode and queue twice as many frames as it displays.
2020-11-26 14:04:06 -05:00
bunnei 322349e8cc
Merge pull request #4975 from comex/invalid-syncpoint-id
nvdrv, video_core: Don't index out of bounds when given invalid syncpoint ID
2020-11-26 01:27:24 -08:00
ameerj c9e3abe206 Address PR feedback
remove some redundant moves, make deleter match naming guidelines.

Co-Authored-By: LC <712067+lioncash@users.noreply.github.com>
2020-11-26 00:18:26 -05:00
Rodrigo Locatti 0e15c68f54
Merge pull request #4976 from comex/poll-events
Overhaul EmuWindow::PollEvents to fix yuzu-cmd calling SDL_PollEvents off main thread
2020-11-25 20:44:53 -03:00
ameerj eab041866b Queue decoded frames, cleanup decoders 2020-11-25 17:10:44 -05:00
ameerj d52ee6d0a7 cleanup unneeded comments and newlines 2020-11-25 14:46:08 -05:00
ameerj e87670ee48 Refactor MaxwellToSpirvComparison. Use Common::BitCast
Co-Authored-By: Rodrigo Locatti <reinuseslisp@airmail.cc>
2020-11-25 00:33:20 -05:00
ameerj 1dbf71ceb3 Address PR feedback from Rein 2020-11-24 22:46:45 -05:00
ameerj 9014861858 vulkan_renderer: Alpha Test Culling Implementation
Used by various textures in many titles, e.g.  SSBU menu.
2020-11-24 22:46:45 -05:00
comex e8b2fd21d8 nvdrv, video_core: Don't index out of bounds when given invalid syncpoint ID
- Use .at() instead of raw indexing when dealing with untrusted indices.

- For the special case of WaitFence with syncpoint id UINT32_MAX,
  instead of crashing, log an error and ignore.  This is what I get when
  running Super Mario Maker 2.
2020-11-24 12:59:41 -05:00
Rodrigo Locatti fbda5e9ec9
Merge pull request #3681 from lioncash/component
decoder/image: Fix incorrect G24R8 component sizes in GetComponentSize()
2020-11-24 04:38:03 -03:00
comex 994f497781 Overhaul EmuWindow::PollEvents to fix yuzu-cmd calling SDL_PollEvents off main thread
EmuWindow::PollEvents was called from the GPU thread (or the CPU thread
in sync-GPU mode) when swapping buffers.  It had three implementations:

- In GRenderWindow, it didn't actually poll events, just set a flag and
  emit a signal to indicate that a frame was displayed.

- In EmuWindow_SDL2_Hide, it did nothing.

- In EmuWindow_SDL2, it did call SDL_PollEvents, but this is wrong
  because SDL_PollEvents is supposed to be called on the thread that set
  up video - in this case, the main thread, which was sleeping in a
  busyloop (regardless of whether sync-GPU was enabled).  On macOS this
  causes a crash.

To fix this:

- Rename EmuWindow::PollEvents to OnFrameDisplayed, and give it a
  default implementation that does nothing.

- In EmuWindow_SDL2, do not override OnFrameDisplayed, but instead have
  the main thread call SDL_WaitEvent in a loop.
2020-11-23 17:58:49 -05:00
Morph e13a91fa9b
Merge pull request #4954 from lioncash/compare
gl_rasterizer: Make floating-point literal a float
2020-11-22 09:55:23 +08:00
bunnei 5502f39125
Merge pull request #4955 from lioncash/move3
async_shaders: std::move data within QueueVulkanShader()
2020-11-21 01:21:08 -08:00
LC d88baa746b
Merge pull request #4957 from ReinUsesLisp/alpha-test-rt
gl_rasterizer: Remove warning of untested alpha test
2020-11-20 21:19:06 -05:00
ReinUsesLisp acc14d233f gl_rasterizer: Remove warning of untested alpha test
Alpha test has been proven to only affect the first render target.
2020-11-20 23:17:40 -03:00
bunnei b00f4abe36
Merge pull request #4953 from lioncash/shader-shadow
shader_bytecode: Eliminate variable shadowing
2020-11-20 16:58:14 -08:00
Lioncash 01db5cf203 async_shaders: emplace threads into the worker thread vector
Same behavior, but constructs the threads in place instead of moving
them.
2020-11-20 04:46:56 -05:00
Lioncash ba3916fc67 async_shaders: Simplify implementation of GetCompletedWork()
This is equivalent to moving all the contents and then clearing the
vector. This avoids a redundant allocation.
2020-11-20 04:44:44 -05:00
Lioncash 3fcc98e11a async_shaders: Simplify moving data into the pending queue 2020-11-20 04:41:29 -05:00
Lioncash 5b441fa25d async_shaders: std::move data within QueueVulkanShader()
Same behavior, but avoids redundant copies.

While we're at it, we can simplify the pushing of the parameters into
the pending queue.
2020-11-20 04:38:18 -05:00
Lioncash 8469b76630 gl_rasterizer: Make floating-point literal a float
Gets rid of an unnecessary expansion from float to double.
2020-11-20 04:24:33 -05:00
Lioncash b7cd5d742e shader_bytecode: Make use of [[nodiscard]] where applicable
Ensures that all queried values are made use of.
2020-11-20 02:20:37 -05:00
Lioncash 56ecafc204 shader_bytecode: Eliminate variable shadowing 2020-11-20 02:13:45 -05:00
Rodrigo Locatti 1889b641d9
Merge pull request #4308 from ReinUsesLisp/maxwell-3d-funcs
maxwell_3d: Move code to separate functions and insert instead of push_back
2020-11-20 01:57:22 -03:00
Lioncash 70812ec57b rasterizer_interface: Make use of [[nodiscard]] where applicable 2020-11-17 07:19:13 -05:00
Lioncash a78021580d render_base: Make use of [[nodiscard]] where applicable 2020-11-17 07:19:12 -05:00
Lioncash b928fca114 gpu: Make use of [[nodiscard]] where applicable 2020-11-17 07:19:09 -05:00
ReinUsesLisp 622830f4e1 maxwell_3d: Use insert instead of loop push_back
This reduces the overhead of bounds checking on each element.
It won't reduce the cost of allocation because usually this vector's
capacity is usually large enough to hold whatever we push to it.
2020-11-11 19:52:19 -03:00
ReinUsesLisp 9ea8cffe35 maxwell_3d: Move code to separate functions
Deduplicate some code and put it in separate functions so it's easier to
understand and profile.
2020-11-11 19:52:19 -03:00
bunnei dc5396a466 video_core: dma_pusher: Remove integrity check on command lists.
- This seems to cause softlocks in Breath of the Wild.
2020-11-07 00:08:19 -08:00
bunnei 91a45834fd
Merge pull request #4891 from lioncash/clang2
General: Fix clang build
2020-11-06 10:33:13 -08:00
bunnei a111a9ae2c
Merge pull request #4854 from ReinUsesLisp/cube-array-shadow
shader: Partially implement texture cube array shadow
2020-11-05 16:25:00 -08:00
Lioncash 6f006d051e General: Fix clang build
Allows building on clang to work again
2020-11-05 10:07:16 -05:00
bunnei 087f52e872
Merge pull request #4858 from lioncash/initializer
General: Resolve a few missing initializer warnings
2020-11-04 12:10:10 -08:00
Chloe 6bbbbe8f85
Merge pull request #4869 from bunnei/improve-gpu-sync
Improvements to GPU synchronization & various refactoring
2020-11-04 18:36:55 +11:00
bunnei 4bfa411ddc
Merge pull request #4874 from lioncash/nodiscard2
nvdec: Make use of [[nodiscard]] where applicable
2020-11-03 16:34:07 -08:00
Lioncash 4f0f481f63 nvdec: Make use of [[nodiscard]] where applicable
Prevents bugs from occurring where the results of a function are
accidentally discarded
2020-11-02 02:45:15 -05:00
bunnei 1089d76736
Merge pull request #4865 from ameerj/async-threadcount
async_shaders: Increase Async worker thread count for >8 thread cpus
2020-11-01 01:54:01 -07:00
bunnei c6e1c46ac7 video_core: dma_pusher: Add support for integrity checks.
- Log corrupted command lists, rather than crash.
2020-11-01 01:52:38 -07:00
bunnei c64545d07a video_core: dma_pusher: Add support for prefetched command lists. 2020-11-01 01:52:38 -07:00
bunnei 6053b95552 video_core: gpu: Implement WaitFence and IncrementSyncPoint. 2020-11-01 01:52:37 -07:00
bunnei 98f68d06f1
Merge pull request #4853 from ReinUsesLisp/fcmp-imm
shader/arithmetic: Implement FCMP immediate + register variant
2020-10-31 01:25:02 -07:00
Lioncash 12eeffcb7c vp9: Be explicit with copy and move operators
It's deprecated in the language to autogenerate these if the destructor
for a type is specified, so we can explicitly specify how we want these
to be generated.
2020-10-29 22:57:35 -04:00
Lioncash 0d713cf8eb vp9: Mark functions with [[nodiscard]] where applicable
Prevents values from mistakenly being discarded in cases where it's a
bug to do so.
2020-10-29 22:57:32 -04:00
Lioncash badea3b301 vp9: Provide a default initializer for "hidden" member
The API of VP9 exposes a WasFrameHidden() function which accesses this
member. Given the constructor previously didn't initialize this member,
it's a potential vector for an uninitialized read.

Instead, we can initialize this to a deterministic value to prevent that
from occurring.
2020-10-29 22:35:55 -04:00
Lioncash f8543249f0 vp9: Make some member functions internally linked
These helper functions don't directly modify any member state and can be
hidden from view.
2020-10-29 22:34:46 -04:00
Lioncash 5553bd3ba2 General: Resolve a few missing initializer warnings
Resolves a few -Wmissing-initializer warnings.
2020-10-29 19:37:07 -04:00
bunnei ef29bf4515
Merge pull request #4837 from lioncash/nvdec-2
nvdec: Minor tidying up
2020-10-29 12:28:07 -07:00
ameerj 3620206136 async_shaders: Increase Async worker thread count for 8+ thread cpus
Adds 1 async worker thread for every 2 available threads above 8
2020-10-29 14:16:45 -04:00
bunnei c6d001c94f
Merge pull request #4838 from lioncash/syncmgr
sync_manager: Amend parameter order of calls to SyncptIncr constructor
2020-10-28 22:49:22 -07:00
bunnei 94eca09cf6 video_core: cdma_pusher: Add missing LOG_DEBUG field in ExecuteCommand. 2020-10-28 16:47:08 -07:00
ReinUsesLisp 657771bdcb shader: Partially implement texture cube array shadow
This implements texture cube arrays with shadow comparisons but doesn't
fix the asserts related to it.

Fixes out of bounds reads on swizzle constructors and makes them use
bounds checked ::at instead of the unsafe operator[].
2020-10-28 17:12:40 -03:00
ReinUsesLisp 44b552be71 shader/arithmetic: Implement FCMP immediate + register variant
Trivially add the encoding for this.
2020-10-28 17:05:41 -03:00
LC 978e7897a3
Merge pull request #4848 from ReinUsesLisp/type-limits
video_core: Enforce -Werror=type-limits
2020-10-28 03:16:10 -04:00
ReinUsesLisp 79da90cea8 video_core: Enforce -Wredundant-move and -Wpessimizing-move
Silence three warnings and make them errors to avoid introducing more in the future.
2020-10-28 02:44:50 -03:00
ReinUsesLisp 4a451e5849 video_core: Enforce -Werror=type-limits
Silences one warning and avoids introducing more in the future.
2020-10-28 02:37:47 -03:00
Lioncash 047e77e2f0 sync_manager: Amend parameter order of calls to SyncptIncr constructor
Corrects some cases where the arguments would be incorrectly swapped.
2020-10-27 03:22:57 -04:00
Lioncash cce14b4cd7 h264: Make WriteUe take a u32
Enforces the type of the desired value in calling code.
2020-10-27 03:21:53 -04:00
Lioncash 6291975731 vp9: std::move buffer within ComposeFrameHeader()
We can move the buffer here to avoid a heap reallocation
2020-10-27 02:27:31 -04:00
Lioncash 00decfbb07 vp9: Remove dead code 2020-10-27 02:26:17 -04:00
Lioncash 111802bbbb vp9: Join declarations with assignments 2020-10-27 02:26:03 -04:00
Lioncash 3b5d5fa86f vp9: Remove pessimizing moves
The move will already occur without std::move.
2020-10-27 02:21:40 -04:00
Lioncash dcc26c54a5 vp9: Resolve variable shadowing 2020-10-27 02:20:17 -04:00
Lioncash c04203b786 nvdec: Tidy up header includes
Prevents a few unnecessary inclusions.
2020-10-27 02:16:42 -04:00
ameerj eb67a45ca8 video_core: NVDEC Implementation
This commit aims to implement the NVDEC (Nvidia Decoder) functionality, with video frame decoding being handled by the FFmpeg library.

The process begins with Ioctl commands being sent to the NVDEC and VIC (Video Image Composer) emulated devices. These allocate the necessary GPU buffers for the frame data, along with providing information on the incoming video data. A Submit command then signals the GPU to process and decode the frame data.

To decode the frame, the respective codec's header must be manually composed from the information provided by NVDEC, then sent with the raw frame data to the ffmpeg library.

Currently, H264 and VP9 are supported, with VP9 having some minor artifacting issues related mainly to the reference frame composition in its uncompressed header.

Async GPU is not properly implemented at the moment.

Co-Authored-By: David <25727384+ogniK5377@users.noreply.github.com>
2020-10-26 23:07:36 -04:00
bunnei 3e46934442
Merge pull request #4706 from ReinUsesLisp/cmake-host-shaders
video_core: Fix instances where msbuild always regenerated host shaders
2020-10-23 10:01:16 -07:00
Lioncash 678d012c2c video_core: Conditially activate relevant compiler warnings
These compiler flags aren't shared with clang, so specifying these flags
unconditionally can lead to a bit of warning spam.

While we're in the area, we can also enable -Wunused-but-set-parameter
given this is almost always a bug.
2020-10-20 20:28:25 -04:00
ReinUsesLisp f21a189148 gl_arb_decompiler: Implement robust buffer operations
This emulates the behavior we get on GLSL with regular SSBOs with a
pointer + length pair. It aims to be consistent with the crashes we
might get.

Out of bounds stores are ignored. Atomics are ignored and return zero.
Reads return zero.
2020-10-20 03:34:32 -03:00
bunnei f1ead11df7
Merge pull request #4204 from ReinUsesLisp/vulkan-1.0
renderer_vulkan: Create and properly use Vulkan 1.0 instances when 1.1 is not available
2020-10-19 14:18:54 -07:00
bunnei 743fe1aea3
Merge pull request #4782 from ReinUsesLisp/remove-dyn-primitive
vk_graphics_pipeline: Manage primitive topology as fixed state
2020-10-17 22:14:17 -07:00
bunnei d47ac3ce09
Merge pull request #4772 from goldenx86/block-rdna
vk_device: Block VK_EXT_extended_dynamic_state for RDNA devices
2020-10-14 17:51:39 -07:00
ReinUsesLisp e4e0abc418 vk_graphics_pipeline: Manage primitive topology as fixed state
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.
2020-10-13 04:08:33 -03:00
bunnei 4c348f4069
Merge pull request #4766 from ReinUsesLisp/tmml-cube
shader/texture: Implement CUBE texture type for TMML and fix arrays
2020-10-12 12:53:57 -07:00
ReinUsesLisp e1600b0962 video_core: Enforce -Wclass-memaccess 2020-10-09 16:46:11 -03:00
LC 61b246a3a9
Merge pull request #4771 from ReinUsesLisp/warn-unused-var
video_core: Enforce -Wunused-variable and -Wunused-but-set-variable
2020-10-08 21:10:31 -04:00
goldenx86 0120e5b1d9 vk_device: Block VK_EXT_extended_dynamic_state for RDNA devices
RDNA devices seem to crash when using VK_EXT_extended_dynamic_state in
the latest 20.9.2 proprietary Windows drivers. As a workaround, for now
we block device names corresponding to current RDNA released products.
2020-10-08 21:27:49 -03:00
ReinUsesLisp dffaffaac1 shader/texture: Implement CUBE texture type for TMML and fix arrays
TMML takes an array argument that has no known meaning, this one appears
as the first component in gpr8 followed by s, t and r. Skip this
component when arrays are being used. Also implement CUBE texture types.

- Used by Pikmin 3: Deluxe Demo.
2020-10-07 23:17:46 -03:00
ReinUsesLisp cd3e959f23 renderer_vulkan/wrapper: Fix physical device sorting
The old code had a sort function that was invalid and it didn't work as
expected when the base vector had a different order (e.g. renderdoc was
attached).

This sorts devices as expected and fixes a debug assert on MSVC.
2020-10-07 17:13:22 -03:00
ReinUsesLisp 2a24b1c973 video_core: Enforce -Wunused-variable and -Wunused-but-set-variable 2020-10-02 21:19:35 -03:00
Matías Locatti d7843b8ef2
Remove ext_extended_dynamic_state blacklist
Latest AMD 20.9.2 driver fixed this, there's no reason to keep it blocked, as the previous stable signed driver release doesn't include the extension.
2020-09-30 03:13:38 -03:00
Rodrigo Locatti e5a1e0a76d
Merge pull request #4724 from lat9nq/fix-vulkan-nvidia-allocate-2
vk_stream_buffer: Fix initializing Vulkan with NVIDIA on Linux
2020-09-26 23:52:49 +00:00
bunnei 442096298e
Merge pull request #4703 from lioncash/desig7
shader/registry: Make use of designated initializers where applicable
2020-09-26 15:23:15 -07:00
lat9nq ca26fd0f42 vk_stream_buffer: Fix initializing Vulkan with NVIDIA on Linux
The previous fix only partially solved the issue, as only certain GPUs that needed 9 or less MiB subtracted would work (i.e. GTX 980 Ti, GT 730). This takes from DXVK's example to divide `heap_size` by 2 to determine `allocable_size`. Additionally tested on my Quadro K4200, which previously required setting it to 12 to boot.
2020-09-25 17:42:59 -04:00
Lioncash 940d85241b vk_command_pool: Move definition of Pool into the cpp file
Allows the implementation details to be changed without recompiling any
files that include this header.
2020-09-25 00:15:52 -04:00
Lioncash 4ed4bba305 vk_command_pool: Make use of override on destructor 2020-09-25 00:14:10 -04:00
Lioncash e0f2db4376 vk_command_pool: Add missing header guard 2020-09-25 00:12:45 -04:00
Levi Behunin bc69cc1511 More forgetting... duh 2020-09-24 22:12:13 -06:00
bunnei 2634e3c6eb
Merge pull request #4711 from lioncash/move5
arithmetic_integer_immediate: Make use of std::move where applicable
2020-09-24 21:02:42 -07:00
Levi Behunin 24c1bb3842 Forgot to apply suggestion here as well 2020-09-24 21:58:51 -06:00
Levi Behunin a19dc3bf00 Address Comments 2020-09-24 21:52:23 -06:00
Levi Behunin d53b79ff5c Start of Integer flags implementation 2020-09-24 16:40:06 -06:00