• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SAMPLER_DESCRIPTOR_H_
16 #define SRC_VULKAN_SAMPLER_DESCRIPTOR_H_
17 
18 #include <memory>
19 #include <vector>
20 
21 #include "src/vulkan/descriptor.h"
22 #include "src/vulkan/sampler.h"
23 #include "src/vulkan/transfer_image.h"
24 
25 namespace amber {
26 namespace vulkan {
27 
28 class SamplerDescriptor : public Descriptor {
29  public:
30   SamplerDescriptor(amber::Sampler* sampler,
31                     DescriptorType type,
32                     Device* device,
33                     uint32_t desc_set,
34                     uint32_t binding);
35   ~SamplerDescriptor() override;
36 
37   void UpdateDescriptorSetIfNeeded(VkDescriptorSet descriptor_set) override;
38   Result CreateResourceIfNeeded() override;
AddAmberSampler(amber::Sampler * sampler)39   void AddAmberSampler(amber::Sampler* sampler) {
40     amber_samplers_.push_back(sampler);
41   }
GetDescriptorCount()42   uint32_t GetDescriptorCount() override {
43     return static_cast<uint32_t>(amber_samplers_.size());
44   }
AsSamplerDescriptor()45   SamplerDescriptor* AsSamplerDescriptor() override { return this; }
46 
47  private:
48   std::vector<amber::Sampler*> amber_samplers_;
49   std::vector<std::unique_ptr<amber::vulkan::Sampler>> vulkan_samplers_;
50 };
51 
52 }  // namespace vulkan
53 }  // namespace amber
54 
55 #endif  // SRC_VULKAN_SAMPLER_DESCRIPTOR_H_
56