* infra: Migrate to .NET 6
* Rollback version naming change
* Workaround .NET 6 ZipArchive API issues
* ci: Switch to VS 2022 for AppVeyor
CI is now ready for .NET 6
* Suppress WebClient warning in DoUpdateWithMultipleThreads
* Attempt to workaround System.Drawing.Common changes on 6.0.0
* Change keyboard rendering from System.Drawing to ImageSharp
* Make the software keyboard renderer multithreaded
* Bump ImageSharp version to 1.0.4 to fix a bug in Image.Load
* Add fallback fonts to the keyboard renderer
* Fix warnings
* Address caian's comment
* Clean up linux workaround as it's uneeded now
* Update readme
Co-authored-by: Caian Benedicto <caianbene@gmail.com>
* Support shader gl_Color, gl_SecondaryColor and gl_TexCoord built-ins
* Shader cache version bump
* Fix back color value on fragment shader
* Disable IPA multiplication for fixed function attributes and back color selection
* Support coherent images
* Add support for fragment shader interlock
* Change to tree based match approach
* Refactor + check for branch targets and external registers
* Make detection more robust
* Use Intel fragment shader ordering if interlock is not available, use nothing if both are not available
* Remove unused field
* Another workaround for NVIDIA driver 496.13 shader bug
This might work better than the other one. Give this a test to see if it fixes/doesn't fix issues with the other one.
The problem seems to be when any variable assignment happens with a negation. `temp_1 = -temp_0;` seems to trigger weird behaviour, but `temp_1 = 0.0 - temp_0;` does not. This also might to extend towards integer types?
* Update cache version
* Add disclaimer comment
* Wording
* Fix TXQ for 3D textures.
Assumes the texture is 3D if the component mask contains Z.
This fixes a bug in UE4 games where parts of the map had garbage pointers to lighting voxels, as the lookup 3D texture was not being initialized. Most notable game is THPS1+2.
May need another PR to keep image store data alive and properly flush it in order using the AutoDeleteCache.
* Get sampler type for TextureSize from bound textures.
* Initial Implementation
* Further improvements (no support for float/64-bit types)
* Merge atomic and reduce instructions, add missing format switch
* Fix rebase issues.
* Not used.
* Whoops. Fixed.
* Partial implementation of inc/dec, cleanup and TODOs
* Remove testing path
* Address Feedback
* Replace BGRA and scale uniforms with a uniform block
* Setting the data again on program change is no longer needed
* Optimize and resolve some warnings
* Avoid redundant support buffer updates
* Some optimizations to BindBuffers (now inlined)
* Unify render scale arrays
* Use a new approach for shader BRX targets
* Make shader cache actually work
* Improve the shader pattern matching a bit
* Extend LDC search to predecessor blocks, catches more cases
* Nit
* Only save the amount of constant buffer data actually used. Avoids crashes on partially mapped buffers
* Ignore Rd on predicate instructions, as they do not have a Rd register (catches more cases)
* shadertools: Prepare for new target Langugaes and APIs
This improves shader tools command line by adding support for target
language and api.
* Address gdkchan's comments
* Move shader resource descriptor creation out of the backend
* Remove now unused code, and other nits
* Shader cache version bump
* Nits
* Set format for bindless image load/store
* Fix buffer write flag
* Pass CbufSlot when getting info from the texture descriptor
Fixes some issues with bindless textures, when CbufSlot is not equal to the current TextureBufferIndex.
Specifically fixes a random chance of full screen colour flickering in Super Mario Party.
* Apply suggestions from code review
Oops
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Salieri: Add blacklist system and blacklist shaders using bindless
Currently the shader cache doesn't have the right format to support
bindless textures correctly and may cache shaders that it cannot rebuild
after host invalidation.
This PR address the issue by blacklisting shaders using bindless
textures.
THis also support detection of already cached broken shader and handle removal
of those.
* Move to a feature flags design to avoid intrusive changes in the translator
This remove the auto correct behaviour
* Reduce diff on TranslationFlags
* Reduce comma on last entry of TranslationFlags
* Fix inverted logic and remove leftovers
* remove debug edits oops
This allows bindless handles to be found for image/texture instructions with predicates, when the assignment of the texture handle is within the same predicate.
This seems to cover the remaining bindless handles that compilers seem to be creating due to optimizations.
Will affect newer UE4 games, and games by NdCube (Super Mario Party, Clubhouse Games)
* Improve Buffer Textures and flush Image Stores
Fixes a number of issues with buffer textures:
- Reworked Buffer Textures to create their buffers in the TextureManager, then bind them with the BufferManager later.
- Fixes an issue where a buffer texture's buffer could be invalidated after it is bound, but before use.
- Fixed width unpacking for large buffer textures. The width is now 32-bit rather than 16.
- Force buffer textures to be rebound whenever any buffer is created, as using the handle id wasn't reliable, and the cost of binding isn't too high.
Fixes vertex explosions and flickering animations in UE4 games.
* Set ImageStore flag... for ImageStore.
* Check the offset and size.
* Initial implementation of buffer flush (VERY WIP)
* Host shaders need to be rebuilt for the SSBO write flag.
* New approach with reserved regions and gl sync
* Fix a ton of buffer issues.
* Remove unused buffer unmapped behaviour
* Revert "Remove unused buffer unmapped behaviour"
This reverts commit f1700e52fb8760180ac5e0987a07d409d1e70ece.
* Delete modified ranges on unmap
Fixes potential crashes in Super Smash Bros, where a previously modified range could lie on either side of an unmap.
* Cache some more delegates.
* Dispose Sync on Close
* Also create host sync for GPFifo syncpoint increment.
* Copy buffer optimization, add docs
* Fix race condition with OpenGL Sync
* Enable read tracking on CommandBuffer, insert syncpoint on WaitForIdle
* Performance: Only flush individual pages of SSBO at a time
This avoids flushing large amounts of data when only a small amount is actually used.
* Signal Modified rather than flushing after clear
* Fix some docs and code style.
* Introduce a new test for tracking memory protection.
Sucessfully demonstrates that the bug causing write protection to be cleared by a read action has been fixed. (these tests fail on master)
* Address Comments
* Add host sync for SetReference
This ensures that any indirect draws will correctly flush any related buffer data written before them. Fixes some flashing and misplaced world geometry in MH rise.
* Make PageAlign static
* Re-enable read tracking, for reads.
* Implement shader CC mode for ISCADD, X mode for ISETP and fix STS/STG with RZ
* Fix STG too and bump shader cache version
* Fix wrong name
* Fix Carry being inverted on comparison
* infra: Migrate to .NET 5
This migrate projects and CI to .NET 5
* Remove language version restrictions (now on 9.0 by default)
* infra: pin .NET 5 to avoid later issues
* infra: Cleanup csproj files
* infra: update dependencies
* infra: Add temporary workaround for a bug in Vector128.Create
see https://github.com/dotnet/runtime/issues/44704 for more informations
Here come Salieri, my implementation of a disk shader cache!
"I'm sure you know why I named it that."
"It doesn't really mean anything."
This implementation collects shaders at runtime and cache them to be later compiled when starting a game.
* Add scaling for Texture2DArray when using TexelFetch.
* Should only really trigger for Texture2D. (do not emit texelfetch for
TextureBufferArray(?) and Texture1DArray)
* Address nit.
* Add support for CAL and RET shader instructions
* Remove unused stuff
* Fix a bug that could cause the wrong values to be passed to a function
* Avoid repopulating function id dictionary every time
* PR feedback
* Fix vertex shader A/B merge
* Fix output component register on pixel shaders
* Clean up usings
* Do not advance if no component is enabled for the target, this keeps the previous behavior
* Use a better viewport flipping approach
* New approach to detect depth mode
* nit: Sort method on the OpenGL backend
* Adjust spacing on comment
* Unswap near and far parameters based on ScaleZ
* Initial transform feedback support
* Some nits and fixes
* Update ReportCounterType and Write method
* Can't change shader or TFB bindings while TFB is active
* Fix geometry shader input names with new naming
* Initial implementation of Render Target Scaling
Works with most games I have. No GUI option right now, it is hardcoded.
Missing handling for texelFetch operation.
* Realtime Configuration, refactoring.
* texelFetch scaling on fragment shader (WIP)
* Improve Shader-Side changes.
* Fix potential crash when no color/depth bound
* Workaround random uses of textures in compute.
This was blacklisting textures in a few games despite causing no bugs. Will eventually add full support so this doesn't break anything.
* Fix scales oscillating when changing between non-native scales.
* Scaled textures on compute, cleanup, lazier uniform update.
* Cleanup.
* Fix stupidity
* Address Thog Feedback.
* Cover most of GDK's feedback (two comments remain)
* Fix bad rename
* Move IsDepthStencil to FormatExtensions, add docs.
* Fix default config, square texture detection.
* Three final fixes:
- Nearest copy when texture is integer format.
- Texture2D -> Texture3D copy correctly blacklists the texture before trying an unscaled copy (caused driver error)
- Discount small textures.
* Remove scale threshold.
Not needed right now - we'll see if we run into problems.
* All CPU modification blacklists scale.
* Fix comment.
* Viewport swizzle support on NV and clip origin
* Initialize default viewport swizzle state, emulate viewport swizzle on shaders when not supported
* Address PR feedback
* Support separate textures and samplers
* Add missing bindless flag, fix SNORM format on buffer textures
* Add missing separation
* Add comments about the new handles