diff options
author | Brian Salomon <bsalomon@google.com> | 2017-10-09 13:02:49 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-09 20:24:04 +0000 |
commit | 7f56d3d2d865a9fed44c420bd3b9497118b7ed26 (patch) | |
tree | d8f5f15eb65e087d153a783cbfd10cb23939aab6 /src/gpu | |
parent | c795a4c8862dbab914561fadf7a3567c55362ae4 (diff) |
Revert "Revert "Disable GL buffer mapping on TSAN/Mac.""
This reverts commit 4e7cdd5a0052aa76bed6f80ec325be19e09e6ab1.
Bug: skia:7058
Change-Id: I3b92c35835cf7a8c04e9218194bf293b790413e0
Reviewed-on: https://skia-review.googlesource.com/57222
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrResourceProvider.cpp | 27 | ||||
-rw-r--r-- | src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp | 1 | ||||
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 8 | ||||
-rw-r--r-- | src/gpu/instanced/GLInstancedRendering.cpp | 3 |
4 files changed, 27 insertions, 12 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index d50bb01f86..d68a5e6701 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -330,13 +330,17 @@ const GrBuffer* GrResourceProvider::createPatternedIndexBuffer(const uint16_t* p size_t bufferSize = patternSize * reps * sizeof(uint16_t); // This is typically used in GrMeshDrawOps, so we assume kNoPendingIO. - GrBuffer* buffer = this->createBuffer(bufferSize, kIndex_GrBufferType, kStatic_GrAccessPattern, - kNoPendingIO_Flag); + sk_sp<GrBuffer> buffer(this->createBuffer(bufferSize, kIndex_GrBufferType, + kStatic_GrAccessPattern, kNoPendingIO_Flag)); if (!buffer) { return nullptr; } - - SkAutoTArray<uint16_t> data(reps * patternSize); + uint16_t* data = (uint16_t*) buffer->map(); + SkAutoTArray<uint16_t> temp; + if (!data) { + temp.reset(reps * patternSize); + data = temp.get(); + } for (int i = 0; i < reps; ++i) { int baseIdx = i * patternSize; uint16_t baseVert = (uint16_t)(i * vertCount); @@ -344,14 +348,15 @@ const GrBuffer* GrResourceProvider::createPatternedIndexBuffer(const uint16_t* p data[baseIdx+j] = baseVert + pattern[j]; } } - - if (!buffer->updateData(data.get(), bufferSize)) { - buffer->unref(); - return nullptr; + if (temp.get()) { + if (!buffer->updateData(data, bufferSize)) { + return nullptr; + } + } else { + buffer->unmap(); } - - this->assignUniqueKeyToResource(key, buffer); - return buffer; + this->assignUniqueKeyToResource(key, buffer.get()); + return buffer.release(); } static constexpr int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1; diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp index a5b423010d..877c8727b0 100644 --- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp +++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp @@ -32,6 +32,7 @@ bool GrCoverageCountingPathRenderer::IsSupported(const GrCaps& caps) { caps.instanceAttribSupport() && caps.isConfigTexturable(kAlpha_half_GrPixelConfig) && caps.isConfigRenderable(kAlpha_half_GrPixelConfig, /*withMSAA=*/false) && + GrCaps::kNone_MapFlags != caps.mapBufferFlags() && !caps.blacklistCoverageCounting(); } diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index af04dc7771..94c5f2e184 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -481,6 +481,14 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, } } +#if defined(__has_feature) +#if defined(SK_BUILD_FOR_MAC) && __has_feature(thread_sanitizer) + // See skbug.com/7058 + fMapBufferType = kNone_MapBufferType; + fMapBufferFlags = kNone_MapFlags; +#endif +#endif + // We found that the Galaxy J5 with an Adreno 306 running 6.0.1 has a bug where // GL_INVALID_OPERATION thrown by glDrawArrays when using a buffer that was mapped. The same bug // did not reproduce on a Nexus7 2013 with a 320 running Android M with driver 127.0. It's diff --git a/src/gpu/instanced/GLInstancedRendering.cpp b/src/gpu/instanced/GLInstancedRendering.cpp index df51cd827c..bb733c2b81 100644 --- a/src/gpu/instanced/GLInstancedRendering.cpp +++ b/src/gpu/instanced/GLInstancedRendering.cpp @@ -37,7 +37,8 @@ GrCaps::InstancedSupport GLInstancedRendering::CheckSupport(const GrGLCaps& glCa // This method is only intended to be used for initializing fInstancedSupport in the caps. SkASSERT(GrCaps::InstancedSupport::kNone == glCaps.instancedSupport()); if (!glCaps.vertexArrayObjectSupport() || - (!glCaps.drawIndirectSupport() && !glCaps.drawInstancedSupport())) { + (!glCaps.drawIndirectSupport() && !glCaps.drawInstancedSupport()) || + GrGLCaps::kNone_MapBufferType == glCaps.mapBufferType()) { return GrCaps::InstancedSupport::kNone; } return InstanceProcessor::CheckSupport(*glCaps.shaderCaps(), glCaps); |