Skip to content

Commit 98356da

Browse files
committed
Improve debug logs for search failures
1 parent 898a7a1 commit 98356da

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

Source/astcenc_weight_align.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ static const unsigned int quantization_steps_for_level[13] {
6565
alignas(ASTCENC_VECALIGN) static float sin_table[SINCOS_STEPS][ANGULAR_STEPS];
6666
alignas(ASTCENC_VECALIGN) static float cos_table[SINCOS_STEPS][ANGULAR_STEPS];
6767

68+
#if !defined(NDEBUG)
69+
static bool print_once { true };
70+
#endif
71+
6872
/* See header for documentation. */
6973
void prepare_angular_tables()
7074
{
@@ -327,9 +331,10 @@ static void compute_angular_endpoints_for_quant_levels(
327331

328332
// Did we find anything?
329333
#if !defined(NDEBUG)
330-
if (bsi < 0)
334+
if ((bsi < 0) && print_once)
331335
{
332-
printf("WARNING: Unable to find encoding within specified error limit\n");
336+
print_once = false;
337+
printf("WARNING: Unable to find full encoding within search error limit\n\n");
333338
}
334339
#endif
335340

@@ -491,9 +496,10 @@ static void compute_angular_endpoints_for_quant_levels_lwc(
491496

492497
// Did we find anything?
493498
#if !defined(NDEBUG)
494-
if (bsi < 0)
499+
if ((bsi < 0) && print_once)
495500
{
496-
printf("WARNING: Unable to find encoding within specified error limit\n");
501+
print_once = false;
502+
printf("WARNING: Unable to find low weight encoding within search error limit\n\n");
497503
}
498504
#endif
499505

0 commit comments

Comments
 (0)