Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
0f7220c9
There was an error fetching the commit references. Please try again later.
Commit
0f7220c9
authored
2 years ago
by
Ameer J
Browse files
Options
Downloads
Patches
Plain Diff
flatten encoding_values
parent
71857e88
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/video_core/host_shaders/astc_decoder.comp
+10
-11
10 additions, 11 deletions
src/video_core/host_shaders/astc_decoder.comp
with
10 additions
and
11 deletions
src/video_core/host_shaders/astc_decoder.comp
+
10
−
11
View file @
0f7220c9
...
@@ -54,13 +54,13 @@ const uint TRIT = 2u;
...
@@ -54,13 +54,13 @@ const uint TRIT = 2u;
// ASTC Encodings data, sorted in ascending order based on their BitLength value
// ASTC Encodings data, sorted in ascending order based on their BitLength value
// (see GetBitLength() function)
// (see GetBitLength() function)
const u
vec4
encoding_values[
6
] = u
vec4
[](
const u
int
encoding_values[
22
] = u
int
[](
uvec4(
(JUST_BITS), (JUST_BITS | (1u << 8u)), (TRIT), (JUST_BITS | (2u << 8u))
)
,
(JUST_BITS), (JUST_BITS | (1u << 8u)), (TRIT), (JUST_BITS | (2u << 8u)),
uvec4(
(QUINT), (TRIT | (1u << 8u)), (JUST_BITS | (3u << 8u)), (QUINT | (1u << 8u))
)
,
(QUINT), (TRIT | (1u << 8u)), (JUST_BITS | (3u << 8u)), (QUINT | (1u << 8u)),
uvec4(
(TRIT | (2u << 8u)), (JUST_BITS | (4u << 8u)), (QUINT | (2u << 8u)), (TRIT | (3u << 8u))
)
,
(TRIT | (2u << 8u)), (JUST_BITS | (4u << 8u)), (QUINT | (2u << 8u)), (TRIT | (3u << 8u)),
uvec4(
(JUST_BITS | (5u << 8u)), (QUINT | (3u << 8u)), (TRIT | (4u << 8u)), (JUST_BITS | (6u << 8u))
)
,
(JUST_BITS | (5u << 8u)), (QUINT | (3u << 8u)), (TRIT | (4u << 8u)), (JUST_BITS | (6u << 8u)),
uvec4(
(QUINT | (4u << 8u)), (TRIT | (5u << 8u)), (JUST_BITS | (7u << 8u)), (QUINT | (5u << 8u))
)
,
(QUINT | (4u << 8u)), (TRIT | (5u << 8u)), (JUST_BITS | (7u << 8u)), (QUINT | (5u << 8u)),
uvec4(
(TRIT | (6u << 8u)), (JUST_BITS | (8u << 8u))
, 0u, 0u)
);
(TRIT | (6u << 8u)), (JUST_BITS | (8u << 8u)));
// Input ASTC texture globals
// Input ASTC texture globals
int total_bitsread = 0;
int total_bitsread = 0;
...
@@ -313,8 +313,7 @@ EncodingData GetEncodingFromVector(uint index) {
...
@@ -313,8 +313,7 @@ EncodingData GetEncodingFromVector(uint index) {
// Returns the number of bits required to encode n_vals values.
// Returns the number of bits required to encode n_vals values.
uint GetBitLength(uint n_vals, uint encoding_index) {
uint GetBitLength(uint n_vals, uint encoding_index) {
const EncodingData encoding_value =
const EncodingData encoding_value = EncodingData(encoding_values[encoding_index]);
EncodingData(encoding_values[encoding_index / 4][encoding_index % 4]);
const uint encoding = Encoding(encoding_value);
const uint encoding = Encoding(encoding_value);
uint total_bits = NumBits(encoding_value) * n_vals;
uint total_bits = NumBits(encoding_value) * n_vals;
if (encoding == TRIT) {
if (encoding == TRIT) {
...
@@ -435,7 +434,7 @@ void DecodeTritBlock(uint num_bits) {
...
@@ -435,7 +434,7 @@ void DecodeTritBlock(uint num_bits) {
}
}
void DecodeIntegerSequence(uint max_range, uint num_values) {
void DecodeIntegerSequence(uint max_range, uint num_values) {
EncodingData val = EncodingData(encoding_values[max_range
/ 4][max_range % 4
]);
EncodingData val = EncodingData(encoding_values[max_range]);
const uint encoding = Encoding(val);
const uint encoding = Encoding(val);
const uint num_bits = NumBits(val);
const uint num_bits = NumBits(val);
uint vals_decoded = 0;
uint vals_decoded = 0;
...
@@ -467,7 +466,7 @@ void DecodeColorValues(uvec4 modes, uint num_partitions, uint color_data_bits) {
...
@@ -467,7 +466,7 @@ void DecodeColorValues(uvec4 modes, uint num_partitions, uint color_data_bits) {
// Find the largest encoding that's within color_data_bits
// Find the largest encoding that's within color_data_bits
// TODO(ameerj): profile with binary search
// TODO(ameerj): profile with binary search
int range = 0;
int range = 0;
while (++range <
((
encoding_values.length()
* 4) - 2)
) {
while (++range < encoding_values.length()) {
const uint bit_length = GetBitLength(num_values, range);
const uint bit_length = GetBitLength(num_values, range);
if (bit_length > color_data_bits) {
if (bit_length > color_data_bits) {
break;
break;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment