blob: 208318cf9d7c5915b8bb812aa6ab13e3b63f36d6 [file]
/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef skgpu_graphite_MtlBuffer_DEFINED
#define skgpu_graphite_MtlBuffer_DEFINED
#include "include/core/SkRefCnt.h"
#include "include/ports/SkCFObject.h"
#include "src/gpu/graphite/Buffer.h"
#import <Metal/Metal.h>
namespace skgpu::graphite {
class MtlSharedContext;
class MtlBuffer final : public Buffer {
public:
static sk_sp<Buffer> Make(const MtlSharedContext*,
size_t,
BufferType,
AccessPattern,
std::string_view label);
id<MTLBuffer> mtlBuffer() const { return fBuffer.get(); }
private:
MtlBuffer(const MtlSharedContext*, size_t, sk_cfp<id<MTLBuffer>>, std::string_view label);
void onMap() override;
void onUnmap() override;
void freeGpuData() override;
void setBackendLabel(char const* label) override;
sk_cfp<id<MTLBuffer>> fBuffer;
};
} // namespace skgpu::graphite
#endif // skgpu_graphite_MtlBuffer_DEFINED