aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar cdalton <cdalton@nvidia.com>2015-04-21 11:45:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-21 11:45:56 -0700
commitfd4167ddf12ea723b828462ec1507acebdef5776 (patch)
tree88b2ded78a3c7a85637cc097a78b472e89b1061b /src
parentd557462f1fd274400107dd28ea36900da51e42a6 (diff)
Import glTextureBarrier
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrDrawTarget.cpp3
-rw-r--r--src/gpu/GrDrawTargetCaps.h2
-rw-r--r--src/gpu/gl/GrGLAssembleInterface.cpp9
-rw-r--r--src/gpu/gl/GrGLCaps.cpp8
-rw-r--r--src/gpu/gl/GrGLInterface.cpp15
5 files changed, 37 insertions, 0 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 5b29b9e8b5..bca347dbea 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -1063,6 +1063,7 @@ void GrDrawTargetCaps::reset() {
fGpuTracingSupport = false;
fCompressedTexSubImageSupport = false;
fOversizedStencilSupport = false;
+ fTextureBarrierSupport = false;
fUseDrawInsteadOfClear = false;
@@ -1093,6 +1094,7 @@ GrDrawTargetCaps& GrDrawTargetCaps::operator=(const GrDrawTargetCaps& other) {
fGpuTracingSupport = other.fGpuTracingSupport;
fCompressedTexSubImageSupport = other.fCompressedTexSubImageSupport;
fOversizedStencilSupport = other.fOversizedStencilSupport;
+ fTextureBarrierSupport = other.fTextureBarrierSupport;
fUseDrawInsteadOfClear = other.fUseDrawInsteadOfClear;
@@ -1175,6 +1177,7 @@ SkString GrDrawTargetCaps::dump() const {
r.appendf("Gpu Tracing Support : %s\n", gNY[fGpuTracingSupport]);
r.appendf("Compressed Update Support : %s\n", gNY[fCompressedTexSubImageSupport]);
r.appendf("Oversized Stencil Support : %s\n", gNY[fOversizedStencilSupport]);
+ r.appendf("Texture Barrier Support : %s\n", gNY[fTextureBarrierSupport]);
r.appendf("Draw Instead of Clear [workaround] : %s\n", gNY[fUseDrawInsteadOfClear]);
r.appendf("Max Texture Size : %d\n", fMaxTextureSize);
diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h
index 08f4f43382..e1fd1cf403 100644
--- a/src/gpu/GrDrawTargetCaps.h
+++ b/src/gpu/GrDrawTargetCaps.h
@@ -86,6 +86,7 @@ public:
#endif
bool compressedTexSubImageSupport() const { return fCompressedTexSubImageSupport; }
bool oversizedStencilSupport() const { return fOversizedStencilSupport; }
+ bool textureBarrierSupport() const { return fTextureBarrierSupport; }
bool useDrawInsteadOfClear() const { return fUseDrawInsteadOfClear; }
@@ -157,6 +158,7 @@ protected:
bool fGpuTracingSupport : 1;
bool fCompressedTexSubImageSupport : 1;
bool fOversizedStencilSupport : 1;
+ bool fTextureBarrierSupport : 1;
// Driver workaround
bool fUseDrawInsteadOfClear : 1;
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index 6a4fbe20e0..b0f0430ffb 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -163,6 +163,11 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC_SUFFIX(TexStorage2D, EXT);
}
GET_PROC(TexSubImage2D);
+ if (glVer >= GR_GL_VER(4,5) || extensions.has("GL_ARB_texture_barrier")) {
+ GET_PROC(TextureBarrier);
+ } else if (extensions.has("GL_NV_texture_barrier")) {
+ GET_PROC_SUFFIX(TextureBarrier, NV);
+ }
GET_PROC(Uniform1f);
GET_PROC(Uniform1i);
GET_PROC(Uniform1fv);
@@ -404,6 +409,10 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC_SUFFIX(TexStorage2D, EXT);
}
+ if (extensions.has("GL_NV_texture_barrier")) {
+ GET_PROC_SUFFIX(TextureBarrier, NV);
+ }
+
GET_PROC_SUFFIX(DiscardFramebuffer, EXT);
GET_PROC(Uniform1f);
GET_PROC(Uniform1i);
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 895cce870e..73bf6f0ee6 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -186,6 +186,14 @@ bool GrGLCaps::init(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
ctxInfo.hasExtension("GL_EXT_texture_storage");
}
+ if (kGL_GrGLStandard == standard) {
+ fTextureBarrierSupport = version >= GR_GL_VER(4,5) ||
+ ctxInfo.hasExtension("GL_ARB_texture_barrier") ||
+ ctxInfo.hasExtension("GL_NV_texture_barrier");
+ } else {
+ fTextureBarrierSupport = ctxInfo.hasExtension("GL_NV_texture_barrier");
+ }
+
// ARB_texture_rg is part of OpenGL 3.0, but mesa doesn't support GL_RED
// and GL_RG on FBO textures.
if (!ctxInfo.isMesa()) {
diff --git a/src/gpu/gl/GrGLInterface.cpp b/src/gpu/gl/GrGLInterface.cpp
index 2e3dd1f039..da1c3fc0e1 100644
--- a/src/gpu/gl/GrGLInterface.cpp
+++ b/src/gpu/gl/GrGLInterface.cpp
@@ -306,6 +306,21 @@ bool GrGLInterface::validate() const {
}
}
+ // glTextureBarrier is part of desktop 4.5. There are also ARB and NV extensions.
+ if (kGL_GrGLStandard == fStandard) {
+ if (glVer >= GR_GL_VER(4,5) ||
+ fExtensions.has("GL_ARB_texture_barrier") ||
+ fExtensions.has("GL_NV_texture_barrier")) {
+ if (NULL == fFunctions.fTextureBarrier) {
+ RETURN_FALSE_INTERFACE
+ }
+ }
+ } else if (fExtensions.has("GL_NV_texture_barrier")) {
+ if (NULL == fFunctions.fTextureBarrier) {
+ RETURN_FALSE_INTERFACE
+ }
+ }
+
if (fExtensions.has("GL_EXT_discard_framebuffer")) {
// FIXME: Remove this once Chromium is updated to provide this function
#if 0