summaryrefslogtreecommitdiffstats
path: root/src/render/renderers/opengl/graphicshelpers
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-06-03 08:07:38 +0200
committerPaul Lemire <paul.lemire@kdab.com>2019-06-04 14:53:15 +0200
commit6eca6eb123588fab5db7a74718f81575f6b2220b (patch)
treebb8f9bc73b328232e8030bb4fd15cfabe84386d4 /src/render/renderers/opengl/graphicshelpers
parentdd1d8f51e67ec93031fdd7f7930d63761d1238e6 (diff)
GraphicsHelpers: add bindImageTexture support
Since GL 4.2 and ES 3.1 Change-Id: I3feaaa6e34b3031121771017763d51ac6ef07687 Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'src/render/renderers/opengl/graphicshelpers')
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp13
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp15
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp14
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp15
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp15
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp14
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp14
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h1
-rw-r--r--src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h4
15 files changed, 110 insertions, 1 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp
index 9bbb5fc5e..05b294885 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp
@@ -587,6 +587,19 @@ void GraphicsContext::bindFragOutputs(GLuint shader, const QHash<QString, int> &
m_glHelper->bindFragDataLocation(shader, outputs);
}
+void GraphicsContext::bindImageTexture(GLuint imageUnit, GLuint texture,
+ GLint mipLevel, GLboolean layered,
+ GLint layer, GLenum access, GLenum format)
+{
+ m_glHelper->bindImageTexture(imageUnit,
+ texture,
+ mipLevel,
+ layered,
+ layer,
+ access,
+ format);
+}
+
void GraphicsContext::bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
{
m_glHelper->bindUniformBlock(programId, uniformBlockIndex, uniformBlockBinding);
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h b/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h
index 9a9f1416b..a6cce47cd 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h
@@ -123,6 +123,7 @@ public:
void bindFramebuffer(GLuint fbo, GraphicsHelperInterface::FBOBindMode mode);
void bindBufferBase(GLenum target, GLuint bindingIndex, GLuint buffer);
void bindFragOutputs(GLuint shader, const QHash<QString, int> &outputs);
+ void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format);
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding);
void blendEquation(GLenum mode);
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
index 0eb7401ed..5f77dd376 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp
@@ -447,6 +447,21 @@ void GraphicsHelperES2::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode
m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId);
}
+void GraphicsHelperES2::bindImageTexture(GLuint imageUnit, GLuint texture,
+ GLint mipLevel, GLboolean layered,
+ GLint layer, GLenum access, GLenum format)
+{
+ Q_UNUSED(imageUnit)
+ Q_UNUSED(texture)
+ Q_UNUSED(mipLevel)
+ Q_UNUSED(layered)
+ Q_UNUSED(layer)
+ Q_UNUSED(access)
+ Q_UNUSED(format)
+ qWarning() << "Shader Images are not supported by ES 2.0 (since ES 3.1)";
+
+}
+
GLuint GraphicsHelperES2::boundFrameBufferObject()
{
GLint id = 0;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
index 87e4c92c8..882931ad9 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2_p.h
@@ -76,6 +76,7 @@ public:
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) override;
void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) override;
void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override;
+ void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) override;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) override;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
void blendEquation(GLenum mode) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
index a555b67ef..6b702efa4 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1.cpp
@@ -175,6 +175,7 @@ bool GraphicsHelperES3_1::supportsFeature(GraphicsHelperInterface::Feature featu
case GraphicsHelperInterface::Compute:
case GraphicsHelperInterface::ShaderStorageObject:
case GraphicsHelperInterface::IndirectDrawing:
+ case GraphicsHelperInterface::ShaderImage:
return true;
default:
break;
@@ -182,6 +183,19 @@ bool GraphicsHelperES3_1::supportsFeature(GraphicsHelperInterface::Feature featu
return GraphicsHelperES3::supportsFeature(feature);
}
+void GraphicsHelperES3_1::bindImageTexture(GLuint imageUnit, GLuint texture,
+ GLint mipLevel, GLboolean layered,
+ GLint layer, GLenum access, GLenum format)
+{
+ m_extraFuncs->glBindImageTexture(imageUnit,
+ texture,
+ mipLevel,
+ layered,
+ layer,
+ access,
+ format);
+}
+
void GraphicsHelperES3_1::dispatchCompute(GLuint wx, GLuint wy, GLuint wz)
{
m_extraFuncs->glDispatchCompute(wx, wy, wz);
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
index 2c130fbf5..43d9ae7dd 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_1_p.h
@@ -65,6 +65,7 @@ public:
~GraphicsHelperES3_1();
bool supportsFeature(Feature feature) const override;
+ void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) override;
void dispatchCompute(GLuint wx, GLuint wy, GLuint wz) override;
void memoryBarrier(QMemoryBarrier::Operations barriers) override;
void drawArraysIndirect(GLenum mode,void *indirect) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
index d6dad7de2..b9ee16acb 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2.cpp
@@ -490,6 +490,21 @@ void GraphicsHelperGL2::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode
}
}
+void GraphicsHelperGL2::bindImageTexture(GLuint imageUnit, GLuint texture,
+ GLint mipLevel, GLboolean layered,
+ GLint layer, GLenum access, GLenum format)
+{
+ Q_UNUSED(imageUnit)
+ Q_UNUSED(texture)
+ Q_UNUSED(mipLevel)
+ Q_UNUSED(layered)
+ Q_UNUSED(layer)
+ Q_UNUSED(access)
+ Q_UNUSED(format)
+ qWarning() << "Shader Images are not supported by OpenGL 2.0 (since OpenGL 4.2)";
+
+}
+
GLuint GraphicsHelperGL2::boundFrameBufferObject()
{
GLint id = 0;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
index 56e05e3ff..eb85b8537 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl2_p.h
@@ -76,6 +76,7 @@ public:
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) override;
void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) override;
void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override;
+ void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) override;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) override;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
void blendEquation(GLenum mode) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
index 9d5305059..f20491358 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2.cpp
@@ -462,6 +462,21 @@ void GraphicsHelperGL3_2::bindFrameBufferObject(GLuint frameBufferId, FBOBindMod
}
}
+void GraphicsHelperGL3_2::bindImageTexture(GLuint imageUnit, GLuint texture,
+ GLint mipLevel, GLboolean layered,
+ GLint layer, GLenum access, GLenum format)
+{
+ Q_UNUSED(imageUnit)
+ Q_UNUSED(texture)
+ Q_UNUSED(mipLevel)
+ Q_UNUSED(layered)
+ Q_UNUSED(layer)
+ Q_UNUSED(access)
+ Q_UNUSED(format)
+ qWarning() << "Shader Images are not supported by OpenGL 3.2 (since OpenGL 4.2)";
+
+}
+
GLuint GraphicsHelperGL3_2::boundFrameBufferObject()
{
GLint id = 0;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
index fc273a2c2..914afc9ff 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_2_p.h
@@ -78,6 +78,7 @@ public:
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) override;
void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) override;
void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override;
+ void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) override;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) override;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
void blendEquation(GLenum mode) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
index 6c636e292..ddffb38e2 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3.cpp
@@ -556,6 +556,20 @@ void GraphicsHelperGL3_3::bindShaderStorageBlock(GLuint programId, GLuint shader
qWarning() << "SSBO are not supported by OpenGL 3.3 (since OpenGL 4.3)";
}
+void GraphicsHelperGL3_3::bindImageTexture(GLuint imageUnit, GLuint texture,
+ GLint mipLevel, GLboolean layered,
+ GLint layer, GLenum access, GLenum format)
+{
+ Q_UNUSED(imageUnit)
+ Q_UNUSED(texture)
+ Q_UNUSED(mipLevel)
+ Q_UNUSED(layered)
+ Q_UNUSED(layer)
+ Q_UNUSED(access)
+ Q_UNUSED(format)
+ qWarning() << "Shader Images are not supported by OpenGL 3.3 (since OpenGL 4.2)";
+}
+
void GraphicsHelperGL3_3::bindBufferBase(GLenum target, GLuint index, GLuint buffer)
{
m_funcs->glBindBufferBase(target, index, buffer);
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
index 1750b66ee..4dbf6fe7b 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl3_3_p.h
@@ -79,6 +79,7 @@ public:
void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) override;
void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) override;
+ void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) override;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
void blendEquation(GLenum mode) override;
void blendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
index a8926860b..392bd4177 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4.cpp
@@ -724,6 +724,19 @@ void GraphicsHelperGL4::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode
}
}
+void GraphicsHelperGL4::bindImageTexture(GLuint imageUnit, GLuint texture,
+ GLint mipLevel, GLboolean layered,
+ GLint layer, GLenum access, GLenum format)
+{
+ m_funcs->glBindImageTexture(imageUnit,
+ texture,
+ mipLevel,
+ layered,
+ layer,
+ access,
+ format);
+}
+
GLuint GraphicsHelperGL4::boundFrameBufferObject()
{
GLint id = 0;
@@ -791,6 +804,7 @@ bool GraphicsHelperGL4::supportsFeature(GraphicsHelperInterface::Feature feature
case IndirectDrawing:
case MapBuffer:
case Fences:
+ case ShaderImage:
return true;
default:
return false;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
index 26613a39a..d3ce0d079 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelpergl4_p.h
@@ -76,6 +76,7 @@ public:
void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) override;
void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) override;
void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override;
+ void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) override;
void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) override;
void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
void blendEquation(GLenum mode) override;
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
index d91761422..21146c32b 100644
--- a/src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
+++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperinterface_p.h
@@ -83,7 +83,8 @@ public:
BlitFramebuffer,
IndirectDrawing,
MapBuffer,
- Fences
+ Fences,
+ ShaderImage
};
enum FBOBindMode {
@@ -100,6 +101,7 @@ public:
virtual void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) = 0;
virtual void bindFrameBufferAttachment(RenderBuffer *renderBuffer, const Attachment &attachment) = 0;
virtual void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) = 0;
+ virtual void bindImageTexture(GLuint imageUnit, GLuint texture, GLint mipLevel, GLboolean layered, GLint layer, GLenum access, GLenum format) = 0;
virtual void bindShaderStorageBlock(GLuint programId, GLuint shaderStorageBlockIndex, GLuint shaderStorageBlockBinding) = 0;
virtual void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) = 0;
virtual void blendEquation(GLenum mode) = 0;