diff --git a/interface/src/graphics/GraphicsEngine.cpp b/interface/src/graphics/GraphicsEngine.cpp index 98ad7c0ad7..ab7195a01b 100644 --- a/interface/src/graphics/GraphicsEngine.cpp +++ b/interface/src/graphics/GraphicsEngine.cpp @@ -240,7 +240,6 @@ void GraphicsEngine::render_performFrame() { renderArgs._context->setStereoViews(stereoEyeOffsets); } } - bool renderScene = true; gpu::FramebufferPointer finalFramebuffer; QSize finalFramebufferSize; { @@ -277,32 +276,13 @@ void GraphicsEngine::render_performFrame() { qApp->getApplicationCompositor().setFrameInfo(_renderFrameCount, eyeToWorld, sensorToWorld); } - - if (renderScene) { + { PROFILE_RANGE(render, "/runRenderFrame"); renderArgs._hudOperator = displayPlugin->getHUDOperator(); renderArgs._hudTexture = qApp->getApplicationOverlay().getOverlayTexture(); renderArgs._takingSnapshot = qApp->takeSnapshotOperators(snapshotOperators); renderArgs._blitFramebuffer = finalFramebuffer; render_runRenderFrame(&renderArgs); - } else { - // Instead of clearing, drawing the splash screen background (that looks like the default skybox) - gpu::doInBatch("splashFrame", _gpuContext, [&](gpu::Batch& batch) { - batch.setFramebuffer(finalFramebuffer); - batch.enableSkybox(true); - batch.enableStereo(isStereo); - batch.clearDepthStencilFramebuffer(1.0, 0); - batch.setViewportTransform({ 0, 0, finalFramebuffer->getSize() }); - _splashScreen->render(batch, viewFrustum, renderArgs._renderMethod == RenderArgs::RenderMethod::FORWARD); - }); - - // THen just use the HUD operator of thedisplay plugin - gpu::doInBatch("drawHUD", renderArgs._context, [&](gpu::Batch& batch) { - batch.setFramebuffer(finalFramebuffer); - // TODO we should do more transform setup here just like in "REnderHUDLayerTask.cpp CompositeHUD job if we wanted to support stereo - displayPlugin->getHUDOperator()(batch, qApp->getApplicationOverlay().getOverlayTexture()); - }); - // And voila } } diff --git a/libraries/entities-renderer/src/RenderableMaterialEntityItem.cpp b/libraries/entities-renderer/src/RenderableMaterialEntityItem.cpp index c8dc701989..eae0561343 100644 --- a/libraries/entities-renderer/src/RenderableMaterialEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableMaterialEntityItem.cpp @@ -11,9 +11,6 @@ #include "RenderPipelines.h" #include "GeometryCache.h" -#include "EntitiesRendererLogging.h" - - using namespace render; using namespace render::entities; @@ -198,10 +195,7 @@ void MaterialEntityRenderer::doRenderUpdateAsynchronousTyped(const TypedEntityPo auto material = getMaterial(); bool newTexturesLoaded = material ? !material->isMissingTexture() : false; if (!_texturesLoaded && newTexturesLoaded) { - bool changed = material->checkResetOpacityMap(); - if (changed) { - qCWarning(entitiesrenderer) << "opacity change detected for material " << material->getName().c_str(); - } + material->checkResetOpacityMap(); } _texturesLoaded = newTexturesLoaded; } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index a91d07947a..6314cc8ce4 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -41,7 +41,6 @@ void ModelEntityWrapper::setModel(const ModelPointer& model) { if (_model) { _needsInitialSimulation = true; } - } }); } @@ -1432,13 +1431,12 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce } } - bool currentTexturesLoaded = resultWithReadLock([&] { return _texturesLoaded; }); - if (!currentTexturesLoaded && model->getGeometry() && model->getGeometry()->areTexturesLoaded()) { + if (!_texturesLoaded && model->getGeometry() && model->getGeometry()->areTexturesLoaded()) { withWriteLock([&] { _texturesLoaded = true; }); model->updateRenderItems(); - } else if (!currentTexturesLoaded) { + } else if (!_texturesLoaded) { emit requestRenderUpdate(); } diff --git a/libraries/gl/src/gl/GLHelpers.cpp b/libraries/gl/src/gl/GLHelpers.cpp index ddb93e0fa0..b2c98e91d3 100644 --- a/libraries/gl/src/gl/GLHelpers.cpp +++ b/libraries/gl/src/gl/GLHelpers.cpp @@ -287,7 +287,6 @@ const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() { // Qt Quick may need a depth and stencil buffer. Always make sure these are available. format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS); format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS); - format.setColorSpace(QSurfaceFormat::ColorSpace::sRGBColorSpace); auto glversion = ::gl::getTargetVersion(); format.setMajorVersion(GL_GET_MAJOR_VERSION(glversion)); format.setMinorVersion(GL_GET_MINOR_VERSION(glversion)); diff --git a/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp b/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp index 02083af932..5abe568909 100644 --- a/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp +++ b/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp @@ -382,8 +382,7 @@ namespace scriptable { if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::SCATTERING_VAL_BIT)) { obj.setProperty("scattering", FALLTHROUGH); - } - else if (material.key.isScattering()) { + } else if (material.key.isScattering()) { obj.setProperty("scattering", material.scattering); } @@ -427,12 +426,11 @@ namespace scriptable { obj.setProperty("keys.isTexelOpaque", material.key.isTexelOpaque()); obj.setProperty("keys.isSurfaceOpaque", material.key.isSurfaceOpaque()); - if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::OPACITY_MASK_MAP_BIT)) { + if (hasPropertyFallthroughs && material.propertyFallthroughs.at(graphics::MaterialKey::OPACITY_TRANSLUCENT_MAP_BIT)) { obj.setProperty("opacityMapMode", FALLTHROUGH); obj.setProperty("alphaCutoff", FALLTHROUGH); } else if (material.key.isGlossy()) { obj.setProperty("opacityMapMode", material.opacityMode); - obj.setProperty("alphaCutoff", material.alphaCutoff); } diff --git a/libraries/graphics/src/graphics/Material.cpp b/libraries/graphics/src/graphics/Material.cpp index aeb37fc8d2..21ba2872a4 100755 --- a/libraries/graphics/src/graphics/Material.cpp +++ b/libraries/graphics/src/graphics/Material.cpp @@ -122,7 +122,7 @@ void Material::setScattering(float scattering) { void Material::setAlphaCutoff(float alphaCutoff) { alphaCutoff = glm::clamp(alphaCutoff, 0.0f, 1.0f); - // _key.setAlphaCutoff(alphaCutoff != DEFAULT_ALPHA_CUTOFF); + _key.setAlphaCutoff(alphaCutoff != DEFAULT_ALPHA_CUTOFF); _alphaCutoff = alphaCutoff; } @@ -191,7 +191,7 @@ bool Material::resetOpacityMap() const { } auto newious = _key.getAlphaMapMode(); if (previous != newious) { - qCWarning(graphicsLog) << "opacity change detected for material " << _name.c_str(); + //opacity change detected for this material return true; } return false; diff --git a/libraries/graphics/src/graphics/Material.h b/libraries/graphics/src/graphics/Material.h index dd97aa1216..94d9a9b3f0 100755 --- a/libraries/graphics/src/graphics/Material.h +++ b/libraries/graphics/src/graphics/Material.h @@ -43,6 +43,7 @@ public: OPACITY_VAL_BIT, OPACITY_MASK_MAP_BIT, // Opacity Map and Opacity MASK map are mutually exclusive OPACITY_TRANSLUCENT_MAP_BIT, + ALPHA_CUTOFF_VAL_BIT, SCATTERING_VAL_BIT, // THe map bits must be in the same sequence as the enum names for the map channels @@ -101,6 +102,8 @@ public: Builder& withTranslucentFactor() { _flags.set(OPACITY_VAL_BIT); return (*this); } + Builder& withAlphaCutoff() { _flags.set(ALPHA_CUTOFF_VAL_BIT); return (*this); } + Builder& withScattering() { _flags.set(SCATTERING_VAL_BIT); return (*this); } Builder& withEmissiveMap() { _flags.set(EMISSIVE_MAP_BIT); return (*this); } @@ -168,6 +171,9 @@ public: void setTranslucentFactor(bool value) { _flags.set(OPACITY_VAL_BIT, value); } bool isTranslucentFactor() const { return _flags[OPACITY_VAL_BIT]; } + void setAlphaCutoff(bool value) { _flags.set(ALPHA_CUTOFF_VAL_BIT, value); } + bool isAlphaCutoff() const { return _flags[ALPHA_CUTOFF_VAL_BIT]; } + void setTranslucentMap(bool value) { _flags.set(OPACITY_TRANSLUCENT_MAP_BIT, value); } bool isTranslucentMap() const { return _flags[OPACITY_TRANSLUCENT_MAP_BIT]; } @@ -264,6 +270,9 @@ public: Builder& withoutTranslucentFactor() { _value.reset(MaterialKey::OPACITY_VAL_BIT); _mask.set(MaterialKey::OPACITY_VAL_BIT); return (*this); } Builder& withTranslucentFactor() { _value.set(MaterialKey::OPACITY_VAL_BIT); _mask.set(MaterialKey::OPACITY_VAL_BIT); return (*this); } + Builder& withoutAlphaCutoff() { _value.reset(MaterialKey::ALPHA_CUTOFF_VAL_BIT); _mask.set(MaterialKey::ALPHA_CUTOFF_VAL_BIT); return (*this); } + Builder& withAlphaCutoff() { _value.set(MaterialKey::ALPHA_CUTOFF_VAL_BIT); _mask.set(MaterialKey::ALPHA_CUTOFF_VAL_BIT); return (*this); } + Builder& withoutTranslucentMap() { _value.reset(MaterialKey::OPACITY_TRANSLUCENT_MAP_BIT); _mask.set(MaterialKey::OPACITY_TRANSLUCENT_MAP_BIT); return (*this); } Builder& withTranslucentMap() { _value.set(MaterialKey::OPACITY_TRANSLUCENT_MAP_BIT); _mask.set(MaterialKey::OPACITY_TRANSLUCENT_MAP_BIT); return (*this); } @@ -324,6 +333,7 @@ public: void setOpacity(float opacity); float getOpacity() const { return _opacity; } + static const MaterialKey::AlphaMapMode DEFAULT_ALPHA_MAP_MODE; void setAlphaMapMode(MaterialKey::AlphaMapMode alphaMode); MaterialKey::AlphaMapMode getAlphaMapMode() const; diff --git a/libraries/graphics/src/graphics/Material.slh b/libraries/graphics/src/graphics/Material.slh index 8ebf66417c..76847c081f 100644 --- a/libraries/graphics/src/graphics/Material.slh +++ b/libraries/graphics/src/graphics/Material.slh @@ -85,16 +85,17 @@ const BITFIELD GLOSSY_VAL_BIT = 0x00000010; const BITFIELD OPACITY_VAL_BIT = 0x00000020; const BITFIELD OPACITY_MASK_MAP_BIT = 0x00000040; const BITFIELD OPACITY_TRANSLUCENT_MAP_BIT = 0x00000080; -const BITFIELD SCATTERING_VAL_BIT = 0x00000100; +const BITFIELD ALPHA_CUTOFF_VAL_BIT = 0x00000100; +const BITFIELD SCATTERING_VAL_BIT = 0x00000200; -const BITFIELD EMISSIVE_MAP_BIT = 0x00000200; -const BITFIELD ALBEDO_MAP_BIT = 0x00000400; -const BITFIELD METALLIC_MAP_BIT = 0x00000800; -const BITFIELD ROUGHNESS_MAP_BIT = 0x00001000; -const BITFIELD NORMAL_MAP_BIT = 0x00002000; -const BITFIELD OCCLUSION_MAP_BIT = 0x00004000; -const BITFIELD LIGHTMAP_MAP_BIT = 0x00008000; -const BITFIELD SCATTERING_MAP_BIT = 0x00010000; +const BITFIELD EMISSIVE_MAP_BIT = 0x00000400; +const BITFIELD ALBEDO_MAP_BIT = 0x00000800; +const BITFIELD METALLIC_MAP_BIT = 0x00001000; +const BITFIELD ROUGHNESS_MAP_BIT = 0x00002000; +const BITFIELD NORMAL_MAP_BIT = 0x00004000; +const BITFIELD OCCLUSION_MAP_BIT = 0x00008000; +const BITFIELD LIGHTMAP_MAP_BIT = 0x00010000; +const BITFIELD SCATTERING_MAP_BIT = 0x00020000; <@endif@> diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 25d40ed659..88a4f5bf32 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -320,11 +320,11 @@ void ResourceCache::refreshAll() { QVariantList ResourceCache::getResourceList() { QVariantList list; - /*if (QThread::currentThread() != thread()) { + if (QThread::currentThread() != thread()) { // NOTE: invokeMethod does not allow a const QObject* BLOCKING_INVOKE_METHOD(this, "getResourceList", Q_RETURN_ARG(QVariantList, list)); - } else {*/ + } else { QList resources; { QReadLocker locker(&_resourcesLock); @@ -334,7 +334,7 @@ QVariantList ResourceCache::getResourceList() { for (auto& resource : resources) { list << resource; } - /* }*/ + } return list; } @@ -517,13 +517,6 @@ void ResourceCache::updateTotalSize(const qint64& deltaSize) { emit dirty(); } -void ResourceCache::incrementNumLoading() { - _numLoadingResources++; -} -void ResourceCache::decrementNumLoading() { - _numLoadingResources--; -} - QList> ResourceCache::getLoadingRequests() { return DependencyManager::get()->getLoadingRequests(); } @@ -541,7 +534,7 @@ bool ResourceCache::attemptRequest(QSharedPointer resource) { auto sharedItems = DependencyManager::get(); if (sharedItems->appendRequest(resource)) { - resource->makeRequest(); + resource->makeRequest(); return true; } return false; diff --git a/libraries/networking/src/ResourceCache.h b/libraries/networking/src/ResourceCache.h index b9b339644e..259e14c650 100644 --- a/libraries/networking/src/ResourceCache.h +++ b/libraries/networking/src/ResourceCache.h @@ -200,21 +200,15 @@ class ResourceCache : public QObject { Q_PROPERTY(size_t sizeTotal READ getSizeTotalResources NOTIFY dirty) Q_PROPERTY(size_t sizeCached READ getSizeCachedResources NOTIFY dirty) - Q_PROPERTY(size_t numLoading READ getNumLoadingResources NOTIFY dirty) - public: size_t getNumTotalResources() const { return _numTotalResources; } size_t getSizeTotalResources() const { return _totalResourcesSize; } size_t getNumCachedResources() const { return _numUnusedResources; } size_t getSizeCachedResources() const { return _unusedResourcesSize; } - size_t getNumLoadingResources() const { return _numLoadingResources; } Q_INVOKABLE QVariantList getResourceList(); - Q_INVOKABLE void incrementNumLoading(); - Q_INVOKABLE void decrementNumLoading(); - static void setRequestLimit(uint32_t limit); static uint32_t getRequestLimit() { return DependencyManager::get()->getRequestLimit(); } @@ -295,7 +289,6 @@ private: std::atomic _numTotalResources { 0 }; std::atomic _totalResourcesSize { 0 }; - std::atomic _numLoadingResources{ 0 }; // Cached resources QMap> _unusedResources; @@ -324,8 +317,10 @@ class ScriptableResourceCache : public QObject { Q_PROPERTY(size_t sizeTotal READ getSizeTotalResources NOTIFY dirty) Q_PROPERTY(size_t sizeCached READ getSizeCachedResources NOTIFY dirty) - Q_PROPERTY(size_t numLoading READ getNumLoadingResources NOTIFY dirty) - + /**jsdoc + * @property {number} numGlobalQueriesPending - Total number of global queries pending (across all resource managers). Read-only. + * @property {number} numGlobalQueriesLoading - Total number of global queries pending (across all resource managers). Read-only. + */ Q_PROPERTY(size_t numGlobalQueriesPending READ getNumGlobalQueriesPending NOTIFY dirty) Q_PROPERTY(size_t numGlobalQueriesLoading READ getNumGlobalQueriesLoading NOTIFY dirty) @@ -402,7 +397,6 @@ private: size_t getSizeTotalResources() const { return _resourceCache->getSizeTotalResources(); } size_t getNumCachedResources() const { return _resourceCache->getNumCachedResources(); } size_t getSizeCachedResources() const { return _resourceCache->getSizeCachedResources(); } - size_t getNumLoadingResources() const { return _resourceCache->getNumLoadingResources(); } size_t getNumGlobalQueriesPending() const { return ResourceCache::getLoadingRequestCount(); } size_t getNumGlobalQueriesLoading() const { return ResourceCache::getPendingRequestCount(); } diff --git a/libraries/render-utils/src/RenderPipelines.cpp b/libraries/render-utils/src/RenderPipelines.cpp index 14ceb4f9be..42ff74476f 100644 --- a/libraries/render-utils/src/RenderPipelines.cpp +++ b/libraries/render-utils/src/RenderPipelines.cpp @@ -461,6 +461,13 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial wasSet = true; } break; + case graphics::MaterialKey::ALPHA_CUTOFF_VAL_BIT: + if (materialKey.isAlphaCutoff()) { + schema._alphaCutoff = material->getAlphaCutoff(); + schemaKey.setAlphaCutoff(true); + wasSet = true; + } + break; case graphics::MaterialKey::SCATTERING_VAL_BIT: if (materialKey.isScattering()) { schema._scattering = material->getScattering(); @@ -486,7 +493,6 @@ void RenderPipelines::updateMultiMaterial(graphics::MultiMaterial& multiMaterial schemaKey.setAlbedoMap(true); schemaKey.setOpacityMaskMap(material->getKey().isOpacityMaskMap()); schemaKey.setTranslucentMap(material->getKey().isTranslucentMap()); - schema._alphaCutoff = material->getAlphaCutoff(); } break; case graphics::MaterialKey::METALLIC_MAP_BIT: diff --git a/libraries/render/src/render/EngineStats.cpp b/libraries/render/src/render/EngineStats.cpp index 9f45f7e559..6fbd3e6f9c 100644 --- a/libraries/render/src/render/EngineStats.cpp +++ b/libraries/render/src/render/EngineStats.cpp @@ -63,5 +63,6 @@ void EngineStats::run(const RenderContextPointer& renderContext) { config->frameSetPipelineCount = _gpuStats._PSNumSetPipelines; config->frameSetInputFormatCount = _gpuStats._ISNumFormatChanges; - config->emitDirty(); + + // These new stat values are notified with the "newStats" signal triggered by the timer } diff --git a/libraries/render/src/render/EngineStats.h b/libraries/render/src/render/EngineStats.h index 9150e78f82..9f8be748f7 100644 --- a/libraries/render/src/render/EngineStats.h +++ b/libraries/render/src/render/EngineStats.h @@ -101,11 +101,6 @@ namespace render { quint32 frameSetPipelineCount{ 0 }; quint32 frameSetInputFormatCount{ 0 }; - - - - void emitDirty() { emit newStats(); } - }; class EngineStats { diff --git a/tools/gpu-frame-player/src/RenderThread.cpp b/tools/gpu-frame-player/src/RenderThread.cpp index ef553e59fc..6c0d3c7bba 100644 --- a/tools/gpu-frame-player/src/RenderThread.cpp +++ b/tools/gpu-frame-player/src/RenderThread.cpp @@ -188,6 +188,7 @@ void RenderThread::renderFrame(gpu::FramePointer& frame) { glDisable(GL_FRAMEBUFFER_SRGB); _gpuContext->executeBatch(*batch); + // Keep this raw gl code here for reference //glDisable(GL_FRAMEBUFFER_SRGB); //glClear(GL_COLOR_BUFFER_BIT); /* glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);