Commit Graph
100 Commits
Author SHA1 Message Date
ReinUsesLispandFernando Sahmkow e66d5b88a6 shader: Properly scale image reads and add GL SPIR-V support
Thanks for everything!
2021-11-16 22:11:29 +01:00
ReinUsesLispandFernando Sahmkow fc9bb3c3fe shader: Properly blacklist and scale image loads 2021-11-16 22:11:29 +01:00
ReinUsesLispandFernando Sahmkow c7a1cbad44 texture_cache: Add getter to query if image view is rescaled 2021-11-16 22:11:29 +01:00
ReinUsesLispandFernando Sahmkow 526e47f148 vk_rasterizer: Minor style change 2021-11-16 22:11:29 +01:00
ReinUsesLispandFernando Sahmkow c9238555f7 gl_texture_cache: Fix scaling blits 2021-11-16 22:11:29 +01:00
ReinUsesLispandFernando Sahmkow cfeb161c7e glsl/glasm: Pass and use scaling parameters in shaders 2021-11-16 22:11:29 +01:00
ReinUsesLispandFernando Sahmkow 4a512d6827 gl_rasterizer: Properly scale viewports and scissors 2021-11-16 22:11:29 +01:00
ReinUsesLispandFernando Sahmkow 2182d25750 texture_cache: Fix blacklists on compute 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 56ccda1d99 texture_cache: Simplify image view queries and blacklisting 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow d2388dd0d0 vulkan: Implement rescaling shader patching 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow dc72d4d4f5 vk_texture_cache: Properly scale blit source images 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow baf0993d5c vk_graphics_pipeline: Use Shader::NumDescriptors when possible 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 6f3a41abe2 opengl: Use Shader::NumDescriptors when possible 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 656adee630 spirv: Implement rescaling patching 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 01379c5e3c shader/rescaling_pass: Patch more instructions 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow c15332c44f shader: Add IsTextureScaled opcode 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 74efa57c1b texture_cache: Add image getters 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow c892359d1b shader: Add copy constructor to instructions 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 95761cc6a7 shader: Add integer division opcodes 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 43aa695a04 common/settings: Remove unused scaling options 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow e580299467 shader: Fix rescaling pass 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 0fb4b84383 vk_texture_cache: Simplify and optimize scaling blits 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 520c4a44f6 vk_texture_cache: Fix scaling blit validation errors 2021-11-16 22:11:28 +01:00
ReinUsesLispandFernando Sahmkow 1672e9ba09 shader: Fix resolution scaling pass 2021-11-16 22:11:27 +01:00
ReinUsesLispandFernando Sahmkow fb924ea85c shader: Add resolution down factor opcode 2021-11-16 22:11:27 +01:00
ReinUsesLispandFernando Sahmkow d464b122d5 Fix blits with mips 2021-11-16 22:11:27 +01:00
ReinUsesLispandFernando Sahmkow 973f8f1d08 Fix blits 2021-11-16 22:11:27 +01:00
ReinUsesLisp 8c9febe8f7 shader: Fold UnpackFloat2x16 and PackFloat2x16
Simplifies the code a bit when possible. These instructions should be
no-ops codegen wise.
2021-07-29 21:22:52 -03: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
ReinUsesLisp 1bb46b7d64 shader: Mark ConvertF16F32 and ConvertF32F16 as fp16 instructions
Fixes instances where fp16 types are not declared on SPIR-V but they are
used. This shouldn't happen on master, as it's been uncovered by an
additional optimization pass.
2021-07-27 21:33:05 -03: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
Rodrigo LocattiandGitHub ab206d6378 Merge pull request #6748 from lioncash/engine-init
video_core/engine: Consistently initialize rasterizer pointers
2021-07-27 16:17:20 -03:00
Rodrigo LocattiandGitHub 5da97c57cd Merge pull request #6744 from lioncash/exc
exception: Make constructors explicit
2021-07-27 16:11:17 -03:00
Rodrigo LocattiandGitHub 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 LocattiandGitHub 1a94b3f452 Merge pull request #6740 from K0bin/hvv-fallback
Handle allocation failure in Staging buffer
2021-07-26 20:34:44 -03:00
Rodrigo LocattiandGitHub 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
Rodrigo LocattiandGitHub 6c432d5349 Merge pull request #6729 from ReinUsesLisp/quad-indexed-barrier
vk_compute_pass: Fix pipeline barrier for indexed quads
2021-07-26 18:30:05 -03:00
ReinUsesLisp 5f9a4817a5 vk_stream_buffer: Remove unused stream buffer
Remove unused file.
2021-07-26 18:19:53 -03:00
Rodrigo LocattiandGitHub c0f99558fb Merge pull request #6724 from lioncash/nodisc-shader
shader_recompiler: Remove unnecessary [[nodiscard]] instances
2021-07-26 16:35:21 -03:00
Rodrigo LocattiandGitHub de0b89792c Merge pull request #6726 from lioncash/hguard
emit_spirv_instructions: Add missing header guard
2021-07-26 16:35:11 -03:00
Rodrigo LocattiandGitHub 3d97f1e6cf Merge pull request #6727 from lioncash/topology
emit_glasm: Fix LINESS_ADJACENCY typo in InputPrimitive()
2021-07-26 16:35:03 -03:00
Rodrigo LocattiandGitHub b2b3fcdccd Merge pull request #6723 from lioncash/shader
object_pool: Add missing return in Chunk move assignment operator
2021-07-26 06:01:21 -03:00
Rodrigo LocattiandGitHub 4afc2de129 Merge pull request #6725 from lioncash/control-token
control_flow: Fix duplicate switch case in OpcodeToken
2021-07-26 06:00:23 -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
ReinUsesLisp 66a0cedba3 shader: Fold integer FMA from Nvidia's pattern
Fold shaders doing "a * b + c" on integers from the pattern generated by
Nvidia's GL compiler.

On a somewhat complex compute shader it reduces the code size by 16
instructions from 2 matches on Turing GPUs.

On Intel as extracted from KHR_pipeline_executable_properties:
Before the optimization:
```
Instruction Count: 2057
Basic Block Count: 45
Scratch Memory Size: 14752
Spill Count: 232
Fill Count: 261
SEND Count: 610
Cycle Count: 11325
```

After the optimization:
```
Instruction Count: 2046
Basic Block Count: 44
Scratch Memory Size: 13728
Spill Count: 219
Fill Count: 268
SEND Count: 604
Cycle Count: 11367
```
2021-07-26 04:58:02 -03:00
ReinUsesLisp 09fb41dc63 shader: Use TryInstRecursive on XMAD multiply folding
Simplify a bit the logic.
2021-07-26 04:15:27 -03:00
ReinUsesLisp f6f0383b49 shader: Add TryInstRecursive utility to values 2021-07-26 01:31:05 -03:00
ReinUsesLispandameerj 7f13104c17 shader: Support out of bound local memory reads and immediate writes
Support ignoring immediate out of bound writes. Writing dynamically out
of bounds is not yet supported (e.g. R0+0x4).

Reading out of bounds yields zero. This is supported checking for the
size from the IR; if the input is immediate, the optimization passes
will drop it.
2021-07-22 21:51:41 -04:00
ReinUsesLispandameerj 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
ReinUsesLispandameerj 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
ReinUsesLispandameerj 594ea29015 cmake: Remove unused code in GenerateSCMRev.cmake
Remove shader code hash generation code as it's no longer used.
2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj a741513e65 qt: Remove "experimental" from asynchronous shader building UI 2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj 3c6d440015 Revert "renderers: Disable async shader compilation"
This reverts commit 4a152767286717fa69bfc94846a124a366f70065.
2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj 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
ReinUsesLispandameerj 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
ReinUsesLispandameerj 4a82450c81 cmake: Remove shader cache version 2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj 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
ReinUsesLispandameerj bf2956d77a shader: Avoid usage of C++20 ranges to build in clang 2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj 8c166c68d4 gl_shader_cache: Properly implement asynchronous shaders 2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj 2235a51b5d shader: Manually convert from array<u32> to bitset instead of using bit_cast 2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj be54aad1c4 maxwell_to_vk: Add R16_SNORM 2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj 57171b23f9 vulkan_device: Enable VK_EXT_extended_dynamic_state on RADV 21.2 onward 2021-07-22 21:51:40 -04:00
ReinUsesLispandameerj 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
ReinUsesLispandameerj b21bf79bd2 shader: Only apply shift on register mode for IADD3 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 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
ReinUsesLispandameerj 5643a909bc shader: Fix disabled and unwritten attributes and varyings 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj f94f0be521 vk_graphics_pipeline: Implement smooth lines 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 57a8921e01 vk_graphics_pipeline: Implement line width 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 5b2b0634a1 spirv: Fix code emission when descriptor aliasing is unsupported
Fixes OpenGL.
2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 8612b5fec5 shader: Use std::bit_cast instead of Common::BitCast for passthrough 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 8a3427a4c8 glasm: Add passthrough geometry shader support 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 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
ReinUsesLispandameerj 4f052a1f39 vk_graphics_pipeline: Implement conservative rendering 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj ecd6b4356b shader: Only verify shader when graphics debugging is enabled 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 395bed3a0a shader: Unify shader stage types 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj fb166b5ff4 shader: Emulate 64-bit integers when not supported
Useful for mobile and Intel Xe devices.
2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj d8d5501459 shader: Add int64 to int32 lowering pass 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 04ef2160f9 shader: Teach global memory base tracker to follow vectors 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 97e80dda55 shader: Add constant propagation to integer vectors 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 4397053d5c shader: Remove IAbs64 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 808ef97a08 shader: Move loop safety tests to code emission 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 3877918e96 gl_graphics_pipeline: Fix assembly shaders check for transform feedbacks 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 9bd0531384 gl_graphics_pipeline: Inline hash and operator== key functions 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj f5db8c7440 gl_shader_cache: Check previous pipeline before checking hash map
Port optimization from Vulkan.
2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 218dedca1f gl_graphics_pipeline: Port optimizations from Vulkan pipelines 2021-07-22 21:51:39 -04:00
ReinUsesLispandameerj 1d182fc0f5 shader: Calibrate loop safety threshold 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj df9b7e18f5 buffer_cache: Fix debugging leftover 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj 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
ReinUsesLispandameerj 0cd08b3e72 shader: Align constant buffer sizes to 16 bytes
WAR for AMD reading zeroes on uniform buffers of size 2.
2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj 59fead3a47 spirv: Properly handle devices without int8 and int16 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj b5e78607ad spirv: Handle small storage buffer loads on devices with no support 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj 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
ReinUsesLispandameerj 1091995f8e shader: Simplify MergeDualVertexPrograms 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj 374eeda1a3 shader: Properly manage attributes not written from previous stages 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj 892b8aa2ad glsl: Only declare fragment outputs on fragment shaders 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj 0ffea97e2e shader: Split profile and runtime info headers 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj cbbca26d18 shader: Add support for native 16-bit floats 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj 376aa94819 shader: Rename maxwell/program.h to translate_program.h 2021-07-22 21:51:38 -04:00
ReinUsesLispandameerj 69f9b97e7e vulkan_device: Blacklist VK_EXT_vertex_input_dynamic_state on Intel 2021-07-22 21:51:38 -04:00