Stephen White | 5048a6a | 2019-07-29 17:07:44 -0400 | [diff] [blame] | 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 GrDawnBuffer_DEFINED |
| 9 | #define GrDawnBuffer_DEFINED |
| 10 | |
| 11 | #include "src/gpu/GrGpuBuffer.h" |
| 12 | #include "dawn/dawncpp.h" |
| 13 | |
| 14 | class GrDawnGpu; |
| 15 | |
| 16 | class GrDawnBuffer : public GrGpuBuffer { |
| 17 | public: |
| 18 | GrDawnBuffer(GrDawnGpu* gpu, size_t sizeInBytes, GrGpuBufferType tpye, GrAccessPattern pattern); |
| 19 | ~GrDawnBuffer() override; |
| 20 | |
| 21 | void onMap() override; |
| 22 | void onUnmap() override; |
| 23 | bool onUpdateData(const void* src, size_t srcSizeInBytes) override; |
| 24 | |
| 25 | GrDawnGpu* getDawnGpu() const; |
| 26 | dawn::Buffer get() const { return fBuffer; } |
| 27 | |
| 28 | private: |
| 29 | dawn::Buffer fBuffer; |
| 30 | char* fData; // Used only for map/unmap. |
| 31 | typedef GrGpuBuffer INHERITED; |
| 32 | }; |
| 33 | |
| 34 | #endif |