Skip to content

Commit 10214dd

Browse files
past-duepull[bot]
authored andcommitted
gfx_api: Additional logging
1 parent c42004b commit 10214dd

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

lib/ivis_opengl/gfx_api.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,36 @@ gfx_api::texture* gfx_api::context::createTextureForCompatibleImageUploads(const
356356
return pTexture;
357357
}
358358

359+
const char* gfx_api::format_to_str(gfx_api::pixel_format format)
360+
{
361+
switch (format)
362+
{
363+
// UNCOMPRESSED FORMATS
364+
case gfx_api::pixel_format::FORMAT_RGBA8_UNORM_PACK8: return "RGBA8_UNORM";
365+
case gfx_api::pixel_format::FORMAT_BGRA8_UNORM_PACK8: return "BGRA8_UNORM";
366+
case gfx_api::pixel_format::FORMAT_RGB8_UNORM_PACK8: return "RGB8_UNORM";
367+
case gfx_api::pixel_format::FORMAT_RG8_UNORM: return "RG8_UNORM";
368+
case gfx_api::pixel_format::FORMAT_R8_UNORM: return "R8_UNORM";
369+
// COMPRESSED FORMAT
370+
case gfx_api::pixel_format::FORMAT_RGB_BC1_UNORM: return "RGB_BC1_UNORM";
371+
case gfx_api::pixel_format::FORMAT_RGBA_BC2_UNORM: return "RGBA_BC2_UNORM";
372+
case gfx_api::pixel_format::FORMAT_RGBA_BC3_UNORM: return "RGBA_BC3_UNORM";
373+
case gfx_api::pixel_format::FORMAT_R_BC4_UNORM: return "R_BC4_UNORM";
374+
case gfx_api::pixel_format::FORMAT_RG_BC5_UNORM: return "RG_BC5_UNORM";
375+
case gfx_api::pixel_format::FORMAT_RGBA_BPTC_UNORM: return "RGBA_BPTC_UNORM";
376+
case gfx_api::pixel_format::FORMAT_RGB8_ETC1: return "RGB8_ETC1";
377+
case gfx_api::pixel_format::FORMAT_RGB8_ETC2: return "RGB8_ETC2";
378+
case gfx_api::pixel_format::FORMAT_RGBA8_ETC2_EAC: return "RGBA8_ETC2_EAC";
379+
case gfx_api::pixel_format::FORMAT_R11_EAC: return "R11_EAC";
380+
case gfx_api::pixel_format::FORMAT_RG11_EAC: return "RG11_EAC";
381+
case gfx_api::pixel_format::FORMAT_ASTC_4x4_UNORM: return "ASTC_4x4_UNORM";
382+
default:
383+
debug(LOG_ERROR, "Unrecognised pixel format: %zu", static_cast<size_t>(format));
384+
return "";
385+
}
386+
return ""; // silence warning
387+
}
388+
359389
unsigned int gfx_api::format_channels(gfx_api::pixel_format format)
360390
{
361391
switch (format)

lib/ivis_opengl/gfx_api_formats_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ namespace gfx_api
7676
return false;
7777
}
7878

79+
const char* format_to_str(gfx_api::pixel_format format);
7980
unsigned int format_channels(gfx_api::pixel_format format);
8081
size_t format_memory_size(gfx_api::pixel_format format, size_t width, size_t height);
8182

lib/ivis_opengl/gfx_api_image_basis_priv.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ void gfx_api::initBasisTranscoder()
151151
for (size_t target_idx = 0; target_idx < gfx_api::PIXEL_FORMAT_TARGET_COUNT; target_idx++)
152152
{
153153
gfx_api::pixel_format_target target = static_cast<gfx_api::pixel_format_target>(target_idx);
154+
debug(LOG_3D, "Basis target compression formats [%zu]", target_idx);
154155
for ( auto format : qualityOrderRGBA )
155156
{
156157
if (!basisLibrarySupportsFormat(format))
@@ -163,6 +164,7 @@ void gfx_api::initBasisTranscoder()
163164
break;
164165
}
165166
}
167+
debug(LOG_3D, " * GameTextureRGBA: %s", (bestAvailableBasisCompressionFormat_GameTextureRGBA[target_idx].has_value()) ? gfx_api::format_to_str(bestAvailableBasisCompressionFormat_GameTextureRGBA[target_idx].value()) : "<none>");
166168
for ( auto format : qualityOrderRGB )
167169
{
168170
if (!basisLibrarySupportsFormat(format))
@@ -175,6 +177,7 @@ void gfx_api::initBasisTranscoder()
175177
break;
176178
}
177179
}
180+
debug(LOG_3D, " * GameTextureRGB: %s", (bestAvailableBasisCompressionFormat_GameTextureRGB[target_idx].has_value()) ? gfx_api::format_to_str(bestAvailableBasisCompressionFormat_GameTextureRGB[target_idx].value()) : "<none>");
178181

179182
// gfx_api::texture_type::alpha_mask: // a single-channel texture, containing the alpha values
180183
// gfx_api::texture_type::specular_map: // a single-channel texture, containing the specular / luma value
@@ -194,6 +197,8 @@ void gfx_api::initBasisTranscoder()
194197
break;
195198
}
196199
}
200+
debug(LOG_3D, " * AlphaMask: %s", (bestAvailableBasisCompressionFormat_AlphaMask[target_idx].has_value()) ? gfx_api::format_to_str(bestAvailableBasisCompressionFormat_AlphaMask[target_idx].value()) : "<none>");
201+
debug(LOG_3D, " * SpecularMap: %s", (bestAvailableBasisCompressionFormat_SpecularMap[target_idx].has_value()) ? gfx_api::format_to_str(bestAvailableBasisCompressionFormat_SpecularMap[target_idx].value()) : "<none>");
197202
}
198203
}
199204

lib/ivis_opengl/gfx_api_image_compress_priv.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ void gfx_api::initBestRealTimeCompressionFormats()
5757
for (size_t target_idx = 0; target_idx < gfx_api::PIXEL_FORMAT_TARGET_COUNT; target_idx++)
5858
{
5959
gfx_api::pixel_format_target target = static_cast<gfx_api::pixel_format_target>(target_idx);
60+
debug(LOG_3D, "Real-time compression formats [%zu]", target_idx);
6061
for ( auto format : qualityOrderRGBA )
6162
{
6263
if (!hasBuiltInRealTimeFormatCompressor(format))
@@ -69,6 +70,7 @@ void gfx_api::initBestRealTimeCompressionFormats()
6970
break;
7071
}
7172
}
73+
debug(LOG_3D, " * GameTextureRGBA: %s", (bestAvailableCompressionFormat_GameTextureRGBA[target_idx].has_value()) ? gfx_api::format_to_str(bestAvailableCompressionFormat_GameTextureRGBA[target_idx].value()) : "<none>");
7274
for ( auto format : qualityOrderRGB )
7375
{
7476
if (!hasBuiltInRealTimeFormatCompressor(format))
@@ -81,6 +83,7 @@ void gfx_api::initBestRealTimeCompressionFormats()
8183
break;
8284
}
8385
}
86+
debug(LOG_3D, " * GameTextureRGB: %s", (bestAvailableCompressionFormat_GameTextureRGB[target_idx].has_value()) ? gfx_api::format_to_str(bestAvailableCompressionFormat_GameTextureRGB[target_idx].value()) : "<none>");
8487
}
8588
}
8689

0 commit comments

Comments
 (0)