| 3410 | } |
| 3411 | |
| 3412 | void basisu_frontend::dump_debug_image(const char *pFilename, uint32_t first_block, uint32_t num_blocks_x, uint32_t num_blocks_y, bool output_blocks) |
| 3413 | { |
| 3414 | gpu_image g; |
| 3415 | g.init(texture_format::cETC1, num_blocks_x * 4, num_blocks_y * 4); |
| 3416 | |
| 3417 | for (uint32_t y = 0; y < num_blocks_y; y++) |
| 3418 | { |
| 3419 | for (uint32_t x = 0; x < num_blocks_x; x++) |
| 3420 | { |
| 3421 | const uint32_t block_index = first_block + x + y * num_blocks_x; |
| 3422 | |
| 3423 | etc_block &blk = *(etc_block *)g.get_block_ptr(x, y); |
| 3424 | |
| 3425 | if (output_blocks) |
| 3426 | blk = get_output_block(block_index); |
| 3427 | else |
| 3428 | { |
| 3429 | const bool diff_flag = get_diff_flag(block_index); |
| 3430 | |
| 3431 | blk.set_diff_bit(diff_flag); |
| 3432 | blk.set_flip_bit(true); |
| 3433 | |
| 3434 | const uint32_t endpoint_cluster0_index = get_subblock_endpoint_cluster_index(block_index, 0); |
| 3435 | const uint32_t endpoint_cluster1_index = get_subblock_endpoint_cluster_index(block_index, 1); |
| 3436 | |
| 3437 | if (diff_flag) |
| 3438 | blk.set_block_color5(get_endpoint_cluster_unscaled_color(endpoint_cluster0_index, false), get_endpoint_cluster_unscaled_color(endpoint_cluster1_index, false)); |
| 3439 | else |
| 3440 | blk.set_block_color4(get_endpoint_cluster_unscaled_color(endpoint_cluster0_index, true), get_endpoint_cluster_unscaled_color(endpoint_cluster1_index, true)); |
| 3441 | |
| 3442 | blk.set_inten_table(0, get_endpoint_cluster_inten_table(endpoint_cluster0_index, !diff_flag)); |
| 3443 | blk.set_inten_table(1, get_endpoint_cluster_inten_table(endpoint_cluster1_index, !diff_flag)); |
| 3444 | |
| 3445 | const uint32_t selector_cluster_index = get_block_selector_cluster_index(block_index); |
| 3446 | blk.set_raw_selector_bits(get_selector_cluster_selector_bits(selector_cluster_index).get_raw_selector_bits()); |
| 3447 | } |
| 3448 | } |
| 3449 | } |
| 3450 | |
| 3451 | image img; |
| 3452 | g.unpack(img); |
| 3453 | |
| 3454 | save_png(pFilename, img); |
| 3455 | } |
| 3456 | |
| 3457 | } // namespace basisu |
| 3458 |
no test coverage detected