From e81fba22edb5712913da26f05ae4b0aedd1e87c9 Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Mon, 26 Feb 2018 13:43:35 -0800 Subject: [PATCH 1/3] EntityServer should update a previously matched entity. EntityServer currently keeps a per-Node set of entities that matched the JSON filter. This commit will send an update for an entity that no longer matches then remove it from the set. https://highfidelity.fogbugz.com/f/cases/11244/ --- .../src/entities/EntityTreeSendThread.cpp | 14 +++++++++++--- libraries/entities/src/EntityNodeData.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/assignment-client/src/entities/EntityTreeSendThread.cpp b/assignment-client/src/entities/EntityTreeSendThread.cpp index e5cee84f1b..94d21f1c9a 100644 --- a/assignment-client/src/entities/EntityTreeSendThread.cpp +++ b/assignment-client/src/entities/EntityTreeSendThread.cpp @@ -442,12 +442,16 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream PrioritizedEntity queuedItem = _sendQueue.top(); EntityItemPointer entity = queuedItem.getEntity(); if (entity) { - // Only send entities that match the jsonFilters, but keep track of everything we've tried to send so we don't try to send it again + const QUuid& entityID = entity->getID(); + // Only send entities that match the jsonFilters, but keep track of everything we've tried to send so we don't try to send it again; + // also send if we previously matched since this represents change to a matched item. bool entityMatchesFilters = entity->matchesJSONFilters(jsonFilters); - if (entityMatchesFilters || entityNodeData->isEntityFlaggedAsExtra(entity->getID())) { + bool entityPreviouslyMatchedFilter = entityNodeData->sentFilteredEntity(entityID); + + if (entityMatchesFilters || entityNodeData->isEntityFlaggedAsExtra(entityID) || entityPreviouslyMatchedFilter) { if (!jsonFilters.isEmpty() && entityMatchesFilters) { // Record explicitly filtered-in entity so that extra entities can be flagged. - entityNodeData->insertSentFilteredEntity(entity->getID()); + entityNodeData->insertSentFilteredEntity(entityID); } OctreeElement::AppendState appendEntityState = entity->appendEntityData(&_packetData, params, _extraEncodeData); @@ -458,6 +462,10 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream params.stopReason = EncodeBitstreamParams::DIDNT_FIT; break; } + + if (entityPreviouslyMatchedFilter && !entityMatchesFilters) { + entityNodeData->removeSentFilteredEntity(entityID); + } ++_numEntities; } if (queuedItem.shouldForceRemove()) { diff --git a/libraries/entities/src/EntityNodeData.h b/libraries/entities/src/EntityNodeData.h index eb5a1610cc..090a5e0526 100644 --- a/libraries/entities/src/EntityNodeData.h +++ b/libraries/entities/src/EntityNodeData.h @@ -33,7 +33,7 @@ public: // these can only be called from the OctreeSendThread for the given Node void insertSentFilteredEntity(const QUuid& entityID) { _sentFilteredEntities.insert(entityID); } void removeSentFilteredEntity(const QUuid& entityID) { _sentFilteredEntities.remove(entityID); } - bool sentFilteredEntity(const QUuid& entityID) { return _sentFilteredEntities.contains(entityID); } + bool sentFilteredEntity(const QUuid& entityID) const { return _sentFilteredEntities.contains(entityID); } QSet getSentFilteredEntities() { return _sentFilteredEntities; } // the following flagged extra entity methods can only be called from the OctreeSendThread for the given Node From 884da98466d258d073456bf1a3eed9a493340d3b Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 14 Mar 2018 14:50:44 -0300 Subject: [PATCH 2/3] Change default mode to My View (android) --- scripts/system/+android/modes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/+android/modes.js b/scripts/system/+android/modes.js index b29548094f..097798e393 100644 --- a/scripts/system/+android/modes.js +++ b/scripts/system/+android/modes.js @@ -17,7 +17,7 @@ var currentSelectedBtn; var SETTING_CURRENT_MODE_KEY = 'Android/Mode'; var MODE_VR = "VR", MODE_RADAR = "RADAR", MODE_MY_VIEW = "MY VIEW"; -var DEFAULT_MODE = MODE_RADAR; +var DEFAULT_MODE = MODE_MY_VIEW; var logEnabled = true; var radar = Script.require('./radar.js'); From e59af8892a75885730114a43699deaa2fc09ab75 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Wed, 14 Mar 2018 12:08:35 -0700 Subject: [PATCH 3/3] make same changes to gles backend from taa pr --- libraries/gpu-gles/src/gpu/gl/GLBackend.cpp | 4 + libraries/gpu-gles/src/gpu/gl/GLBackend.h | 6 ++ .../gpu-gles/src/gpu/gl/GLBackendOutput.cpp | 20 +++++ .../gpu-gles/src/gpu/gl/GLBackendPipeline.cpp | 29 ++++++- .../src/gpu/gl/GLBackendTransform.cpp | 2 +- .../gpu-gles/src/gpu/gl/GLTexelFormat.cpp | 85 ++++++++++++++++++- .../render-utils/src/AntialiasingEffect.h | 2 +- 7 files changed, 142 insertions(+), 6 deletions(-) diff --git a/libraries/gpu-gles/src/gpu/gl/GLBackend.cpp b/libraries/gpu-gles/src/gpu/gl/GLBackend.cpp index e8e89a1da6..5dc2b1446c 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLBackend.cpp +++ b/libraries/gpu-gles/src/gpu/gl/GLBackend.cpp @@ -93,12 +93,16 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] = (&::gpu::gl::GLBackend::do_setUniformBuffer), (&::gpu::gl::GLBackend::do_setResourceBuffer), (&::gpu::gl::GLBackend::do_setResourceTexture), + (&::gpu::gl::GLBackend::do_setResourceFramebufferSwapChainTexture), (&::gpu::gl::GLBackend::do_setFramebuffer), + (&::gpu::gl::GLBackend::do_setFramebufferSwapChain), (&::gpu::gl::GLBackend::do_clearFramebuffer), (&::gpu::gl::GLBackend::do_blit), (&::gpu::gl::GLBackend::do_generateTextureMips), + (&::gpu::gl::GLBackend::do_advance), + (&::gpu::gl::GLBackend::do_beginQuery), (&::gpu::gl::GLBackend::do_endQuery), (&::gpu::gl::GLBackend::do_getQuery), diff --git a/libraries/gpu-gles/src/gpu/gl/GLBackend.h b/libraries/gpu-gles/src/gpu/gl/GLBackend.h index 33bec07854..081bd78e85 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLBackend.h +++ b/libraries/gpu-gles/src/gpu/gl/GLBackend.h @@ -123,15 +123,19 @@ public: // Resource Stage virtual void do_setResourceBuffer(const Batch& batch, size_t paramOffset) final; virtual void do_setResourceTexture(const Batch& batch, size_t paramOffset) final; + virtual void do_setResourceFramebufferSwapChainTexture(const Batch& batch, size_t paramOffset) final; // Pipeline Stage virtual void do_setPipeline(const Batch& batch, size_t paramOffset) final; // Output stage virtual void do_setFramebuffer(const Batch& batch, size_t paramOffset) final; + virtual void do_setFramebufferSwapChain(const Batch& batch, size_t paramOffset) final; virtual void do_clearFramebuffer(const Batch& batch, size_t paramOffset) final; virtual void do_blit(const Batch& batch, size_t paramOffset) = 0; + virtual void do_advance(const Batch& batch, size_t paramOffset) final; + // Query section virtual void do_beginQuery(const Batch& batch, size_t paramOffset) final; virtual void do_endQuery(const Batch& batch, size_t paramOffset) final; @@ -242,6 +246,8 @@ protected: void setupStereoSide(int side); #endif + virtual void setResourceTexture(unsigned int slot, const TexturePointer& resourceTexture); + virtual void setFramebuffer(const FramebufferPointer& framebuffer); virtual void initInput() final; virtual void killInput() final; virtual void syncInputStateCache() final; diff --git a/libraries/gpu-gles/src/gpu/gl/GLBackendOutput.cpp b/libraries/gpu-gles/src/gpu/gl/GLBackendOutput.cpp index 45c0de8ed7..0f36f86c88 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLBackendOutput.cpp +++ b/libraries/gpu-gles/src/gpu/gl/GLBackendOutput.cpp @@ -37,6 +37,19 @@ void GLBackend::resetOutputStage() { void GLBackend::do_setFramebuffer(const Batch& batch, size_t paramOffset) { auto framebuffer = batch._framebuffers.get(batch._params[paramOffset]._uint); + setFramebuffer(framebuffer); +} + +void GLBackend::do_setFramebufferSwapChain(const Batch& batch, size_t paramOffset) { + auto swapChain = batch._swapChains.get(batch._params[paramOffset]._uint); + if (swapChain) { + auto index = batch._params[paramOffset + 1]._uint; + FramebufferPointer framebuffer = static_cast(swapChain.get())->get(index); + setFramebuffer(framebuffer); + } +} + +void GLBackend::setFramebuffer(const FramebufferPointer& framebuffer) { if (_output._framebuffer != framebuffer) { auto newFBO = getFramebufferID(framebuffer); if (_output._drawFBO != newFBO) { @@ -47,6 +60,13 @@ void GLBackend::do_setFramebuffer(const Batch& batch, size_t paramOffset) { } } +void GLBackend::do_advance(const Batch& batch, size_t paramOffset) { + auto ringbuffer = batch._swapChains.get(batch._params[paramOffset]._uint); + if (ringbuffer) { + ringbuffer->advance(); + } +} + void GLBackend::do_clearFramebuffer(const Batch& batch, size_t paramOffset) { if (_stereo.isStereo() && !_pipeline._stateCache.scissorEnable) { qWarning("Clear without scissor in stereo mode"); diff --git a/libraries/gpu-gles/src/gpu/gl/GLBackendPipeline.cpp b/libraries/gpu-gles/src/gpu/gl/GLBackendPipeline.cpp index b80be8492f..7fdf6eca41 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLBackendPipeline.cpp +++ b/libraries/gpu-gles/src/gpu/gl/GLBackendPipeline.cpp @@ -251,6 +251,31 @@ void GLBackend::do_setResourceTexture(const Batch& batch, size_t paramOffset) { releaseResourceTexture(slot); return; } + setResourceTexture(slot, resourceTexture); +} + +void GLBackend::do_setResourceFramebufferSwapChainTexture(const Batch& batch, size_t paramOffset) { + GLuint slot = batch._params[paramOffset + 1]._uint; + if (slot >= (GLuint)MAX_NUM_RESOURCE_TEXTURES) { + qCDebug(gpugllogging) << "GLBackend::do_setResourceFramebufferSwapChainTexture: Trying to set a resource Texture at slot #" << slot << " which doesn't exist. MaxNumResourceTextures = " << getMaxNumResourceTextures(); + return; + } + + SwapChainPointer swapChain = batch._swapChains.get(batch._params[paramOffset + 0]._uint); + + if (!swapChain) { + releaseResourceTexture(slot); + return; + } + auto index = batch._params[paramOffset + 2]._uint; + auto renderBufferSlot = batch._params[paramOffset + 3]._uint; + FramebufferPointer resourceFramebuffer = static_cast(swapChain.get())->get(index); + TexturePointer resourceTexture = resourceFramebuffer->getRenderBuffer(renderBufferSlot); + + setResourceTexture(slot, resourceTexture); +} + +void GLBackend::setResourceTexture(unsigned int slot, const TexturePointer& resourceTexture) { // check cache before thinking if (_resource._textures[slot] == resourceTexture) { return; @@ -267,11 +292,11 @@ void GLBackend::do_setResourceTexture(const Batch& batch, size_t paramOffset) { glActiveTexture(GL_TEXTURE0 + slot); glBindTexture(target, to); - (void) CHECK_GL_ERROR(); + (void)CHECK_GL_ERROR(); _resource._textures[slot] = resourceTexture; - _stats._RSAmountTextureMemoryBounded += (int) object->size(); + _stats._RSAmountTextureMemoryBounded += (int)object->size(); } else { releaseResourceTexture(slot); diff --git a/libraries/gpu-gles/src/gpu/gl/GLBackendTransform.cpp b/libraries/gpu-gles/src/gpu/gl/GLBackendTransform.cpp index f286a5cca9..72aaa5aa66 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLBackendTransform.cpp +++ b/libraries/gpu-gles/src/gpu/gl/GLBackendTransform.cpp @@ -105,7 +105,7 @@ void GLBackend::TransformStageState::preUpdate(size_t commandIndex, const Stereo if (_viewIsCamera && (_viewCorrectionEnabled && _correction.correction != glm::mat4())) { // FIXME should I switch to using the camera correction buffer in Transform.slf and leave this out? Transform result; - _view.mult(result, _view, _correction.correction); + _view.mult(result, _view, _correction.correctionInverse); if (_skybox) { result.setTranslation(vec3()); } diff --git a/libraries/gpu-gles/src/gpu/gl/GLTexelFormat.cpp b/libraries/gpu-gles/src/gpu/gl/GLTexelFormat.cpp index 2a39901ee7..bad6c3456c 100644 --- a/libraries/gpu-gles/src/gpu/gl/GLTexelFormat.cpp +++ b/libraries/gpu-gles/src/gpu/gl/GLTexelFormat.cpp @@ -173,7 +173,47 @@ GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) { case gpu::RGB: case gpu::RGBA: case gpu::XY: - result = GL_RG8; + switch (dstFormat.getType()) { + case gpu::UINT32: + result = GL_RG32UI; + break; + case gpu::INT32: + result = GL_RG32I; + break; + case gpu::FLOAT: + result = GL_RG32F; + break; + case gpu::UINT16: + result = GL_RG16UI; + break; + case gpu::INT16: + result = GL_RG16I; + break; + case gpu::HALF: + result = GL_RG16F; + break; + case gpu::UINT8: + result = GL_RG8UI; + break; + case gpu::INT8: + result = GL_RG8I; + break; + case gpu::NUINT8: + result = GL_RG8; + break; + case gpu::NINT8: + result = GL_RG8_SNORM; + break; + case gpu::NUINT32: + case gpu::NINT32: + case gpu::NUINT2: + case gpu::NINT2_10_10_10: + case gpu::COMPRESSED: + case gpu::NUINT16: + case gpu::NINT16: + case gpu::NUM_TYPES: // quiet compiler + Q_UNREACHABLE(); + } break; default: qCWarning(gpugllogging) << "Unknown combination of texel format"; @@ -312,7 +352,48 @@ GLTexelFormat GLTexelFormat::evalGLTexelFormat(const Element& dstFormat, const E case gpu::RGB: case gpu::RGBA: case gpu::XY: - texel.internalFormat = GL_RG8; + switch (dstFormat.getType()) { + case gpu::UINT32: + texel.internalFormat = GL_RG32UI; + break; + case gpu::INT32: + texel.internalFormat = GL_RG32I; + break; + case gpu::FLOAT: + texel.internalFormat = GL_RG32F; + break; + case gpu::UINT16: + texel.internalFormat = GL_RG16UI; + break; + case gpu::INT16: + texel.internalFormat = GL_RG16I; + break; + case gpu::HALF: + texel.type = GL_FLOAT; + texel.internalFormat = GL_RG16F; + break; + case gpu::UINT8: + texel.internalFormat = GL_RG8UI; + break; + case gpu::INT8: + texel.internalFormat = GL_RG8I; + break; + case gpu::NUINT8: + texel.internalFormat = GL_RG8; + break; + case gpu::NINT8: + texel.internalFormat = GL_RG8_SNORM; + break; + case gpu::NUINT32: + case gpu::NINT32: + case gpu::NUINT2: + case gpu::NINT2_10_10_10: + case gpu::COMPRESSED: + case gpu::NUINT16: + case gpu::NINT16: + case gpu::NUM_TYPES: // quiet compiler + Q_UNREACHABLE(); + } break; default: qCWarning(gpugllogging) << "Unknown combination of texel format"; diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index da9a0bd384..03fdb9d9a4 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -88,7 +88,7 @@ class AntialiasingConfig : public render::Job::Config { Q_PROPERTY(float blend MEMBER blend NOTIFY dirty) Q_PROPERTY(float sharpen MEMBER sharpen NOTIFY dirty) Q_PROPERTY(float covarianceGamma MEMBER covarianceGamma NOTIFY dirty) - + Q_PROPERTY(bool constrainColor MEMBER constrainColor NOTIFY dirty) Q_PROPERTY(bool feedbackColor MEMBER feedbackColor NOTIFY dirty)