| 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 GrVkUniformBuffer_DEFINED | 8 #ifndef GrVkUniformBuffer_DEFINED |
| 9 #define GrVkUniformBuffer_DEFINED | 9 #define GrVkUniformBuffer_DEFINED |
| 10 | 10 |
| 11 #include "GrVkBuffer.h" | 11 #include "GrVkBuffer.h" |
| 12 #include "vk/GrVkInterface.h" | 12 #include "vk/GrVkInterface.h" |
| 13 | 13 |
| 14 class GrVkGpu; | 14 class GrVkGpu; |
| 15 | 15 |
| 16 class GrVkUniformBuffer : public GrVkBuffer { | 16 class GrVkUniformBuffer : public GrVkBuffer { |
| 17 | 17 |
| 18 public: | 18 public: |
| 19 static GrVkUniformBuffer* Create(GrVkGpu* gpu, size_t size, bool dynamic); | 19 static GrVkUniformBuffer* Create(GrVkGpu* gpu, size_t size, bool dynamic); |
| 20 | 20 |
| 21 void* map(const GrVkGpu* gpu) { | 21 // TODO: deprecate. |
| 22 return this->vkMap(gpu); | |
| 23 } | |
| 24 void unmap(const GrVkGpu* gpu) { | |
| 25 this->vkUnmap(gpu); | |
| 26 } | |
| 27 bool updateData(const GrVkGpu* gpu, const void* src, size_t srcSizeInBytes)
{ | 22 bool updateData(const GrVkGpu* gpu, const void* src, size_t srcSizeInBytes)
{ |
| 28 return this->vkUpdateData(gpu, src, srcSizeInBytes); | 23 SkASSERT(gpu == this->vkGpu()); |
| 29 } | 24 return this->INHERITED::updateData(src, srcSizeInBytes); |
| 30 void release(const GrVkGpu* gpu) { | |
| 31 this->vkRelease(gpu); | |
| 32 } | |
| 33 void abandon() { | |
| 34 this->vkAbandon(); | |
| 35 } | 25 } |
| 36 | 26 |
| 37 private: | 27 private: |
| 38 GrVkUniformBuffer(const GrVkBuffer::Desc& desc, const GrVkBuffer::Resource*
resource) | 28 GrVkUniformBuffer(GrVkGpu* gpu, const GrVkBuffer::Desc& desc, |
| 39 : INHERITED(desc, resource) { | 29 const GrVkBuffer::Resource* resource) |
| 30 : INHERITED(gpu, desc, resource) { |
| 40 }; | 31 }; |
| 41 | 32 |
| 42 typedef GrVkBuffer INHERITED; | 33 typedef GrVkBuffer INHERITED; |
| 43 }; | 34 }; |
| 44 | 35 |
| 45 #endif | 36 #endif |
| OLD | NEW |