Commit graph

2258 commits

Author SHA1 Message Date
gdk
1448136c3d SPIR-V: Implement LogicalExclusiveOr 2022-06-17 22:42:53 +01:00
gdk
fbfaf63940 Fix relaunch issues 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
90ae2dbf69 Fix validation error for query reset
Need to think of a better way to do this.
2022-06-17 22:42:52 +01:00
riperiperi
05a736b6d3 Remove unnecessary lines
Was for testing
2022-06-17 22:42:51 +01:00
riperiperi
4cc0c2132c Rework Query stuff a bit to avoid render pass end
Tries to reset returned queries in background when possible, rather than ending the render pass.

Still ends render pass when resetting a counter after draws, but maybe that can be solved too. (by just pulling an empty object off the pool?)
2022-06-17 22:42:51 +01:00
riperiperi
eda65c8dd3 Copy query results after RP ends, rather than ending to copy
We need to end the render pass to get the data (submit command buffer) anyways...

Reduces render passes created in games that use queries.
2022-06-17 22:42:51 +01:00
riperiperi
af4aae7951 Use a bitmap to do granular tracking for buffer uploads.
This path is only taken if the much faster check of "is the buffer rented at all" is triggered, so it doesn't actually end up costing too much, and the time saved by not ending render passes (and on gpu for not waiting on barriers) is probably helpful.

Avoids ending render passes to update buffer data (not all the time)
- 140-180 to 35-45 in SMO metro kingdom (these updates are in the UI)
- Very variable 60-150(!) to 16-25 in mario kart 8 (these updates are in the UI)

As well as allowing more data to be preloaded persistently, this will also allow more data to be loaded in the preload buffer, which should be faster as it doesn't need to insert barriers between draws. (and on tbdr, does not need to flush and reload tile memory)

Improves performance in GPU limited scenarios. Should notably improve performance on TBDR gpus. Still a lot more to do here.
2022-06-17 22:42:51 +01:00
riperiperi
3e88558182 Only update fragment scale count if a vertex texture needs a scale.
Fixes a performance regression introduced by texture scaling in the vertex stage where support buffer updates would be very frequent, even at 1x, if any textures were used on the vertex stage.

This check doesn't exactly look cheap (a flag in the shader stage would probably be preferred), but it is much cheaper than uploading scales in both vulkan and opengl, so it will do for now.
2022-06-17 22:42:51 +01:00
riperiperi
9c696fc2e1 Fix Multisampling 2022-06-17 22:42:50 +01:00
riperiperi
089fa6bd54 Make more robust to shader compilation failure
- Don't freeze when GLSL compilation fails
- Background SPIR-V pipeline compile failure results in skipped draws, similar to GLSL compilation failure.
2022-06-17 22:42:50 +01:00
riperiperi
d45b28f6b7 Cleanup for merge (note: disables spir-v) 2022-06-17 22:42:50 +01:00
riperiperi
6c09cfff4c Update topology with GpuAccessorState 2022-06-17 22:42:50 +01:00
riperiperi
ba8887b848 Make this 32 2022-06-17 22:42:49 +01:00
riperiperi
c75860e627 Address some feedback 2022-06-17 22:42:49 +01:00
riperiperi
f6196fe07b Multithreaded Pipeline Compilation 2022-06-17 22:42:49 +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
51d986da35 Multisampling: We can only resolve for unscaled copies 2022-06-17 22:42:47 +01:00
gdk
5efe0167ea Multisampling: Use resolve if src samples count > dst samples count 2022-06-17 22:42:47 +01:00
gdk
6810796638 Multisampling support 2022-06-17 22:42:46 +01:00
riperiperi
fb20e5b371 Don't pass depth clip state right now (fix decals)
Explicitly disabling it is incorrect. OpenGL currently automatically disables based on depth clamp, which is the behaviour if this state is omitted.
2022-06-17 22:42:45 +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
riperiperi
bf94f4c7d6 Some optimizations to Spv.Generator
- Dictionary for lookups of type declarations, constants, extinst
- LiteralInteger internal data format -> ushort
- Deterministic HashCode implementation to avoid spirv result not being the same between runs
- Inline operand list instead of List<T>, falls back to array if many operands. (large performance boost)

TODO: improve instruction allocation, structured program creator, ssa?
2022-06-17 22:42:43 +01:00
riperiperi
12dec18f39 Reduce allocations for Spir-v serialization
Passes BinaryWriter instead of the stream to Write and WriteOperand

- Removes creation of BinaryWriter for each instruction
- Removes allocations for literal string
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
be36f6fa5b Correct GTK UI status bar positions 2022-06-17 22:42:40 +01:00
gdk
f1a1f477ef Allow custom aspect ratio on Vulkan 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
9b779adf57 Better workaround for AMD vertex buffer size alignment issue 2022-06-17 22:42:39 +01:00
gdk
522e7933e8 Workaround for wrong last attribute on AMD (affects FFVII, STRIKERS1945, probably more) 2022-06-17 22:42:39 +01:00
gdk
36b3ab0741 Fix draw outside of render pass and missing capability 2022-06-17 22:42:39 +01:00
gdk
5a3695c968 Don't pause transform feedback for multi draw 2022-06-17 22:42:39 +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
riperiperi
0fe19f51c0 Insert barriers around vkCmdBlitImage (may fix some amd flicker) 2022-06-17 22:42:38 +01:00