1 // Copyright 2019 The Amber Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef SRC_VULKAN_IMAGE_DESCRIPTOR_H_ 16 #define SRC_VULKAN_IMAGE_DESCRIPTOR_H_ 17 18 #include <memory> 19 #include <unordered_map> 20 #include <utility> 21 #include <vector> 22 23 #include "src/vulkan/buffer_backed_descriptor.h" 24 #include "src/vulkan/pipeline.h" 25 #include "src/vulkan/sampler.h" 26 #include "src/vulkan/transfer_image.h" 27 28 namespace amber { 29 namespace vulkan { 30 31 class ImageDescriptor : public BufferBackedDescriptor { 32 public: 33 ImageDescriptor(Buffer* buffer, 34 DescriptorType type, 35 Device* device, 36 uint32_t base_mip_level, 37 uint32_t desc_set, 38 uint32_t binding, 39 Pipeline* pipeline); 40 ~ImageDescriptor() override; 41 42 void UpdateDescriptorSetIfNeeded(VkDescriptorSet descriptor_set) override; 43 Result CreateResourceIfNeeded() override; SetAmberSampler(amber::Sampler * sampler)44 void SetAmberSampler(amber::Sampler* sampler) { amber_sampler_ = sampler; } 45 AsImageDescriptor()46 ImageDescriptor* AsImageDescriptor() override { return this; } 47 48 private: 49 uint32_t base_mip_level_ = 0; 50 amber::Sampler* amber_sampler_ = nullptr; 51 amber::vulkan::Sampler vulkan_sampler_; 52 }; 53 54 } // namespace vulkan 55 } // namespace amber 56 57 #endif // SRC_VULKAN_IMAGE_DESCRIPTOR_H_ 58