Disable GL buffer mapping on TSAN/Mac.

Also reverts 65e7063796 which disabled buffer mapping in GrResourceProvider::createPatternedIndexBuffer.

Bug: skia:7058
Change-Id: I6816abe53251e1cd8e92eae41b8cdbe45218a341
Reviewed-on: https://skia-review.googlesource.com/50100
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2017-09-23 08:31:08 -04:00 committed by Skia Commit-Bot
parent 67ef5d7640
commit c203e65265
5 changed files with 32 additions and 13 deletions

View File

@ -195,7 +195,8 @@ def dm_flags(api, bot):
configs = [x.replace(old, new) for x in configs]
# We also test non-msaa instanced.
configs.append(new)
elif 'MacMini7.1' in bot:
elif 'MacMini7.1' in bot and 'TSAN' not in bot:
# The TSAN bot disables GL buffer mapping which is required for inst.
configs.extend([gl_prefix + 'inst'])
# CommandBuffer bot *only* runs the command_buffer config.

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -64,6 +64,10 @@ bool does_full_buffer_contain_correct_values(GrColor* srcBuffer,
void basic_transfer_test(skiatest::Reporter* reporter, GrContext* context, GrPixelConfig config,
GrSurfaceOrigin origin, bool renderTarget) {
if (GrCaps::kNone_MapFlags == context->caps()->mapBufferFlags()) {
return;
}
// set up the data
const int kTextureWidth = 16;
const int kTextureHeight = 16;