diff options
Diffstat (limited to 'src/plugins/renderers/opengl/graphicshelpers')
7 files changed, 38 insertions, 10 deletions
diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp index 97a256b9c..2a0f449fb 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3.cpp @@ -263,6 +263,17 @@ void GraphicsHelperES3::drawArraysInstanced(GLenum primitiveType, GLint first, G instances); } +void GraphicsHelperES3::drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) +{ + if (baseInstance != 0) + qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 3"; + + m_extraFuncs->glDrawArraysInstanced(primitiveType, + first, + count, + instances); +} + void GraphicsHelperES3::readBuffer(GLenum mode) { m_extraFuncs->glReadBuffer(mode); diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp index 65108800b..5f5bc8578 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_2.cpp @@ -140,7 +140,7 @@ void GraphicsHelperES3_2::setVerticesPerPatch(GLint verticesPerPatch) void GraphicsHelperES3_2::drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex, GLint baseInstance) { if (baseInstance != 0) - qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2"; + qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 3.2"; m_extraFuncs->glDrawElementsInstancedBaseVertex(primitiveType, primitiveCount, diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h index 5c34a8abb..9ac9ea159 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelperes3_p.h @@ -76,6 +76,7 @@ public: void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) override; void drawBuffers(GLsizei n, const int *bufs) override; void drawArraysInstanced(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances) override; + void drawArraysInstancedBaseInstance(GLenum primitiveType, GLint first, GLsizei count, GLsizei instances, GLsizei baseInstance) override; void drawElementsInstancedBaseVertexBaseInstance(GLenum primitiveType, GLsizei primitiveCount, GLint indexType, void *indices, GLsizei instances, GLint baseVertex = 0, GLint baseInstance = 0) override; void readBuffer(GLenum mode) override; void drawBuffer(GLenum mode) override; diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp index 8e843bca7..d220fb16d 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp @@ -105,7 +105,7 @@ void GraphicsHelperGL3_2::drawElementsInstancedBaseVertexBaseInstance(GLenum pri GLint baseInstance) { if (baseInstance != 0) - qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2"; + qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL 3.2"; // glDrawElements OpenGL 3.1 or greater m_funcs->glDrawElementsInstancedBaseVertex(primitiveType, diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp index 3a8c8bde8..065cb1c0b 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp @@ -104,7 +104,7 @@ void GraphicsHelperGL3_3::drawElementsInstancedBaseVertexBaseInstance(GLenum pri GLint baseInstance) { if (baseInstance != 0) - qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL 3"; + qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL 3.3"; // glDrawElements OpenGL 3.1 or greater m_funcs->glDrawElementsInstancedBaseVertex(primitiveType, diff --git a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp index f23dd8485..7130bb0be 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp @@ -188,16 +188,13 @@ void GraphicsHelperGL4::drawElementsInstancedBaseVertexBaseInstance(GLenum primi GLint baseVertex, GLint baseInstance) { - if (baseInstance != 0) - qWarning() << "glDrawElementsInstancedBaseVertexBaseInstance is not supported with OpenGL ES 2"; - - // glDrawElements OpenGL 3.1 or greater - m_funcs->glDrawElementsInstancedBaseVertex(primitiveType, + m_funcs->glDrawElementsInstancedBaseVertexBaseInstance(primitiveType, primitiveCount, indexType, indices, instances, - baseVertex); + baseVertex, + baseInstance); } void GraphicsHelperGL4::drawArraysInstanced(GLenum primitiveType, @@ -634,6 +631,7 @@ UniformType GraphicsHelperGL4::uniformTypeFromGLType(GLenum type) case GL_SAMPLER_1D: case GL_SAMPLER_1D_ARRAY: case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_1D_ARRAY_SHADOW: case GL_SAMPLER_2D: case GL_SAMPLER_2D_RECT: case GL_SAMPLER_2D_SHADOW: @@ -652,6 +650,7 @@ UniformType GraphicsHelperGL4::uniformTypeFromGLType(GLenum type) case GL_INT_SAMPLER_2D: case GL_INT_SAMPLER_3D: case GL_INT_SAMPLER_BUFFER: + case GL_INT_SAMPLER_2D_RECT: case GL_INT_SAMPLER_CUBE: case GL_INT_SAMPLER_CUBE_MAP_ARRAY: case GL_INT_SAMPLER_1D_ARRAY: @@ -662,6 +661,7 @@ UniformType GraphicsHelperGL4::uniformTypeFromGLType(GLenum type) case GL_UNSIGNED_INT_SAMPLER_2D: case GL_UNSIGNED_INT_SAMPLER_3D: case GL_UNSIGNED_INT_SAMPLER_BUFFER: + case GL_UNSIGNED_INT_SAMPLER_2D_RECT: case GL_UNSIGNED_INT_SAMPLER_1D_ARRAY: case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: @@ -1078,17 +1078,21 @@ void GraphicsHelperGL4::buildUniformBuffer(const QVariant &v, const ShaderUnifor case GL_INT_SAMPLER_2D: case GL_INT_SAMPLER_3D: case GL_INT_SAMPLER_CUBE: + case GL_INT_SAMPLER_CUBE_MAP_ARRAY: case GL_INT_SAMPLER_BUFFER: case GL_INT_SAMPLER_2D_RECT: case GL_UNSIGNED_INT_SAMPLER_1D: case GL_UNSIGNED_INT_SAMPLER_2D: case GL_UNSIGNED_INT_SAMPLER_3D: case GL_UNSIGNED_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY: case GL_UNSIGNED_INT_SAMPLER_BUFFER: case GL_UNSIGNED_INT_SAMPLER_2D_RECT: case GL_SAMPLER_1D_SHADOW: case GL_SAMPLER_2D_SHADOW: case GL_SAMPLER_CUBE_SHADOW: + case GL_SAMPLER_CUBE_MAP_ARRAY: + case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW: case GL_SAMPLER_1D_ARRAY: case GL_SAMPLER_2D_ARRAY: case GL_INT_SAMPLER_1D_ARRAY: @@ -1251,6 +1255,10 @@ uint GraphicsHelperGL4::uniformByteSize(const ShaderUniform &description) case GL_SAMPLER_1D_SHADOW: case GL_SAMPLER_2D_SHADOW: case GL_SAMPLER_CUBE_SHADOW: + case GL_SAMPLER_CUBE_MAP_ARRAY: + case GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW: + case GL_INT_SAMPLER_CUBE_MAP_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY: case GL_SAMPLER_1D_ARRAY: case GL_SAMPLER_2D_ARRAY: case GL_INT_SAMPLER_1D_ARRAY: diff --git a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp index ab5948e49..7ba67fed9 100644 --- a/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -481,6 +481,10 @@ bool SubmissionContext::beginDrawing(QSurface *surface) } m_boundArrayBuffer = nullptr; + + // Record the default FBO value as there's no guarantee it remains constant over time + m_defaultFBO = m_gl->defaultFramebufferObject(); + return true; } @@ -1226,6 +1230,10 @@ bool SubmissionContext::setParameters(ShaderParameterPack ¶meterPack, GLShad } } + // Set the pinned images of the previous material + // to pinable so that we should easily find an available image unit + m_imageContext.deactivateImages(); + // Fill Image Uniform Value with proper image units // so that they can be applied as regular uniforms in a second step for (int i = 0; i < parameterPack.images().size(); ++i) { @@ -1598,7 +1606,7 @@ void SubmissionContext::blitFramebuffer(Qt3DCore::QNodeId inputRenderTargetId, if (!outputBufferIsDefault) { // Note that we use glDrawBuffers, not glDrawBuffer. The // latter is not available with GLES. - const int buf = glAttachmentPoint(outputAttachmentPoint); + const int buf = outputAttachmentPoint; drawBuffers(1, &buf); } |