Commit graph

45 commits

Author SHA1 Message Date
Andrea Pappacoda
01cf05bc75
chore: add missing SPDX tags
Follow-up to 99ceb03a1c
2022-04-28 18:24:11 +02:00
ameerj
866b7c20a8 general: Fix clang/gcc build errors 2022-03-20 02:25:09 -04:00
ameerj
5665d05547 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
15c0c213b1 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
d3d6613d33 video_core: Silence signed/unsigned mismatch warnings 2021-06-28 09:21:42 -04:00
ameerj
ace20ba4a4 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
31b125ef57 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
5fc8393125 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
c4ff7ecf51 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
2f83d9a61b astc_decoder: Refactor for style and more efficient memory use 2021-03-25 16:53:51 -04:00
ReinUsesLisp
22be115eb2 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
0ec71b78fb 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
9764c13d6d 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
6bf5d2b011 astc: Hard code bit depth changes to 8 and use fast replicate 2020-04-09 18:37:12 -03:00
ReinUsesLisp
bd2c1ab8a0 astc: Use boost's static_vector to avoid heap allocations 2020-04-09 05:27:57 -03:00
ReinUsesLisp
5de130beea astc: Implement a fast precompiled alternative for Replicate 2020-04-09 03:58:25 -03:00
ReinUsesLisp
6b4d4473be astc: Move Replicate to a constexpr LUT when possible 2020-04-09 03:35:07 -03:00
ReinUsesLisp
d22a689250 astc: Make InputBitStream constexpr 2020-04-09 02:54:05 -03:00
ReinUsesLisp
0efc230381 astc: OutputBitStream style changes and make it constexpr 2020-04-09 02:37:51 -03:00
ReinUsesLisp
664fa4ea06 astc: Fix clang build issues 2020-03-18 04:30:25 -03:00
ReinUsesLisp
42cb8f1124 astc: Fix typos from search and replace 2020-03-14 01:05:20 -03:00
ReinUsesLisp
9b8fb3c756 astc: Minor changes to InputBitStream 2020-03-14 00:45:54 -03:00
ReinUsesLisp
d71d7d917e astc: Pass val in Replicate by copy 2020-03-14 00:13:58 -03:00
ReinUsesLisp
134f3ff9b4 astc: Call std::vector:reserve on decodedClolorValues to avoid reallocating 2020-03-14 00:09:56 -03:00
ReinUsesLisp
3377b78ea7 astc: Call std::vector::reserve on texelWeightValues to avoid reallocating 2020-03-13 23:52:51 -03:00
ReinUsesLisp
801fd04f75 astc: Create a LUT at compile time for encoding values 2020-03-13 23:40:02 -03:00
ReinUsesLisp
e183820956 astc: Make IntegerEncodedValue a trivial structure 2020-03-13 22:49:28 -03:00
ReinUsesLisp
70a31eda62 astc: Make IntegerEncodedValue constructor constexpr 2020-03-13 22:36:45 -03:00
ReinUsesLisp
5ed377b989 astc: Make IntegerEncodedValue trivially copyable 2020-03-13 22:30:31 -03:00
ReinUsesLisp
e7d97605e8 astc: Rename C types to common_types 2020-03-13 22:28:51 -03:00
ReinUsesLisp
835a3d09c6 astc: Move Popcnt to an anonymous namespace and make it constexpr 2020-03-13 22:26:48 -03:00
ReinUsesLisp
731a9a322e astc: Use common types instead of stdint.h integer types 2020-03-13 22:22:27 -03:00
ReinUsesLisp
d3dc4e399c astc: Use 'enum class' instead of 'enum' for EIntegerEncoding 2020-03-13 22:20:12 -03:00
ReinUsesLisp
096f339a2a video_core: Silence implicit conversion warnings 2019-11-08 22:48:50 +00:00
ReinUsesLisp
a5aa1bb174
astc: Silence implicit conversion warnings 2019-10-27 03:04:50 -03:00
Lioncash
c56d893e77 video_core/textures/astc: Remove unused variables
Silences a few compilation warnings.
2019-05-09 18:33:36 -04:00
Fernando Sahmkow
95261639fb Fix Layered ASTC Textures
By adding the missing layer offset in ASTC compression.
2019-04-30 23:02:31 -04:00
ReinUsesLisp
0ad3c031f4 gl_rasterizer_cache: Move format conversion to its own file 2019-02-26 20:08:27 -03:00
FernandoS27
60a184455c Fix ASTC Decompressor to support depth parameter 2018-11-01 19:22:12 -04:00
Lioncash
6a03badcbc 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
0f148548f3 astc: Mark functions as internally linked where applicable 2018-07-17 23:58:14 -04:00
Lioncash
c5803e30d3 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
e3fadb9616 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
4cd52a34b9 astc: In-class initialize member variables where appropriate 2018-07-17 23:58:10 -04:00
bunnei
61779fa072 gl_rasterizer: Implement texture format ASTC_2D_4X4. 2018-06-18 01:56:59 -04:00