summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/host_shaders/astc_decoder.comp57
1 files changed, 19 insertions, 38 deletions
diff --git a/src/video_core/host_shaders/astc_decoder.comp b/src/video_core/host_shaders/astc_decoder.comp
index 7f4efa31a..8d8b64fbd 100644
--- a/src/video_core/host_shaders/astc_decoder.comp
+++ b/src/video_core/host_shaders/astc_decoder.comp
@@ -284,14 +284,10 @@ uint Hash52(uint p) {
284 return p; 284 return p;
285} 285}
286 286
287uint SelectPartition(uint seed, uint x, uint y, uint z, uint partition_count, bool small_block) { 287uint Select2DPartition(uint seed, uint x, uint y, uint partition_count, bool small_block) {
288 if (partition_count == 1) {
289 return 0;
290 }
291 if (small_block) { 288 if (small_block) {
292 x <<= 1; 289 x <<= 1;
293 y <<= 1; 290 y <<= 1;
294 z <<= 1;
295 } 291 }
296 292
297 seed += (partition_count - 1) * 1024; 293 seed += (partition_count - 1) * 1024;
@@ -305,10 +301,6 @@ uint SelectPartition(uint seed, uint x, uint y, uint z, uint partition_count, bo
305 uint seed6 = uint((rnum >> 20) & 0xF); 301 uint seed6 = uint((rnum >> 20) & 0xF);
306 uint seed7 = uint((rnum >> 24) & 0xF); 302 uint seed7 = uint((rnum >> 24) & 0xF);
307 uint seed8 = uint((rnum >> 28) & 0xF); 303 uint seed8 = uint((rnum >> 28) & 0xF);
308 uint seed9 = uint((rnum >> 18) & 0xF);
309 uint seed10 = uint((rnum >> 22) & 0xF);
310 uint seed11 = uint((rnum >> 26) & 0xF);
311 uint seed12 = uint(((rnum >> 30) | (rnum << 2)) & 0xF);
312 304
313 seed1 = (seed1 * seed1); 305 seed1 = (seed1 * seed1);
314 seed2 = (seed2 * seed2); 306 seed2 = (seed2 * seed2);
@@ -318,12 +310,8 @@ uint SelectPartition(uint seed, uint x, uint y, uint z, uint partition_count, bo
318 seed6 = (seed6 * seed6); 310 seed6 = (seed6 * seed6);
319 seed7 = (seed7 * seed7); 311 seed7 = (seed7 * seed7);
320 seed8 = (seed8 * seed8); 312 seed8 = (seed8 * seed8);
321 seed9 = (seed9 * seed9);
322 seed10 = (seed10 * seed10);
323 seed11 = (seed11 * seed11);
324 seed12 = (seed12 * seed12);
325 313
326 int sh1, sh2, sh3; 314 uint sh1, sh2;
327 if ((seed & 1) > 0) { 315 if ((seed & 1) > 0) {
328 sh1 = (seed & 2) > 0 ? 4 : 5; 316 sh1 = (seed & 2) > 0 ? 4 : 5;
329 sh2 = (partition_count == 3) ? 6 : 5; 317 sh2 = (partition_count == 3) ? 6 : 5;
@@ -331,25 +319,19 @@ uint SelectPartition(uint seed, uint x, uint y, uint z, uint partition_count, bo
331 sh1 = (partition_count == 3) ? 6 : 5; 319 sh1 = (partition_count == 3) ? 6 : 5;
332 sh2 = (seed & 2) > 0 ? 4 : 5; 320 sh2 = (seed & 2) > 0 ? 4 : 5;
333 } 321 }
334 sh3 = (seed & 0x10) > 0 ? sh1 : sh2; 322 seed1 >>= sh1;
335 323 seed2 >>= sh2;
336 seed1 = (seed1 >> sh1); 324 seed3 >>= sh1;
337 seed2 = (seed2 >> sh2); 325 seed4 >>= sh2;
338 seed3 = (seed3 >> sh1); 326 seed5 >>= sh1;
339 seed4 = (seed4 >> sh2); 327 seed6 >>= sh2;
340 seed5 = (seed5 >> sh1); 328 seed7 >>= sh1;
341 seed6 = (seed6 >> sh2); 329 seed8 >>= sh2;
342 seed7 = (seed7 >> sh1); 330
343 seed8 = (seed8 >> sh2); 331 uint a = seed1 * x + seed2 * y + (rnum >> 14);
344 seed9 = (seed9 >> sh3); 332 uint b = seed3 * x + seed4 * y + (rnum >> 10);
345 seed10 = (seed10 >> sh3); 333 uint c = seed5 * x + seed6 * y + (rnum >> 6);
346 seed11 = (seed11 >> sh3); 334 uint d = seed7 * x + seed8 * y + (rnum >> 2);
347 seed12 = (seed12 >> sh3);
348
349 uint a = seed1 * x + seed2 * y + seed11 * z + (rnum >> 14);
350 uint b = seed3 * x + seed4 * y + seed12 * z + (rnum >> 10);
351 uint c = seed5 * x + seed6 * y + seed9 * z + (rnum >> 6);
352 uint d = seed7 * x + seed8 * y + seed10 * z + (rnum >> 2);
353 335
354 a &= 0x3F; 336 a &= 0x3F;
355 b &= 0x3F; 337 b &= 0x3F;
@@ -374,10 +356,6 @@ uint SelectPartition(uint seed, uint x, uint y, uint z, uint partition_count, bo
374 } 356 }
375} 357}
376 358
377uint Select2DPartition(uint seed, uint x, uint y, uint partition_count, bool small_block) {
378 return SelectPartition(seed, x, y, 0, partition_count, small_block);
379}
380
381uint ReadBit() { 359uint ReadBit() {
382 if (current_index >= local_buff.length()) { 360 if (current_index >= local_buff.length()) {
383 return 0; 361 return 0;
@@ -1281,8 +1259,11 @@ void DecompressBlock(ivec3 coord, uint block_index) {
1281 1259
1282 for (uint j = 0; j < block_dims.y; j++) { 1260 for (uint j = 0; j < block_dims.y; j++) {
1283 for (uint i = 0; i < block_dims.x; i++) { 1261 for (uint i = 0; i < block_dims.x; i++) {
1284 uint local_partition = Select2DPartition(partition_index, i, j, num_partitions, 1262 uint local_partition = 0;
1263 if (num_partitions > 1) {
1264 local_partition = Select2DPartition(partition_index, i, j, num_partitions,
1285 (block_dims.y * block_dims.x) < 32); 1265 (block_dims.y * block_dims.x) < 32);
1266 }
1286 vec4 p; 1267 vec4 p;
1287 uvec4 C0 = ReplicateByteTo16(endpoints[local_partition][0]); 1268 uvec4 C0 = ReplicateByteTo16(endpoints[local_partition][0]);
1288 uvec4 C1 = ReplicateByteTo16(endpoints[local_partition][1]); 1269 uvec4 C1 = ReplicateByteTo16(endpoints[local_partition][1]);