Home | History | Annotate | Download | only in vk
      1 /*
      2 * Copyright 2015 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 GrVkUniformBuffer_DEFINED
      9 #define GrVkUniformBuffer_DEFINED
     10 
     11 #include "GrVkBuffer.h"
     12 #include "vk/GrVkInterface.h"
     13 
     14 class GrVkGpu;
     15 
     16 class GrVkUniformBuffer : public GrVkBuffer {
     17 
     18 public:
     19     static GrVkUniformBuffer* Create(GrVkGpu* gpu, size_t size, bool dynamic);
     20 
     21     void* map(const GrVkGpu* gpu) {
     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) {
     28         return this->vkUpdateData(gpu, src, srcSizeInBytes);
     29     }
     30     void release(const GrVkGpu* gpu) {
     31         this->vkRelease(gpu);
     32     }
     33     void abandon() {
     34         this->vkAbandon();
     35     }
     36 
     37 private:
     38     GrVkUniformBuffer(const GrVkBuffer::Desc& desc, const GrVkBuffer::Resource* resource)
     39         : INHERITED(desc, resource) {
     40     };
     41 
     42     typedef GrVkBuffer INHERITED;
     43 };
     44 
     45 #endif
     46