| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrVkBuffer_DEFINED | 8 #ifndef GrVkBuffer_DEFINED |
| 9 #define GrVkBuffer_DEFINED | 9 #define GrVkBuffer_DEFINED |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 struct Desc { | 49 struct Desc { |
| 50 size_t fSizeInBytes; | 50 size_t fSizeInBytes; |
| 51 Type fType; // vertex buffer, index buffer, etc. | 51 Type fType; // vertex buffer, index buffer, etc. |
| 52 bool fDynamic; | 52 bool fDynamic; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 class Resource : public GrVkResource { | 55 class Resource : public GrVkResource { |
| 56 public: | 56 public: |
| 57 Resource(VkBuffer buf, const GrVkAlloc& alloc) | 57 Resource(VkBuffer buf, const GrVkAlloc& alloc, Type type) |
| 58 : INHERITED(), fBuffer(buf), fAlloc(alloc) {} | 58 : INHERITED(), fBuffer(buf), fAlloc(alloc), fType(type) {} |
| 59 | 59 |
| 60 VkBuffer fBuffer; | 60 VkBuffer fBuffer; |
| 61 GrVkAlloc fAlloc; | 61 GrVkAlloc fAlloc; |
| 62 Type fType; |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 void freeGPUData(const GrVkGpu* gpu) const; | 65 void freeGPUData(const GrVkGpu* gpu) const; |
| 65 | 66 |
| 66 typedef GrVkResource INHERITED; | 67 typedef GrVkResource INHERITED; |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 // convenience routine for raw buffer creation | 70 // convenience routine for raw buffer creation |
| 70 static const Resource* Create(const GrVkGpu* gpu, | 71 static const Resource* Create(const GrVkGpu* gpu, |
| 71 const Desc& descriptor); | 72 const Desc& descriptor); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 89 bool vkIsMapped() const; | 90 bool vkIsMapped() const; |
| 90 | 91 |
| 91 Desc fDesc; | 92 Desc fDesc; |
| 92 const Resource* fResource; | 93 const Resource* fResource; |
| 93 void* fMapPtr; | 94 void* fMapPtr; |
| 94 | 95 |
| 95 typedef SkNoncopyable INHERITED; | 96 typedef SkNoncopyable INHERITED; |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 #endif | 99 #endif |
| OLD | NEW |