OpenGL: Print more debug info at init time

This commit is contained in:
sfan5 2024-02-21 18:58:42 +01:00
parent 602a4050b5
commit 9f2d13a2b6
4 changed files with 32 additions and 8 deletions

View File

@ -205,7 +205,7 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
// print renderer information
VendorName = GL.GetString(GL_VENDOR);
os::Printer::log(VendorName.c_str(), ELL_INFORMATION);
os::Printer::log("Vendor", VendorName.c_str(), ELL_INFORMATION);
Version = getVersionFromOpenGL();
}
@ -222,6 +222,7 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
{
initVersion();
initFeatures();
printTextureFormats();
// reset cache handler
delete CacheHandler;
@ -276,6 +277,22 @@ COpenGL3DriverBase::~COpenGL3DriverBase()
return true;
}
void COpenGL3DriverBase::printTextureFormats()
{
char buf[128];
for (u32 i = 0; i < static_cast<u32>(ECF_UNKNOWN); i++) {
auto &info = TextureFormats[i];
if (!info.InternalFormat) {
snprintf_irr(buf, sizeof(buf), "%s -> unsupported", ColorFormatNames[i]);
} else {
snprintf_irr(buf, sizeof(buf), "%s -> %#06x %#06x %#06x%s",
ColorFormatNames[i], info.InternalFormat, info.PixelFormat,
info.PixelType, info.Converter ? " (c)" : "");
}
os::Printer::log(buf, ELL_DEBUG);
}
}
void COpenGL3DriverBase::loadShaderData(const io::path& vertexShaderName, const io::path& fragmentShaderName, c8** vertexShaderData, c8** fragmentShaderData)
{
io::path vsPath(OGLES2ShaderPath);

View File

@ -272,7 +272,6 @@ namespace video
COpenGL3CacheHandler* getCacheHandler() const;
protected:
//! inits the opengl-es driver
virtual bool genericDriverInit(const core::dimension2d<u32>& screenSize, bool stencilBuffer);
void initVersion();
@ -391,6 +390,8 @@ private:
IContextManager* ContextManager;
void printTextureFormats();
void addDummyMaterial(E_MATERIAL_TYPE type);
unsigned QuadIndexCount;

View File

@ -9,8 +9,11 @@
#include "irrString.h"
#include "SMaterial.h"
#include "fast_atof.h"
#include "os.h"
#include <mt_opengl.h>
// FIXME: this basically duplicates what mt_opengl.h already does
namespace irr
{
namespace video
@ -24,7 +27,7 @@ namespace video
pos = next + 1;
}
addExtension(pos);
updateLegacyExtensionList();
extensionsLoaded();
}
void COpenGL3ExtensionHandler::initExtensionsNew()
@ -32,10 +35,10 @@ namespace video
int ext_count = GetInteger(GL_NUM_EXTENSIONS);
for (int k = 0; k < ext_count; k++)
addExtension(reinterpret_cast<const char *>(GL.GetStringi(GL_EXTENSIONS, k)));
updateLegacyExtensionList();
extensionsLoaded();
}
void COpenGL3ExtensionHandler::addExtension(std::string name) {
void COpenGL3ExtensionHandler::addExtension(std::string &&name) {
Extensions.emplace(std::move(name));
}
@ -43,7 +46,10 @@ namespace video
return Extensions.find(name) != Extensions.end();
}
void COpenGL3ExtensionHandler::updateLegacyExtensionList() {
void COpenGL3ExtensionHandler::extensionsLoaded() {
os::Printer::log((std::string("Loaded ") + std::to_string(Extensions.size()) + " extensions:").c_str(), ELL_DEBUG);
for (const auto &it : Extensions)
os::Printer::log((std::string(" ") + it).c_str(), ELL_DEBUG);
for (size_t j = 0; j < IRR_OGLES_Feature_Count; ++j)
FeatureAvailable[j] = queryExtension(getFeatureString(j));
}

View File

@ -159,8 +159,8 @@ namespace video
bool BlendMinMaxSupported = false;
private:
void addExtension(std::string name);
void updateLegacyExtensionList();
void addExtension(std::string &&name);
void extensionsLoaded();
std::unordered_set<std::string> Extensions;
};