const uint STREAM_BUF_SIZE = 256; // In uint32s. 1 kB per stream ought to be enough for everyone :-)
const uint NUM_SYMS = 256;
const uint ESCAPE_LIMIT = NUM_SYMS - 1;
+const uint WIDTH_BLOCKS = 160; // TODO: send in as a uniform.
#define MAPPING(s0, s1, s2, s3, s4, s5, s6, s7) ((s0) | (s1 << 2) | (s2 << 4) | (s3 << 6) | (s4 << 8) | (s5 << 10) | (s6 << 12) | (s7 << 14))
for (uint subblock_idx = 0; subblock_idx < BLOCKS_PER_STREAM; ++subblock_idx) {
// TODO: Use SSBOs instead of a texture?
- uint x = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) % 160;
- uint y = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) / 160;
+ uint x = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) % WIDTH_BLOCKS;
+ uint y = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) / WIDTH_BLOCKS;
uint f = imageLoad(tex, ivec2(x, y * 8 + coeff_row)).x;
encode_coeff(sign_extend(f & 0x1ffu, 9), enc1);
for (uint subblock_idx = 0; subblock_idx < BLOCKS_PER_STREAM; ++subblock_idx) {
// TODO: Use SSBOs instead of a texture?
- uint x = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) % 160;
- uint y = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) / 160;
+ uint x = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) % WIDTH_BLOCKS;
+ uint y = (streamgroup_num * BLOCKS_PER_STREAM + subblock_idx) / WIDTH_BLOCKS;
int f = imageLoad(tex, ivec2(x, y * 8 + coeff_row)).x;
encode_coeff(f, enc);