Commit Graph

4651 Commits

Author SHA1 Message Date
Lioncash
08d36afd40 vk_swapchain: Make use of designated initializers where applicable 2020-07-16 19:27:02 -04:00
Lioncash
3c060503bc vk_stream_buffer: Make use of designated initializers where applicable 2020-07-16 19:22:11 -04:00
Lioncash
70147e913f vk_staging_buffer_pool: Make use of designated initializers where applicable 2020-07-16 19:22:03 -04:00
Lioncash
2025f847bb vk_shader_util: Make use of designated initializers where applicable 2020-07-16 19:17:41 -04:00
Lioncash
97e7663004 vk_scheduler: Make use of designated initializers where applicable 2020-07-16 19:11:43 -04:00
Lioncash
fd7af52ec3 vk_sampler_cache: Make use of designated initializers where applicable 2020-07-16 19:06:40 -04:00
Lioncash
772b6e4d28 vk_resource_manager: Make use of designated initializers where applicable 2020-07-16 19:02:35 -04:00
Lioncash
8ebd6a21c5 vk_renderpass_cache: Make use of designated initializers where applicable 2020-07-16 18:57:23 -04:00
Lioncash
01f297f2e0 vk_rasterizer: Make use of designated initializers where applicable 2020-07-16 18:49:42 -04:00
Lioncash
c07b0ffe47 vk_query_cache: Make use of designated initializers where applicable 2020-07-16 18:34:04 -04:00
Lioncash
d43e923990 vk_pipeline_cache: Make use of designated initializers where applicable 2020-07-16 18:32:29 -04:00
Lioncash
7d5f93832c vk_memory_manager: Make use of designated initializers where applicable 2020-07-16 18:26:30 -04:00
Lioncash
75c00c3cb0 vk_image: Make use of designated initializers where applicable 2020-07-16 18:24:26 -04:00
Lioncash
6d165481ad vk_descriptor_pool: Make use of designated initializers where applicable 2020-07-16 18:19:45 -04:00
Lioncash
fb563e75e9 vk_graphics_pipeline: Resolve narrowing warnings
For whatever reason, VK_TRUE and VK_FALSE aren't defined as having a
VkBool32 type, so we need to cast to it explicitly.
2020-07-16 18:13:49 -04:00
Lioncash
5330ca396d vk_compute_pipeline: Make use of designated initializers where applicable 2020-07-16 17:32:12 -04:00
Lioncash
757ddd8158 vk_compute_pass: Make use of designated initializers where applicable
Note: Some barriers can't be converted over yet, as they ICE MSVC.
2020-07-16 17:23:56 -04:00
Lioncash
a66a0a6a53 vk_buffer_cache: Make use of designated initializers where applicable
Note: An array within CopyFrom() cannot be converted over yet, as it
ICEs MSVC when converted over.
2020-07-16 16:59:39 -04:00
Rodrigo Locatti
be68ee88c2
Merge pull request #4333 from lioncash/desig3
vk_graphics_pipeline: Make use of designated initializers where applicable
2020-07-16 17:41:45 -03:00
Rodrigo Locatti
b6d73ec9c2
Merge pull request #4332 from lioncash/vkdev
vk_device: Make use of designated initializers where applicable
2020-07-16 17:41:20 -03:00
ReinUsesLisp
210cc0204d decode/other: Implement S2R.LaneId
This maps to host's thread id.

- Fixes graphical issues on Paper Mario.
2020-07-16 16:09:39 -03:00
ReinUsesLisp
88e57b13e0 gl_arb_decompiler: Execute BAR even when inside control flow
Unlike GLSL, GLASM allows us to call BAR inside control flow.

- Fixes graphical artifacts in Paper Mario.
2020-07-16 16:05:52 -03:00
ReinUsesLisp
a5a72cbd20 renderer_{opengl,vulkan}: Clamp shared memory to host's limit
This stops shaders from failing to build when the exceed host's shared
memory size limit. An error is logged.
2020-07-16 16:02:46 -03:00
bunnei
98b36625fa
Merge pull request #4321 from lioncash/desig
vk_blit_screen: Make use of designated initializers where applicable
2020-07-16 14:55:36 -04:00
Lioncash
969100d41a shader_cache: Make use of std::erase_if
Now that we use C++20, we can also make use of std::erase_if instead of
needing to do the erase-remove idiom.
2020-07-14 15:49:15 -04:00
bunnei
666b37ad56
Merge pull request #4242 from ReinUsesLisp/maxwell-dma
maxwell_dma: Match official doc and support pitch->voxel copies
2020-07-14 14:04:16 -04:00
Lioncash
0f8b977663 vk_device: Make use of designated initializers where applicable
Avoids redundant repetitions of variable names, and allows assignment
all in one statement.
2020-07-13 22:24:01 -04:00
Lioncash
0475a167f8 vk_graphics_pipeline: Make use of designated initializers where applicable
Avoids redundant variable name repetitions.
2020-07-13 21:07:56 -04:00
ReinUsesLisp
fbc232426d video_core: Rearrange pixel format names
Normalizes pixel format names to match Vulkan names. Previous to this
commit pixel formats had no convention, leading to confusion and
potential bugs.
2020-07-13 01:44:23 -03:00
ReinUsesLisp
eda37ff26b video_core: Fix DXT4 and RGB565 2020-07-13 01:01:09 -03:00
ReinUsesLisp
a8dab2ffb3 video_core/format_lookup_table: Add formats with existing PixelFormat 2020-07-13 01:01:09 -03:00
ReinUsesLisp
480850ffe7 video_core: Fix B5G6R5_UNORM render target format 2020-07-13 01:01:09 -03:00
ReinUsesLisp
990b14f181 video_core: Fix B5G6R5U 2020-07-13 01:01:09 -03:00
ReinUsesLisp
1d20aac795 video_core: Implement RGBA32_SINT render target 2020-07-13 01:01:09 -03:00
ReinUsesLisp
9338599d72 video_core: Implement RGBA32_SINT render target 2020-07-13 01:01:09 -03:00
ReinUsesLisp
95c0f5afe5 video_core: Implement RGBA16_SINT render target 2020-07-13 01:01:09 -03:00
ReinUsesLisp
977d6c46f3 video_core: Implement RGBA8_SINT render target 2020-07-13 01:01:09 -03:00
ReinUsesLisp
50c6030a8d video_core: Implement RG32_SINT render target 2020-07-13 01:01:09 -03:00
ReinUsesLisp
e849d68048 video_core: Implement RG8_SINT render target and fix RG8_UINT 2020-07-13 01:01:09 -03:00
ReinUsesLisp
f29fede49c video_core: Implement R8_SINT render target 2020-07-13 01:01:08 -03:00
ReinUsesLisp
fd33e996e0 video_core: Implement R8_SNORM render target 2020-07-13 01:01:08 -03:00
ReinUsesLisp
505c206eb8 video_core/surface: Remove explicit values on PixelFormat's definition 2020-07-13 01:01:08 -03:00
ReinUsesLisp
143662118c video_core/surface: Reorder render target to pixel format switch 2020-07-13 01:01:08 -03:00
Lioncash
db6fbd5894 vk_blit_screen: Make use of designated initializers where applicable
Now that we make use of C++20, we can use designated initializers to
make things a little nicer to read.
2020-07-12 19:45:30 -04:00
ReinUsesLisp
0fe09df386 vk_state_tracker: Fix dirty flags for stencil_enable on VK_EXT_extended_dynamic_state
Fixes a regression on any game using stencil on devices with
VK_EXT_extended_dynamic_state.
2020-07-12 20:43:42 -03:00
ReinUsesLisp
fca26980a2 vk_rasterizer: Pass <pSizes> to CmdBindVertexBuffers2EXT
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.
2020-07-10 18:15:32 -03:00
ReinUsesLisp
c574ab5aa1 video_core/textures: Add and use SwizzleSliceToVoxel, and minor style changes
Change GOB sizes from free-functions to constexpr constants.

Add SwizzleSliceToVoxel, a function that swizzles a 2D array of pixels
into a 3D texture and use it for 3D copies.
2020-07-10 04:09:32 -03:00
Rodrigo Locatti
e73c53fad1
Merge pull request #4283 from lat9nq/fix-linux-nvidia-vulkan
vk_stream_buffer: Prevent Vulkan crash in Linux on recent NVIDIA driver
2020-07-10 00:18:44 -03:00
lat9nq
63d23835ef
configuration: implement per-game configurations (#4098)
* Switch game settings to use a pointer

In order to add full per-game settings, we need to be able to tell yuzu to switch
to using either the global or game configuration. Using a pointer makes it easier
to switch.

* configuration: add new UI without changing existing funcitonality

The new UI also adds General, System, Graphics, Advanced Graphics,
and Audio tabs, but as yet they do nothing. This commit keeps yuzu
to the same functionality as originally branched.

* configuration: Rename files

These weren't included in the last commit. Now they are.

* configuration: setup global configuration checkbox

Global config checkbox now enables/disables the appropriate tabs in the game
properties dialog. The use global configuration setting is now saved to the
config, defaulting to true. This also addresses some changes requested in the PR.

* configuration: swap to per-game config memory for properties dialog

Does not set memory going in-game. Swaps to game values when opening the
properties dialog, then swaps back when closing it. Uses a `memcpy` to swap.
Also implements saving config files, limited to certain groups of configurations
so as to not risk setting unsafe configurations.

* configuration: change config interfaces to use config-specific pointers

When a game is booted, we need to be able to open the configuration dialogs
without changing the settings pointer in the game's emualtion. A new pointer
specific to just the configuration dialogs can be used to separate changes
to just those config dialogs without affecting the emulation.

* configuration: boot a game using per-game settings

Swaps values where needed to boot a game.

* configuration: user correct config during emulation

Creates a new pointer specifically for modifying the configuration while
emulation is in progress. Both the regular configuration dialog and the game
properties dialog now use the pointer Settings::config_values to focus edits to
the correct struct.

* settings: split Settings::values into two different structs

By splitting the settings into two mutually exclusive structs, it becomes easier,
as a developer, to determine how to use the Settings structs after per-game
configurations is merged. Other benefits include only duplicating the required
settings in memory.

* settings: move use_docked_mode to Controls group

`use_docked_mode` is set in the input settings and cannot be accessed from the
system settings. Grouping it with system settings causes it to be saved with
per-game settings, which may make transferring configs more difficult later on,
especially since docked mode cannot be set from within the game properties
dialog.

* configuration: Fix the other yuzu executables and a regression

In main.cpp, we have to get the title ID before the ROM is loaded, else the
renderer will reflect only the global settings and now the user's game specific
settings.

* settings: use a template to duplicate memory for each setting

Replaces the type of each variable in the Settings::Values struct with a new
class that allows basic data reading and writing. The new struct
Settings::Setting duplicates the data in memory and can manage global overrides
per each setting.

* configuration: correct add-ons config and swap settings when apropriate

Any add-ons interaction happens directly through the global values struct.
Swapping bewteen structs now also includes copying the necessary global configs
that cannot be changed nor saved in per-game settings. General and System config
menus now update based on whether it is viewing the global or per-game settings.

* settings: restore old values struct

No longer needed with the Settings::Setting class template.

* configuration: implement hierarchical game properties dialog

This sets the apropriate global or local data in each setting.

* clang format

* clang format take 2

can the docker container save this?

* address comments and style issues

* config: read and write settings with global awareness

Adds new functions to read and write settings while keeping the global state in
focus. Files now generated per-game are much smaller since often they only need
address the global state.

* settings: restore global state when necessary

Upon closing a game or the game properties dialog, we need to restore all global
settings to the original global state so that we can properly open the
configuration dialog or boot a different game.

* configuration: guard setting values incorrectly

This disables setting values while a game is running if the setting is
overwritten by a per game setting.

* config: don't write local settings in the global config

Simple guards to prevent writing the wrong settings in the wrong files.

* configuration: add comments, assume less, and clang format

No longer assumes that a disabled UI element means the global state is turned
off, instead opting to directly answer that question. Still however assumes a
game is running if it is in that state.

* configuration: fix a logic error

Should not be negated

* restore settings' global state regardless of accept/cancel

Fixes loading a properties dialog and causing the global config dialog to show
local settings.

* fix more logic errors

Fixed the frame limit would set the global setting from the game properties
dialog. Also strengthened the Settings::Setting member variables and simplified
the logic in config reading (ReadSettingGlobal).

* fix another logic error

In my efforts to guard RestoreGlobalState, I accidentally negated the IsPowered
condition.

* configure_audio: set toggle_stretched_audio to tristate

* fixed custom rtc and rng seed overwriting the global value

* clang format

* rebased

* clang format take 4

* address my own review

Basically revert unintended changes

* settings: literal instead of casting

"No need to cast, use 1U instead"
Thanks, Morph!

Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>

* Revert "settings: literal instead of casting
"

This reverts commit 95e992a87c898f3e882ffdb415bb0ef9f80f613f.

* main: fix status buttons reporting wrong settings after stop emulation

* settings: Log UseDockedMode in the Controls group

This should have happened when use_docked_mode was moved over to the controls group
internally. This just reflects this in the log.

* main: load settings if the file has a title id

In other words, don't exit if the loader has trouble getting a title id.

* use a zero

* settings: initalize resolution factor with constructor instead of casting

* Revert "settings: initalize resolution factor with constructor instead of casting"

This reverts commit 54c35ecb46a29953842614620f9b7de1aa9d5dc8.

* configure_graphics: guard device selector when Vulkan is global

Prevents the user from editing the device selector if Vulkan is the global
renderer backend. Also resets the vulkan_device variable when the users
switches back-and-forth between global and Vulkan.

* address reviewer concerns

Changes function variables to const wherever they don't need to be changed. Sets Settings::Setting to final as it should not be inherited from. Sets ConfigurationShared::use_global_text to static.

Co-Authored-By: VolcaEM <volcaem@users.noreply.github.com>

* main: load per-game settings after LoadROM

This prevents `Restart Emulation` from restoring the global settings *after* the per-game settings were applied. Thanks to BSoDGamingYT for finding this bug.

* Revert "main: load per-game settings after LoadROM"

This reverts commit 9d0d48c52d2dcf3bfb1806cc8fa7d5a271a8a804.

* main: only restore global settings when necessary

Loading the per-game settings cannot happen after the ROM is loaded, so we have to specify when to restore the global state. Again thanks to BSoD for finding the bug.

* configuration_shared: address reviewer concerns except operator overrides

Dropping operator override usage in next commit.

Co-Authored-By: LC <lioncash@users.noreply.github.com>

* settings: Drop operator overrides from Setting template

Requires using GetValue and SetValue explicitly. Also reverts a change that broke title ID formatting in the game properties dialog.

* complete rebase

* configuration_shared: translate "Use global configuration"

Uses ConfigurePerGame to do so, since its usage, at least as of now, corresponds with ConfigurationShared.

* configure_per_game: address reviewer concern

As far as I understand, it prevents the program from unnecessarily copying strings.

Co-Authored-By: LC <lioncash@users.noreply.github.com>

Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
Co-authored-by: VolcaEM <volcaem@users.noreply.github.com>
Co-authored-by: LC <lioncash@users.noreply.github.com>
2020-07-09 22:42:09 -04:00
lat9nq
1c7d106aac vk_stream_buffer: set allocable_size to 9 MiB
This solves the crash on Linux systems running the current Linux Long Lived branch nVidia driver.
2020-07-09 21:28:32 -04:00
ReinUsesLisp
2a9d17b7e7 maxwell_dma: Rename registers to match official docs and reorder
Rename registers in the MaxwellDMA class to match Nvidia's official
documentation. This one can be found here:

https://github.com/NVIDIA/open-gpu-doc/blob/master/classes/dma-copy/clb0b5.h

While we are at it, reorganize the code in MaxwellDMA to be separated in
different functions.
2020-07-07 19:19:33 -03:00
bunnei
35f7740b6c
Merge pull request #4150 from ReinUsesLisp/dynamic-state-impl
vulkan: Use VK_EXT_extended_dynamic_state when available
2020-07-07 10:58:09 -04:00
Fernando Sahmkow
52882a93a5
Merge pull request #4194 from ReinUsesLisp/fix-shader-cache
shader_cache: Fix use-after-free and orphan invalidation cache entries
2020-07-04 20:49:00 -04:00
bunnei
41a333321a
Merge pull request #4175 from ReinUsesLisp/read-buffer
gl_buffer_cache: Copy to buffers created as STREAM_READ before downloading
2020-07-02 23:30:08 -04:00
Rodrigo Locatti
c58e21cd76
Merge pull request #4082 from Morph1984/mirror-once-clamp
maxwell_to_gl: Implement MirrorOnceClampOGL wrap mode using GL_MIRROR_CLAMP_EXT
2020-07-02 04:57:40 -03:00
ReinUsesLisp
f6cb128eac shader_cache: Fix use-after-free and orphan invalidation cache entries
This fixes some cases where entries could have been removed multiple
times reading freed memory. To address this issue this commit removes
duplicates from entries marked for removal and sorts out the removal
process to fix another use-after-free situation.

Another issue fixed in this commit is orphan invalidation cache entries.
Previously only the entries that were invalidated in the current
operations had its entries removed. This led to more use-after-free
situations when these entries were actually invalidated but referenced
an object that didn't exist.
2020-07-01 18:16:53 -03:00
Fernando Sahmkow
a4f48efea4
Merge pull request #4176 from ReinUsesLisp/compatible-formats
texture_cache: Check format compatibility before copying
2020-06-30 15:36:13 -04:00
Fernando Sahmkow
977a3ab352
Merge pull request #4157 from ReinUsesLisp/unified-turing
gl_device: Enable NV_vertex_buffer_unified_memory on Turing devices
2020-06-30 14:36:51 -04:00
Morph
1b31755ba6 maxwell_to_gl: Implement MirrorOnceClampOGL using GL_MIRROR_CLAMP_EXT
Like MirrorOnceBorder, this requires the GL_EXT_texture_mirror_clamp extension. This extension is unfortunately not available on Intel's drivers (both Windows proprietary and Linux Mesa). Use GL_MIRROR_CLAMP_TO_EDGE as a fallback if the extension is unavailable.
2020-06-30 02:40:14 -04:00
Rodrigo Locatti
d217017c9e
Merge pull request #4191 from Morph1984/vertex-formats
maxwell_to_gl/vk: Reorder vertex formats
2020-06-30 03:30:00 -03:00
David
7c970132b5
macro: Add support for "middle methods" on the code cache (#4112)
Macro code is just uploaded sequentially from a starting address, however that does not mean the entry point for the macro is at that address. This PR adds preliminary support for executing macros in the middle of our cached code.
2020-06-30 02:32:24 -03:00
Morph
10eca7f651 maxwell_to_gl: Rename VertexType() to VertexFormat() 2020-06-29 11:48:38 -04:00
Rodrigo Locatti
f84cbf6429
Merge pull request #4140 from ReinUsesLisp/validation-layers
renderer_vulkan: Update validation layer name and test before enabling
2020-06-29 02:12:38 -03:00
Morph
4a35df337b maxwell_to_vk: Reorder vertex formats and add A2B10G10R10 for all types except float 2020-06-28 02:57:10 -04:00
Morph
78d80d99a0 maxwell_to_gl: Add 32 bit component sizes to (un)signed scaled formats
Add 32 bit component sizes to (un)signed scaled formats and group (un)signed normalized, scaled, and integer formats together.
2020-06-28 02:51:13 -04:00
Fernando Sahmkow
528b19a842 General: Tune the priority of main emulation threads so they have higher priority than less important helper threads. 2020-06-27 11:36:09 -04:00
Fernando Sahmkow
ad92865497 General: Correct rebase, sync gpu and context management. 2020-06-27 11:36:08 -04:00
Fernando Sahmkow
dc58058203 General: Setup yuzu threads' microprofile, naming and registry. 2020-06-27 11:35:09 -04:00
Fernando Sahmkow
e31425df38 General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host 
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and 
Suspended State, Recreates the bootmanager, Initializes Multicore 
system.
2020-06-27 11:35:06 -04:00
bunnei
efef7b1517
Merge pull request #4147 from ReinUsesLisp/hset2-imm
shader/half_set: Implement HSET2_IMM
2020-06-26 23:14:56 -04:00
ReinUsesLisp
9d55e5586f vk_rasterizer: Use nullptr for <pSizes> in CmdBindVertexBuffers2EXT
Disable this temporarily.
2020-06-26 20:57:22 -03:00
ReinUsesLisp
8584a77eb2 vk_pipeline_cache: Avoid hashing and comparing dynamic state when possible
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.
2020-06-26 20:57:22 -03:00
ReinUsesLisp
1a84209418 vulkan/fixed_pipeline_state: Move state out of individual structures 2020-06-26 20:57:22 -03:00
ReinUsesLisp
c94b398f14 vk_rasterizer: Use VK_EXT_extended_dynamic_state 2020-06-26 20:57:22 -03:00
ReinUsesLisp
a6db8e5f4d renderer_vulkan/wrapper: Add VK_EXT_extended_dynamic_state functions 2020-06-26 20:55:15 -03:00
ReinUsesLisp
c387a72c76 fixed_pipeline_state: Add requirements for VK_EXT_extended_dynamic_state
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.
2020-06-26 20:55:15 -03:00
ReinUsesLisp
7527402a46 vk_device: Enable VK_EXT_extended_dynamic_state when available 2020-06-26 20:55:15 -03:00
ReinUsesLisp
bb2cbdf704 texture_cache: Test format compatibility before copying
Avoid illegal copies. This intercepts the last step of a copy to avoid
generating validation errors or corrupting the driver on some instances.

We can create views and emit copies accordingly in future commits and
remove this last-step validation.
2020-06-26 20:52:22 -03:00
bunnei
3579db425e
Merge pull request #4144 from FernandoS27/tt-fix
TextureCache: Fix case where layer goes off bound.
2020-06-26 19:02:39 -04:00
bunnei
78d3b54ea7
Merge pull request #4111 from ReinUsesLisp/preserve-contents-vk
vk_rasterizer: Don't preserve contents on full screen clears
2020-06-26 18:48:12 -04:00
ReinUsesLisp
1d6be9febf video_core/compatible_formats: Table to test if two formats are legal to view or copy
Add a flat table to test if it's legal to create a texture view between
two formats or copy betweem them.

This table is based on ARB_copy_image and ARB_texture_view. Copies are
more permissive than views.
2020-06-26 19:28:11 -03:00
ReinUsesLisp
6481d91e4a gl_buffer_cache: Copy to buffers created as STREAM_READ before downloading
After marking buffers as resident, Nvidia's driver seems to take a
slow path. To workaround this issue, copy to a STREAM_READ buffer and
then call GetNamedBufferSubData on it.

This is a temporary solution until we have asynchronous flushing.
2020-06-26 16:58:40 -03:00
Rodrigo Locatti
5872fc21fe
Merge pull request #4151 from ReinUsesLisp/gl-invalidations
gl_shader_cache: Avoid use after move for program size
2020-06-25 21:05:27 -03:00
David Marcec
a927d8be52 gl_device: Fix IsASTCSupported
Other targets were never actually checked
2020-06-25 19:12:56 +10:00
ReinUsesLisp
bc8d3b8f82 gl_device: Enable NV_vertex_buffer_unified_memory on Turing devices
Once we make sure not to corrupt Nvidia's driver, we can safely use
resident buffers on Turing devices.

See GitHub pull request #4156
2020-06-25 01:28:47 -03:00
bunnei
0e1268e507
Merge pull request #4105 from ReinUsesLisp/resident-buffers
gl_rasterizer: Use NV_vertex_buffer_unified_memory for vertex buffer robustness
2020-06-24 11:40:30 -04:00
bunnei
2f2df9a4a7
Merge pull request #4083 from Morph1984/B10G11R11F
decode/image: Implement B10G11R11F
2020-06-24 11:02:38 -04:00
Fernando Sahmkow
32343d820d
Merge pull request #4046 from ogniK5377/macro-hle-prod
Add support for HLEing Macros
2020-06-24 09:01:00 -04:00
ReinUsesLisp
32a2dcd415 buffer_cache: Use buffer methods instead of cache virtual methods 2020-06-24 02:36:14 -03:00
ReinUsesLisp
39c97f1b65 gl_stream_buffer: Use InvalidateBufferData instead unmap and map
Making the stream buffer resident increases GPU usage significantly on
some games. This seems to be addressed invalidating the stream buffer
with InvalidateBufferData instead of using a Unmap + Map (with
invalidation flags).
2020-06-24 02:36:14 -03:00
ReinUsesLisp
41a4090320 gl_rasterizer: Use NV_vertex_buffer_unified_memory for vertex buffer robustness
Switch games are allowed to bind less data than what they use in a
vertex buffer, the expected behavior here is that these values are read
as zero. At the moment of writing this only D3D12, OpenGL and NVN through
NV_vertex_buffer_unified_memory support vertex buffer with a size limit.

In theory this could be emulated on Vulkan creating a new VkBuffer for
each (handle, offset, length) tuple and binding the expected data to it.
This is likely going to be slow and memory expensive when used on the
vertex buffer and we have to do it on all draws because we can't know
without analyzing indices when a game is going to read vertex data out
of bounds.

This is not a problem on OpenGL's BufferAddressRangeNV because it takes
a length parameter, unlike Vulkan's CmdBindVertexBuffers that only takes
buffers and offsets (the length is implicit in VkBuffer). It isn't a
problem on D3D12 either, because D3D12_VERTEX_BUFFER_VIEW on
IASetVertexBuffers takes SizeInBytes as a parameter (although I am not
familiar with robustness on D3D12).

Currently this only implements buffer ranges for vertex buffers,
although indices can also be affected. A KHR_robustness profile is not
created, but Nvidia's driver reads out of bound vertex data as zero
anyway, this might have to be changed in the future.

- Fixes SMO random triangles when capturing an enemy, getting hit, or
looking at the environment on certain maps.
2020-06-24 02:36:14 -03:00
ReinUsesLisp
32485917ba gl_buffer_cache: Mark buffers as resident
Make stream buffer and cached buffers as resident and query their
address. This allows us to use GPU addresses for several proprietary
Nvidia extensions.
2020-06-24 02:36:14 -03:00
ReinUsesLisp
73fb3a304b gl_device: Expose NV_vertex_buffer_unified_memory except on Turing
Expose NV_vertex_buffer_unified_memory when the driver supports it.

This commit adds a function the determine if a GL_RENDERER is a Turing
GPU. This is required because on Turing GPUs Nvidia's driver crashes
when the buffer is marked as resident or on DeleteBuffers. Without a
synchronous debug output (single threaded driver), it's likely that
the driver will crash in the first blocking call.
2020-06-24 02:36:14 -03:00
ReinUsesLisp
00c66a7289 gl_stream_buffer: Always use a non-coherent buffer 2020-06-24 02:35:33 -03:00
ReinUsesLisp
da79ec9565 gl_stream_buffer: Always use persistent memory maps
yuzu no longer supports platforms without persistent maps.
2020-06-24 02:35:33 -03:00
Rodrigo Locatti
b66ccaa376
Merge pull request #4129 from Morph1984/texture-shadow-lod-workaround
gl_shader_decompiler: Workaround textureLod when GL_EXT_texture_shadow_lod is not available
2020-06-24 01:51:15 -03:00
David Marcec
f5e2aec422 addressed issues 2020-06-24 12:18:33 +10:00
David Marcec
52340e94ac clear mme draw mode
We already draw, so we can clear it
2020-06-24 12:09:04 +10:00
David Marcec
fabdf5d385 Addressed issues 2020-06-24 12:09:03 +10:00
David Marcec
74b4334d51 Fix constbuffer for 0217920100488FF7 2020-06-24 12:09:02 +10:00