1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge branch 'which-gpu-are-you' into 'master'

Log OpenGL Vendor, Renderer and Version on startup

See merge request OpenMW/openmw!1482
This commit is contained in:
psi29a 2021-12-16 08:02:24 +00:00
commit cc97c4450a
3 changed files with 48 additions and 1 deletions

View File

@ -43,6 +43,7 @@
#include <components/sceneutil/screencapture.hpp>
#include <components/sceneutil/depth.hpp>
#include <components/sceneutil/util.hpp>
#include "mwinput/inputmanagerimp.hpp"
@ -239,6 +240,20 @@ namespace
{
void operator()(std::string) const {}
};
class IdentifyOpenGLOperation : public osg::GraphicsOperation
{
public:
IdentifyOpenGLOperation() : GraphicsOperation("IdentifyOpenGLOperation", false)
{}
void operator()(osg::GraphicsContext* graphicsContext) override
{
Log(Debug::Info) << "OpenGL Vendor: " << glGetString(GL_VENDOR);
Log(Debug::Info) << "OpenGL Renderer: " << glGetString(GL_RENDERER);
Log(Debug::Info) << "OpenGL Version: " << glGetString(GL_VERSION);
}
};
}
void OMW::Engine::executeLocalScripts()
@ -643,8 +658,12 @@ void OMW::Engine::createWindow(Settings::Manager& settings)
camera->setGraphicsContext(graphicsWindow);
camera->setViewport(0, 0, graphicsWindow->getTraits()->width, graphicsWindow->getTraits()->height);
osg::ref_ptr<SceneUtil::OperationSequence> realizeOperations = new SceneUtil::OperationSequence(false);
mViewer->setRealizeOperation(realizeOperations);
realizeOperations->add(new IdentifyOpenGLOperation());
if (Debug::shouldDebugOpenGL())
mViewer->setRealizeOperation(new Debug::EnableGLDebugOperation());
realizeOperations->add(new Debug::EnableGLDebugOperation());
mViewer->realize();

View File

@ -317,4 +317,20 @@ bool attachAlphaToCoverageFriendlyFramebufferToCamera(osg::Camera* camera, osg::
return addMSAAIntermediateTarget;
}
OperationSequence::OperationSequence(bool keep)
: Operation("OperationSequence", keep)
, mOperationQueue(new osg::OperationQueue())
{
}
void OperationSequence::operator()(osg::Object* object)
{
mOperationQueue->runOperations(object);
}
void OperationSequence::add(osg::Operation* operation)
{
mOperationQueue->add(operation);
}
}

View File

@ -63,6 +63,18 @@ namespace SceneUtil
// Alpha-to-coverage requires a multisampled framebuffer, so we need to set that up for RTTs
bool attachAlphaToCoverageFriendlyFramebufferToCamera(osg::Camera* camera, osg::Camera::BufferComponent buffer, osg::Texture* texture, unsigned int level = 0, unsigned int face = 0, bool mipMapGeneration = false);
class OperationSequence : public osg::Operation
{
public:
OperationSequence(bool keep);
void operator()(osg::Object* object) override;
void add(osg::Operation* operation);
protected:
osg::ref_ptr<osg::OperationQueue> mOperationQueue;
};
}
#endif