aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mtl/GrMtlGpu.h
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2017-07-13 15:07:54 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-13 21:29:33 +0000
commitb76a72a659f53b8bf449c5ca2685045d08a21e43 (patch)
treecc2e1b3c997817f514438e79c248d3b890e65ef7 /src/gpu/mtl/GrMtlGpu.h
parentee3e0bacc8bedd1e3ebfb52fbc8b1cc3ccdad358 (diff)
Add support for creating a GrContext backed by Metal.
Also adds the support code to allow our TestContext to create a Metal backend. Bug: skia: Change-Id: Ia850687019d79b897bb16e2c151f4f8526721ad9 Reviewed-on: https://skia-review.googlesource.com/22644 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/mtl/GrMtlGpu.h')
-rw-r--r--src/gpu/mtl/GrMtlGpu.h24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/gpu/mtl/GrMtlGpu.h b/src/gpu/mtl/GrMtlGpu.h
index 7ec9907675..b63f9080be 100644
--- a/src/gpu/mtl/GrMtlGpu.h
+++ b/src/gpu/mtl/GrMtlGpu.h
@@ -16,11 +16,12 @@
#import <Metal/Metal.h>
class GrSemaphore;
+struct GrMtlBackendContext;
class GrMtlGpu : public GrGpu {
public:
- static GrGpu* Create(GrBackendContext backendContext, const GrContextOptions& options,
- GrContext* context);
+ static GrGpu* Create(GrContext* context, const GrContextOptions& options,
+ id<MTLDevice> device, id<MTLCommandQueue> queue);
~GrMtlGpu() override {}
@@ -59,19 +60,8 @@ public:
sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override { return nullptr; }
private:
- GrMtlGpu(GrContext* context, const GrContextOptions& options) : INHERITED(context) {
- id<MTLDevice> device = MTLCreateSystemDefaultDevice();
-
- MTLTextureDescriptor* txDesc = [[MTLTextureDescriptor alloc] init];
- txDesc.textureType = MTLTextureType3D;
- txDesc.height = 64;
- txDesc.width = 64;
- txDesc.depth = 64;
- txDesc.pixelFormat = MTLPixelFormatBGRA8Unorm;
- txDesc.arrayLength = 1;
- txDesc.mipmapLevelCount = 1;
- fTestHeaderTexture = [device newTextureWithDescriptor:txDesc];
- }
+ GrMtlGpu(GrContext* context, const GrContextOptions& options,
+ id<MTLDevice> device, id<MTLCommandQueue> queue);
void onResetContext(uint32_t resetBits) override {}
@@ -146,7 +136,9 @@ private:
bool isTestingOnlyBackendTexture(GrBackendObject ) const override { return false; }
void deleteTestingOnlyBackendTexture(GrBackendObject, bool abandonTexture) override {}
- id<MTLTexture> fTestHeaderTexture;
+ id<MTLDevice> fDevice;
+ id<MTLCommandQueue> fQueue;
+
typedef GrGpu INHERITED;
};