GrVkDescriptorSet.cpp 884 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright 2016 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. #include "src/gpu/vk/GrVkDescriptorSet.h"
  8. #include "src/gpu/vk/GrVkDescriptorPool.h"
  9. #include "src/gpu/vk/GrVkGpu.h"
  10. #include "src/gpu/vk/GrVkResourceProvider.h"
  11. GrVkDescriptorSet::GrVkDescriptorSet(VkDescriptorSet descSet,
  12. GrVkDescriptorPool* pool,
  13. GrVkDescriptorSetManager::Handle handle)
  14. : fDescSet(descSet)
  15. , fPool(pool)
  16. , fHandle(handle) {
  17. fPool->ref();
  18. }
  19. void GrVkDescriptorSet::freeGPUData(GrVkGpu* gpu) const {
  20. fPool->unref(gpu);
  21. }
  22. void GrVkDescriptorSet::onRecycle(GrVkGpu* gpu) const {
  23. gpu->resourceProvider().recycleDescriptorSet(this, fHandle);
  24. }
  25. void GrVkDescriptorSet::abandonGPUData() const {
  26. fPool->unrefAndAbandon();
  27. }