aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-06-27 09:29:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-27 09:29:07 -0700
commitc411f2d963cdee3a934c9ff65b0728d2b927586a (patch)
tree7720a0f08fbbf9742995ecd855b64dff4181aae7 /src
parent790a70118327a129cb6b48fabe80f4e184c1e67c (diff)
Add a GL cap for instanced rendering to floating point
We have observed on OS X that instanced draws don't always behave correctly when the framebuffer is floating point. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2095183002 Review-Url: https://codereview.chromium.org/2095183002
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp10
-rw-r--r--src/gpu/gl/GrGLCaps.h4
2 files changed, 14 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 9dd0fbe36e..431390697b 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -40,6 +40,7 @@ GrGLCaps::GrGLCaps(const GrContextOptions& contextOptions,
fDrawIndirectSupport = false;
fMultiDrawIndirectSupport = false;
fBaseInstanceSupport = false;
+ fCanDrawIndirectToFloat = false;
fUseNonVBOVertexAndIndexDynamicData = false;
fIsCoreProfile = false;
fBindFragDataLocationSupport = false;
@@ -530,6 +531,14 @@ void GrGLCaps::init(const GrContextOptions& contextOptions,
fBaseInstanceSupport = ctxInfo.hasExtension("GL_EXT_base_instance");
}
+ // OS X doesn't seem to write correctly to floating point textures when using glDraw*Indirect,
+ // regardless of the underlying GPU.
+#ifndef SK_BUILD_FOR_MAC
+ if (fDrawIndirectSupport) {
+ fCanDrawIndirectToFloat = true;
+ }
+#endif
+
this->initShaderPrecisionTable(ctxInfo, gli, glslCaps);
if (contextOptions.fUseShaderSwizzling) {
@@ -1112,6 +1121,7 @@ SkString GrGLCaps::dump() const {
r.appendf("Draw indirect support: %s\n", (fDrawIndirectSupport ? "YES" : "NO"));
r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ? "YES" : "NO"));
r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO"));
+ r.appendf("Can draw indirect to float: %s\n", (fCanDrawIndirectToFloat ? "YES" : "NO"));
r.appendf("Use non-VBO for dynamic data: %s\n",
(fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO"));
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 0cb353aa9f..1ccdf3e79c 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -307,6 +307,9 @@ public:
/// Are the baseInstance fields supported in indirect draw commands?
bool baseInstanceSupport() const { return fBaseInstanceSupport; }
+ /// Does the platform have known issuses rendering to floating point when using glDraw*Indirect?
+ bool canDrawIndirectToFloat() const { return fCanDrawIndirectToFloat; }
+
/// Use indices or vertices in CPU arrays rather than VBOs for dynamic content.
bool useNonVBOVertexAndIndexDynamicData() const { return fUseNonVBOVertexAndIndexDynamicData; }
@@ -398,6 +401,7 @@ private:
bool fDrawIndirectSupport : 1;
bool fMultiDrawIndirectSupport : 1;
bool fBaseInstanceSupport : 1;
+ bool fCanDrawIndirectToFloat : 1;
bool fUseNonVBOVertexAndIndexDynamicData : 1;
bool fIsCoreProfile : 1;
bool fBindFragDataLocationSupport : 1;