mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
PR feedback
This commit is contained in:
parent
bfe42215aa
commit
06ad461c32
8 changed files with 67 additions and 65 deletions
|
@ -1659,7 +1659,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
// The value will be 0 if the user blew away settings this session, which is both a feature and a bug.
|
// The value will be 0 if the user blew away settings this session, which is both a feature and a bug.
|
||||||
static const QString TESTER = "HIFI_TESTER";
|
static const QString TESTER = "HIFI_TESTER";
|
||||||
auto gpuIdent = GPUIdent::getInstance();
|
auto gpuIdent = GPUIdent::getInstance();
|
||||||
auto glContextData = getGLContextData();
|
auto glContextData = gl::ContextInfo::get();
|
||||||
QJsonObject properties = {
|
QJsonObject properties = {
|
||||||
{ "version", applicationVersion() },
|
{ "version", applicationVersion() },
|
||||||
{ "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) || isTester },
|
{ "tester", QProcessEnvironment::systemEnvironment().contains(TESTER) || isTester },
|
||||||
|
@ -1676,11 +1676,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
{ "gpu_name", gpuIdent->getName() },
|
{ "gpu_name", gpuIdent->getName() },
|
||||||
{ "gpu_driver", gpuIdent->getDriver() },
|
{ "gpu_driver", gpuIdent->getDriver() },
|
||||||
{ "gpu_memory", static_cast<qint64>(gpuIdent->getMemory()) },
|
{ "gpu_memory", static_cast<qint64>(gpuIdent->getMemory()) },
|
||||||
{ "gl_version_int", glVersionToInteger(glContextData.value("version").toString()) },
|
{ "gl_version_int", glVersionToInteger(glContextData.version.c_str()) },
|
||||||
{ "gl_version", glContextData["version"] },
|
{ "gl_version", glContextData.version.c_str() },
|
||||||
{ "gl_vender", glContextData["vendor"] },
|
{ "gl_vender", glContextData.vendor.c_str() },
|
||||||
{ "gl_sl_version", glContextData["sl_version"] },
|
{ "gl_sl_version", glContextData.shadingLanguageVersion.c_str() },
|
||||||
{ "gl_renderer", glContextData["renderer"] },
|
{ "gl_renderer", glContextData.renderer.c_str() },
|
||||||
{ "ideal_thread_count", QThread::idealThreadCount() }
|
{ "ideal_thread_count", QThread::idealThreadCount() }
|
||||||
};
|
};
|
||||||
auto macVersion = QSysInfo::macVersion();
|
auto macVersion = QSysInfo::macVersion();
|
||||||
|
@ -2282,8 +2282,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
properties["active_display_plugin"] = getActiveDisplayPlugin()->getName();
|
properties["active_display_plugin"] = getActiveDisplayPlugin()->getName();
|
||||||
properties["using_hmd"] = isHMDMode();
|
properties["using_hmd"] = isHMDMode();
|
||||||
|
|
||||||
auto glInfo = getGLContextData();
|
auto contextInfo = gl::ContextInfo::get();
|
||||||
properties["gl_info"] = glInfo;
|
properties["gl_info"] = QJsonObject{
|
||||||
|
{ "version", contextInfo.version.c_str() },
|
||||||
|
{ "sl_version", contextInfo.shadingLanguageVersion.c_str() },
|
||||||
|
{ "vendor", contextInfo.vendor.c_str() },
|
||||||
|
{ "renderer", contextInfo.renderer.c_str() },
|
||||||
|
};
|
||||||
properties["gpu_used_memory"] = (int)BYTES_TO_MB(gpu::Context::getUsedGPUMemSize());
|
properties["gpu_used_memory"] = (int)BYTES_TO_MB(gpu::Context::getUsedGPUMemSize());
|
||||||
properties["gpu_free_memory"] = (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemSize());
|
properties["gpu_free_memory"] = (int)BYTES_TO_MB(gpu::Context::getFreeGPUMemSize());
|
||||||
properties["gpu_frame_time"] = (float)(qApp->getGPUContext()->getFrameTimerGPUAverage());
|
properties["gpu_frame_time"] = (float)(qApp->getGPUContext()->getFrameTimerGPUAverage());
|
||||||
|
|
|
@ -304,21 +304,6 @@ int glVersionToInteger(QString glVersion) {
|
||||||
return (majorNumber << 16) | minorNumber;
|
return (majorNumber << 16) | minorNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QJsonObject& getGLContextData() {
|
|
||||||
static QJsonObject result;
|
|
||||||
static std::once_flag once;
|
|
||||||
std::call_once(once, [] {
|
|
||||||
auto contextInfo = gl::ContextInfo::get();
|
|
||||||
result = QJsonObject {
|
|
||||||
{ "version", contextInfo.version.c_str() },
|
|
||||||
{ "sl_version", contextInfo.shadingLanguageVersion.c_str() },
|
|
||||||
{ "vendor", contextInfo.vendor.c_str() },
|
|
||||||
{ "renderer", contextInfo.renderer.c_str() },
|
|
||||||
};
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QThread* RENDER_THREAD = nullptr;
|
QThread* RENDER_THREAD = nullptr;
|
||||||
|
|
||||||
bool isRenderThread() {
|
bool isRenderThread() {
|
||||||
|
|
|
@ -29,7 +29,6 @@ class QGLFormat;
|
||||||
size_t evalGLFormatSwapchainPixelSize(const QSurfaceFormat& format);
|
size_t evalGLFormatSwapchainPixelSize(const QSurfaceFormat& format);
|
||||||
|
|
||||||
const QSurfaceFormat& getDefaultOpenGLSurfaceFormat();
|
const QSurfaceFormat& getDefaultOpenGLSurfaceFormat();
|
||||||
const QJsonObject& getGLContextData();
|
|
||||||
int glVersionToInteger(QString glVersion);
|
int glVersionToInteger(QString glVersion);
|
||||||
|
|
||||||
bool isRenderThread();
|
bool isRenderThread();
|
||||||
|
|
|
@ -34,21 +34,21 @@ namespace platform { namespace keys{
|
||||||
extern const char* displays;
|
extern const char* displays;
|
||||||
extern const char* isMaster;
|
extern const char* isMaster;
|
||||||
}
|
}
|
||||||
namespace renderingApis {
|
namespace graphicsAPI {
|
||||||
|
extern const char* name;
|
||||||
|
extern const char* version;
|
||||||
extern const char* apiOpenGL;
|
extern const char* apiOpenGL;
|
||||||
extern const char* apiVulkan;
|
extern const char* apiVulkan;
|
||||||
extern const char* apiDirect3D11;
|
extern const char* apiDirect3D11;
|
||||||
extern const char* apiDirect3D12;
|
extern const char* apiDirect3D12;
|
||||||
extern const char* apiMetal;
|
extern const char* apiMetal;
|
||||||
namespace gl {
|
namespace gl {
|
||||||
extern const char* version;
|
|
||||||
extern const char* shadingLanguageVersion;
|
extern const char* shadingLanguageVersion;
|
||||||
extern const char* vendor;
|
extern const char* vendor;
|
||||||
extern const char* renderer;
|
extern const char* renderer;
|
||||||
extern const char* extensions;
|
extern const char* extensions;
|
||||||
}
|
}
|
||||||
namespace vk {
|
namespace vk {
|
||||||
extern const char* version;
|
|
||||||
extern const char* devices;
|
extern const char* devices;
|
||||||
namespace device {
|
namespace device {
|
||||||
extern const char* apiVersion;
|
extern const char* apiVersion;
|
||||||
|
@ -115,7 +115,7 @@ namespace platform { namespace keys{
|
||||||
// Keys for categories used in json returned by getAll()
|
// Keys for categories used in json returned by getAll()
|
||||||
extern const char* CPUS;
|
extern const char* CPUS;
|
||||||
extern const char* GPUS;
|
extern const char* GPUS;
|
||||||
extern const char* RENDERING_APIS;
|
extern const char* GRAPHICS_APIS;
|
||||||
extern const char* DISPLAYS;
|
extern const char* DISPLAYS;
|
||||||
extern const char* NICS;
|
extern const char* NICS;
|
||||||
extern const char* MEMORY;
|
extern const char* MEMORY;
|
||||||
|
|
|
@ -35,7 +35,10 @@ namespace platform { namespace keys {
|
||||||
const char* displays = "displays";
|
const char* displays = "displays";
|
||||||
const char* isMaster = "isMaster";
|
const char* isMaster = "isMaster";
|
||||||
}
|
}
|
||||||
namespace renderingApis {
|
namespace graphicsAPI {
|
||||||
|
const char* name = "name";
|
||||||
|
const char* version = "version";
|
||||||
|
|
||||||
const char* apiOpenGL = "OpenGL";
|
const char* apiOpenGL = "OpenGL";
|
||||||
const char* apiVulkan = "Vulkan";
|
const char* apiVulkan = "Vulkan";
|
||||||
const char* apiDirect3D11 = "D3D11";
|
const char* apiDirect3D11 = "D3D11";
|
||||||
|
@ -116,7 +119,7 @@ namespace platform { namespace keys {
|
||||||
|
|
||||||
const char* CPUS = "cpus";
|
const char* CPUS = "cpus";
|
||||||
const char* GPUS = "gpus";
|
const char* GPUS = "gpus";
|
||||||
const char* RENDERING_APIS = "renderingApis";
|
const char* GRAPHICS_APIS = "graphicsAPIS";
|
||||||
const char* DISPLAYS = "displays";
|
const char* DISPLAYS = "displays";
|
||||||
const char* NICS = "nics";
|
const char* NICS = "nics";
|
||||||
const char* MEMORY = "memory";
|
const char* MEMORY = "memory";
|
||||||
|
|
|
@ -127,12 +127,13 @@ void Instance::enumerateRenderingApis() {
|
||||||
{
|
{
|
||||||
auto& glContextInfo = gl::ContextInfo::get();
|
auto& glContextInfo = gl::ContextInfo::get();
|
||||||
json gl;
|
json gl;
|
||||||
gl[keys::renderingApis::gl::version] = glContextInfo.version;
|
gl[keys::graphicsAPI::name] = keys::graphicsAPI::apiOpenGL;
|
||||||
gl[keys::renderingApis::gl::vendor] = glContextInfo.vendor;
|
gl[keys::graphicsAPI::version] = glContextInfo.version;
|
||||||
gl[keys::renderingApis::gl::renderer] = glContextInfo.renderer;
|
gl[keys::graphicsAPI::gl::vendor] = glContextInfo.vendor;
|
||||||
gl[keys::renderingApis::gl::shadingLanguageVersion] = glContextInfo.shadingLanguageVersion;
|
gl[keys::graphicsAPI::gl::renderer] = glContextInfo.renderer;
|
||||||
gl[keys::renderingApis::gl::extensions] = glContextInfo.extensions;
|
gl[keys::graphicsAPI::gl::shadingLanguageVersion] = glContextInfo.shadingLanguageVersion;
|
||||||
_renderingApis[keys::renderingApis::apiOpenGL] = gl;
|
gl[keys::graphicsAPI::gl::extensions] = glContextInfo.extensions;
|
||||||
|
_graphicsApis.push_back(gl);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_VULKAN)
|
#if defined(HAVE_VULKAN)
|
||||||
|
@ -144,36 +145,37 @@ void Instance::enumerateRenderingApis() {
|
||||||
if (instancePtr) {
|
if (instancePtr) {
|
||||||
json vkinfo;
|
json vkinfo;
|
||||||
const auto& vkinstance = *instancePtr;
|
const auto& vkinstance = *instancePtr;
|
||||||
vkinfo[keys::renderingApis::vk::version] = vkVersionToString(VK_API_VERSION_1_1);
|
vkinfo[keys::graphicsAPI::name] = keys::graphicsAPI::apiVulkan;
|
||||||
|
vkinfo[keys::graphicsAPI::version] = vkVersionToString(VK_API_VERSION_1_1);
|
||||||
for (const auto& physicalDevice : vkinstance.enumeratePhysicalDevices()) {
|
for (const auto& physicalDevice : vkinstance.enumeratePhysicalDevices()) {
|
||||||
json vkdevice;
|
json vkdevice;
|
||||||
auto properties = physicalDevice.getProperties();
|
auto properties = physicalDevice.getProperties();
|
||||||
vkdevice[keys::renderingApis::vk::device::driverVersion] = vkVersionToString(properties.driverVersion);
|
vkdevice[keys::graphicsAPI::vk::device::driverVersion] = vkVersionToString(properties.driverVersion);
|
||||||
vkdevice[keys::renderingApis::vk::device::apiVersion] = vkVersionToString(properties.apiVersion);
|
vkdevice[keys::graphicsAPI::vk::device::apiVersion] = vkVersionToString(properties.apiVersion);
|
||||||
vkdevice[keys::renderingApis::vk::device::deviceType] = vk::to_string(properties.deviceType);
|
vkdevice[keys::graphicsAPI::vk::device::deviceType] = vk::to_string(properties.deviceType);
|
||||||
vkdevice[keys::renderingApis::vk::device::vendor] = properties.vendorID;
|
vkdevice[keys::graphicsAPI::vk::device::vendor] = properties.vendorID;
|
||||||
vkdevice[keys::renderingApis::vk::device::name] = properties.deviceName;
|
vkdevice[keys::graphicsAPI::vk::device::name] = properties.deviceName;
|
||||||
for (const auto& extensionProperties : physicalDevice.enumerateDeviceExtensionProperties()) {
|
for (const auto& extensionProperties : physicalDevice.enumerateDeviceExtensionProperties()) {
|
||||||
vkdevice[keys::renderingApis::vk::device::extensions].push_back(extensionProperties.extensionName);
|
vkdevice[keys::graphicsAPI::vk::device::extensions].push_back(extensionProperties.extensionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& queueFamilyProperties : physicalDevice.getQueueFamilyProperties()) {
|
for (const auto& queueFamilyProperties : physicalDevice.getQueueFamilyProperties()) {
|
||||||
json vkqueuefamily;
|
json vkqueuefamily;
|
||||||
vkqueuefamily[keys::renderingApis::vk::device::queue::flags] = vk::to_string(queueFamilyProperties.queueFlags);
|
vkqueuefamily[keys::graphicsAPI::vk::device::queue::flags] = vk::to_string(queueFamilyProperties.queueFlags);
|
||||||
vkqueuefamily[keys::renderingApis::vk::device::queue::count] = queueFamilyProperties.queueCount;
|
vkqueuefamily[keys::graphicsAPI::vk::device::queue::count] = queueFamilyProperties.queueCount;
|
||||||
vkdevice[keys::renderingApis::vk::device::queues].push_back(vkqueuefamily);
|
vkdevice[keys::graphicsAPI::vk::device::queues].push_back(vkqueuefamily);
|
||||||
}
|
}
|
||||||
auto memoryProperties = physicalDevice.getMemoryProperties();
|
auto memoryProperties = physicalDevice.getMemoryProperties();
|
||||||
for (uint32_t heapIndex = 0; heapIndex < memoryProperties.memoryHeapCount; ++heapIndex) {
|
for (uint32_t heapIndex = 0; heapIndex < memoryProperties.memoryHeapCount; ++heapIndex) {
|
||||||
json vkmemoryheap;
|
json vkmemoryheap;
|
||||||
const auto& heap = memoryProperties.memoryHeaps[heapIndex];
|
const auto& heap = memoryProperties.memoryHeaps[heapIndex];
|
||||||
vkmemoryheap[keys::renderingApis::vk::device::heap::flags] = vk::to_string(heap.flags);
|
vkmemoryheap[keys::graphicsAPI::vk::device::heap::flags] = vk::to_string(heap.flags);
|
||||||
vkmemoryheap[keys::renderingApis::vk::device::heap::size] = heap.size;
|
vkmemoryheap[keys::graphicsAPI::vk::device::heap::size] = heap.size;
|
||||||
vkdevice[keys::renderingApis::vk::device::heaps].push_back(vkmemoryheap);
|
vkdevice[keys::graphicsAPI::vk::device::heaps].push_back(vkmemoryheap);
|
||||||
}
|
}
|
||||||
vkinfo[keys::renderingApis::vk::devices].push_back(vkdevice);
|
vkinfo[keys::graphicsAPI::vk::devices].push_back(vkdevice);
|
||||||
}
|
}
|
||||||
_renderingApis[keys::renderingApis::apiVulkan] = vkinfo;
|
_graphicsApis.push_back(vkinfo);
|
||||||
}
|
}
|
||||||
} catch (const std::runtime_error&) {
|
} catch (const std::runtime_error&) {
|
||||||
}
|
}
|
||||||
|
@ -243,17 +245,13 @@ json Instance::listAllKeys() {
|
||||||
keys::gpu::driver,
|
keys::gpu::driver,
|
||||||
keys::gpu::displays,
|
keys::gpu::displays,
|
||||||
|
|
||||||
keys::renderingApis::apiOpenGL,
|
keys::graphicsAPI::version,
|
||||||
keys::renderingApis::apiVulkan,
|
keys::graphicsAPI::name,
|
||||||
keys::renderingApis::apiMetal,
|
|
||||||
keys::renderingApis::apiDirect3D11,
|
|
||||||
keys::renderingApis::apiDirect3D12,
|
|
||||||
|
|
||||||
keys::renderingApis::gl::version,
|
keys::graphicsAPI::gl::shadingLanguageVersion,
|
||||||
keys::renderingApis::gl::shadingLanguageVersion,
|
keys::graphicsAPI::gl::vendor,
|
||||||
keys::renderingApis::gl::vendor,
|
keys::graphicsAPI::gl::renderer,
|
||||||
keys::renderingApis::gl::renderer,
|
keys::graphicsAPI::gl::extensions,
|
||||||
keys::renderingApis::gl::extensions,
|
|
||||||
|
|
||||||
keys::display::boundsLeft,
|
keys::display::boundsLeft,
|
||||||
keys::display::boundsRight,
|
keys::display::boundsRight,
|
||||||
|
@ -276,7 +274,7 @@ json Instance::listAllKeys() {
|
||||||
|
|
||||||
keys::CPUS,
|
keys::CPUS,
|
||||||
keys::GPUS,
|
keys::GPUS,
|
||||||
keys::RENDERING_APIS,
|
keys::GRAPHICS_APIS,
|
||||||
keys::DISPLAYS,
|
keys::DISPLAYS,
|
||||||
keys::MEMORY,
|
keys::MEMORY,
|
||||||
keys::COMPUTER,
|
keys::COMPUTER,
|
||||||
|
@ -308,7 +306,7 @@ json Instance::getAll() {
|
||||||
all[keys::MEMORY] = _memory;
|
all[keys::MEMORY] = _memory;
|
||||||
all[keys::CPUS] = _cpus;
|
all[keys::CPUS] = _cpus;
|
||||||
all[keys::GPUS] = _gpus;
|
all[keys::GPUS] = _gpus;
|
||||||
all[keys::RENDERING_APIS] = _renderingApis;
|
all[keys::GRAPHICS_APIS] = _graphicsApis;
|
||||||
all[keys::DISPLAYS] = _displays;
|
all[keys::DISPLAYS] = _displays;
|
||||||
all[keys::NICS] = _nics;
|
all[keys::NICS] = _nics;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
||||||
std::vector<json> _gpus;
|
std::vector<json> _gpus;
|
||||||
std::vector<json> _displays;
|
std::vector<json> _displays;
|
||||||
std::vector<json> _nics;
|
std::vector<json> _nics;
|
||||||
json _renderingApis;
|
json _graphicsApis;
|
||||||
json _memory;
|
json _memory;
|
||||||
json _computer;
|
json _computer;
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,19 @@ void OffscreenQmlSurface::initializeEngine(QQmlEngine* engine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto rootContext = engine->rootContext();
|
auto rootContext = engine->rootContext();
|
||||||
rootContext->setContextProperty("GL", ::getGLContextData());
|
|
||||||
|
static QJsonObject QML_GL_INFO;
|
||||||
|
static std::once_flag once_gl_info;
|
||||||
|
std::call_once(once_gl_info, [] {
|
||||||
|
const auto& contextInfo = gl::ContextInfo::get();
|
||||||
|
QML_GL_INFO = QJsonObject {
|
||||||
|
{ "version", contextInfo.version.c_str() },
|
||||||
|
{ "sl_version", contextInfo.shadingLanguageVersion.c_str() },
|
||||||
|
{ "vendor", contextInfo.vendor.c_str() },
|
||||||
|
{ "renderer", contextInfo.renderer.c_str() },
|
||||||
|
};
|
||||||
|
});
|
||||||
|
rootContext->setContextProperty("GL", QML_GL_INFO);
|
||||||
rootContext->setContextProperty("urlHandler", new UrlHandler(rootContext));
|
rootContext->setContextProperty("urlHandler", new UrlHandler(rootContext));
|
||||||
rootContext->setContextProperty("resourceDirectoryUrl", QUrl::fromLocalFile(PathUtils::resourcesPath()));
|
rootContext->setContextProperty("resourceDirectoryUrl", QUrl::fromLocalFile(PathUtils::resourcesPath()));
|
||||||
rootContext->setContextProperty("ApplicationInterface", qApp);
|
rootContext->setContextProperty("ApplicationInterface", qApp);
|
||||||
|
|
Loading…
Reference in a new issue