diff options
author | Mike Krus <mike.krus@kdab.com> | 2019-01-23 15:23:25 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-01-23 15:24:14 +0100 |
commit | d51c6983baedc283020b39062714962b6b7d0c5e (patch) | |
tree | dbf93254ef97b0f01b043d3bd94fb840c7bec013 | |
parent | b0e11393968ceaad8c35e7df528c73a5e6111f32 (diff) | |
parent | 77aa17d543f09802f1d9eade8ab1278b0fba203f (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
.qmake.conf
src/render/renderers/opengl/textures/gltexture.cpp
Done-with: Liang Qi <liang.qi@qt.io>
Change-Id: I2b419458913a2e3cb2064b934b07b1f6ff05e3cd
4 files changed, 162 insertions, 12 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp index f41f0f0f3..71540b1ad 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp +++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp @@ -163,17 +163,29 @@ void GraphicsHelperES2::drawArrays(GLenum primitiveType, void GraphicsHelperES2::drawElementsIndirect(GLenum, GLenum, void *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "Indirect Drawing is not supported with OpenGL ES 2"; } void GraphicsHelperES2::drawArraysIndirect(GLenum , void *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "Indirect Drawing is not supported with OpenGL ES 2"; } void GraphicsHelperES2::setVerticesPerPatch(GLint verticesPerPatch) { Q_UNUSED(verticesPerPatch); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "Tessellation not supported with OpenGL ES 2"; } @@ -235,6 +247,10 @@ QVector<ShaderUniformBlock> GraphicsHelperES2::programUniformBlocks(GLuint progr { Q_UNUSED(programId); QVector<ShaderUniformBlock> blocks; + static bool showWarning = true; + if (!showWarning) + return blocks; + showWarning = false; qWarning() << "UBO are not supported by OpenGL ES 2.0 (since OpenGL ES 3.0)"; return blocks; } @@ -243,6 +259,10 @@ QVector<ShaderStorageBlock> GraphicsHelperES2::programShaderStorageBlocks(GLuint { Q_UNUSED(programId); QVector<ShaderStorageBlock> blocks; + static bool showWarning = true; + if (!showWarning) + return blocks; + showWarning = false; qWarning() << "SSBO are not supported by OpenGL ES 2.0 (since OpenGL ES 3.1)"; return blocks; } @@ -281,12 +301,20 @@ void GraphicsHelperES2::vertexAttributePointer(GLenum shaderDataType, void GraphicsHelperES2::readBuffer(GLenum mode) { Q_UNUSED(mode) + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glReadBuffer not supported by OpenGL ES 2.0 (since OpenGL ES 3.0)"; } void GraphicsHelperES2::drawBuffer(GLenum mode) { Q_UNUSED(mode); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glDrawBuffer is not supported with OpenGL ES 2"; } @@ -328,6 +356,10 @@ void GraphicsHelperES2::blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) Q_UNUSED(sfactor); Q_UNUSED(dfactor); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glBlendFunci() not supported by OpenGL ES 2.0"; } @@ -339,6 +371,10 @@ void GraphicsHelperES2::blendFuncSeparatei(GLuint buf, GLenum sRGB, GLenum dRGB, Q_UNUSED(sAlpha); Q_UNUSED(dAlpha); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glBlendFuncSeparatei() not supported by OpenGL ES 2.0"; } @@ -366,6 +402,10 @@ void GraphicsHelperES2::frontFace(GLenum mode) void GraphicsHelperES2::setMSAAEnabled(bool enabled) { Q_UNUSED(enabled); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "MSAA not available with OpenGL ES 2.0"; } @@ -479,8 +519,13 @@ bool GraphicsHelperES2::supportsFeature(GraphicsHelperInterface::Feature feature return false; } } + void GraphicsHelperES2::drawBuffers(GLsizei, const int *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "drawBuffers is not supported by ES 2.0"; } @@ -494,6 +539,10 @@ void GraphicsHelperES2::bindUniformBlock(GLuint programId, GLuint uniformBlockIn Q_UNUSED(programId); Q_UNUSED(uniformBlockIndex); Q_UNUSED(uniformBlockBinding); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "UBO are not supported by ES 2.0 (since ES 3.0)"; } @@ -502,6 +551,10 @@ void GraphicsHelperES2::bindShaderStorageBlock(GLuint programId, GLuint shaderSt Q_UNUSED(programId); Q_UNUSED(shaderStorageBlockIndex); Q_UNUSED(shaderStorageBlockBinding); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "SSBO are not supported by ES 2.0 (since ES 3.1)"; } @@ -510,6 +563,10 @@ void GraphicsHelperES2::bindBufferBase(GLenum target, GLuint index, GLuint buffe Q_UNUSED(target); Q_UNUSED(index); Q_UNUSED(buffer); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "bindBufferBase is not supported by ES 2.0 (since ES 3.0)"; } @@ -518,6 +575,10 @@ void GraphicsHelperES2::buildUniformBuffer(const QVariant &v, const ShaderUnifor Q_UNUSED(v); Q_UNUSED(description); Q_UNUSED(buffer); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "UBO are not supported by ES 2.0 (since ES 3.0)"; } @@ -593,6 +654,10 @@ void GraphicsHelperES2::disableClipPlane(int) void GraphicsHelperES2::setClipPlane(int, const QVector3D &, float) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "Clip planes not supported by OpenGL ES 2.0"; } @@ -604,6 +669,10 @@ GLint GraphicsHelperES2::maxClipPlaneCount() void GraphicsHelperES2::memoryBarrier(QMemoryBarrier::Operations barriers) { Q_UNUSED(barriers); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "memory barrier is not supported by OpenGL ES 2.0 (since 4.3)"; } @@ -624,6 +693,10 @@ void GraphicsHelperES2::clearBufferf(GLint drawbuffer, const QVector4D &values) { Q_UNUSED(drawbuffer); Q_UNUSED(values); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glClearBuffer*() not supported by OpenGL ES 2.0"; } @@ -643,6 +716,10 @@ void GraphicsHelperES2::enablei(GLenum cap, GLuint index) { Q_UNUSED(cap); Q_UNUSED(index); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glEnablei() not supported by OpenGL ES 2.0"; } @@ -650,12 +727,20 @@ void GraphicsHelperES2::disablei(GLenum cap, GLuint index) { Q_UNUSED(cap); Q_UNUSED(index); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glDisablei() not supported by OpenGL ES 2.0"; } void GraphicsHelperES2::setSeamlessCubemap(bool enable) { Q_UNUSED(enable); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "GL_TEXTURE_CUBE_MAP_SEAMLESS not supported by OpenGL ES 2.0"; } @@ -686,6 +771,10 @@ void GraphicsHelperES2::dispatchCompute(GLuint wx, GLuint wy, GLuint wz) Q_UNUSED(wx); Q_UNUSED(wy); Q_UNUSED(wz); + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "Compute Shaders are not supported by ES 2.0 (since ES 3.1)"; } @@ -693,6 +782,10 @@ char *GraphicsHelperES2::mapBuffer(GLenum target, GLsizeiptr size) { Q_UNUSED(target); Q_UNUSED(size); + static bool showWarning = true; + if (!showWarning) + return nullptr; + showWarning = false; qWarning() << "Map buffer is not a core requirement for ES 2.0"; return nullptr; } @@ -700,6 +793,10 @@ char *GraphicsHelperES2::mapBuffer(GLenum target, GLsizeiptr size) GLboolean GraphicsHelperES2::unmapBuffer(GLenum target) { Q_UNUSED(target); + static bool showWarning = true; + if (!showWarning) + return false; + showWarning = false; qWarning() << "unMap buffer is not a core requirement for ES 2.0"; return false; } @@ -746,21 +843,37 @@ void GraphicsHelperES2::glUniform4iv(GLint location, GLsizei count, const GLint void GraphicsHelperES2::glUniform1uiv(GLint , GLsizei , const GLuint *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniform1uiv not supported by ES 2"; } void GraphicsHelperES2::glUniform2uiv(GLint , GLsizei , const GLuint *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniform2uiv not supported by ES 2"; } void GraphicsHelperES2::glUniform3uiv(GLint , GLsizei , const GLuint *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniform3uiv not supported by ES 2"; } void GraphicsHelperES2::glUniform4uiv(GLint , GLsizei , const GLuint *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniform4uiv not supported by ES 2"; } @@ -781,31 +894,55 @@ void GraphicsHelperES2::glUniformMatrix4fv(GLint location, GLsizei count, const void GraphicsHelperES2::glUniformMatrix2x3fv(GLint , GLsizei , const GLfloat *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniformMatrix2x3fv not supported by ES 2"; } void GraphicsHelperES2::glUniformMatrix3x2fv(GLint , GLsizei , const GLfloat *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniformMatrix3x2fv not supported by ES 2"; } void GraphicsHelperES2::glUniformMatrix2x4fv(GLint , GLsizei , const GLfloat *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniformMatrix2x4fv not supported by ES 2"; } void GraphicsHelperES2::glUniformMatrix4x2fv(GLint , GLsizei , const GLfloat *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniformMatrix4x2fv not supported by ES 2"; } void GraphicsHelperES2::glUniformMatrix3x4fv(GLint , GLsizei , const GLfloat *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniformMatrix3x4fv not supported by ES 2"; } void GraphicsHelperES2::glUniformMatrix4x3fv(GLint , GLsizei , const GLfloat *) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "glUniformMatrix4x3fv not supported by ES 2"; } @@ -854,9 +991,13 @@ UniformType GraphicsHelperES2::uniformTypeFromGLType(GLenum type) void GraphicsHelperES2::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { - if (!m_supportFramebufferBlit) + if (!m_supportFramebufferBlit) { + static bool showWarning = true; + if (!showWarning) + return; + showWarning = false; qWarning() << "Framebuffer blits are not supported by ES 2.0 (since ES 3.1)"; - else + } else m_ext->glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp index 71bd6aa9c..d1ac853ea 100644 --- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -1312,14 +1312,15 @@ bool SubmissionContext::setParameters(ShaderParameterPack ¶meterPack) GLTexture *t = manager->glTextureManager()->lookupResource(namedTex.texId); if (t != nullptr) { UniformValue &texUniform = uniformValues[namedTex.glslNameId]; - Q_ASSERT(texUniform.valueType() == UniformValue::TextureValue); - const int texUnit = activateTexture(TextureScopeMaterial, t); - texUniform.data<int>()[namedTex.uniformArrayIndex] = texUnit; - if (texUnit == -1) { - if (namedTex.glslNameId != irradianceId && - namedTex.glslNameId != specularId) { - // Only return false if we are not dealing with env light textures - return false; + if (texUniform.valueType() == UniformValue::TextureValue) { + const int texUnit = activateTexture(TextureScopeMaterial, t); + texUniform.data<int>()[namedTex.uniformArrayIndex] = texUnit; + if (texUnit == -1) { + if (namedTex.glslNameId != irradianceId && + namedTex.glslNameId != specularId) { + // Only return false if we are not dealing with env light textures + return false; + } } } } diff --git a/src/render/renderers/opengl/textures/gltexture.cpp b/src/render/renderers/opengl/textures/gltexture.cpp index 8efc34f23..47a97c688 100644 --- a/src/render/renderers/opengl/textures/gltexture.cpp +++ b/src/render/renderers/opengl/textures/gltexture.cpp @@ -80,6 +80,7 @@ GLTexture::GLTexture(TextureDataManager *texDataMgr, , m_textureImageDataManager(texImgDataMgr) , m_dataFunctor(texGen) , m_sharedTextureId(-1) + , m_pendingDataFunctor(nullptr) , m_externalRendering(false) { // make sure texture generator is executed @@ -199,7 +200,10 @@ GLTexture::TextureUpdateInfo GLTexture::createOrUpdateGLTexture() setDirtyFlag(Properties, true); needUpload = true; } else { - qWarning() << "[Qt3DRender::GLTexture] No QTextureData generated from Texture Generator yet. Texture will be invalid for this frame"; + if (m_pendingDataFunctor != m_dataFunctor.get()) { + qWarning() << "[Qt3DRender::GLTexture] No QTextureData generated from Texture Generator yet. Texture will be invalid for this frame"; + m_pendingDataFunctor = m_dataFunctor.get(); + } textureInfo.properties.status = QAbstractTexture::Loading; return textureInfo; } @@ -292,7 +296,10 @@ RenderBuffer *GLTexture::getOrCreateRenderBuffer() setDirtyFlag(Properties); } else { - qWarning() << "[Qt3DRender::GLTexture] [renderbuffer] No QTextureData generated from Texture Generator yet. Texture will be invalid for this frame"; + if (m_pendingDataFunctor != m_dataFunctor.get()) { + qWarning() << "[Qt3DRender::GLTexture] [renderbuffer] No QTextureData generated from Texture Generator yet. Texture will be invalid for this frame"; + m_pendingDataFunctor = m_dataFunctor.get(); + } return nullptr; } } diff --git a/src/render/renderers/opengl/textures/gltexture_p.h b/src/render/renderers/opengl/textures/gltexture_p.h index 47ecfdfa8..66f66926c 100644 --- a/src/render/renderers/opengl/textures/gltexture_p.h +++ b/src/render/renderers/opengl/textures/gltexture_p.h @@ -253,6 +253,7 @@ private: TextureParameters m_parameters; QTextureGeneratorPtr m_dataFunctor; + QTextureGenerator *m_pendingDataFunctor; QVector<Image> m_images; // cache actual image data generated by the functors |