Prepare texture for cross context usage when using the Metal backend.

This implementation will only work when the two contexts are created using
the same device and command queue. This restriction is now applied in Flutter.
With the patch and context setup, async texture uploads on the IO thread are
functional.

Change-Id: I887d24b2612cde933e088f74f33912a3a8762159
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275758
Commit-Queue: Chinmay Garde <chinmaygarde@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Chinmay Garde <chinmaygarde@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Chinmay Garde 2020-03-06 16:29:02 -08:00 committed by Skia Commit-Bot
parent 1b0124fec6
commit cf573d844d
2 changed files with 6 additions and 3 deletions

View File

@ -100,9 +100,7 @@ public:
void insertSemaphore(GrSemaphore* semaphore) override;
void waitSemaphore(GrSemaphore* semaphore) override;
void checkFinishProcs() override;
std::unique_ptr<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override {
return nullptr;
}
std::unique_ptr<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override;
// When the Metal backend actually uses indirect command buffers, this function will actually do
// what it says. For now, every command is encoded directly into the primary command buffer, so

View File

@ -226,6 +226,11 @@ void GrMtlGpu::checkFinishProcs() {
}
}
std::unique_ptr<GrSemaphore> GrMtlGpu::prepareTextureForCrossContextUsage(GrTexture*) {
submitCommandBuffer(SyncQueue::kSkip_SyncQueue);
return nullptr;
}
sk_sp<GrGpuBuffer> GrMtlGpu::onCreateBuffer(size_t size, GrGpuBufferType type,
GrAccessPattern accessPattern, const void* data) {
return GrMtlBuffer::Make(this, size, type, accessPattern, data);