aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/mtl/GrMtlGpu.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/mtl/GrMtlGpu.mm')
-rw-r--r--src/gpu/mtl/GrMtlGpu.mm29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 7d9339cf29..986bb8a6f7 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -11,8 +11,31 @@
#error This file must be compiled with Arc. Use -fobjc-arc flag
#endif
-GrGpu* GrMtlGpu::Create(GrBackendContext backendContext, const GrContextOptions& options,
- GrContext* context) {
- return nullptr;
+GrGpu* GrMtlGpu::Create(GrContext* context, const GrContextOptions& options,
+ id<MTLDevice> device, id<MTLCommandQueue> queue) {
+ if (!device || !queue) {
+ return nullptr;
+ }
+ return new GrMtlGpu(context, options, device, queue);
}
+GrMtlGpu::GrMtlGpu(GrContext* context, const GrContextOptions& options,
+ id<MTLDevice> device, id<MTLCommandQueue> queue)
+ : INHERITED(context)
+ , fDevice(device)
+ , fQueue(queue) {
+ MTLTextureDescriptor* txDesc = [[MTLTextureDescriptor alloc] init];
+ txDesc.textureType = MTLTextureType3D;
+ txDesc.height = 64;
+ txDesc.width = 64;
+ txDesc.depth = 64;
+ txDesc.pixelFormat = MTLPixelFormatRGBA8Unorm;
+ txDesc.arrayLength = 1;
+ txDesc.mipmapLevelCount = 1;
+ id<MTLTexture> testTexture = [fDevice newTextureWithDescriptor:txDesc];
+ // To get ride of unused var warning
+ int width = [testTexture width];
+ SkDebugf("width: %d\n", width);
+ // Unused queue warning fix
+ SkDebugf("ptr to queue: %p\n", fQueue);
+}