Commit graph

5 commits

Author SHA1 Message Date
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
97b179696b SPIR-V: Fix ImageQuerySizeLod 2022-06-17 22:42:40 +01:00
gdk
9a95c3c3bc Update Spv.Generator 2022-06-17 22:42:35 +01:00