/* * Copyright 2019 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrMtlCommandBuffer_DEFINED #define GrMtlCommandBuffer_DEFINED #import #include "include/core/SkRefCnt.h" class GrMtlGpu; class GrMtlPipelineState; class GrMtlGpuRTCommandBuffer; class GrMtlCommandBuffer { public: static GrMtlCommandBuffer* Create(id queue); ~GrMtlCommandBuffer(); void commit(bool waitUntilCompleted); id getBlitCommandEncoder(); id getRenderCommandEncoder(MTLRenderPassDescriptor*, const GrMtlPipelineState*, GrMtlGpuRTCommandBuffer* gpuCommandBuffer); void addCompletedHandler(MTLCommandBufferHandler block) { [fCmdBuffer addCompletedHandler:block]; } private: GrMtlCommandBuffer(id cmdBuffer) : fCmdBuffer(cmdBuffer) , fPreviousRenderPassDescriptor(nil) {} void endAllEncoding(); id fCmdBuffer; id fActiveBlitCommandEncoder; id fActiveRenderCommandEncoder; MTLRenderPassDescriptor* fPreviousRenderPassDescriptor; }; #endif