1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrMockAttachment_DEFINED 9 #define GrMockAttachment_DEFINED 10 11 #include "src/gpu/ganesh/GrAttachment.h" 12 #include "src/gpu/ganesh/GrBackendUtils.h" 13 #include "src/gpu/ganesh/mock/GrMockGpu.h" 14 15 class GrMockAttachment : public GrAttachment { 16 public: GrMockAttachment(GrMockGpu * gpu,SkISize dimensions,UsageFlags supportedUsages,int sampleCnt,std::string_view label)17 GrMockAttachment(GrMockGpu* gpu, 18 SkISize dimensions, 19 UsageFlags supportedUsages, 20 int sampleCnt, 21 std::string_view label) 22 : INHERITED(gpu, dimensions, supportedUsages, sampleCnt, GrMipmapped::kNo, 23 GrProtected::kNo, label) { 24 SkASSERT(supportedUsages == UsageFlags::kStencilAttachment); 25 this->registerWithCache(skgpu::Budgeted::kYes); 26 } 27 backendFormat()28 GrBackendFormat backendFormat() const override { 29 return GrBackendFormat::MakeMock(GrColorType::kUnknown, SkImage::CompressionType::kNone, 30 /*isStencilFormat*/ true); 31 } 32 33 private: 34 using INHERITED = GrAttachment; 35 }; 36 37 #endif 38