Commit graph

5523 commits

Author SHA1 Message Date
ameerj
c439fc9be9 astc_decoder: Reduce workgroup size
This reduces the amount of over dispatching when there are odd dimensions (i.e. ASTC 8x5), which rarely evenly divide into 32x32.
2021-08-01 01:22:27 -04:00
ameerj
5ab8053511 astc_decoder: Compute offset swizzles in-shader
Alleviates the dependency on the swizzle table and a uniform which is constant for all ASTC texture sizes.
2021-08-01 01:22:26 -04:00
ameerj
b2862e4772 astc_decoder: Make use of uvec4 for payload data 2021-07-31 22:28:04 -04:00
ameerj
a75d70fa90 astc_decoder: Simplify Select2DPartition 2021-07-31 21:36:26 -04:00
ameerj
5665d05547 astc_decoder: Optimize the use EncodingData
This buffer was a list of EncodingData structures sorted by their bit length, with some duplication from the cpu decoder implementation.
We can take advantage of its sorted property to optimize its usage in the shader.

Thanks to wwylele for the optimization idea.
2021-07-31 21:36:26 -04:00
ameerj
15c0c213b1 astc.h: Move data to cpp implementation
Moves leftover values that are no longer used by the gpu decoder back to the cpp implementation.
2021-07-31 21:26:42 -04:00
bunnei
7530594602
Merge pull request #6759 from ReinUsesLisp/pipeline-statistics
renderer_vulkan: Add setting to log pipeline statistics
2021-07-30 11:18:52 -07:00
ReinUsesLisp
b185567a03 vk_rasterizer: Flip viewport on Y_NEGATE
Matches OpenGL's behavior. I don't believe this register flips geometry,
but we have to try to match behavior on both backends.
2021-07-29 02:17:53 -03:00
ameerj
7ac99bb127 renderers: Add explicit invert_y bool to screenshot callback
OpenGL and Vulkan images render in different coordinate systems. This allows us to specify the coordinate system of the screenshot within each renderer
2021-07-28 21:46:08 -04:00
ameerj
75e7f54fb0 renderer_vulkan: Implement screenshots 2021-07-28 21:45:55 -04:00
ameerj
548bac8989 vk_blit_screen: Add public CreateFramebuffer method 2021-07-28 21:43:02 -04:00
ameerj
1e6c5d323d vk_blit_screen: Make Draw method more generic
Allows specifying the framebuffer and render area dimensions, rather than being hard coded for the render window.
2021-07-28 21:37:30 -04:00
ReinUsesLisp
3b006f4fe2 renderer_vulkan: Add setting to log pipeline statistics
Use VK_KHR_pipeline_executable_properties when enabled and available to
log statistics about the pipeline cache in a game.

For example, this is on Turing GPUs when generating a pipeline cache
from Super Smash Bros. Ultimate:

Average pipeline statistics
==========================================
Code size:       6433.167
Register count:    32.939

More advanced results could be presented, at the moment it's just an
average of all 3D and compute pipelines.
2021-07-27 21:29:24 -03:00
bunnei
92887a65f0
Merge pull request #6749 from lioncash/rtarget
render_target: Add missing initializer for size extent
2021-07-27 17:28:53 -07:00
Rodrigo Locatti
ab206d6378
Merge pull request #6748 from lioncash/engine-init
video_core/engine: Consistently initialize rasterizer pointers
2021-07-27 16:17:20 -03:00
bunnei
2717e79c74
Merge pull request #6745 from lioncash/copies
video_core: Remove some unused variables
2021-07-27 11:38:32 -07:00
Lioncash
00e100de08 render_target: Add missing initializer for size extent
Everything else has a default constructor that does the straightforward
thing of initializing most members to a default value, except for the
size.

We explicitly initialize the size (and others, for consistency), to
prevent potential uninitialized reads from occurring. Particularly given
the largeish surface area that this struct is used in.
2021-07-27 07:41:21 -04:00
Lioncash
f8964dd89a video_core/engine: Consistently initialize rasterizer pointers
Ensures all of the engines have consistent and deterministic
initialization of the rasterizer pointers.
2021-07-27 07:30:57 -04:00
Lioncash
8c82c594f0 vulkan_wrapper: Fix SetObjectName() always indicating objects as images
We should be using the passed in object type instead.
2021-07-27 07:19:15 -04:00
Lioncash
ec56a17acd buffer_cache: Remove unused small_vector in CommitAsyncFlushesHigh()
Given this is non-trivial, the constructor is required to execute, so
this removes a bit of redundant codegen.
2021-07-27 06:24:44 -04:00
Lioncash
075a744e38 gl_shader_cache: Remove unused variable 2021-07-27 06:23:49 -04:00
Lioncash
296728ec46 vk_compute_pass: Remove unused captures
Resolves two compiler warnings.
2021-07-27 06:17:52 -04:00
bunnei
d6c799494c
Merge pull request #6696 from ameerj/speed-limit-rename
general: Rename "Frame Limit" references to "Speed Limit"
2021-07-26 18:51:00 -07:00
Rodrigo Locatti
7511f65e31
Merge pull request #6741 from ReinUsesLisp/stream-remove
vk_stream_buffer: Remove unused stream buffer
2021-07-26 20:35:01 -03:00
Rodrigo Locatti
1a94b3f452
Merge pull request #6740 from K0bin/hvv-fallback
Handle allocation failure in Staging buffer
2021-07-26 20:34:44 -03:00
Robin Kertels
75050c788c
vk_staging_buffer_pool: Fall back to host memory when allocation fails 2021-07-26 23:37:18 +02:00
Rodrigo Locatti
c6991fa900
Merge pull request #6728 from ReinUsesLisp/null-buffer-usage
vk_buffer_cache: Add transform feedback usage to null buffer
2021-07-26 18:30:45 -03:00
ReinUsesLisp
5f9a4817a5 vk_stream_buffer: Remove unused stream buffer
Remove unused file.
2021-07-26 18:19:53 -03:00
ReinUsesLisp
771dcb2a56 vk_compute_pass: Fix pipeline barrier for indexed quads
Use an index buffer barrier instead of a vertex input read barrier.
2021-07-26 05:51:09 -03:00
ReinUsesLisp
27ed6e7c2b vk_buffer_cache: Add transform feedback usage to null buffer
Fixes bad API usages on Vulkan.
2021-07-26 05:49:37 -03:00
bunnei
98b26b6e12
Merge pull request #6585 from ameerj/hades
Shader Decompiler Rewrite
2021-07-25 11:39:04 -07:00
bunnei
84b9c42642
Merge pull request #6690 from ReinUsesLisp/dma-clear-fixups
buffer_cache: Misc fixups related to buffer clears
2021-07-24 01:27:50 -04:00
ameerj
c80ae87b4e renderer_base: Removed redundant settings
use_framelimiter was not being used internally by the renderers.
set_background_color was always set to true as there is no toggle for the renderer background color, instead users directly choose the color of their choice.
2021-07-23 22:10:01 -04:00
ameerj
9dfbc9bdce general: Rename "Frame Limit" references to "Speed Limit"
This setting is best referred to as a speed limit, as it involves the limits of all timing based aspects of the emulator, not only framerate.
This allows us to differentiate it from the fps unlocker setting.
2021-07-23 22:10:01 -04:00
ReinUsesLisp
a55ff22900 vulkan/blit_image: Commit descriptor sets within worker thread
Fixes race condition caused. The descriptor pool is not thread safe, so
we have to commit descriptor sets within the same thread.
2021-07-22 21:51:40 -04:00
ReinUsesLisp
f6796cad9c vulkan_device: Blacklist Volta and older from VK_KHR_push_descriptor
Causes crashes on Link's Awakening intro. It's hard to debug if it's our
fault due to bugs in validation layers.
2021-07-22 21:51:40 -04:00
ReinUsesLisp
3c6d440015 Revert "renderers: Disable async shader compilation"
This reverts commit 4a152767286717fa69bfc94846a124a366f70065.
2021-07-22 21:51:40 -04:00
ReinUsesLisp
8381490a04 opengl: Fix asynchronous shaders
Wait for shader to build before configuring it, and wait for the shader
to build before sharing it with other contexts.
2021-07-22 21:51:40 -04:00
ReinUsesLisp
258f35515d shader_environment: Receive cache version from outside
This allows us invalidating OpenGL and Vulkan separately in the future.
2021-07-22 21:51:40 -04:00
ameerj
56478bc9ac shader: Fix disabled attribute default values 2021-07-22 21:51:40 -04:00
ameerj
c9528282d9 gl_device: Simplify GLASM setting logic 2021-07-22 21:51:40 -04:00
ReinUsesLisp
e1ed218b41 renderer_opengl: Use ARB_separate_shader_objects
Ensures that states set for a particular stage are not attached to other
stages which may not need them.
2021-07-22 21:51:40 -04:00
ameerj
94af0a00f6 glsl: Clamp shared mem size to GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 2021-07-22 21:51:40 -04:00
ReinUsesLisp
8c166c68d4 gl_shader_cache: Properly implement asynchronous shaders 2021-07-22 21:51:40 -04:00
lat9nq
49946cf780 shader_recompiler, video_core: Resolve clang errors
Silences the following warnings-turned-errors:
-Wsign-conversion
-Wunused-private-field
-Wbraced-scalar-init
-Wunused-variable

And some other errors
2021-07-22 21:51:40 -04:00
ameerj
41493fbe89 renderers: Fix clang formatting 2021-07-22 21:51:40 -04:00
ameerj
8390286a89 renderers: Disable async shader compilation
The current implementation is prone to causing graphical issues. Disable until a better solution is implemented.
2021-07-22 21:51:40 -04:00
ReinUsesLisp
be54aad1c4 maxwell_to_vk: Add R16_SNORM 2021-07-22 21:51:40 -04:00
ameerj
11f04f1022 shader: Ignore global memory ops on devices lacking int64 support 2021-07-22 21:51:40 -04:00
lat9nq
55233c2861 vulkan_device: Add missing include algorithm 2021-07-22 21:51:40 -04:00
ameerj
7277d7fe96 vulkan_device: Blacklist ampere devices from float16 math 2021-07-22 21:51:40 -04:00
ameerj
dbee32d302 gl_shader_cache: Fixes for async shaders 2021-07-22 21:51:40 -04:00
ReinUsesLisp
57171b23f9 vulkan_device: Enable VK_EXT_extended_dynamic_state on RADV 21.2 onward 2021-07-22 21:51:40 -04:00
ReinUsesLisp
8722668b3c emit_spirv: Workaround VK_KHR_shader_float_controls on fp16 Nvidia
Fix regression on Fire Emblem: Three Houses when using native fp16.
2021-07-22 21:51:40 -04:00
ReinUsesLisp
fba6bd92d4 vk_rasterizer: Workaround bug in VK_EXT_vertex_input_dynamic_state
Workaround potential bug on Nvidia's driver where only updating high
attributes leaves low attributes out dated.
2021-07-22 21:51:39 -04:00
ReinUsesLisp
5643a909bc shader: Fix disabled and unwritten attributes and varyings 2021-07-22 21:51:39 -04:00
ReinUsesLisp
f94f0be521 vk_graphics_pipeline: Implement smooth lines 2021-07-22 21:51:39 -04:00
ReinUsesLisp
57a8921e01 vk_graphics_pipeline: Implement line width 2021-07-22 21:51:39 -04:00
lat9nq
fb9b1787f8 video_core: Enable GL SPIR-V shaders 2021-07-22 21:51:39 -04:00
lat9nq
1152d66ddd general: Add setting shader_backend
GLASM is getting good enough that we can move it out of advanced
graphics settings. This removes the setting `use_assembly_shaders`,
opting for a enum class `shader_backend`. This comes with the benefits
that it is extensible for additional shader backends besides GLSL and
GLASM, and this will work better with a QComboBox.

Qt removes the related assembly shader setting from the Advanced
Graphics section and places it as a new QComboBox in the API Settings
group. This will replace the Vulkan device selector when OpenGL is
selected.

Additionally, mark all of the custom anisotropic filtering settings as
"WILL BREAK THINGS", as that is the case with a select few games.
2021-07-22 21:51:39 -04:00
ReinUsesLisp
8a3427a4c8 glasm: Add passthrough geometry shader support 2021-07-22 21:51:39 -04:00
ReinUsesLisp
7dafa96ab5 shader: Rework varyings and implement passthrough geometry shaders
Put all varyings into a single std::bitset with helpers to access it.

Implement passthrough geometry shaders using host's.
2021-07-22 21:51:39 -04:00
ReinUsesLisp
4f052a1f39 vk_graphics_pipeline: Implement conservative rendering 2021-07-22 21:51:39 -04:00
ReinUsesLisp
395bed3a0a shader: Unify shader stage types 2021-07-22 21:51:39 -04:00
ReinUsesLisp
fb166b5ff4 shader: Emulate 64-bit integers when not supported
Useful for mobile and Intel Xe devices.
2021-07-22 21:51:39 -04:00
ReinUsesLisp
3877918e96 gl_graphics_pipeline: Fix assembly shaders check for transform feedbacks 2021-07-22 21:51:39 -04:00
ReinUsesLisp
9bd0531384 gl_graphics_pipeline: Inline hash and operator== key functions 2021-07-22 21:51:39 -04:00
ReinUsesLisp
f5db8c7440 gl_shader_cache: Check previous pipeline before checking hash map
Port optimization from Vulkan.
2021-07-22 21:51:39 -04:00
ReinUsesLisp
218dedca1f gl_graphics_pipeline: Port optimizations from Vulkan pipelines 2021-07-22 21:51:39 -04:00
ReinUsesLisp
df9b7e18f5 buffer_cache: Fix debugging leftover 2021-07-22 21:51:38 -04:00
ReinUsesLisp
838d7e4ca5 buffer_cache: Fix size reductions not having in mind bind sizes
A buffer binding can change between shaders without changing the
shaders. This lead to outdated bindings on OpenGL.
2021-07-22 21:51:38 -04:00
ameerj
fcff19e0fa shaders: Allow shader notify when async shaders is disabled 2021-07-22 21:51:38 -04:00
ReinUsesLisp
ca67077ca8 vk_graphics_pipeline: Use VK_KHR_push_descriptor when available
~51% faster on Nvidia compared to previous method.
2021-07-22 21:51:38 -04:00
ReinUsesLisp
374eeda1a3 shader: Properly manage attributes not written from previous stages 2021-07-22 21:51:38 -04:00
ReinUsesLisp
0ffea97e2e shader: Split profile and runtime info headers 2021-07-22 21:51:38 -04:00
ReinUsesLisp
cbbca26d18 shader: Add support for native 16-bit floats 2021-07-22 21:51:38 -04:00
ReinUsesLisp
376aa94819 shader: Rename maxwell/program.h to translate_program.h 2021-07-22 21:51:38 -04:00
ReinUsesLisp
69f9b97e7e vulkan_device: Blacklist VK_EXT_vertex_input_dynamic_state on Intel 2021-07-22 21:51:38 -04:00
ameerj
d36f667bc0 glsl: Address rest of feedback 2021-07-22 21:51:38 -04:00
ameerj
3b339fbbf6 glsl: Conditionally use fine/coarse derivatives based on device support 2021-07-22 21:51:38 -04:00
ameerj
6eea88d614 glsl: Cleanup/Address feedback 2021-07-22 21:51:38 -04:00
ameerj
74f683787e gl_shader_cache: Implement async shaders 2021-07-22 21:51:38 -04:00
ameerj
5e7b2b9661 glsl: Add stubs for sparse queries and variable aoffi when not supported 2021-07-22 21:51:38 -04:00
ameerj
ff3de0fb6b gl_shader_cache: Remove const from pipeline source arguments 2021-07-22 21:51:38 -04:00
ameerj
413eb6983f gl_shader_cache: Move OGL shader compilation to the respective Pipeline constructor 2021-07-22 21:51:38 -04:00
ameerj
e81c73a874 glsl: Address more feedback. Implement indexed texture reads 2021-07-22 21:51:38 -04:00
ameerj
6650c4799d gl_rasterizer: Add texture fetch barrier for fragments
Fixes flicker seen in XC2
2021-07-22 21:51:37 -04:00
ameerj
8bb8bbf4ae glsl: Implement fswzadd
and wip nv thread shuffle impl
2021-07-22 21:51:37 -04:00
ameerj
970fc39d98 glsl: Rebase fixes 2021-07-22 21:51:37 -04:00
ameerj
747b8556a4 glsl: Use textureGrad fallback when EXT_texture_shadow_lod is unsupported 2021-07-22 21:51:37 -04:00
ameerj
6577a63d36 glsl: skip gl_ViewportIndex write if device does not support it 2021-07-22 21:51:37 -04:00
ameerj
f4799e8fa1 glsl: Implement transform feedback 2021-07-22 21:51:37 -04:00
ameerj
e35ffbbeb0 glsl: Implement VOTE for subgroup size potentially larger 2021-07-22 21:51:36 -04:00
ameerj
3d086e6130 glsl: Implement some attribute getters and setters 2021-07-22 21:51:36 -04:00
ameerj
bd24fa9713 glsl: Query GL Device for FP16 extension support 2021-07-22 21:51:36 -04:00
ReinUsesLisp
53667ddd4e glsl: Fixup build issues 2021-07-22 21:51:36 -04:00
ameerj
eaff1030de glsl: Initial backend 2021-07-22 21:51:35 -04:00
ReinUsesLisp
8fb2048934 vk_rasterizer: Exit render passes on fragment barriers 2021-07-22 21:51:35 -04:00
Rodrigo Locatti
dbf7cb9f90 vk_graphics_pipeline: Fix path with no VK_EXT_extended_dynamic_state 2021-07-22 21:51:35 -04:00
ReinUsesLisp
94e751f415 buffer_cache: Invalidate fast buffers on compute 2021-07-22 21:51:35 -04:00