1 /* 2 * Copyright 2019 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 GrDawnStencil_DEFINED 9 #define GrDawnStencil_DEFINED 10 11 #include "src/gpu/GrStencilAttachment.h" 12 13 #include "dawn/dawncpp.h" 14 15 class GrDawnGpu; 16 17 class GrDawnStencilAttachment : public GrStencilAttachment { 18 public: 19 static GrDawnStencilAttachment* Create(GrDawnGpu* gpu, int width, int height, 20 int sampleCnt); 21 22 ~GrDawnStencilAttachment() override; view()23 dawn::TextureView view() const { return fView; } 24 25 protected: 26 void onRelease() override; 27 void onAbandon() override; 28 29 private: 30 size_t onGpuMemorySize() const override; 31 32 GrDawnStencilAttachment(GrDawnGpu* gpu, int width, int height, int bits, int samples, 33 dawn::Texture texture, dawn::TextureView view); 34 35 GrDawnGpu* getDawnGpu() const; 36 37 dawn::Texture fTexture; 38 dawn::TextureView fView; 39 40 typedef GrStencilAttachment INHERITED; 41 }; 42 43 #endif 44