Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit cf573d8

Browse files
chinmaygardeSkia Commit-Bot
authored and
Skia Commit-Bot
committed
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 <[email protected]> Commit-Queue: Greg Daniel <[email protected]> Auto-Submit: Chinmay Garde <[email protected]> Reviewed-by: Greg Daniel <[email protected]>
1 parent 1b0124f commit cf573d8

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/gpu/mtl/GrMtlGpu.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ class GrMtlGpu : public GrGpu {
100100
void insertSemaphore(GrSemaphore* semaphore) override;
101101
void waitSemaphore(GrSemaphore* semaphore) override;
102102
void checkFinishProcs() override;
103-
std::unique_ptr<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override {
104-
return nullptr;
105-
}
103+
std::unique_ptr<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override;
106104

107105
// When the Metal backend actually uses indirect command buffers, this function will actually do
108106
// what it says. For now, every command is encoded directly into the primary command buffer, so

src/gpu/mtl/GrMtlGpu.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ static bool get_feature_set(id<MTLDevice> device, MTLFeatureSet* featureSet) {
226226
}
227227
}
228228

229+
std::unique_ptr<GrSemaphore> GrMtlGpu::prepareTextureForCrossContextUsage(GrTexture*) {
230+
submitCommandBuffer(SyncQueue::kSkip_SyncQueue);
231+
return nullptr;
232+
}
233+
229234
sk_sp<GrGpuBuffer> GrMtlGpu::onCreateBuffer(size_t size, GrGpuBufferType type,
230235
GrAccessPattern accessPattern, const void* data) {
231236
return GrMtlBuffer::Make(this, size, type, accessPattern, data);

0 commit comments

Comments
 (0)