Commit graph

43 commits

Author SHA1 Message Date
ameerj
958ede1ed9 astc_decoder: Optimize the use EncodingData
This buffer was a list of EncodingData structures sorted by their bit length, with some duplication from the cpu decoder implementation.
We can take advantage of its sorted property to optimize its usage in the shader.

Thanks to wwylele for the optimization idea.
2021-07-31 21:36:26 -04:00
ameerj
f4409c9db9 astc.h: Move data to cpp implementation
Moves leftover values that are no longer used by the gpu decoder back to the cpp implementation.
2021-07-31 21:26:42 -04:00
Morph
2986e26179 video_core: Silence signed/unsigned mismatch warnings 2021-06-28 09:21:42 -04:00
ameerj
79621cca95 astc_decoder.comp: Remove unnecessary LUT SSBOs
We can move them to instead be compile time constants within the shader.
2021-06-19 10:56:13 -04:00
ameerj
fe7d3006f5 astc: Various robustness enhancements for the gpu decoder
These changes should help in reducing crashes/drivers panics that may
occur due to synchronization issues between the shader completion and
later access of the decoded texture.
2021-06-19 09:00:33 -04:00
ameerj
13b046aae1 astc_decoder: Fix LDR CEM1 endpoint calculation
Per the spec, L1 is clamped to the value 0xff if it is greater than 0xff. An oversight caused us to take the maximum of L1 and 0xff, rather than the minimum.

Huge thanks to wwylele for finding this.

Co-Authored-By: Weiyi Wang <wwylele@gmail.com>
2021-06-15 20:19:01 -04:00
ameerj
e5da434498 textures: Reintroduce CPU ASTC decoder
Users may want to fall back to the CPU ASTC texture decoder due to hangs
and crashes that may be caused by keeping the GPU under compute heavy
loads for extended periods of time. This is especially the case in games
such as Astral Chain which make extensive use of ASTC textures.
2021-06-15 20:19:00 -04:00
ameerj
e0977af861 astc_decoder: Refactor for style and more efficient memory use 2021-03-25 16:53:51 -04:00
ReinUsesLisp
c0c51e4be0 astc: Increase integer encoded vector size
Invalid ASTC textures seem to write more bytes here, increase
the size to something that can't make us push out of bounds.
2021-01-15 02:24:36 -03:00
ReinUsesLisp
185c16d893 astc: Return zero on out of bound bits
Avoid out of bound reads on invalid ASTC textures.
Games can bind invalid textures that make us read or write out of bounds.
2021-01-15 02:24:36 -03:00
ReinUsesLisp
d25b097e84 video_core: Rewrite the texture cache
The current texture cache has several points that hurt maintainability
and performance. It's easy to break unrelated parts of the cache
when doing minor changes. The cache can easily forget valuable
information about the cached textures by CPU writes or simply by its
normal usage.The current texture cache has several points that hurt
maintainability and performance. It's easy to break unrelated parts
of the cache when doing minor changes. The cache can easily forget
valuable information about the cached textures by CPU writes or simply
by its normal usage.

This commit aims to address those issues.
2020-12-30 03:38:50 -03:00
ReinUsesLisp
cc5d2bc965 astc: Hard code bit depth changes to 8 and use fast replicate 2020-04-09 18:37:12 -03:00
ReinUsesLisp
ac81541a37 astc: Use boost's static_vector to avoid heap allocations 2020-04-09 05:27:57 -03:00
ReinUsesLisp
a648629d8a astc: Implement a fast precompiled alternative for Replicate 2020-04-09 03:58:25 -03:00
ReinUsesLisp
10d59444d9 astc: Move Replicate to a constexpr LUT when possible 2020-04-09 03:35:07 -03:00
ReinUsesLisp
14ea2ced5b astc: Make InputBitStream constexpr 2020-04-09 02:54:05 -03:00
ReinUsesLisp
2f105bd298 astc: OutputBitStream style changes and make it constexpr 2020-04-09 02:37:51 -03:00
ReinUsesLisp
dc0beee3a1 astc: Fix clang build issues 2020-03-18 04:30:25 -03:00
ReinUsesLisp
5c892bc5fd astc: Fix typos from search and replace 2020-03-14 01:05:20 -03:00
ReinUsesLisp
932c96f2b0 astc: Minor changes to InputBitStream 2020-03-14 00:45:54 -03:00
ReinUsesLisp
c96749415c astc: Pass val in Replicate by copy 2020-03-14 00:13:58 -03:00
ReinUsesLisp
83bdac46d1 astc: Call std::vector:reserve on decodedClolorValues to avoid reallocating 2020-03-14 00:09:56 -03:00
ReinUsesLisp
8412a20f00 astc: Call std::vector::reserve on texelWeightValues to avoid reallocating 2020-03-13 23:52:51 -03:00
ReinUsesLisp
fdbedfa8ef astc: Create a LUT at compile time for encoding values 2020-03-13 23:40:02 -03:00
ReinUsesLisp
bac05076fd astc: Make IntegerEncodedValue a trivial structure 2020-03-13 22:49:28 -03:00
ReinUsesLisp
ddd428097d astc: Make IntegerEncodedValue constructor constexpr 2020-03-13 22:36:45 -03:00
ReinUsesLisp
9aad3e84f0 astc: Make IntegerEncodedValue trivially copyable 2020-03-13 22:30:31 -03:00
ReinUsesLisp
0672618026 astc: Rename C types to common_types 2020-03-13 22:28:51 -03:00
ReinUsesLisp
a3969886ca astc: Move Popcnt to an anonymous namespace and make it constexpr 2020-03-13 22:26:48 -03:00
ReinUsesLisp
0d8b0fe402 astc: Use common types instead of stdint.h integer types 2020-03-13 22:22:27 -03:00
ReinUsesLisp
d9645551bc astc: Use 'enum class' instead of 'enum' for EIntegerEncoding 2020-03-13 22:20:12 -03:00
ReinUsesLisp
905cc250a4 video_core: Silence implicit conversion warnings 2019-11-08 22:48:50 +00:00
ReinUsesLisp
2140a0cadd astc: Silence implicit conversion warnings 2019-10-27 03:04:50 -03:00
Lioncash
d6db5ebae2 video_core/textures/astc: Remove unused variables
Silences a few compilation warnings.
2019-05-09 18:33:36 -04:00
Fernando Sahmkow
aebe67fac7 Fix Layered ASTC Textures
By adding the missing layer offset in ASTC compression.
2019-04-30 23:02:31 -04:00
ReinUsesLisp
3989075e5f gl_rasterizer_cache: Move format conversion to its own file 2019-02-26 20:08:27 -03:00
FernandoS27
82d04c5e99 Fix ASTC Decompressor to support depth parameter 2018-11-01 19:22:12 -04:00
Lioncash
e0c31daa57 astc: Initialize vector size directly in Decompress
There's no need to perform a separate resize.
2018-07-17 23:58:14 -04:00
Lioncash
fa13cedc7a astc: Mark functions as internally linked where applicable 2018-07-17 23:58:14 -04:00
Lioncash
03f1f17552 astc: const-correctness changes where applicable
A few member functions didn't actually modify class state, so these can
be amended as necessary.
2018-07-17 23:58:14 -04:00
Lioncash
62eb3b3ede astc: Delete Bits' copy contstructor and assignment operator
This also potentially avoids warnings, considering the copy assignment
operator is supposed to have a return value.
2018-07-17 23:58:14 -04:00
Lioncash
6b32ef1d9e astc: In-class initialize member variables where appropriate 2018-07-17 23:58:10 -04:00
bunnei
9feb7f7a63 gl_rasterizer: Implement texture format ASTC_2D_4X4. 2018-06-18 01:56:59 -04:00