MCPcopy Create free account
hub / github.com/defold/defold / dump_debug_image

Method dump_debug_image

engine/dlib/src/basis/encoder/basisu_frontend.cpp:3416–3459  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

process_frontendMethod · 0.80

Calls 11

get_block_ptrMethod · 0.80
unpackMethod · 0.80
save_pngFunction · 0.70
initMethod · 0.65
set_diff_bitMethod · 0.45
set_flip_bitMethod · 0.45
set_block_color5Method · 0.45
set_block_color4Method · 0.45
set_inten_tableMethod · 0.45
set_raw_selector_bitsMethod · 0.45
get_raw_selector_bitsMethod · 0.45

Tested by

no test coverage detected