* Add support for BC1/2/3 decompression (for 3D textures)
* Optimize and clean up
* Unsafe not needed here
* Fix alpha value interpolation when a0 <= a1
* Initial test for texture sync
* WIP new texture flushing setup
* Improve rules for incompatible overlaps
Fixes a lot of issues with Unreal Engine games. Still a few minor issues (some caused by dma fast path?) Needs docs and cleanup.
* Cleanup, improvements
Improve rules for fast DMA
* Small tweak to group together flushes of overlapping handles.
* Fixes, flush overlapping texture data for ASTC and BC4/5 compressed textures.
Fixes the new Life is Strange game.
* Flush overlaps before init data, fix 3d texture size/overlap stuff
* Fix 3D Textures, faster single layer flush
Note: nosy people can no longer merge this with Vulkan. (unless they are nosy enough to implement the new backend methods)
* Remove unused method
* Minor cleanup
* More cleanup
* Use the More Fun and Hopefully No Driver Bugs method for getting compressed tex too
This one's for metro
* Address feedback, ASTC+ETC to FormatClass
* Change offset to use Span slice rather than IntPtr Add
* Fix this too
* Compare aligned size for largest mip level when considering sampler resize
When selecting a texture that's a view for a sampler resize, we should take care that resizing it doesn't change the aligned size of any larger mip levels.
This PR covers two cases:
- When creating a view of the texture, we check that the aligned size of the view shifted up to level 0 still matches the aligned size of the container. If it does not, a copy dependency is created rather than resizing.
- When searching for a texture for sampler, textures that do _not_ match our aligned size when both are shifted up by its base level are not considered an exact match, as resizing the found texture will cause the mip 0 aligned size to change. It will create a copy dependency view instead.
Fixes graphical errors and crashes (on flush) in various Unity games that use render-to-texture.
* Move shared code to its own method.
* Improve linear texture compatibility rules
Fixes an issue where small or width-aligned (rather than byte aligned) textures would fail to create a view of existing data. Creates a copy dependency as size change may be risky.
* Minor cleanup
* Remove Size Change for Copy Depenedencies
The copy to the target (potentially different sized) texture can properly deal with cropping by itself.
* Move StrideAlignment and GobAlignment into Constants
* Initial implementation (3d tex mips broken)
This works rather well for most games, just need to fix 3d texture mips.
* Cleanup
* Address feedback
* Copy Dependencies and various other fixes
* Fix layer/level offset for copy from view<->view.
* Remove dirty flag from dependency
The dirty flag behaviour is not needed - DeferredCopy is all we need.
* Fix tracking mip slices.
* Propagate granularity (fix astral chain)
* Address Feedback pt 1
* Save slice sizes as part of SizeInfo
* Fix nits
* Fix disposing multiple dependencies causing a crash
This list is obviously modified when removing dependencies, so create a copy of it.
* Add swizzle matching rules.
Improves rules which try to match incompatible formats as perfect, such as D32 float -> R32 float.
Remove Format.HasOneComponent, since this information is now available via the FormatInfo struct.
* Fix this rule.
* Update component counts for depth formats.
* Initial implementation. Still pending better valid-overlap handling,
disposed pool, compressed format flush fix.
* Very messy backend resource cache.
* Oops
* Dispose -> Release
* Improve Release/Dispose.
* More rule refinement.
* View compatibility levels as an enum - you can always know if a view is only copy compatible.
* General cleanup.
Use locking on the resource cache, as it is likely to be used by other threads in future.
* Rename resource cache to resource pool.
* Address some of the smaller nits.
* Fix regression with MK8 lens flare
Texture flushes done the old way should trigger memory tracking.
* Use TextureCreateInfo as a key.
It now implements IEquatable and generates a hashcode based on width/height.
* Fix size change for compressed+non-compressed view combos.
Before, this could set either the compressed or non compressed texture with a size with the wrong size, depending on which texture had its size changed. This caused exceptions when flushing the texture.
Now it correctly takes the block size into account, assuming that these textures are only related because a pixel in the non-compressed texture represents a block in the compressed one.
* Implement JD's suggestion for HashCode Combine
Co-authored-by: jduncanator <1518948+jduncanator@users.noreply.github.com>
* Address feedback
* Address feedback.
Co-authored-by: jduncanator <1518948+jduncanator@users.noreply.github.com>