Commit graph

246 commits

Author SHA1 Message Date
gdk
572759a4ac Combine non-buffer with buffer image descriptor sets 2022-06-17 22:47:03 +01:00
gdk
c832f55618 Fix inverse viewport transform vector type on SPIR-V 2022-06-17 22:47:02 +01:00
riperiperi
52050e4d48 Fix gl_FragCoord.z transformation
FragCoord.z is always in 0-1, even when the real depth range is -1 to 1. Turns out the only bug was geo and tess stage outputs.

Fixes Pokemon Sword/Shield, possibly others.
2022-06-17 22:47:01 +01:00
riperiperi
d4ccb6b895 Return of the Vector Indexing Bug
One day, everyone will get this right.
2022-06-17 22:47:00 +01:00
riperiperi
5a6a70e3d5 Fix typo 2022-06-17 22:47:00 +01:00
riperiperi
182c95a588 Vulkan/SPIR-V support for viewport inverse 2022-06-17 22:47:00 +01:00
riperiperi
a34efcd398 Remove gl_FragDepth scaling
This is always 0-1; the other two issues were causing the problems. Fixes regression with Xenoblade.
2022-06-17 22:47:00 +01:00
riperiperi
c3951877f7 Geometry Shader index count from ThreadsPerInputPrimitive
Generally fixes SPIR-V emitting too many triangles, may change games in OpenGL
2022-06-17 22:46:59 +01:00
riperiperi
8097480b02 Improvements to -1 to 1 depth mode.
- Transformation is only applied on the last stage in the vertex pipeline.
- Should fix some issues with geometry and tessellation (hopefully)
- Reading back FragCoord Z on fragment will transform back to -1 to 1.
2022-06-17 22:46:59 +01:00
gdk
dd54eb4be1 Geometry shader passthrough emulation 2022-06-17 22:46:05 +01:00
gdk
fd2e53fdc6 Raise textures limit to 64 on Vulkan 2022-06-17 22:46:05 +01:00
gdk
c95cdc853e Enable shader cache on Vulkan and implement MultiplyHighS32/U32 on SPIR-V (missed those before) 2022-06-17 22:45:57 +01:00
gdk
4f086b0ec9 Shader specialization for new Vulkan required state (fixes remaining alpha test issues, vertex stretching on AMD on Crash Bandicoot, etc) 2022-06-17 22:45:00 +01:00
gdk
f16b47114c SPIR-V: Workaround for Intel FrontFacing bug 2022-06-17 22:42:56 +01:00
gdk
ad081de56b SPIR-V: Fix ImageLoad CompositeExtract component type 2022-06-17 22:42:56 +01:00
gdk
0a7fbb6bfd SPIRV/GLSL: More scaling related fixes 2022-06-17 22:42:56 +01:00
gdk
3aa5397bad SPIR-V: Fix another case of wrong field index 2022-06-17 22:42:56 +01:00
gdk
670431f4fa SPIR-V: Fix field index for scale count 2022-06-17 22:42:56 +01:00
gdk
0b27b3e470 SPIR-V: Resolution scale support and fix TextureSample multisample with LOD bug 2022-06-17 22:42:55 +01:00
gdk
f18e7aa779 SPIR-V: Implement StoreShader8/16 and StoreStorage8/16 2022-06-17 22:42:55 +01:00
gdk
3b444f0ea3 SPIR-V: Geometry shader passthrough support 2022-06-17 22:42:54 +01:00
gdk
cacc9c7da4 SPIR-V: Implement tessellation support 2022-06-17 22:42:54 +01:00
gdk
070996ad6d Ignore unsupported attributes rather than throwing (matches current GLSL behaviour) 2022-06-17 22:42:54 +01:00
gdk
d5e2cc2f9b SPIR-V: Constant buffer indexing support 2022-06-17 22:42:54 +01:00
gdk
1448136c3d SPIR-V: Implement LogicalExclusiveOr 2022-06-17 22:42:53 +01:00
gdk
324d0528d3 SPIR-V: Fix TextureSize for MS and Buffer sampler types 2022-06-17 22:42:53 +01:00
gdk
95d5a50042 SPIR-V: Implement attribute indexing and StoreAttribute 2022-06-17 22:42:53 +01:00
gdk
2ef7622126 SPIR-V: Fix SwizzleAdd and some validation errors 2022-06-17 22:42:52 +01:00
riperiperi
7882c0498b SPIR-V: Only use input attribute type for input attributes
Output vertex attributes should always be of type float.
2022-06-17 22:42:48 +01:00
riperiperi
cbeb40934f SPIR-V: Don't OpReturn if we already OpExit'ed
Fixes spir-v parse failure and stack smashing in RADV (obviously you still need bolist)
2022-06-17 22:42:48 +01:00
riperiperi
c1517e5ee3 SPIR-V: Use ConstantComposite for Texture Offset Vector
Fixes a bunch of freezes with SPIR-V on AMD hardware, and validation errors. Note: Obviously assumes input offsets are constant, which they currently are.
2022-06-17 22:42:48 +01:00
riperiperi
2d6642d605 SPIR-V: Only add FSI exec mode if used. 2022-06-17 22:42:47 +01:00
gdk
1ab42e9ce8 SPIR-V: Implement SwizzleAdd, add missing Triangles ExecutionMode for geometry shaders, remove SamplerType field from TextureMeta 2022-06-17 22:42:44 +01:00
gdk
c260ef7b0a SPIR-V: Add early fragment tests support 2022-06-17 22:42:44 +01:00
gdk
387333454b SPIR-V: Fragment shader interlock support (and image coherency) 2022-06-17 22:42:44 +01:00
gdk
f51f9e90d4 SPIR-V: Transform feedback support 2022-06-17 22:42:44 +01:00
riperiperi
afa54813f7 LocalDefMap for Ssa Rewriter
Rather than allocating a large array of all registers for each block in the shader, allocate one array of all registers and clear it between blocks. Reduces allocations in the shader translator.
2022-06-17 22:42:44 +01:00
riperiperi
dd718fbe97 Pool Spv.Generator resources, cache delegates, spv opts
- Pools for Instructions and LiteralIntegers. Can be passed in when creating the generator module.
  - NewInstruction is called instead of new Instruction()
  - Ryujinx SpirvGenerator passes in some pools that are static. The idea is for these to be shared between threads eventually.
- Estimate code size when creating the output MemoryStream
- LiteralInteger pools using ThreadStatic pools that are initialized before and after creation... not sure of a better way since the way these are created is via implicit cast.

Also, cache delegates for Spv.Generator for functions that are passed around to GenerateBinary etc, since passing the function raw creates a delegate on each call.

TODO: update python spv cs generator to make the coregrammar with NewInstruction and the `params` overloads.
2022-06-17 22:42:43 +01:00
gdk
301ddec36f SPIR-V: Use correct binding number on storage buffers array 2022-06-17 22:42:43 +01:00
gdk
e1d73cc560 SPIR-V: Geometry shader support 2022-06-17 22:42:42 +01:00
gdk
bd56998f4d Re-enable BGRA (was not supposed to disable it) 2022-06-17 22:42:41 +01:00
gdk
3c949309e5 SPIR-V: Implement LoopContinue IR instruction 2022-06-17 22:42:41 +01:00
gdk
aa0913838d SPIR-V: Set DepthReplacing execution mode when FragDepth is modified 2022-06-17 22:42:40 +01:00
gdk
97b179696b SPIR-V: Fix ImageQuerySizeLod 2022-06-17 22:42:40 +01:00
gdk
a2e4b4b6d8 SPIR-V: Functions must always end with a return 2022-06-17 22:42:40 +01:00
gdk
7347642c05 More instructions + fixes on SPIR-V backend 2022-06-17 22:42:40 +01:00
gdk
52249e50dd Fix transform feedback on Intel, gl_Position feedback and clears to inexistent depth buffers 2022-06-17 22:42:38 +01:00
gdk
4c7e6df7d1 Add alpha test emulation on shader (but no shader specialisation yet...) 2022-06-17 22:42:35 +01:00
gdk
9a95c3c3bc Update Spv.Generator 2022-06-17 22:42:35 +01:00
riperiperi
393d0a6134 Update findMSB/findLSB to match master's instruction enum 2022-06-17 22:42:34 +01:00