Merge And Modifying the Graphics settings and the dev menu

This commit is contained in:
Sam Gateau 2019-06-20 17:48:36 -07:00
commit 22cd631a04
33 changed files with 319 additions and 241 deletions

View file

@ -8539,23 +8539,7 @@ void Application::shareSnapshot(const QString& path, const QUrl& href) {
}
float Application::getRenderResolutionScale() const {
auto menu = Menu::getInstance();
if (!menu) {
return 1.0f;
}
if (menu->isOptionChecked(MenuOption::RenderResolutionOne)) {
return 1.0f;
} else if (menu->isOptionChecked(MenuOption::RenderResolutionTwoThird)) {
return 0.666f;
} else if (menu->isOptionChecked(MenuOption::RenderResolutionHalf)) {
return 0.5f;
} else if (menu->isOptionChecked(MenuOption::RenderResolutionThird)) {
return 0.333f;
} else if (menu->isOptionChecked(MenuOption::RenderResolutionQuarter)) {
return 0.25f;
} else {
return 1.0f;
}
return 1.0f;
}
void Application::notifyPacketVersionMismatch() {

View file

@ -382,28 +382,6 @@ Menu::Menu() {
// Developer > Render > OpenVR threaded submit
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::OpenVrThreadedSubmit, 0, true);
// Developer > Render > Resolution
MenuWrapper* resolutionMenu = renderOptionsMenu->addMenu(MenuOption::RenderResolution);
QActionGroup* resolutionGroup = new QActionGroup(resolutionMenu);
resolutionGroup->setExclusive(true);
#if defined(Q_OS_MAC)
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionOne, 0, false));
#else
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionOne, 0, true));
#endif
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionTwoThird, 0, false));
#if defined(Q_OS_MAC)
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionHalf, 0, true));
#else
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionHalf, 0, false));
#endif
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionThird, 0, false));
resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionQuarter, 0, false));
//const QString = "Automatic Texture Memory";
//const QString = "64 MB";
//const QString = "256 MB";

View file

@ -168,12 +168,6 @@ namespace MenuOption {
const QString RenderMaxTexture4096MB = "4096 MB";
const QString RenderMaxTexture6144MB = "6144 MB";
const QString RenderMaxTexture8192MB = "8192 MB";
const QString RenderResolution = "Scale Resolution";
const QString RenderResolutionOne = "1";
const QString RenderResolutionTwoThird = "2/3";
const QString RenderResolutionHalf = "1/2";
const QString RenderResolutionThird = "1/3";
const QString RenderResolutionQuarter = "1/4";
const QString RenderSensorToWorldMatrix = "Show SensorToWorld Matrix";
const QString RenderIKTargets = "Show IK Targets";
const QString RenderIKConstraints = "Show IK Constraints";

View file

@ -192,7 +192,7 @@ QString PlatformInfoScriptingInterface::getDisplay(int index) {
}
QString PlatformInfoScriptingInterface::getMemory() {
auto desc = platform::getMemory(0);
auto desc = platform::getMemory();
return QString(desc.dump().c_str());
}
@ -201,6 +201,10 @@ QString PlatformInfoScriptingInterface::getComputer() {
return QString(desc.dump().c_str());
}
QString PlatformInfoScriptingInterface::getPlatform() {
auto desc = platform::getAll();
return QString(desc.dump().c_str());
}
PlatformInfoScriptingInterface::PlatformTier PlatformInfoScriptingInterface::getTierProfiled() {
return (PlatformInfoScriptingInterface::PlatformTier) platform::Profiler::profilePlatform();

View file

@ -51,6 +51,8 @@ public slots:
* Gets the operating system type.
* @function PlatformInfo.getOperatingSystemType
* @returns {string} <code>"WINDOWS"</code>, <code>"MACOS"</code>, or <code>"UNKNOWN"</code>.
* @deprecated This function is deprecated and will be removed.
* use getComputer()["OS"] instead
*/
QString getOperatingSystemType();
@ -61,6 +63,10 @@ public slots:
* @example <caption>Report the CPU being used.</caption>
* print("CPU: " + PlatformInfo.getCPUBrand());
* // Example: Intel(R) Core(TM) i7-7820HK CPU @ 2.90GHz
* @deprecated This function is deprecated and will be removed.
* use getNumCPUs() to know the number of CPUs in the hardware, at least one is expected
* use getCPU(0)["vendor"] to get the brand of the vendor
* use getCPU(0)["model"] to get the model name of the cpu
*/
QString getCPUBrand();
@ -68,6 +74,8 @@ public slots:
* Gets the number of logical CPU cores.
* @function PlatformInfo.getNumLogicalCores
* @returns {number} The number of logical CPU cores.
* @deprecated This function is deprecated and will be removed.
* use getCPU(0)["numCores"] instead
*/
unsigned int getNumLogicalCores();
@ -75,6 +83,8 @@ public slots:
* Returns the total system memory in megabytes.
* @function PlatformInfo.getTotalSystemMemoryMB
* @returns {number} The total system memory in megabytes.
* @deprecated This function is deprecated and will be removed.
* use getMemory()["memTotal"] instead
*/
int getTotalSystemMemoryMB();
@ -82,6 +92,10 @@ public slots:
* Gets the graphics card type.
* @function PlatformInfo.getGraphicsCardType
* @returns {string} The graphics card type.
* @deprecated This function is deprecated and will be removed.
* use getNumGPUs() to know the number of GPUs in the hardware, at least one is expected
* use getGPU(0)["vendor"] to get the brand of the vendor
* use getGPU(0)["model"] to get the model name of the gpu
*/
QString getGraphicsCardType();
@ -141,7 +155,7 @@ public slots:
/**jsdoc
* Get the description of the GPU at the index parameter
* expected fields are:
* - gpuVendor...
* - vendor, model...
* @param index The index of the GPU of the platform
* @function PlatformInfo.getGPU
* @returns {string} The GPU description json field
@ -183,6 +197,14 @@ public slots:
*/
QString getComputer();
/**jsdoc
* Get the complete description of the Platform as an aggregated Json
* The expected object description is:
* { "computer": {...}, "memory": {...}, "cpus": [{...}, ...], "gpus": [{...}, ...], "displays": [{...}, ...] }
* @function PlatformInfo.getPlatform
* @returns {string} The Platform description json field
*/
QString getPlatform();
/**jsdoc
* Get the Platform TIer profiled on startup of the Computer

View file

@ -14,10 +14,9 @@
#include <ScriptEngines.h>
#include <OffscreenUi.h>
#include <Preferences.h>
#include <RenderShadowTask.h>
#include <plugins/PluginUtils.h>
#include <display-plugins/CompositorHelper.h>
#include "scripting/RenderScriptingInterface.h"
#include "Application.h"
#include "DialogsManager.h"
#include "LODManager.h"
@ -103,6 +102,22 @@ void setupPreferences() {
preference->setItems(refreshRateProfiles);
preferences->addPreference(preference);
}
{
// Expose the Viewport Resolution Scale
auto getter = []()->float {
return RenderScriptingInterface::getInstance()->getViewportResolutionScale();
};
auto setter = [](float value) {
RenderScriptingInterface::getInstance()->setViewportResolutionScale(value);
};
auto scaleSlider = new SpinnerSliderPreference(GRAPHICS_QUALITY, "Viewport Resolution Scale", getter, setter);
scaleSlider->setMin(0.5f);
scaleSlider->setMax(1.0f);
scaleSlider->setStep(0.02f);
preferences->addPreference(scaleSlider);
}
// UI
static const QString UI_CATEGORY { "User Interface" };

View file

@ -112,15 +112,17 @@ bool Basic2DWindowOpenGLDisplayPlugin::internalActivate() {
gpu::PipelinePointer Basic2DWindowOpenGLDisplayPlugin::getCompositeScenePipeline() {
#if defined(Q_OS_ANDROID)
return _linearToSRGBPipeline;
#endif
#else
return _SRGBToLinearPipeline;
#endif
}
gpu::Element Basic2DWindowOpenGLDisplayPlugin::getCompositeFBColorSpace() {
#if defined(Q_OS_ANDROID)
return gpu::Element::COLOR_SRGBA_32;
#endif
#else
return gpu::Element::COLOR_RGBA_32;
#endif
}

View file

@ -593,9 +593,10 @@ std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> OpenGL
hudEyeViewports[eye] = eyeViewport(eye);
});
return [=](gpu::Batch& batch, const gpu::TexturePointer& hudTexture, bool mirror) {
if (hudPipeline && hudTexture) {
auto pipeline = mirror ? hudMirrorPipeline : hudPipeline;
if (pipeline && hudTexture) {
batch.enableStereo(false);
batch.setPipeline(mirror ? hudMirrorPipeline : hudPipeline);
batch.setPipeline(pipeline);
batch.setResourceTexture(0, hudTexture);
if (hudStereo) {
for_each_eye([&](Eye eye) {
@ -661,17 +662,6 @@ void OpenGLDisplayPlugin::compositeLayers() {
compositeScene();
}
#ifdef HIFI_ENABLE_NSIGHT_DEBUG
if (false) // do not draw the HUD if running nsight debug
#endif
{
PROFILE_RANGE_EX(render_detail, "handleHUDBatch", 0xff0077ff, (uint64_t)presentCount())
auto hudOperator = getHUDOperator();
withPresentThreadLock([&] {
_hudOperator = hudOperator;
});
}
{
PROFILE_RANGE_EX(render_detail, "compositeExtra", 0xff0077ff, (uint64_t)presentCount())
compositeExtra();

View file

@ -86,6 +86,8 @@ public:
void copyTextureToQuickFramebuffer(NetworkTexturePointer source, QOpenGLFramebufferObject* target, GLsync* fenceSync) override;
virtual std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator() override;
protected:
friend class PresentThread;
@ -102,7 +104,6 @@ protected:
virtual QThread::Priority getPresentPriority() { return QThread::HighPriority; }
virtual void compositeLayers();
virtual void compositeScene();
virtual std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator();
virtual void compositePointer();
virtual void compositeExtra() {};

View file

@ -1,4 +1,4 @@
//
//
// Created by Bradley Austin Davis on 2016/02/15
// Copyright 2016 High Fidelity, Inc.
//
@ -402,25 +402,18 @@ void HmdDisplayPlugin::HUDRenderer::build() {
format->setAttribute(gpu::Stream::POSITION, gpu::Stream::POSITION, gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::XYZ), 0);
format->setAttribute(gpu::Stream::TEXCOORD, gpu::Stream::TEXCOORD, gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::UV));
uniformsBuffer = std::make_shared<gpu::Buffer>(sizeof(Uniforms), nullptr);
updatePipeline();
auto program = gpu::Shader::createProgram(shader::render_utils::program::hmd_ui);
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
state->setDepthTest(gpu::State::DepthTest(true, true, gpu::LESS_EQUAL));
state->setBlendFunction(true,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
pipeline = gpu::Pipeline::create(program, state);
}
void HmdDisplayPlugin::HUDRenderer::updatePipeline() {
if (!pipeline) {
auto program = gpu::Shader::createProgram(shader::render_utils::program::hmd_ui);
gpu::StatePointer state = gpu::StatePointer(new gpu::State());
state->setDepthTest(gpu::State::DepthTest(true, true, gpu::LESS_EQUAL));
state->setBlendFunction(true,
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
pipeline = gpu::Pipeline::create(program, state);
}
}
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> HmdDisplayPlugin::HUDRenderer::render(HmdDisplayPlugin& plugin) {
updatePipeline();
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> HmdDisplayPlugin::HUDRenderer::render() {
auto hudPipeline = pipeline;
auto hudFormat = format;
auto hudVertices = vertices;
@ -479,7 +472,7 @@ void HmdDisplayPlugin::compositePointer() {
}
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> HmdDisplayPlugin::getHUDOperator() {
return _hudRenderer.render(*this);
return _hudRenderer.render();
}
HmdDisplayPlugin::~HmdDisplayPlugin() {

View file

@ -48,6 +48,7 @@ public:
void pluginUpdate() override {};
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator() override;
virtual StencilMaskMode getStencilMaskMode() const override { return StencilMaskMode::PAINT; }
signals:
@ -62,7 +63,6 @@ protected:
bool internalActivate() override;
void internalDeactivate() override;
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator() override;
void compositePointer() override;
void internalPresent() override;
void customizeContext() override;
@ -105,7 +105,7 @@ private:
gpu::BufferPointer vertices;
gpu::BufferPointer indices;
uint32_t indexCount { 0 };
gpu::PipelinePointer pipeline;
gpu::PipelinePointer pipeline { nullptr };
gpu::BufferPointer uniformsBuffer;
@ -123,7 +123,6 @@ private:
static const int VERTEX_STRIDE { sizeof(Vertex) };
void build();
void updatePipeline();
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> render(HmdDisplayPlugin& plugin);
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> render();
} _hudRenderer;
};

View file

@ -309,20 +309,28 @@ void PhysicalEntitySimulation::buildMotionStatesForEntitiesThatNeedThem() {
SetOfEntities::iterator entityItr = _entitiesToAddToPhysics.begin();
while (entityItr != _entitiesToAddToPhysics.end()) {
EntityItemPointer entity = (*entityItr);
assert(!entity->getPhysicsInfo());
if (entity->isDead()) {
prepareEntityForDelete(entity);
entityItr = _entitiesToAddToPhysics.erase(entityItr);
} else if (!entity->shouldBePhysical()) {
// this entity should no longer be on _entitiesToAddToPhysics
continue;
}
if (entity->getPhysicsInfo()) {
entityItr = _entitiesToAddToPhysics.erase(entityItr);
continue;
}
if (!entity->shouldBePhysical()) {
// this entity should no longer be on _entitiesToAddToPhysics
if (entity->isMovingRelativeToParent()) {
SetOfEntities::iterator itr = _simpleKinematicEntities.find(entity);
if (itr == _simpleKinematicEntities.end()) {
_simpleKinematicEntities.insert(entity);
}
}
} else if (entity->isReadyToComputeShape()) {
entityItr = _entitiesToAddToPhysics.erase(entityItr);
continue;
}
if (entity->isReadyToComputeShape()) {
ShapeRequest shapeRequest(entity);
ShapeRequests::iterator requestItr = _shapeRequests.find(shapeRequest);
if (requestItr == _shapeRequests.end()) {
@ -332,18 +340,7 @@ void PhysicalEntitySimulation::buildMotionStatesForEntitiesThatNeedThem() {
uint32_t requestCount = ObjectMotionState::getShapeManager()->getWorkRequestCount();
btCollisionShape* shape = const_cast<btCollisionShape*>(ObjectMotionState::getShapeManager()->getShape(shapeInfo));
if (shape) {
EntityMotionState* motionState = static_cast<EntityMotionState*>(entity->getPhysicsInfo());
if (!motionState) {
buildMotionState(shape, entity);
} else {
// Is it possible to fall in here?
// entity shouldn't be on _entitiesToAddToPhysics list if it already has a motionState.
// but just in case...
motionState->setShape(shape);
motionState->setRegion(_space->getRegion(entity->getSpaceIndex()));
_physicalObjects.insert(motionState);
_incomingChanges.insert(motionState);
}
buildMotionState(shape, entity);
} else if (requestCount != ObjectMotionState::getShapeManager()->getWorkRequestCount()) {
// shape doesn't exist but a new worker has been spawned to build it --> add to shapeRequests and wait
shapeRequest.shapeHash = shapeInfo.getHash();
@ -354,6 +351,7 @@ void PhysicalEntitySimulation::buildMotionStatesForEntitiesThatNeedThem() {
}
entityItr = _entitiesToAddToPhysics.erase(entityItr);
} else {
// skip for later
++entityItr;
}
}

View file

@ -181,7 +181,7 @@ void ThreadSafeDynamicsWorld::drawConnectedSpheres(btIDebugDraw* drawer, btScala
btVector3 xAxis = direction.cross(btVector3(0.0f, 1.0f, 0.0f));
xAxis = xAxis.length() < EPSILON ? btVector3(1.0f, 0.0f, 0.0f) : xAxis.normalize();
btVector3 zAxis = xAxis.cross(btVector3(0.0f, 1.0f, 0.0f));
zAxis = (direction.normalize().getY() < EPSILON) ? btVector3(0.0f, 1.0f, 0.0f) : zAxis.normalize();
zAxis = (direction.length2() < EPSILON || direction.normalize().getY() < EPSILON) ? btVector3(0.0f, 1.0f, 0.0f) : zAxis.normalize();
float fullCircle = 2.0f * PI;
for (float i = 0; i < fullCircle; i += stepRadians) {
float x1 = btSin(btScalar(i)) * radius1;

View file

@ -27,12 +27,13 @@ json getGPU(int index);
int getNumDisplays();
json getDisplay(int index);
int getNumMemories();
json getMemory(int index);
json getMemory();
json getComputer();
json getAll();
} // namespace platform
#endif // hifi_platform_h

View file

@ -9,6 +9,9 @@
#define hifi_platform_PlatformKeys_h
namespace platform { namespace keys{
// "UNKNOWN"
extern const char* UNKNOWN;
namespace cpu {
extern const char* vendor;
extern const char* vendor_Intel;
@ -36,8 +39,9 @@ namespace platform { namespace keys{
extern const char* coordsTop;
extern const char* coordsBottom;
}
namespace memory {
extern const char* memTotal;
}
namespace computer {
extern const char* OS;
extern const char* OS_WINDOWS;
@ -45,6 +49,8 @@ namespace platform { namespace keys{
extern const char* OS_LINUX;
extern const char* OS_ANDROID;
extern const char* OSVersion;
extern const char* vendor;
extern const char* vendor_Apple;
@ -52,6 +58,14 @@ namespace platform { namespace keys{
extern const char* profileTier;
}
} } // namespace plaform::keys
// Keys for categories used in json returned by getAll()
extern const char* CPUS;
extern const char* GPUS;
extern const char* DISPLAYS;
extern const char* MEMORY;
extern const char* COMPUTER;
} } // namespace plaform::keys
#endif

View file

@ -9,39 +9,45 @@
#include "AndroidPlatform.h"
#include "../PlatformKeys.h"
#include <GPUIdent.h>
#include <QSysInfo>
using namespace platform;
void AndroidInstance::enumerateCpu() {
void AndroidInstance::enumerateCpus() {
json cpu;
cpu[keys::cpu::vendor] = "";
cpu[keys::cpu::model] = "";
cpu[keys::cpu::clockSpeed] = "";
cpu[keys::cpu::numCores] = 0;
_cpu.push_back(cpu);
_cpus.push_back(cpu);
}
void AndroidInstance::enumerateGpu() {
void AndroidInstance::enumerateGpus() {
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get<std::string>());
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_display = ident->getOutput();
_gpus.push_back(gpu);
_displays = ident->getOutput();
}
void AndroidInstance::enumerateMemory() {
json ram = {};
ram[keys::memTotal]=0;
_memory.push_back(ram);
ram[keys::memory::memTotal]=0;
_memory = ram;
}
void AndroidInstance::enumerateComputer(){
_computer[keys::computer::OS] = keys::computer::OS_ANDROID;
_computer[keys::computer::vendor] = "";
_computer[keys::computer::model] = "";
auto sysInfo = QSysInfo();
_computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString();
}

View file

@ -15,10 +15,10 @@ namespace platform {
class AndroidInstance : public Instance {
public:
void enumerateCpu() override;
void enumerateCpus() override;
void enumerateGpus() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateComputer () override;
void enumerateComputer() override;
};
} // namespace platform

View file

@ -13,36 +13,37 @@
#include <string>
#include <CPUIdent.h>
#include <GPUIdent.h>
#include <QSysInfo>
using namespace platform;
void LinuxInstance::enumerateCpu() {
void LinuxInstance::enumerateCpus() {
json cpu = {};
cpu[keys::cpu::vendor] = CPUIdent::Vendor();
cpu[keys::cpu::model] = CPUIdent::Brand();
cpu[keys::cpu::numCores] = std::thread::hardware_concurrency();
_cpu.push_back(cpu);
_cpus.push_back(cpu);
}
void LinuxInstance::enumerateGpu() {
void LinuxInstance::enumerateGpus() {
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get<std::string>());
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_display = ident->getOutput();
_gpus.push_back(gpu);
_displays = ident->getOutput();
}
void LinuxInstance::enumerateMemory() {
json ram = {};
ram[keys::memTotal]=0;
ram[keys::memory::memTotal]=0;
_memory.push_back(ram);
_memory = ram;
}
void LinuxInstance::enumerateComputer(){
@ -50,5 +51,9 @@ void LinuxInstance::enumerateComputer(){
_computer[keys::computer::OS] = keys::computer::OS_LINUX;
_computer[keys::computer::vendor] = "";
_computer[keys::computer::model] = "";
auto sysInfo = QSysInfo();
_computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString();
}

View file

@ -15,10 +15,10 @@ namespace platform {
class LinuxInstance : public Instance {
public:
void enumerateCpu() override;
void enumerateCpus() override;
void enumerateGpus() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateComputer () override;
void enumerateComputer() override;
};
} // namespace platform

View file

@ -21,32 +21,33 @@
#include <CoreFoundation/CoreFoundation.h>
#include <ApplicationServices/ApplicationServices.h>
#include <QSysInfo>
#endif
using namespace platform;
void MACOSInstance::enumerateCpu() {
void MACOSInstance::enumerateCpus() {
json cpu = {};
cpu[keys::cpu::vendor] = CPUIdent::Vendor();
cpu[keys::cpu::model] = CPUIdent::Brand();
cpu[keys::cpu::numCores] = std::thread::hardware_concurrency();
_cpu.push_back(cpu);
_cpus.push_back(cpu);
}
void MACOSInstance::enumerateGpu() {
void MACOSInstance::enumerateGpus() {
#ifdef Q_OS_MAC
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get<std::string>());
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_gpus.push_back(gpu);
#endif
@ -101,7 +102,7 @@ void MACOSInstance::enumerateDisplays() {
display["modeWidth"] = displayModeWidth;
display["modeHeight"] = displayModeHeight;
_display.push_back(display);
_displays.push_back(display);
#endif
}
@ -111,9 +112,9 @@ void MACOSInstance::enumerateMemory() {
#ifdef Q_OS_MAC
long pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGE_SIZE);
ram[keys::memTotal] = pages * page_size;
ram[keys::memory::memTotal] = pages * page_size;
#endif
_memory.push_back(ram);
_memory = ram;
}
void MACOSInstance::enumerateComputer(){
@ -133,5 +134,9 @@ void MACOSInstance::enumerateComputer(){
free(model);
#endif
auto sysInfo = QSysInfo();
_computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString();
}

View file

@ -15,11 +15,11 @@ namespace platform {
class MACOSInstance : public Instance {
public:
void enumerateCpu() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateCpus() override;
void enumerateGpus() override;
void enumerateDisplays() override;
void enumerateComputer () override;
void enumerateMemory() override;
void enumerateComputer() override;
};
} // namespace platform

View file

@ -11,6 +11,8 @@
#include "../PlatformKeys.h"
namespace platform { namespace keys {
const char* UNKNOWN = "UNKNOWN";
namespace cpu {
const char* vendor = "vendor";
const char* vendor_Intel = "Intel";
@ -38,8 +40,9 @@ namespace platform { namespace keys {
const char* coordsTop = "coordinatestop";
const char* coordsBottom = "coordinatesbottom";
}
const char* memTotal = "memTotal";
namespace memory {
const char* memTotal = "memTotal";
}
namespace computer {
const char* OS = "OS";
const char* OS_WINDOWS = "WINDOWS";
@ -47,6 +50,8 @@ namespace platform { namespace keys {
const char* OS_LINUX = "LINUX";
const char* OS_ANDROID = "ANDROID";
const char* OSVersion = "OSVersion";
const char* vendor = "vendor";
const char* vendor_Apple = "Apple";
@ -54,6 +59,12 @@ namespace platform { namespace keys {
const char* profileTier = "profileTier";
}
const char* CPUS = "cpus";
const char* GPUS = "gpus";
const char* DISPLAYS = "displays";
const char* MEMORY = "memory";
const char* COMPUTER = "computer";
}}
#include <qglobal.h>
@ -117,14 +128,14 @@ json platform::getDisplay(int index) {
return _instance->getDisplay(index);
}
int platform::getNumMemories() {
return _instance->getNumMemories();
json platform::getMemory() {
return _instance->getMemory();
}
json platform::getMemory(int index) {
return _instance->getMemory(index);
}
json platform::getComputer(){
json platform::getComputer() {
return _instance->getComputer();
}
json platform::getAll() {
return _instance->getAll();
}

View file

@ -16,10 +16,10 @@ using namespace platform;
bool Instance::enumeratePlatform() {
enumerateComputer();
enumerateCpu();
enumerateGpu();
enumerateDisplays();
enumerateMemory();
enumerateCpus();
enumerateGpus();
enumerateDisplays();
// And profile the platform and put the tier in "computer"
_computer[keys::computer::profileTier] = Profiler::TierNames[Profiler::profilePlatform()];
@ -28,55 +28,42 @@ bool Instance::enumeratePlatform() {
}
json Instance::getCPU(int index) {
assert(index <(int) _cpu.size());
if (index >= (int)_cpu.size())
assert(index <(int) _cpus.size());
if (index >= (int)_cpus.size())
return json();
return _cpu.at(index);
}
//These are ripe for template.. will work on that next
json Instance::getMemory(int index) {
assert(index <(int) _memory.size());
if(index >= (int)_memory.size())
return json();
return _memory.at(index);
return _cpus.at(index);
}
json Instance::getGPU(int index) {
assert(index <(int) _gpu.size());
assert(index <(int) _gpus.size());
if (index >=(int) _gpu.size())
if (index >=(int) _gpus.size())
return json();
return _gpu.at(index);
return _gpus.at(index);
}
json Instance::getDisplay(int index) {
assert(index <(int) _display.size());
assert(index <(int) _displays.size());
if (index >=(int) _display.size())
if (index >=(int) _displays.size())
return json();
return _display.at(index);
return _displays.at(index);
}
Instance::~Instance() {
if (_cpu.size() > 0) {
_cpu.clear();
if (_cpus.size() > 0) {
_cpus.clear();
}
if (_memory.size() > 0) {
_memory.clear();
if (_gpus.size() > 0) {
_gpus.clear();
}
if (_gpu.size() > 0) {
_gpu.clear();
}
if (_display.size() > 0) {
_display.clear();
if (_displays.size() > 0) {
_displays.clear();
}
}
@ -106,17 +93,53 @@ json Instance::listAllKeys() {
keys::display::coordsTop,
keys::display::coordsBottom,
keys::memTotal,
keys::memory::memTotal,
keys::computer::OS,
keys::computer::OS_WINDOWS,
keys::computer::OS_MACOS,
keys::computer::OS_LINUX,
keys::computer::OS_ANDROID,
keys::computer::OSVersion,
keys::computer::vendor,
keys::computer::vendor_Apple,
keys::computer::model,
keys::computer::profileTier
keys::computer::profileTier,
keys::CPUS,
keys::GPUS,
keys::DISPLAYS,
keys::MEMORY,
keys::COMPUTER,
}});
return allKeys;
}
const char* Instance::findGPUVendorInDescription(const std::string& description) {
// intel integrated graphics
if (description.find(keys::gpu::vendor_Intel) != std::string::npos) {
return keys::gpu::vendor_Intel;
}
// AMD gpu
else if (description.find(keys::gpu::vendor_AMD) != std::string::npos) {
return keys::gpu::vendor_AMD;
}
// NVIDIA gpu
else if (description.find(keys::gpu::vendor_NVIDIA) != std::string::npos) {
return keys::gpu::vendor_NVIDIA;
} else {
return keys::UNKNOWN;
}
}
json Instance::getAll() {
json all = {};
all[keys::COMPUTER] = _computer;
all[keys::MEMORY] = _memory;
all[keys::CPUS] = _cpus;
all[keys::GPUS] = _gpus;
all[keys::DISPLAYS] = _displays;
return all;
}

View file

@ -19,36 +19,39 @@ class Instance {
public:
bool virtual enumeratePlatform();
int getNumCPUs() { return (int)_cpu.size(); }
int getNumCPUs() { return (int)_cpus.size(); }
json getCPU(int index);
int getNumGPUs() { return (int)_gpu.size(); }
int getNumGPUs() { return (int)_gpus.size(); }
json getGPU(int index);
int getNumMemories() { return (int)_memory.size(); }
json getMemory(int index);
int getNumDisplays() { return (int)_display.size(); }
int getNumDisplays() { return (int)_displays.size(); }
json getDisplay(int index);
json getMemory() { return _memory; }
json getComputer() { return _computer; }
json getComputer() {return _computer;}
void virtual enumerateCpu()=0;
void virtual enumerateMemory()=0;
void virtual enumerateGpu()=0;
json getAll();
void virtual enumerateCpus()=0;
void virtual enumerateGpus()=0;
void virtual enumerateDisplays() {}
void virtual enumerateMemory() = 0;
void virtual enumerateComputer()=0;
virtual ~Instance();
static json listAllKeys();
// Helper function to filter the vendor name out of the description of a GPU
static const char* findGPUVendorInDescription(const std::string& description);
protected:
std::vector<json> _cpu;
std::vector<json> _memory;
std::vector<json> _gpu;
std::vector<json> _display;
std::vector<json> _cpus;
std::vector<json> _gpus;
std::vector<json> _displays;
json _memory;
json _computer;
};

View file

@ -16,32 +16,33 @@
#ifdef Q_OS_WIN
#include <Windows.h>
#include <QSysInfo>
#endif
using namespace platform;
void WINInstance::enumerateCpu() {
void WINInstance::enumerateCpus() {
json cpu = {};
cpu[keys::cpu::vendor] = CPUIdent::Vendor();
cpu[keys::cpu::model] = CPUIdent::Brand();
cpu[keys::cpu::numCores] = std::thread::hardware_concurrency();
_cpu.push_back(cpu);
_cpus.push_back(cpu);
}
void WINInstance::enumerateGpu() {
void WINInstance::enumerateGpus() {
GPUIdent* ident = GPUIdent::getInstance();
json gpu = {};
gpu[keys::gpu::vendor] = ident->getName().toUtf8().constData();
gpu[keys::gpu::model] = ident->getName().toUtf8().constData();
gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get<std::string>());
gpu[keys::gpu::videoMemory] = ident->getMemory();
gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData();
_gpu.push_back(gpu);
_display = ident->getOutput();
_gpus.push_back(gpu);
_displays = ident->getOutput();
}
void WINInstance::enumerateMemory() {
@ -52,9 +53,9 @@ void WINInstance::enumerateMemory() {
statex.dwLength = sizeof(statex);
GlobalMemoryStatusEx(&statex);
int totalRam = statex.ullTotalPhys / 1024 / 1024;
ram[platform::keys::memTotal] = totalRam;
ram[platform::keys::memory::memTotal] = totalRam;
#endif
_memory.push_back(ram);
_memory = ram;
}
void WINInstance::enumerateComputer(){
@ -62,5 +63,8 @@ void WINInstance::enumerateComputer(){
_computer[keys::computer::vendor] = "";
_computer[keys::computer::model] = "";
auto sysInfo = QSysInfo();
_computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString();
}

View file

@ -15,9 +15,9 @@ namespace platform {
class WINInstance : public Instance {
public:
void enumerateCpu() override;
void enumerateCpus() override;
void enumerateGpus() override;
void enumerateMemory() override;
void enumerateGpu() override;
void enumerateComputer () override;
};
} // namespace platform

View file

@ -35,15 +35,6 @@ void DisplayPlugin::waitForPresent() {
}
}
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> DisplayPlugin::getHUDOperator() {
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> hudOperator;
{
QMutexLocker locker(&_presentMutex);
hudOperator = _hudOperator;
}
return hudOperator;
}
glm::mat4 HmdDisplay::getEyeToHeadTransform(Eye eye) const {
static const glm::mat4 xform;
return xform;

View file

@ -213,13 +213,12 @@ public:
void waitForPresent();
float getAveragePresentTime() { return _movingAveragePresent.average / (float)USECS_PER_MSEC; } // in msec
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator();
static const QString& MENU_PATH();
// for updating plugin-related commands. Mimics the input plugin.
virtual void pluginUpdate() = 0;
virtual std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> getHUDOperator() { return nullptr; }
virtual StencilMaskMode getStencilMaskMode() const { return StencilMaskMode::NONE; }
using StencilMaskMeshOperator = std::function<void(gpu::Batch&)>;
virtual StencilMaskMeshOperator getStencilMaskMeshOperator() { return nullptr; }
@ -234,8 +233,6 @@ protected:
gpu::ContextPointer _gpuContext;
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> _hudOperator { std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)>() };
MovingAverage<float, 10> _movingAveragePresent;
float _renderResolutionScale { 1.0f };

View file

@ -18,7 +18,13 @@
using namespace recording;
NetworkClipLoader::NetworkClipLoader(const QUrl& url) :
Resource(url),
_clip(std::make_shared<NetworkClip>(url)) {}
_clip(std::make_shared<NetworkClip>(url)) {
if (url.isEmpty()) {
_loaded = false;
_startedLoading = false;
_failedToLoad = true;
}
}
void NetworkClip::init(const QByteArray& clipData) {
_clipData = clipData;

View file

@ -124,20 +124,20 @@ namespace render {
DebugFlags _debugFlags { RENDER_DEBUG_NONE };
gpu::Batch* _batch = nullptr;
uint32_t _globalShapeKey{ 0 };
uint32_t _itemShapeKey{ 0 };
bool _enableTexturing{ true };
bool _enableBlendshape{ true };
bool _enableSkinning{ true };
uint32_t _globalShapeKey { 0 };
uint32_t _itemShapeKey { 0 };
bool _enableTexturing { true };
bool _enableBlendshape { true };
bool _enableSkinning { true };
bool _enableFade{ false };
bool _enableFade { false };
RenderDetails _details;
render::ScenePointer _scene;
int8_t _cameraMode { -1 };
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> _hudOperator;
gpu::TexturePointer _hudTexture;
std::function<void(gpu::Batch&, const gpu::TexturePointer&, bool mirror)> _hudOperator { nullptr };
gpu::TexturePointer _hudTexture { nullptr };
bool _takingSnapshot { false };
StencilMaskMode _stencilMaskMode { StencilMaskMode::NONE };

View file

@ -93,7 +93,7 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue
// when clip load fails, call the callback with the URL and failure boolean
connect(clipLoader.data(), &recording::NetworkClipLoader::failed, callback.engine(), [this, weakClipLoader, url, callback](QNetworkReply::NetworkError error) mutable {
qCDebug(scriptengine) << "Failed to load recording from" << url;
qCDebug(scriptengine) << "Failed to load recording from\"" << url << '"';
if (callback.isFunction()) {
QScriptValueList args { false, url };

View file

@ -282,12 +282,13 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
if (!validAdapterList.empty()) {
for (auto outy = adapterToOutputs.begin(); outy != adapterToOutputs.end(); ++outy) {
AdapterEntry entry = *outy;
AdapterEntry entry = *outy;
for (auto test = entry.second.begin(); test != entry.second.end(); ++test) {
std::wstring wDeviceName(test->DeviceName);
std::string deviceName(wDeviceName.begin(), wDeviceName.end());
nlohmann::json output = {};
output["description"] = entry.first.first.Description;
output["deviceName"]= test->DeviceName;
output["model"] = deviceName;
output["coordinatesleft"] = test->DesktopCoordinates.left;
output["coordinatesright"] = test->DesktopCoordinates.right;
output["coordinatestop"] = test->DesktopCoordinates.top;

View file

@ -79,12 +79,21 @@ PropFolderPanel {
})
} break;
case 'object': {
var component = Qt.createComponent("PropItem.qml");
/* var component = Qt.createComponent("PropItem.qml");
component.createObject(propItemsContainer, {
"label": proItem.property,
"object": proItem.object,
"property": proItem.property,
})
})*/
var component = Qt.createComponent("PropGroup.qml");
component.createObject(propItemsContainer, {
"label": proItem.property,
"object": proItem.object,
// "jobPath": root.jobPath + '.' + job.objectName,
// "showProps": root.showProps,
// "showSubs": root.showSubs,
// "indentDepth": root.indentDepth + 1,
})
} break;
case 'printLabel': {
var component = Qt.createComponent("PropItem.qml");
@ -117,8 +126,30 @@ PropFolderPanel {
o["object"] = object
o["property"] = props[p];
// o["readOnly"] = true;
/*
o["type"] = "string";
propsModel.push(o)
propsModel.push(o)*/
var thePropThing = object[props[p]];
if ((thePropThing !== undefined) && (thePropThing !== null)) {
var theType = typeof(thePropThing)
switch(theType) {
case 'object': {
o["type"] = "object";
propsModel.push(o)
}
default: {
o["type"] = "string";
propsModel.push(o)
} break;
}
} else {
o["type"] = "string";
propsModel.push(o)
}
}
root.updatePropItems(root.propItemsPanel, propsModel);
}