diff --git a/runtime/astc_probe.c b/runtime/astc_probe.c index 21e6f352..4728a5ef 100644 --- a/runtime/astc_probe.c +++ b/runtime/astc_probe.c @@ -132,7 +132,7 @@ static int gpu_decode(VkCtx *c, const uint8_t *blk, size_t n0, size_t n1, uint32 VkAstcRegion ar[2] = {{.src = 0, .w = w0, .h = h0, .slices = 1, .level = 0}, {.src = n0 * 16, .w = w1, .h = h1, .slices = 1, .level = 1}}; barrier(cb, ALL_RW, VK_PIPELINE_STAGE_2_COPY_BIT, VK_ACCESS_2_TRANSFER_WRITE_BIT); - int ok = vk_astc_record(cb, sb, (n0 + n1) * 16, ar, 2, bw, bh, srgb, im.img, VK_IMAGE_ASPECT_COLOR_BIT, rb); + int ok = vk_astc_record(cb, sb, (n0 + n1) * 16, ar, 2, bw, bh, srgb, 0, im.img, VK_IMAGE_ASPECT_COLOR_BIT, rb); barrier(cb, VK_PIPELINE_STAGE_2_COPY_BIT, VK_ACCESS_2_TRANSFER_WRITE_BIT, ALL_RW); VkBufferImageCopy cp[2] = {{.bufferOffset = 0, .imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .imageExtent = {w0, h0, 1}}, {.bufferOffset = t0, .imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 1, 0, 1}, .imageExtent = {w1, h1, 1}}}; diff --git a/runtime/bc3_encode_spv.h b/runtime/bc3_encode_spv.h new file mode 100644 index 00000000..ef030d9e --- /dev/null +++ b/runtime/bc3_encode_spv.h @@ -0,0 +1,263 @@ +// Generated by tools/build_shaders.py from runtime/shaders/bc3_encode.comp; do not edit. +// source sha256 ac318d358136b39a113a18474a815f447223667657c90f9e0356a392639d8541 +#pragma once +#include +static const uint32_t bc3_encode_spv[] = { + 0x07230203, 0x00010300, 0x0008000b, 0x00000325, 0x00000000, 0x00020011, 0x00000001, 0x0006000b, + 0x00000001, 0x4c534c47, 0x6474732e, 0x3035342e, 0x00000000, 0x0003000e, 0x00000000, 0x00000001, + 0x0006000f, 0x00000005, 0x00000004, 0x6e69616d, 0x00000000, 0x0000007f, 0x00060010, 0x00000004, + 0x00000011, 0x00000008, 0x00000008, 0x00000001, 0x00030003, 0x00000002, 0x000001c2, 0x00040005, + 0x00000004, 0x6e69616d, 0x00000000, 0x00040005, 0x0000001b, 0x61726150, 0x0000736d, 0x00050006, + 0x0000001b, 0x00000000, 0x625f6e69, 0x00657361, 0x00060006, 0x0000001b, 0x00000001, 0x5f74756f, + 0x65736162, 0x00000000, 0x00050006, 0x0000001b, 0x00000002, 0x74646977, 0x00000068, 0x00050006, + 0x0000001b, 0x00000003, 0x67696568, 0x00007468, 0x00040006, 0x0000001b, 0x00000004, 0x00007862, + 0x00050006, 0x0000001b, 0x00000005, 0x696c7362, 0x00006563, 0x00030005, 0x0000001d, 0x00006370, + 0x00040005, 0x0000002d, 0x65786554, 0x0000736c, 0x00040006, 0x0000002d, 0x00000000, 0x00007870, + 0x00030005, 0x0000002f, 0x00000000, 0x00080005, 0x0000007f, 0x475f6c67, 0x61626f6c, 0x766e496c, + 0x7461636f, 0x496e6f69, 0x00000044, 0x00030005, 0x000000ab, 0x00000074, 0x00040005, 0x000001ea, + 0x636f6c42, 0x0000736b, 0x00040006, 0x000001ea, 0x00000000, 0x006b6c62, 0x00030005, 0x000001ec, + 0x00000000, 0x00030047, 0x0000001b, 0x00000002, 0x00050048, 0x0000001b, 0x00000000, 0x00000023, + 0x00000000, 0x00050048, 0x0000001b, 0x00000001, 0x00000023, 0x00000004, 0x00050048, 0x0000001b, + 0x00000002, 0x00000023, 0x00000008, 0x00050048, 0x0000001b, 0x00000003, 0x00000023, 0x0000000c, + 0x00050048, 0x0000001b, 0x00000004, 0x00000023, 0x00000010, 0x00050048, 0x0000001b, 0x00000005, + 0x00000023, 0x00000014, 0x00040047, 0x0000002c, 0x00000006, 0x00000004, 0x00030047, 0x0000002d, + 0x00000002, 0x00040048, 0x0000002d, 0x00000000, 0x00000018, 0x00050048, 0x0000002d, 0x00000000, + 0x00000023, 0x00000000, 0x00030047, 0x0000002f, 0x00000018, 0x00040047, 0x0000002f, 0x00000021, + 0x00000000, 0x00040047, 0x0000002f, 0x00000022, 0x00000000, 0x00040047, 0x0000007f, 0x0000000b, + 0x0000001c, 0x00040047, 0x000001e9, 0x00000006, 0x00000010, 0x00030047, 0x000001ea, 0x00000002, + 0x00040048, 0x000001ea, 0x00000000, 0x00000019, 0x00050048, 0x000001ea, 0x00000000, 0x00000023, + 0x00000000, 0x00030047, 0x000001ec, 0x00000019, 0x00040047, 0x000001ec, 0x00000021, 0x00000001, + 0x00040047, 0x000001ec, 0x00000022, 0x00000000, 0x00040047, 0x0000020c, 0x0000000b, 0x00000019, + 0x00020013, 0x00000002, 0x00030021, 0x00000003, 0x00000002, 0x00040015, 0x00000006, 0x00000020, + 0x00000000, 0x00030016, 0x00000008, 0x00000020, 0x00040017, 0x00000009, 0x00000008, 0x00000004, + 0x00040017, 0x00000010, 0x00000008, 0x00000003, 0x0008001e, 0x0000001b, 0x00000006, 0x00000006, + 0x00000006, 0x00000006, 0x00000006, 0x00000006, 0x00040020, 0x0000001c, 0x00000009, 0x0000001b, + 0x0004003b, 0x0000001c, 0x0000001d, 0x00000009, 0x00040015, 0x0000001e, 0x00000020, 0x00000001, + 0x0004002b, 0x0000001e, 0x0000001f, 0x00000002, 0x00040020, 0x00000020, 0x00000009, 0x00000006, + 0x0004002b, 0x00000006, 0x00000023, 0x00000001, 0x0004002b, 0x0000001e, 0x00000027, 0x00000003, + 0x0003001d, 0x0000002c, 0x00000006, 0x0003001e, 0x0000002d, 0x0000002c, 0x00040020, 0x0000002e, + 0x0000000c, 0x0000002d, 0x0004003b, 0x0000002e, 0x0000002f, 0x0000000c, 0x0004002b, 0x0000001e, + 0x00000030, 0x00000000, 0x00040020, 0x0000003f, 0x0000000c, 0x00000006, 0x0004002b, 0x00000008, + 0x00000043, 0x437f0000, 0x00040017, 0x00000047, 0x00000006, 0x00000003, 0x0004002b, 0x00000008, + 0x0000004b, 0x00000000, 0x0004002b, 0x00000006, 0x00000057, 0x00000000, 0x0004002b, 0x0000001e, + 0x0000005a, 0x0000000b, 0x0004002b, 0x0000001e, 0x0000005e, 0x00000005, 0x0004002b, 0x00000006, + 0x00000061, 0x00000002, 0x0004002b, 0x00000006, 0x00000069, 0x0000001f, 0x0004002b, 0x00000006, + 0x00000070, 0x0000003f, 0x00040020, 0x0000007e, 0x00000001, 0x00000047, 0x0004003b, 0x0000007e, + 0x0000007f, 0x00000001, 0x0004002b, 0x00000006, 0x00000084, 0x00000003, 0x0004002b, 0x00000006, + 0x00000086, 0x00000004, 0x00020014, 0x00000088, 0x0004002b, 0x0000001e, 0x0000008b, 0x00000004, + 0x00040020, 0x0000009a, 0x00000007, 0x00000009, 0x0007002c, 0x00000009, 0x0000009c, 0x00000043, + 0x00000043, 0x00000043, 0x00000043, 0x0007002c, 0x00000009, 0x0000009e, 0x0000004b, 0x0000004b, + 0x0000004b, 0x0000004b, 0x0004002b, 0x00000006, 0x000000a7, 0x00000010, 0x0004001c, 0x000000a9, + 0x00000009, 0x000000a7, 0x00040020, 0x000000aa, 0x00000007, 0x000000a9, 0x0004002b, 0x0000001e, + 0x000000d0, 0x00000001, 0x00040020, 0x000000d7, 0x00000007, 0x00000008, 0x00040017, 0x000000df, + 0x00000006, 0x00000002, 0x0004002b, 0x0000001e, 0x000000e4, 0x00000008, 0x0004002b, 0x00000008, + 0x00000101, 0x40e00000, 0x0004002b, 0x00000006, 0x00000110, 0x00000007, 0x0004002b, 0x00000006, + 0x0000011f, 0x00000020, 0x0004002b, 0x00000008, 0x000001b5, 0x358637bd, 0x0004002b, 0x00000008, + 0x000001ca, 0x40400000, 0x00040017, 0x000001e8, 0x00000006, 0x00000004, 0x0003001d, 0x000001e9, + 0x000001e8, 0x0003001e, 0x000001ea, 0x000001e9, 0x00040020, 0x000001eb, 0x0000000c, 0x000001ea, + 0x0004003b, 0x000001eb, 0x000001ec, 0x0000000c, 0x0004002b, 0x0000001e, 0x00000204, 0x00000010, + 0x00040020, 0x00000209, 0x0000000c, 0x000001e8, 0x0004002b, 0x00000006, 0x0000020b, 0x00000008, + 0x0006002c, 0x00000047, 0x0000020c, 0x0000020b, 0x0000020b, 0x00000023, 0x0004002b, 0x00000006, + 0x000002c8, 0x00000013, 0x0006002c, 0x00000010, 0x000002ca, 0x0000004b, 0x0000004b, 0x0000004b, + 0x0006002c, 0x00000010, 0x000002cb, 0x00000043, 0x00000043, 0x00000043, 0x0004002b, 0x00000008, + 0x000002cc, 0x3d800000, 0x0007002c, 0x00000009, 0x000002cd, 0x000002cc, 0x000002cc, 0x000002cc, + 0x000002cc, 0x0006002c, 0x00000010, 0x000002ce, 0x000002cc, 0x000002cc, 0x000002cc, 0x0004002b, + 0x00000008, 0x000002d1, 0x3df8f8fa, 0x0004002b, 0x00000008, 0x000002d2, 0x3e7cfcfe, 0x0006002c, + 0x00000010, 0x000002d3, 0x000002d1, 0x000002d2, 0x000002d1, 0x0004002b, 0x00000008, 0x000002d5, + 0x41039ce7, 0x0004002b, 0x00000008, 0x000002d7, 0x40818619, 0x0004002b, 0x00000006, 0x000002d8, + 0xfffffff0, 0x00050036, 0x00000002, 0x00000004, 0x00000000, 0x00000003, 0x000200f8, 0x00000005, + 0x0004003b, 0x000000aa, 0x000000ab, 0x00000007, 0x000300f7, 0x0000020d, 0x00000000, 0x000300fb, + 0x00000057, 0x0000020e, 0x000200f8, 0x0000020e, 0x0004003d, 0x00000047, 0x00000080, 0x0000007f, + 0x00050041, 0x00000020, 0x00000082, 0x0000001d, 0x00000027, 0x0004003d, 0x00000006, 0x00000083, + 0x00000082, 0x00050080, 0x00000006, 0x00000085, 0x00000083, 0x00000084, 0x00050086, 0x00000006, + 0x00000087, 0x00000085, 0x00000086, 0x00050051, 0x00000006, 0x0000008a, 0x00000080, 0x00000000, + 0x00050041, 0x00000020, 0x0000008c, 0x0000001d, 0x0000008b, 0x0004003d, 0x00000006, 0x0000008d, + 0x0000008c, 0x000500ae, 0x00000088, 0x0000008e, 0x0000008a, 0x0000008d, 0x000400a8, 0x00000088, + 0x0000008f, 0x0000008e, 0x000300f7, 0x00000091, 0x00000000, 0x000400fa, 0x0000008f, 0x00000090, + 0x00000091, 0x000200f8, 0x00000090, 0x00050051, 0x00000006, 0x00000093, 0x00000080, 0x00000001, + 0x000500ae, 0x00000088, 0x00000095, 0x00000093, 0x00000087, 0x000200f9, 0x00000091, 0x000200f8, + 0x00000091, 0x000700f5, 0x00000088, 0x00000096, 0x0000008e, 0x0000020e, 0x00000095, 0x00000090, + 0x000300f7, 0x00000098, 0x00000000, 0x000400fa, 0x00000096, 0x00000097, 0x00000098, 0x000200f8, + 0x00000097, 0x000200f9, 0x0000020d, 0x000200f8, 0x00000098, 0x000200f9, 0x000000a1, 0x000200f8, + 0x000000a1, 0x000700f5, 0x00000009, 0x00000304, 0x0000009c, 0x00000098, 0x000000c4, 0x000000a2, + 0x000700f5, 0x00000009, 0x00000303, 0x0000009e, 0x00000098, 0x000000c9, 0x000000a2, 0x000700f5, + 0x00000009, 0x00000286, 0x0000009e, 0x00000098, 0x000000ce, 0x000000a2, 0x000700f5, 0x00000006, + 0x00000285, 0x00000057, 0x00000098, 0x000000d1, 0x000000a2, 0x000500b0, 0x00000088, 0x000000a8, + 0x00000285, 0x000000a7, 0x000400f6, 0x000000a3, 0x000000a2, 0x00000000, 0x000400fa, 0x000000a8, + 0x000000a2, 0x000000a3, 0x000200f8, 0x000000a2, 0x00050084, 0x00000006, 0x000000af, 0x0000008a, + 0x00000086, 0x000500c7, 0x00000006, 0x000000b1, 0x00000285, 0x00000084, 0x00050080, 0x00000006, + 0x000000b2, 0x000000af, 0x000000b1, 0x00050051, 0x00000006, 0x000000b4, 0x00000080, 0x00000001, + 0x00050084, 0x00000006, 0x000000b5, 0x000000b4, 0x00000086, 0x000500c2, 0x00000006, 0x000000b7, + 0x00000285, 0x0000001f, 0x00050080, 0x00000006, 0x000000b8, 0x000000b5, 0x000000b7, 0x00050051, + 0x00000006, 0x000000bd, 0x00000080, 0x00000002, 0x00050041, 0x00000020, 0x00000216, 0x0000001d, + 0x0000001f, 0x0004003d, 0x00000006, 0x00000217, 0x00000216, 0x00050082, 0x00000006, 0x00000218, + 0x00000217, 0x00000023, 0x0007000c, 0x00000006, 0x00000219, 0x00000001, 0x00000026, 0x000000b2, + 0x00000218, 0x00050082, 0x00000006, 0x0000021d, 0x00000083, 0x00000023, 0x0007000c, 0x00000006, + 0x0000021e, 0x00000001, 0x00000026, 0x000000b8, 0x0000021d, 0x00050041, 0x00000020, 0x0000021f, + 0x0000001d, 0x00000030, 0x0004003d, 0x00000006, 0x00000220, 0x0000021f, 0x00050084, 0x00000006, + 0x00000224, 0x000000bd, 0x00000083, 0x00050080, 0x00000006, 0x00000226, 0x00000224, 0x0000021e, + 0x00050084, 0x00000006, 0x00000229, 0x00000226, 0x00000217, 0x00050080, 0x00000006, 0x0000022a, + 0x00000220, 0x00000229, 0x00050080, 0x00000006, 0x0000022c, 0x0000022a, 0x00000219, 0x00060041, + 0x0000003f, 0x0000022d, 0x0000002f, 0x00000030, 0x0000022c, 0x0004003d, 0x00000006, 0x0000022e, + 0x0000022d, 0x0006000c, 0x00000009, 0x0000022f, 0x00000001, 0x00000040, 0x0000022e, 0x0005008e, + 0x00000009, 0x00000230, 0x0000022f, 0x00000043, 0x00050041, 0x0000009a, 0x000000bf, 0x000000ab, + 0x00000285, 0x0003003e, 0x000000bf, 0x00000230, 0x0004003d, 0x00000009, 0x000000c3, 0x000000bf, + 0x0007000c, 0x00000009, 0x000000c4, 0x00000001, 0x00000025, 0x00000304, 0x000000c3, 0x0004003d, + 0x00000009, 0x000000c8, 0x000000bf, 0x0007000c, 0x00000009, 0x000000c9, 0x00000001, 0x00000028, + 0x00000303, 0x000000c8, 0x0004003d, 0x00000009, 0x000000cc, 0x000000bf, 0x00050081, 0x00000009, + 0x000000ce, 0x00000286, 0x000000cc, 0x00050080, 0x00000006, 0x000000d1, 0x00000285, 0x000000d0, + 0x000200f9, 0x000000a1, 0x000200f8, 0x000000a3, 0x00050085, 0x00000009, 0x000000d5, 0x00000286, + 0x000002cd, 0x00050051, 0x00000008, 0x000000d9, 0x00000303, 0x00000003, 0x0004006d, 0x00000006, + 0x000000da, 0x000000d9, 0x00050051, 0x00000008, 0x000000dd, 0x00000304, 0x00000003, 0x0004006d, + 0x00000006, 0x000000de, 0x000000dd, 0x000500c4, 0x00000006, 0x000000e5, 0x000000de, 0x000000e4, + 0x000500c5, 0x00000006, 0x000000e6, 0x000000da, 0x000000e5, 0x00050050, 0x000000df, 0x000000e7, + 0x000000e6, 0x00000057, 0x000500ac, 0x00000088, 0x000000ea, 0x000000da, 0x000000de, 0x000300f7, + 0x000000ec, 0x00000000, 0x000400fa, 0x000000ea, 0x000000eb, 0x000000ec, 0x000200f8, 0x000000eb, + 0x00050082, 0x00000006, 0x000000f0, 0x000000da, 0x000000de, 0x00040070, 0x00000008, 0x000000f1, + 0x000000f0, 0x000200f9, 0x000000f3, 0x000200f8, 0x000000f3, 0x000700f5, 0x000000df, 0x00000314, + 0x000000e7, 0x000000eb, 0x00000324, 0x000000f6, 0x000700f5, 0x00000006, 0x00000287, 0x00000057, + 0x000000eb, 0x00000143, 0x000000f6, 0x000500b0, 0x00000088, 0x000000f9, 0x00000287, 0x000000a7, + 0x000400f6, 0x000000f5, 0x000000f6, 0x00000000, 0x000400fa, 0x000000f9, 0x000000f4, 0x000000f5, + 0x000200f8, 0x000000f4, 0x00040070, 0x00000008, 0x000000fc, 0x000000da, 0x00060041, 0x000000d7, + 0x000000fe, 0x000000ab, 0x00000287, 0x00000084, 0x0004003d, 0x00000008, 0x000000ff, 0x000000fe, + 0x00050083, 0x00000008, 0x00000100, 0x000000fc, 0x000000ff, 0x00050085, 0x00000008, 0x00000102, + 0x00000100, 0x00000101, 0x00050088, 0x00000008, 0x00000104, 0x00000102, 0x000000f1, 0x0006000c, + 0x00000008, 0x00000105, 0x00000001, 0x00000001, 0x00000104, 0x0008000c, 0x00000008, 0x00000106, + 0x00000001, 0x0000002b, 0x00000105, 0x0000004b, 0x00000101, 0x0004006d, 0x00000006, 0x00000107, + 0x00000106, 0x000500aa, 0x00000088, 0x0000010a, 0x00000107, 0x00000057, 0x000300f7, 0x0000010d, + 0x00000000, 0x000400fa, 0x0000010a, 0x0000010c, 0x0000010e, 0x000200f8, 0x0000010c, 0x000200f9, + 0x0000010d, 0x000200f8, 0x0000010e, 0x000500aa, 0x00000088, 0x00000111, 0x00000107, 0x00000110, + 0x000300f7, 0x00000114, 0x00000000, 0x000400fa, 0x00000111, 0x00000113, 0x00000115, 0x000200f8, + 0x00000113, 0x000200f9, 0x00000114, 0x000200f8, 0x00000115, 0x00050080, 0x00000006, 0x00000117, + 0x00000107, 0x00000023, 0x000200f9, 0x00000114, 0x000200f8, 0x00000114, 0x000700f5, 0x00000006, + 0x000002a4, 0x00000023, 0x00000113, 0x00000117, 0x00000115, 0x000200f9, 0x0000010d, 0x000200f8, + 0x0000010d, 0x000700f5, 0x00000006, 0x000002a5, 0x00000057, 0x0000010c, 0x000002a4, 0x00000114, + 0x00050084, 0x00000006, 0x0000011c, 0x00000084, 0x00000287, 0x00050080, 0x00000006, 0x0000011d, + 0x000000a7, 0x0000011c, 0x000500b0, 0x00000088, 0x00000120, 0x0000011d, 0x0000011f, 0x000300f7, + 0x00000122, 0x00000000, 0x000400fa, 0x00000120, 0x00000121, 0x00000122, 0x000200f8, 0x00000121, + 0x000500c4, 0x00000006, 0x00000125, 0x000002a5, 0x0000011d, 0x00050051, 0x00000006, 0x00000127, + 0x00000314, 0x00000000, 0x000500c5, 0x00000006, 0x00000128, 0x00000127, 0x00000125, 0x00060052, + 0x000000df, 0x000002e4, 0x00000128, 0x00000314, 0x00000000, 0x000200f9, 0x00000122, 0x000200f8, + 0x00000122, 0x000700f5, 0x000000df, 0x00000319, 0x00000314, 0x0000010d, 0x000002e4, 0x00000121, + 0x00050080, 0x00000006, 0x0000012b, 0x0000011c, 0x000002c8, 0x000500ac, 0x00000088, 0x0000012c, + 0x0000012b, 0x0000011f, 0x000300f7, 0x0000012e, 0x00000000, 0x000400fa, 0x0000012c, 0x0000012d, + 0x0000012e, 0x000200f8, 0x0000012d, 0x0007000c, 0x00000006, 0x00000131, 0x00000001, 0x00000026, + 0x0000011d, 0x0000011f, 0x00050082, 0x00000006, 0x00000132, 0x0000011f, 0x00000131, 0x000500c2, + 0x00000006, 0x00000133, 0x000002a5, 0x00000132, 0x000500ac, 0x00000088, 0x00000135, 0x0000011d, + 0x0000011f, 0x000300f7, 0x00000138, 0x00000000, 0x000400fa, 0x00000135, 0x00000137, 0x0000013b, + 0x000200f8, 0x00000137, 0x00050080, 0x00000006, 0x0000013a, 0x0000011c, 0x000002d8, 0x000200f9, + 0x00000138, 0x000200f8, 0x0000013b, 0x000200f9, 0x00000138, 0x000200f8, 0x00000138, 0x000700f5, + 0x00000006, 0x000002aa, 0x0000013a, 0x00000137, 0x00000057, 0x0000013b, 0x000500c4, 0x00000006, + 0x0000013d, 0x00000133, 0x000002aa, 0x00050051, 0x00000006, 0x0000013f, 0x00000319, 0x00000001, + 0x000500c5, 0x00000006, 0x00000140, 0x0000013f, 0x0000013d, 0x00060052, 0x000000df, 0x000002e7, + 0x00000140, 0x00000319, 0x00000001, 0x000200f9, 0x0000012e, 0x000200f8, 0x0000012e, 0x000700f5, + 0x000000df, 0x00000324, 0x00000319, 0x00000122, 0x000002e7, 0x00000138, 0x000200f9, 0x000000f6, + 0x000200f8, 0x000000f6, 0x00050080, 0x00000006, 0x00000143, 0x00000287, 0x000000d0, 0x000200f9, + 0x000000f3, 0x000200f8, 0x000000f5, 0x000200f9, 0x000000ec, 0x000200f8, 0x000000ec, 0x000700f5, + 0x000000df, 0x00000313, 0x000000e7, 0x000000a3, 0x00000314, 0x000000f5, 0x0008004f, 0x00000010, + 0x00000146, 0x00000304, 0x00000304, 0x00000000, 0x00000001, 0x00000002, 0x0008004f, 0x00000010, + 0x00000149, 0x00000303, 0x00000303, 0x00000000, 0x00000001, 0x00000002, 0x000200f9, 0x0000014d, + 0x000200f8, 0x0000014d, 0x000700f5, 0x00000008, 0x0000028b, 0x0000004b, 0x000000ec, 0x00000169, + 0x0000014e, 0x000700f5, 0x00000008, 0x00000289, 0x0000004b, 0x000000ec, 0x00000162, 0x0000014e, + 0x000700f5, 0x00000006, 0x00000288, 0x00000057, 0x000000ec, 0x0000016b, 0x0000014e, 0x000500b0, + 0x00000088, 0x00000153, 0x00000288, 0x000000a7, 0x000400f6, 0x0000014f, 0x0000014e, 0x00000000, + 0x000400fa, 0x00000153, 0x0000014e, 0x0000014f, 0x000200f8, 0x0000014e, 0x00050041, 0x0000009a, + 0x00000156, 0x000000ab, 0x00000288, 0x0004003d, 0x00000009, 0x00000157, 0x00000156, 0x0008004f, + 0x00000010, 0x00000158, 0x00000157, 0x00000157, 0x00000000, 0x00000001, 0x00000002, 0x0008004f, + 0x00000010, 0x0000015a, 0x000000d5, 0x000000d5, 0x00000000, 0x00000001, 0x00000002, 0x00050083, + 0x00000010, 0x0000015b, 0x00000158, 0x0000015a, 0x00050051, 0x00000008, 0x0000015d, 0x0000015b, + 0x00000000, 0x00050051, 0x00000008, 0x0000015f, 0x0000015b, 0x00000001, 0x00050085, 0x00000008, + 0x00000160, 0x0000015d, 0x0000015f, 0x00050081, 0x00000008, 0x00000162, 0x00000289, 0x00000160, + 0x00050051, 0x00000008, 0x00000164, 0x0000015b, 0x00000002, 0x00050085, 0x00000008, 0x00000167, + 0x00000164, 0x0000015f, 0x00050081, 0x00000008, 0x00000169, 0x0000028b, 0x00000167, 0x00050080, + 0x00000006, 0x0000016b, 0x00000288, 0x000000d0, 0x000200f9, 0x0000014d, 0x000200f8, 0x0000014f, + 0x000500b8, 0x00000088, 0x0000016d, 0x00000289, 0x0000004b, 0x000300f7, 0x0000016f, 0x00000000, + 0x000400fa, 0x0000016d, 0x0000016e, 0x0000016f, 0x000200f8, 0x0000016e, 0x00050051, 0x00000008, + 0x00000172, 0x00000304, 0x00000000, 0x00050051, 0x00000008, 0x00000174, 0x00000303, 0x00000000, + 0x00060052, 0x00000010, 0x000002ef, 0x00000174, 0x00000146, 0x00000000, 0x00060052, 0x00000010, + 0x000002f1, 0x00000172, 0x00000149, 0x00000000, 0x000200f9, 0x0000016f, 0x000200f8, 0x0000016f, + 0x000700f5, 0x00000010, 0x0000030c, 0x00000149, 0x0000014f, 0x000002f1, 0x0000016e, 0x000700f5, + 0x00000010, 0x0000030b, 0x00000146, 0x0000014f, 0x000002ef, 0x0000016e, 0x000500b8, 0x00000088, + 0x00000179, 0x0000028b, 0x0000004b, 0x000300f7, 0x0000017b, 0x00000000, 0x000400fa, 0x00000179, + 0x0000017a, 0x0000017b, 0x000200f8, 0x0000017a, 0x00050051, 0x00000008, 0x0000017e, 0x0000030b, + 0x00000002, 0x00050051, 0x00000008, 0x00000180, 0x0000030c, 0x00000002, 0x00060052, 0x00000010, + 0x000002f5, 0x00000180, 0x0000030b, 0x00000002, 0x00060052, 0x00000010, 0x000002f7, 0x0000017e, + 0x0000030c, 0x00000002, 0x000200f9, 0x0000017b, 0x000200f8, 0x0000017b, 0x000700f5, 0x00000010, + 0x0000030e, 0x0000030b, 0x0000016f, 0x000002f5, 0x0000017a, 0x000700f5, 0x00000010, 0x0000030d, + 0x0000030c, 0x0000016f, 0x000002f7, 0x0000017a, 0x00050083, 0x00000010, 0x00000187, 0x0000030d, + 0x0000030e, 0x00050085, 0x00000010, 0x00000189, 0x00000187, 0x000002ce, 0x00050083, 0x00000010, + 0x0000018d, 0x0000030d, 0x00000189, 0x0008000c, 0x00000010, 0x00000237, 0x00000001, 0x0000002b, + 0x0000018d, 0x000002ca, 0x000002cb, 0x00050085, 0x00000010, 0x0000023a, 0x00000237, 0x000002d3, + 0x0006000c, 0x00000010, 0x0000023b, 0x00000001, 0x00000001, 0x0000023a, 0x0004006d, 0x00000047, + 0x0000023c, 0x0000023b, 0x00050051, 0x00000006, 0x0000023e, 0x0000023c, 0x00000000, 0x000500c4, + 0x00000006, 0x0000023f, 0x0000023e, 0x0000005a, 0x00050051, 0x00000006, 0x00000241, 0x0000023c, + 0x00000001, 0x000500c4, 0x00000006, 0x00000242, 0x00000241, 0x0000005e, 0x000500c5, 0x00000006, + 0x00000243, 0x0000023f, 0x00000242, 0x00050051, 0x00000006, 0x00000245, 0x0000023c, 0x00000002, + 0x000500c5, 0x00000006, 0x00000246, 0x00000243, 0x00000245, 0x00050081, 0x00000010, 0x00000193, + 0x0000030e, 0x00000189, 0x0008000c, 0x00000010, 0x0000024d, 0x00000001, 0x0000002b, 0x00000193, + 0x000002ca, 0x000002cb, 0x00050085, 0x00000010, 0x00000250, 0x0000024d, 0x000002d3, 0x0006000c, + 0x00000010, 0x00000251, 0x00000001, 0x00000001, 0x00000250, 0x0004006d, 0x00000047, 0x00000252, + 0x00000251, 0x00050051, 0x00000006, 0x00000254, 0x00000252, 0x00000000, 0x000500c4, 0x00000006, + 0x00000255, 0x00000254, 0x0000005a, 0x00050051, 0x00000006, 0x00000257, 0x00000252, 0x00000001, + 0x000500c4, 0x00000006, 0x00000258, 0x00000257, 0x0000005e, 0x000500c5, 0x00000006, 0x00000259, + 0x00000255, 0x00000258, 0x00050051, 0x00000006, 0x0000025b, 0x00000252, 0x00000002, 0x000500c5, + 0x00000006, 0x0000025c, 0x00000259, 0x0000025b, 0x000500ab, 0x00000088, 0x00000199, 0x00000246, + 0x0000025c, 0x000300f7, 0x0000019b, 0x00000000, 0x000400fa, 0x00000199, 0x0000019a, 0x0000019b, + 0x000200f8, 0x0000019a, 0x000500b0, 0x00000088, 0x0000019e, 0x00000246, 0x0000025c, 0x000600a9, + 0x00000006, 0x000002d9, 0x0000019e, 0x00000246, 0x0000025c, 0x000600a9, 0x00000006, 0x000002da, + 0x0000019e, 0x0000025c, 0x00000246, 0x000500c2, 0x00000006, 0x00000260, 0x000002da, 0x0000005a, + 0x000500c7, 0x00000006, 0x00000261, 0x00000260, 0x00000069, 0x00040070, 0x00000008, 0x00000262, + 0x00000261, 0x00050085, 0x00000008, 0x00000264, 0x00000262, 0x000002d5, 0x000500c2, 0x00000006, + 0x00000266, 0x000002da, 0x0000005e, 0x000500c7, 0x00000006, 0x00000267, 0x00000266, 0x00000070, + 0x00040070, 0x00000008, 0x00000268, 0x00000267, 0x00050085, 0x00000008, 0x0000026a, 0x00000268, + 0x000002d7, 0x000500c7, 0x00000006, 0x0000026c, 0x000002da, 0x00000069, 0x00040070, 0x00000008, + 0x0000026d, 0x0000026c, 0x00050085, 0x00000008, 0x0000026f, 0x0000026d, 0x000002d5, 0x00060050, + 0x00000010, 0x00000270, 0x00000264, 0x0000026a, 0x0000026f, 0x000500c2, 0x00000006, 0x00000274, + 0x000002d9, 0x0000005a, 0x000500c7, 0x00000006, 0x00000275, 0x00000274, 0x00000069, 0x00040070, + 0x00000008, 0x00000276, 0x00000275, 0x00050085, 0x00000008, 0x00000278, 0x00000276, 0x000002d5, + 0x000500c2, 0x00000006, 0x0000027a, 0x000002d9, 0x0000005e, 0x000500c7, 0x00000006, 0x0000027b, + 0x0000027a, 0x00000070, 0x00040070, 0x00000008, 0x0000027c, 0x0000027b, 0x00050085, 0x00000008, + 0x0000027e, 0x0000027c, 0x000002d7, 0x000500c7, 0x00000006, 0x00000280, 0x000002d9, 0x00000069, + 0x00040070, 0x00000008, 0x00000281, 0x00000280, 0x00050085, 0x00000008, 0x00000283, 0x00000281, + 0x000002d5, 0x00060050, 0x00000010, 0x00000284, 0x00000278, 0x0000027e, 0x00000283, 0x00050083, + 0x00000010, 0x000001b0, 0x00000284, 0x00000270, 0x00050094, 0x00000008, 0x000001b4, 0x000001b0, + 0x000001b0, 0x0007000c, 0x00000008, 0x000001b6, 0x00000001, 0x00000028, 0x000001b4, 0x000001b5, + 0x000200f9, 0x000001b8, 0x000200f8, 0x000001b8, 0x000700f5, 0x00000006, 0x00000294, 0x00000057, + 0x0000019a, 0x000001e5, 0x000001bb, 0x000700f5, 0x00000006, 0x0000028e, 0x00000057, 0x0000019a, + 0x000001e7, 0x000001bb, 0x000500b0, 0x00000088, 0x000001be, 0x0000028e, 0x000000a7, 0x000400f6, + 0x000001ba, 0x000001bb, 0x00000000, 0x000400fa, 0x000001be, 0x000001b9, 0x000001ba, 0x000200f8, + 0x000001b9, 0x00050041, 0x0000009a, 0x000001c1, 0x000000ab, 0x0000028e, 0x0004003d, 0x00000009, + 0x000001c2, 0x000001c1, 0x0008004f, 0x00000010, 0x000001c3, 0x000001c2, 0x000001c2, 0x00000000, + 0x00000001, 0x00000002, 0x00050083, 0x00000010, 0x000001c5, 0x000001c3, 0x00000270, 0x00050094, + 0x00000008, 0x000001c7, 0x000001c5, 0x000001b0, 0x00050088, 0x00000008, 0x000001c9, 0x000001c7, + 0x000001b6, 0x00050085, 0x00000008, 0x000001cb, 0x000001c9, 0x000001ca, 0x0006000c, 0x00000008, + 0x000001cc, 0x00000001, 0x00000001, 0x000001cb, 0x0008000c, 0x00000008, 0x000001cd, 0x00000001, + 0x0000002b, 0x000001cc, 0x0000004b, 0x000001ca, 0x0004006d, 0x00000006, 0x000001ce, 0x000001cd, + 0x000500aa, 0x00000088, 0x000001d1, 0x000001ce, 0x00000057, 0x000300f7, 0x000001d4, 0x00000000, + 0x000400fa, 0x000001d1, 0x000001d3, 0x000001d5, 0x000200f8, 0x000001d3, 0x000200f9, 0x000001d4, + 0x000200f8, 0x000001d5, 0x000500aa, 0x00000088, 0x000001d7, 0x000001ce, 0x00000084, 0x000300f7, + 0x000001da, 0x00000000, 0x000400fa, 0x000001d7, 0x000001d9, 0x000001db, 0x000200f8, 0x000001d9, + 0x000200f9, 0x000001da, 0x000200f8, 0x000001db, 0x00050080, 0x00000006, 0x000001dd, 0x000001ce, + 0x00000023, 0x000200f9, 0x000001da, 0x000200f8, 0x000001da, 0x000700f5, 0x00000006, 0x00000299, + 0x00000023, 0x000001d9, 0x000001dd, 0x000001db, 0x000200f9, 0x000001d4, 0x000200f8, 0x000001d4, + 0x000700f5, 0x00000006, 0x0000029a, 0x00000057, 0x000001d3, 0x00000299, 0x000001da, 0x00050084, + 0x00000006, 0x000001e2, 0x00000061, 0x0000028e, 0x000500c4, 0x00000006, 0x000001e3, 0x0000029a, + 0x000001e2, 0x000500c5, 0x00000006, 0x000001e5, 0x00000294, 0x000001e3, 0x000200f9, 0x000001bb, + 0x000200f8, 0x000001bb, 0x00050080, 0x00000006, 0x000001e7, 0x0000028e, 0x000000d0, 0x000200f9, + 0x000001b8, 0x000200f8, 0x000001ba, 0x000200f9, 0x0000019b, 0x000200f8, 0x0000019b, 0x000700f5, + 0x00000006, 0x00000293, 0x00000057, 0x0000017b, 0x00000294, 0x000001ba, 0x000700f5, 0x00000006, + 0x00000291, 0x0000025c, 0x0000017b, 0x000002d9, 0x000001ba, 0x000700f5, 0x00000006, 0x0000028f, + 0x00000246, 0x0000017b, 0x000002da, 0x000001ba, 0x00050041, 0x00000020, 0x000001ed, 0x0000001d, + 0x000000d0, 0x0004003d, 0x00000006, 0x000001ee, 0x000001ed, 0x00050051, 0x00000006, 0x000001f0, + 0x00000080, 0x00000002, 0x00050041, 0x00000020, 0x000001f1, 0x0000001d, 0x0000005e, 0x0004003d, + 0x00000006, 0x000001f2, 0x000001f1, 0x00050084, 0x00000006, 0x000001f3, 0x000001f0, 0x000001f2, + 0x00050080, 0x00000006, 0x000001f4, 0x000001ee, 0x000001f3, 0x00050051, 0x00000006, 0x000001f6, + 0x00000080, 0x00000001, 0x00050084, 0x00000006, 0x000001f9, 0x000001f6, 0x0000008d, 0x00050080, + 0x00000006, 0x000001fa, 0x000001f4, 0x000001f9, 0x00050080, 0x00000006, 0x000001fd, 0x000001fa, + 0x0000008a, 0x00050051, 0x00000006, 0x000001ff, 0x00000313, 0x00000000, 0x00050051, 0x00000006, + 0x00000201, 0x00000313, 0x00000001, 0x000500c4, 0x00000006, 0x00000205, 0x00000291, 0x00000204, + 0x000500c5, 0x00000006, 0x00000206, 0x0000028f, 0x00000205, 0x00070050, 0x000001e8, 0x00000208, + 0x000001ff, 0x00000201, 0x00000206, 0x00000293, 0x00060041, 0x00000209, 0x0000020a, 0x000001ec, + 0x00000030, 0x000001fd, 0x0003003e, 0x0000020a, 0x00000208, 0x000200f9, 0x0000020d, 0x000200f8, + 0x0000020d, 0x000100fd, 0x00010038, +}; diff --git a/runtime/cfg.c b/runtime/cfg.c index 1864492d..417513e0 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -30,7 +30,7 @@ static int save_ok = 1; // the last cfg_save_to wrote (o // Every name the runtime reads (and the patch sets in generated/), without the prefix. A file key outside this list is // logged as unknown. A new variable goes here too, or its ini key logs a harmless "unknown key" line. static const char *const known[] = { - "AB", "APP_POOL", "ASSUME_FOCUS", "ASTC", "ASTC_TIME", "ASYNC_PREEMPT", "AUDIO", "AUDIO_OFF", "AUDIO_PREFILL_MS", + "AB", "APP_POOL", "ASSUME_FOCUS", "ASTC", "ASTC_BC", "ASTC_TIME", "ASYNC_PREEMPT", "AUDIO", "AUDIO_OFF", "AUDIO_PREFILL_MS", "BACKGROUND_WINDOW", "BIND_A", "BIND_B", "BIND_DOWN", "BIND_L", "BIND_LCLICK", "BIND_LEFT", "BIND_LSTICK_DOWN", "BIND_LSTICK_LEFT", "BIND_LSTICK_RIGHT", "BIND_LSTICK_UP", "BIND_MINUS", "BIND_PLUS", "BIND_R", "BIND_RCLICK", "BIND_RIGHT", "BIND_RSTICK_DOWN", "BIND_RSTICK_LEFT", "BIND_RSTICK_RIGHT", "BIND_RSTICK_UP", @@ -74,7 +74,7 @@ static const struct { const char *key, *section; } sections[] = { {"TIMER_1MS", "performance"}, {"PIPE_WAIT", "performance"}, {"PIPE_SKIP", "performance"}, {"LIB_PREBUILD", "performance"}, {"LIB_PREBUILD_THREADS", "performance"}, {"PIPE_PREBUILD", "performance"}, {"PREWARM_XLATE", "performance"}, {"GPL", "performance"}, {"ASTC", "performance"}, {"MEMORY", "performance"}, - {"TEX_ALIAS", "performance"}, {"TEX_VRAM_PRESSURE", "performance"}, {"LOD_GUARD", "performance"}, {"FIX_C0", "performance"}, {"FIX_ZERO", "performance"}, + {"TEX_ALIAS", "performance"}, {"TEX_VRAM_PRESSURE", "performance"}, {"ASTC_BC", "performance"}, {"LOD_GUARD", "performance"}, {"FIX_C0", "performance"}, {"FIX_ZERO", "performance"}, {"BIND_SKIP", "performance"}, {"SHADER_MEMO", "performance"}, {"PIPE_MEMO", "performance"}, {"TEX_MEMO", "performance"}, {"DESC_TEMPLATE", "performance"}, {"PUSH_SKIP", "performance"}, {"SPLIT_DRAWS", "performance"}, {"SPLIT_US", "performance"}, {"VK_VALIDATION", "performance"}, {"VK_DYN_VERTEX", "performance"}, {"VK_SUBGROUP_PIN", "performance"}, @@ -115,7 +115,7 @@ static const CfgMeta metas[] = { {"PIPE_PREBUILD", "1", "0|1", RESTART}, {"PREWARM_XLATE", "", "1..64", RESTART}, {"GPL", "", "0|1", RESTART}, // textures and memory {"ASTC", "auto", "auto|gpu|native|cpu", RESTART}, {"MEMORY", "auto", "auto|import|mirror|verify", RESTART}, - {"TEX_ALIAS", "1", "0|1", RESTART}, {"TEX_VRAM_PRESSURE", "90", "0..100", RESTART}, {"ZSTD_NATIVE", "1", "0|1", RESTART}, {"ZSTD_CHECK", "0", "0|1", RESTART}, + {"TEX_ALIAS", "1", "0|1", RESTART}, {"TEX_VRAM_PRESSURE", "90", "0..100", RESTART}, {"ASTC_BC", "0", "0|1", RESTART}, {"ZSTD_NATIVE", "1", "0|1", RESTART}, {"ZSTD_CHECK", "0", "0|1", RESTART}, // render fixes {"LOD_GUARD", "1", "0|1", RESTART}, {"FIX_C0", "1", "0|1", RESTART}, {"FIX_ZERO", "1", "0|1", RESTART}, {"BIND_SKIP", "1", "0|1", RESTART}, {"SHADER_MEMO", "1", "0|1", RESTART}, {"PIPE_MEMO", "1", "0|1", RESTART}, {"TEX_MEMO", "1", "0|1", RESTART}, diff --git a/runtime/shaders/bc3_encode.comp b/runtime/shaders/bc3_encode.comp new file mode 100644 index 00000000..eca6843e --- /dev/null +++ b/runtime/shaders/bc3_encode.comp @@ -0,0 +1,89 @@ +// RGBA8 texels to BC3 blocks on the GPU, one invocation per 4x4 block: the second pass of the ASTC decode when +// TOTK_ASTC_BC is on (vk_astc.c), so a decoded ASTC texture takes 8 bits per texel in video memory instead of 32. +// Texels past the right or bottom edge repeat the last column or row. +// +// Colour: the BC1 four-colour block of the box around the block's colours, its diagonal turned to the sign of the +// colours' covariance and inset by 1/16 of the range (the bounding-box method of stb_dxt and of yuzu's BC1 recompression), +// then each texel takes the nearest of the four palette entries along that axis. Alpha: the eight-value BC3 alpha +// block between the block's smallest and largest alpha. The bytes are what the texels hold, so an sRGB image keeps +// sRGB-encoded values, as BC3_SRGB expects. +// Compiled to runtime/bc3_encode_spv.h by tools/build_shaders.py; vk_astc.c records the dispatch. +#version 450 + +layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; + +layout(std430, set = 0, binding = 0) readonly buffer Texels { uint px[]; }; +layout(std430, set = 0, binding = 1) writeonly buffer Blocks { uvec4 blk[]; }; + +layout(push_constant) uniform Params { + uint in_base; // first texel of slice 0 (index into px) + uint out_base; // first block of slice 0 (uvec4 index into blk) + uint width, height; + uint bx; // blocks per row + uint bslice; // blocks per slice +} pc; + +vec4 texel(uint x, uint y, uint z) { + x = min(x, pc.width - 1u), y = min(y, pc.height - 1u); + return unpackUnorm4x8(px[pc.in_base + (z * pc.height + y) * pc.width + x]) * 255.0; +} + +uint to565(vec3 c) { + uvec3 q = uvec3(round(clamp(c, 0.0, 255.0) * vec3(31.0, 63.0, 31.0) / 255.0)); + return q.r << 11 | q.g << 5 | q.b; +} + +vec3 from565(uint v) { + return vec3(float(v >> 11 & 31u) * 255.0 / 31.0, float(v >> 5 & 63u) * 255.0 / 63.0, float(v & 31u) * 255.0 / 31.0); +} + +void main() { + uvec3 id = gl_GlobalInvocationID; + uint by = (pc.height + 3u) / 4u; + if (id.x >= pc.bx || id.y >= by) return; + vec4 t[16]; + vec4 lo = vec4(255.0), hi = vec4(0.0), mean = vec4(0.0); + for (uint i = 0u; i < 16u; i++) { + t[i] = texel(id.x * 4u + (i & 3u), id.y * 4u + (i >> 2), id.z); + lo = min(lo, t[i]), hi = max(hi, t[i]), mean += t[i]; + } + mean /= 16.0; + + // alpha: a0 > a1 selects the eight-value mode; index 0 is a0, 1 is a1, 2..7 the six steps from a0 to a1 + uint a0 = uint(hi.a), a1 = uint(lo.a); + uvec2 ab = uvec2(a0 | a1 << 8, 0u); + if (a0 > a1) { + float range = float(a0 - a1); + for (uint i = 0u; i < 16u; i++) { + uint s = uint(clamp(round((float(a0) - t[i].a) * 7.0 / range), 0.0, 7.0)); // 0 = a0 .. 7 = a1 + uint code = s == 0u ? 0u : s == 7u ? 1u : s + 1u; + uint bit = 16u + 3u * i; + if (bit < 32u) ab.x |= code << bit; + if (bit + 3u > 32u) ab.y |= code >> (32u - min(bit, 32u)) << (bit > 32u ? bit - 32u : 0u); + } + } + + // colour: the box diagonal along the covariance of red and blue with green + vec3 cmin = lo.rgb, cmax = hi.rgb; + float crg = 0.0, cbg = 0.0; + for (uint i = 0u; i < 16u; i++) { + vec3 d = t[i].rgb - mean.rgb; + crg += d.r * d.g, cbg += d.b * d.g; + } + if (crg < 0.0) { float s = cmin.r; cmin.r = cmax.r; cmax.r = s; } + if (cbg < 0.0) { float s = cmin.b; cmin.b = cmax.b; cmax.b = s; } + vec3 inset = (cmax - cmin) / 16.0; + uint c0 = to565(cmax - inset), c1 = to565(cmin + inset); + uint idx = 0u; + if (c0 != c1) { + if (c0 < c1) { uint s = c0; c0 = c1; c1 = s; } // c0 > c1: the four-colour mode + vec3 e0 = from565(c0), e1 = from565(c1), axis = e1 - e0; + float len2 = max(dot(axis, axis), 1e-6); + for (uint i = 0u; i < 16u; i++) { + uint s = uint(clamp(round(dot(t[i].rgb - e0, axis) / len2 * 3.0), 0.0, 3.0)); // 0 = e0 .. 3 = e1 + uint code = s == 0u ? 0u : s == 3u ? 1u : s + 1u; // palette order e0, e1, 2/3 e0 + 1/3 e1, 1/3 e0 + 2/3 e1 + idx |= code << (2u * i); + } + } + blk[pc.out_base + id.z * pc.bslice + id.y * pc.bx + id.x] = uvec4(ab.x, ab.y, c0 | c1 << 16, idx); +} diff --git a/runtime/tex.h b/runtime/tex.h index 3d4e0599..05be6094 100644 --- a/runtime/tex.h +++ b/runtime/tex.h @@ -54,6 +54,7 @@ typedef struct TexVkFormat { uint8_t astc_bw, astc_bh; // nonzero: ASTC decoded into vk (RGBA8, same colour space) by vk_astc.c or tex_astc.c; // zero for native ASTC (vk == ideal, raw blocks as for BC) uint8_t astc_srgb; + uint8_t astc_bc; // ASTC decoded and then encoded to BC3 (vk BC3, TOTK_ASTC_BC; vk_astc.c) uint8_t depth, stencil; // aspect flags of depth / stencil formats const char *note; // why a fallback or an expansion was chosen; NULL when the mapping is direct const char *reason; // unmapped formats only: why there is no Vulkan format diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 86c2bc5f..45c4428e 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -671,6 +671,7 @@ static void tab_advanced(float scale) { opt_choice("TOTK_MEMORY", UI_MENU_MEMORY, mem, 4, UI_MENU_MEMORY_DESC); opt_toggle("TOTK_TEX_ALIAS", UI_MENU_TEX_ALIAS, UI_MENU_TEX_ALIAS_DESC); opt_slider("TOTK_TEX_VRAM_PRESSURE", UI_MENU_TEX_VRAM_PRESSURE, 0, 100, UI_MENU_TEX_VRAM_PRESSURE_DESC, 1, "%.0f%%"); + opt_toggle("TOTK_ASTC_BC", UI_MENU_ASTC_BC, UI_MENU_ASTC_BC_DESC); opt_group(UI_MENU_GROUP_FIXES); opt_toggle("TOTK_LOD_GUARD", UI_MENU_LOD_GUARD, UI_MENU_LOD_GUARD_DESC); diff --git a/runtime/ui_text.c b/runtime/ui_text.c index b17ebb02..24513f8b 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -187,6 +187,7 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_MEMORY_VERIFY] = "Verify", [UI_MENU_TEX_ALIAS] = "Texture aliasing", [UI_MENU_TEX_ALIAS_DESC] = "A new texture created over a live texture's memory starts with that content instead of empty.", [UI_MENU_TEX_VRAM_PRESSURE] = "Texture memory limit", [UI_MENU_TEX_VRAM_PRESSURE_DESC] = "Percent of video memory above which textures the game released are dropped (they come back from storage when used again). 0 keeps them.", + [UI_MENU_ASTC_BC] = "Compress ASTC to BC3", [UI_MENU_ASTC_BC_DESC] = "With the GPU decoder: re-encodes decoded ASTC textures to BC3, a quarter of the video memory. For GPUs with 4 GB or less; textures look slightly blockier.", [UI_MENU_LOD_GUARD] = "LOD guard", [UI_MENU_LOD_GUARD_DESC] = "Prevents objects flashing in the wrong place or a flat far field for a frame, by waiting for the game to finish rewriting level-of-detail data before the GPU reads it.", [UI_MENU_FIX_C0] = "Constant buffer fix", [UI_MENU_FIX_C0_DESC] = "Fills the driver-reserved constant bank c0 (storage sizes, dispatch size, point size, base instance) instead of reading zeros.", @@ -411,6 +412,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_MEMORY_VERIFY] = "Проверка", [UI_MENU_TEX_ALIAS] = "Наследование содержимого текстур", [UI_MENU_TEX_ALIAS_DESC] = "Новая текстура поверх памяти живой текстуры получает её содержимое, а не пустую.", [UI_MENU_TEX_VRAM_PRESSURE] = "Предел памяти текстур", [UI_MENU_TEX_VRAM_PRESSURE_DESC] = "Процент видеопамяти, выше которого освобождённые игрой текстуры удаляются (при повторном использовании загружаются снова). 0 — не удалять.", + [UI_MENU_ASTC_BC] = "Сжатие ASTC в BC3", [UI_MENU_ASTC_BC_DESC] = "С декодером на GPU: декодированные текстуры ASTC пересжимаются в BC3 и занимают вчетверо меньше видеопамяти. Для видеокарт с 4 ГБ и меньше; текстуры чуть более блочные.", [UI_MENU_LOD_GUARD] = "Защита LOD", [UI_MENU_LOD_GUARD_DESC] = "Не даёт объектам мелькать не на своём месте, а дальнему плану — на кадр становиться плоским: ждёт, пока игра допишет данные уровней детализации, и только потом их читает GPU.", [UI_MENU_FIX_C0] = "Исправление константного буфера", [UI_MENU_FIX_C0_DESC] = "Заполняет зарезервированный драйвером банк констант c0 (размеры хранилищ, размер запуска, размер точки, базовый экземпляр) вместо чтения нулей.", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 24975758..a5b1370e 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -120,6 +120,7 @@ typedef enum { UI_MENU_MEMORY_VERIFY, UI_MENU_TEX_ALIAS, UI_MENU_TEX_ALIAS_DESC, UI_MENU_TEX_VRAM_PRESSURE, UI_MENU_TEX_VRAM_PRESSURE_DESC, + UI_MENU_ASTC_BC, UI_MENU_ASTC_BC_DESC, UI_MENU_LOD_GUARD, UI_MENU_LOD_GUARD_DESC, UI_MENU_FIX_C0, UI_MENU_FIX_C0_DESC, UI_MENU_FIX_ZERO, UI_MENU_FIX_ZERO_DESC, diff --git a/runtime/vk.h b/runtime/vk.h index f7050892..916a2b5c 100644 --- a/runtime/vk.h +++ b/runtime/vk.h @@ -242,6 +242,7 @@ enum { VK_ASTC_CPU, VK_ASTC_GPU, VK_ASTC_NATIVE, VK_ASTC_CHECK }; int vk_astc_mode(void); // decided once per device (logged); VK_ASTC_CPU before vk_init int vk_astc_native(VkFormat astc_fmt); // 1: images of this ASTC format are created as such and get the raw blocks int vk_astc_gpu(void); // 1: ASTC images decoded to RGBA8 by the compute decoder (vk_astc_record) +int vk_astc_bc(void); // 1: those images are BC3 instead, encoded after the decode (TOTK_ASTC_BC=1) // One image region decoded from raw blocks: tight rows of 16-byte blocks at byte src of the source buffer (slices one // after the other), w x h texels and slices deep, written at offset of level / layer. typedef struct { VkDeviceSize src; uint32_t w, h, slices, level, layer; VkOffset3D offset; } VkAstcRegion; @@ -249,9 +250,10 @@ typedef struct { VkDeviceSize src; uint32_t w, h, slices, level, layer; VkOffset // bytes of blocks) goes to a device-local scratch buffer, a dispatch per region decodes it, and the texels are copied // into img (VK_IMAGE_LAYOUT_GENERAL). The caller records its usual barriers around an image copy before and after the // call. readback (optional, host-visible, TRANSFER_DST): also gets the decoded texels, the regions one after the other. +// bc: img is BC3 (TexVkFormat.astc_bc); the texels are encoded to BC3 blocks before the copy, and readback is ignored. // 0 when the decoder is unavailable or the scratch buffer cannot be allocated (nothing recorded). int vk_astc_record(VkCommandBuffer cb, VkBuffer src, VkDeviceSize src_size, const VkAstcRegion *rg, int n, uint32_t bw, - uint32_t bh, int srgb, VkImage img, VkImageAspectFlags aspect, VkBuffer readback); + uint32_t bh, int srgb, int bc, VkImage img, VkImageAspectFlags aspect, VkBuffer readback); void vk_astc_stats(uint64_t *dispatches, uint64_t *texels); // since start // TOTK_ASTC_TIME=1: GPU timestamps around each vk_astc_record's dispatches (logged per footprint and the largest one) void vk_astc_time_enable(int on); diff --git a/runtime/vk_astc.c b/runtime/vk_astc.c index 62afe30d..7e6fcc1b 100644 --- a/runtime/vk_astc.c +++ b/runtime/vk_astc.c @@ -1,6 +1,10 @@ // ASTC textures on the GPU: the TOTK_ASTC knob, a compute decoder that turns raw blocks into the RGBA8 image the CPU // decoder (tex_astc.c) would have written, and the native ASTC formats where the device samples them itself. // +// TOTK_ASTC_BC = 1 (gpu mode only, default 0): a second pass (runtime/shaders/bc3_encode.comp) encodes the decoded +// texels to BC3 and the image is BC3, 8 bits per texel instead of 32. For GPUs with little video memory, at the cost of +// BC3's quality: textures look slightly blockier, and data textures (normal maps) lose some precision. +// // TOTK_ASTC = auto (default): native when the device reports textureCompressionASTC_LDR and the format's features, // else gpu. gpu: compute decode into RGBA8 (runtime/shaders/astc_decode.comp). native: like auto, but logs when the // device cannot. cpu: astc_decode_ldr_mt on the uploading thread, as before. check: gpu, and every upload is also @@ -17,6 +21,7 @@ #include #include "astc_decode_spv.h" +#include "bc3_encode_spv.h" #include "cfg.h" #include "host.h" #include "tex.h" @@ -99,6 +104,8 @@ static struct { VkDescriptorSetLayout dsl; VkPipelineLayout layout; VkPipeline pipe; + VkPipeline bc_pipe; // the BC3 encoder (TOTK_ASTC_BC): the decoder's layout, bindings 0 and 1 + int bc; // 1: ASTC images are BC3 (vk_astc_bc) PFN_vkCmdPushDescriptorSetKHR push; VkBuffer tab; // device-local copy of the tables VmaAllocation tab_alloc; @@ -293,6 +300,36 @@ static int create_pipeline(VkCtx *c) { return 1; } +// TOTK_ASTC_BC=1: the BC3 encoder, when the device samples BC3 (every desktop GPU does); 0 leaves ASTC as RGBA8. +static int create_bc_pipeline(VkCtx *c) { + const char *e = cfg_get("TOTK_ASTC_BC"); + if (!e || !*e || *e == '0') return 0; + VkFormatProperties p; + vkGetPhysicalDeviceFormatProperties(c->phys, VK_FORMAT_BC3_SRGB_BLOCK, &p); + VkFormatFeatureFlags need = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_TRANSFER_DST_BIT; + if ((p.optimalTilingFeatures & need) != need) { + rt_log("vk: TOTK_ASTC_BC: the device does not sample BC3; ASTC stays RGBA8"); + return 0; + } + VkShaderModuleCreateInfo mi = {.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO, .codeSize = sizeof bc3_encode_spv, + .pCode = bc3_encode_spv}; + VkShaderModule m = VK_NULL_HANDLE; + if (vkCreateShaderModule(c->device, &mi, NULL, &m) != VK_SUCCESS) return 0; + VkComputePipelineCreateInfo ci = {.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, + .stage = {.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, + .stage = VK_SHADER_STAGE_COMPUTE_BIT, .module = m, .pName = "main"}, + .layout = G.layout}; + VkResult r = vkCreateComputePipelines(c->device, VK_NULL_HANDLE, 1, &ci, NULL, &G.bc_pipe); + vkDestroyShaderModule(c->device, m, NULL); + if (r != VK_SUCCESS) { + G.bc_pipe = VK_NULL_HANDLE; + rt_log("vk: TOTK_ASTC_BC: the BC3 encoder pipeline failed (%d); ASTC stays RGBA8", (int)r); + return 0; + } + rt_log("vk: ASTC textures are encoded to BC3 after the decode (TOTK_ASTC_BC)"); + return 1; +} + static int native_device(VkCtx *c) { return c->has_astc_ldr; } static const char *mode_name(int m) { @@ -324,6 +361,7 @@ int vk_astc_mode(void) { rt_log("vk: ASTC compute decoder unavailable on %s: ASTC decodes on the CPU", c->props.deviceName); } if (G.failed && m != VK_ASTC_NATIVE) m = VK_ASTC_CPU; + G.bc = m == VK_ASTC_GPU && G.pipe && create_bc_pipeline(c); G.mode = m; rt_log("vk: ASTC textures: %s (textureCompressionASTC_LDR %d)", mode_name(m), native_device(c)); } @@ -352,6 +390,15 @@ int vk_astc_gpu(void) { return ok; } +int vk_astc_bc(void) { + VkCtx *c = vk_ctx(); + if (!c || vk_astc_mode() != VK_ASTC_GPU) return 0; + AcquireSRWLockShared(&g_lock); + int on = G.dev == c->device && G.bc; + ReleaseSRWLockShared(&g_lock); + return on; +} + static void mem_barrier(VkCommandBuffer cb, VkPipelineStageFlags2 src, VkAccessFlags2 sa, VkPipelineStageFlags2 dst, VkAccessFlags2 da) { VkMemoryBarrier2 mb = {.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER_2, .srcStageMask = src, .srcAccessMask = sa, @@ -368,30 +415,47 @@ static VkDeviceSize region_out(const VkAstcRegion *r) { return (VkDeviceSize)r-> static VkDeviceSize region_in(const VkAstcRegion *r, uint32_t bw, uint32_t bh) { return (VkDeviceSize)((r->w + bw - 1) / bw) * ((r->h + bh - 1) / bh) * r->slices * 16; } +static VkDeviceSize region_bc(const VkAstcRegion *r) { return region_in(r, 4, 4); } // BC3: 16 bytes per 4x4 block + +typedef struct { uint32_t in_base, out_base, width, height, bx, bslice; } BcPush; // bc3_encode.comp Params int vk_astc_record(VkCommandBuffer cb, VkBuffer src, VkDeviceSize src_size, const VkAstcRegion *rg, int n, uint32_t bw, - uint32_t bh, int srgb, VkImage img, VkImageAspectFlags aspect, VkBuffer readback) { - static volatile long n_fail; + uint32_t bh, int srgb, int bc, VkImage img, VkImageAspectFlags aspect, VkBuffer readback) { + static volatile long n_fail, n_unaligned; (void)src_size; VkCtx *c = vk_ctx(); if (!c || !vk_astc_gpu() || bw < 4 || bh < 4 || bw > 12 || bh > 12) return 0; AcquireSRWLockShared(&g_lock); - VkPipeline pipe = G.dev == c->device ? G.pipe : VK_NULL_HANDLE; + VkPipeline pipe = G.dev == c->device ? G.pipe : VK_NULL_HANDLE, bc_pipe = G.dev == c->device ? G.bc_pipe : VK_NULL_HANDLE; ReleaseSRWLockShared(&g_lock); - if (!pipe) return 0; - // chunks of consecutive regions; scratch = the largest chunk's blocks, then its texels - VkDeviceSize out_total = 0, cap_in = 0, cap_out = 0, ci = 0, co = 0; + if (!pipe || (bc && !bc_pipe)) return 0; + if (bc) { + readback = VK_NULL_HANDLE; + for (int i = 0; i < n; i++) // a BC copy starts on a block corner; a WriteTexels region of a 5x5 or 6x6 footprint may not + if ((rg[i].offset.x & 3) || (rg[i].offset.y & 3)) { + if (InterlockedIncrement(&n_unaligned) <= 16) + rt_log("vk: ASTC to BC3: region at %d,%d is not on a 4x4 block corner: texture left as it was", + rg[i].offset.x, rg[i].offset.y); + return 0; + } + } + // chunks of consecutive regions; scratch = the largest chunk's blocks, then its texels, then (bc) its BC3 blocks + VkDeviceSize out_total = 0, cap_in = 0, cap_out = 0, cap_bc = 0, ci = 0, co = 0, cb3 = 0; for (int i = 0; i < n; i++) { VkDeviceSize o = region_out(&rg[i]), b = region_in(&rg[i], bw, bh); - if (co && co + o > CHUNK_OUT) ci = co = 0; - ci += b, co += o, out_total += o; + if (co && co + o > CHUNK_OUT) ci = co = cb3 = 0; + ci += b, co += o, cb3 += region_bc(&rg[i]), out_total += o; if (ci > cap_in) cap_in = ci; if (co > cap_out) cap_out = co; + if (cb3 > cap_bc) cap_bc = cb3; } if (!out_total) return 1; - VkDeviceSize al = c->props.limits.minStorageBufferOffsetAlignment; // the texels bind at cap_in - if (al > 1) cap_in = (cap_in + al - 1) / al * al; - VkBufferCreateInfo bi = {.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .size = cap_in + cap_out, + VkDeviceSize al = c->props.limits.minStorageBufferOffsetAlignment; // the texels bind at cap_in, the BC3 blocks after them + if (al < 16) al = 16; + cap_in = (cap_in + al - 1) / al * al; + cap_out = (cap_out + al - 1) / al * al; + if (!bc) cap_bc = 0; + VkBufferCreateInfo bi = {.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .size = cap_in + cap_out + cap_bc, .usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT}; VmaAllocationCreateInfo aci = {.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE}; @@ -485,6 +549,30 @@ int vk_astc_record(VkCommandBuffer cb, VkBuffer src, VkDeviceSize src_size, cons } if (slot >= 0) vkCmdWriteTimestamp2(cb, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, tpool, 2 * (uint32_t)slot + 1); + if (bc) { // the chunk's texels to BC3 blocks behind them; the image copy then takes the blocks + mem_barrier(cb, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT, + VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_STORAGE_READ_BIT); + VkDescriptorBufferInfo bdi[2] = {{sb, cap_in, cap_out}, {sb, cap_in + cap_out, cap_bc}}; + VkWriteDescriptorSet bw2[2]; + for (int k = 0; k < 2; k++) + bw2[k] = (VkWriteDescriptorSet){.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, .dstBinding = (uint32_t)k, + .descriptorCount = 1, .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, + .pBufferInfo = &bdi[k]}; + vkCmdBindPipeline(cb, VK_PIPELINE_BIND_POINT_COMPUTE, bc_pipe); + rec_push(G.push, cb, VK_PIPELINE_BIND_POINT_COMPUTE, G.layout, 0, 2, bw2); + VkDeviceSize to = 0, bo = 0; + for (int i = i0; i < i1; i++) { + const VkAstcRegion *r = &rg[i]; + uint32_t bx4 = (r->w + 3) / 4, by4 = (r->h + 3) / 4; + BcPush pc = {.in_base = (uint32_t)(to / 4), .out_base = (uint32_t)(bo / 16), .width = r->w, .height = r->h, + .bx = bx4, .bslice = bx4 * by4}; + vkCmdPushConstants(cb, G.layout, VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof pc, &pc); + vkCmdDispatch(cb, (bx4 + 7) / 8, (by4 + 7) / 8, r->slices); + VkBufferImageCopy *cp = &copies[i - i0]; + cp->bufferOffset = cap_in + cap_out + bo, cp->bufferRowLength = bx4 * 4, cp->bufferImageHeight = by4 * 4; + to += region_out(r), bo += region_bc(r); + } + } mem_barrier(cb, VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT, VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT, VK_PIPELINE_STAGE_2_COPY_BIT, VK_ACCESS_2_TRANSFER_READ_BIT); vkCmdCopyBufferToImage(cb, sb, img, VK_IMAGE_LAYOUT_GENERAL, (uint32_t)(i1 - i0), copies); @@ -525,6 +613,7 @@ void vk_astc_release(void) { AcquireSRWLockExclusive(&g_lock); if (c && G.dev == c->device) { if (G.pipe) vkDestroyPipeline(c->device, G.pipe, NULL); + if (G.bc_pipe) vkDestroyPipeline(c->device, G.bc_pipe, NULL); if (G.layout) vkDestroyPipelineLayout(c->device, G.layout, NULL); if (G.dsl) vkDestroyDescriptorSetLayout(c->device, G.dsl, NULL); if (G.tab) vmaDestroyBuffer(c->vma, G.tab, G.tab_alloc); diff --git a/runtime/vk_formats.c b/runtime/vk_formats.c index a404c252..7d799fd8 100644 --- a/runtime/vk_formats.c +++ b/runtime/vk_formats.c @@ -126,6 +126,11 @@ int tex_vk_format(int nvn_format, TexVkFormat *o) { o->astc_bh = astc[i].bh; o->astc_srgb = (uint8_t)srgb; o->note = "no native ASTC: decoded to RGBA8 (vk_astc.c compute decoder, or tex_astc.c with TOTK_ASTC=cpu)"; + if (vk_astc_bc()) { + o->vk = srgb ? VK_FORMAT_BC3_SRGB_BLOCK : VK_FORMAT_BC3_UNORM_BLOCK; + o->astc_bc = 1; + o->note = "no native ASTC: decoded and encoded to BC3 on the GPU (vk_astc.c, TOTK_ASTC_BC)"; + } return 1; } if ((f >= 0x51 && f <= 0x68) || f == 0x6B || f == 0x6C) { diff --git a/runtime/vk_texture.c b/runtime/vk_texture.c index f12e7934..a75c9523 100644 --- a/runtime/vk_texture.c +++ b/runtime/vk_texture.c @@ -657,7 +657,7 @@ static void upload(Tex *e) { int checked = 0; if (agpu) { uint64_t a0 = perf_begin(); - checked = vk_astc_record(cb, sb, total, ar, (int)n, e->f.astc_bw, e->f.astc_bh, e->f.astc_srgb, e->pub.image, + checked = vk_astc_record(cb, sb, total, ar, (int)n, e->f.astc_bw, e->f.astc_bh, e->f.astc_srgb, e->f.astc_bc, e->pub.image, e->pub.aspect, rbuf); perf_end(PERF_ASTC, a0); if (!checked) @@ -741,6 +741,7 @@ static void make_fresh_snap(Tex *e) { // Bytes per block and block size of the image's VkFormat (ASTC decodes to RGBA8, RGB expands to RGBA); 0 when the // VkFormat substitutes another one of unknown size. static int img_block(const Tex *e, int *bw, int *bh) { + if (e->f.astc_bc) { *bw = *bh = 4; return 16; } if (e->f.astc_bw) { *bw = *bh = 1; return 4; } int b = nvn_fmt_bpb(e->t.d.format, bw, bh); if (e->f.expand_rgb) { *bw = *bh = 1; return b / 3 * 4; } @@ -1221,7 +1222,7 @@ static int image_texels(Tex *e, const Region *g, const NVNcopyRegion *r, uint8_t ar[z] = (VkAstcRegion){.src = slice * (size_t)z, .w = w, .h = h, .slices = 1, .level = rg[z].imageSubresource.mipLevel, .layer = rg[z].imageSubresource.baseArrayLayer, .offset = rg[z].imageOffset}; uint64_t a0 = perf_begin(); - done = vk_astc_record(cb, sb, slice * (size_t)g->nz, ar, g->nz, e->f.astc_bw, e->f.astc_bh, e->f.astc_srgb, + done = vk_astc_record(cb, sb, slice * (size_t)g->nz, ar, g->nz, e->f.astc_bw, e->f.astc_bh, e->f.astc_srgb, e->f.astc_bc, e->pub.image, aspect, VK_NULL_HANDLE); perf_end(PERF_ASTC, a0); free(ar);