1 // Copyright 2024 The Amber Authors. 2 // Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 #ifndef SRC_VULKAN_TLAS_DESCRIPTOR_H_ 17 #define SRC_VULKAN_TLAS_DESCRIPTOR_H_ 18 19 #include <memory> 20 #include <vector> 21 22 #include "src/vulkan/descriptor.h" 23 #include "src/vulkan/tlas.h" 24 #include "src/vulkan/transfer_image.h" 25 26 namespace amber { 27 namespace vulkan { 28 29 class TLASDescriptor : public Descriptor { 30 public: 31 TLASDescriptor(amber::TLAS* tlas, 32 DescriptorType type, 33 Device* device, 34 BlasesMap* blases, 35 TlasesMap* tlases, 36 uint32_t desc_set, 37 uint32_t binding); 38 ~TLASDescriptor() override; 39 40 void UpdateDescriptorSetIfNeeded(VkDescriptorSet descriptor_set) override; 41 42 Result CreateResourceIfNeeded() override; 43 AddAmberTLAS(amber::TLAS * tlas)44 void AddAmberTLAS(amber::TLAS* tlas) { amber_tlases_.push_back(tlas); } GetDescriptorCount()45 uint32_t GetDescriptorCount() override { 46 return static_cast<uint32_t>(amber_tlases_.size()); 47 } AsTLASDescriptor()48 TLASDescriptor* AsTLASDescriptor() override { return this; } 49 50 private: 51 std::vector<amber::TLAS*> amber_tlases_; 52 BlasesMap* blases_; 53 TlasesMap* tlases_; 54 }; 55 56 } // namespace vulkan 57 } // namespace amber 58 59 #endif // SRC_VULKAN_TLAS_DESCRIPTOR_H_ 60