Skip to content

Commit

Permalink
tests: Remove old AccelerationStructureKHR
Browse files Browse the repository at this point in the history
Remove vk_testing::AccelerationStructureKHR in favor of new helper
classes from the rt::as namespace
  • Loading branch information
arno-lunarg committed Mar 17, 2023
1 parent 8791578 commit 8927ab2
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 72 deletions.
45 changes: 0 additions & 45 deletions tests/framework/binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,18 +807,6 @@ void AccelerationStructure::destroy() noexcept {
}
AccelerationStructure::~AccelerationStructure() noexcept { destroy(); }

void AccelerationStructureKHR::destroy() noexcept {
if (!initialized()) {
return;
}
PFN_vkDestroyAccelerationStructureKHR vkDestroyAccelerationStructureKHR =
(PFN_vkDestroyAccelerationStructureKHR)vk::GetDeviceProcAddr(device(), "vkDestroyAccelerationStructureKHR");
assert(vkDestroyAccelerationStructureKHR != nullptr);
vkDestroyAccelerationStructureKHR(device(), handle(), nullptr);
handle_ = VK_NULL_HANDLE;
}
AccelerationStructureKHR::~AccelerationStructureKHR() noexcept { destroy(); }

VkMemoryRequirements2 AccelerationStructure::memory_requirements() const {
PFN_vkGetAccelerationStructureMemoryRequirementsNV vkGetAccelerationStructureMemoryRequirementsNV =
(PFN_vkGetAccelerationStructureMemoryRequirementsNV)vk::GetDeviceProcAddr(device(),
Expand Down Expand Up @@ -901,39 +889,6 @@ vk_testing::Buffer AccelerationStructure::create_scratch_buffer(const Device &de
return vk_testing::Buffer(device, create_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, pNext);
}

void AccelerationStructureKHR::init(const Device &dev, const VkAccelerationStructureCreateInfoKHR &info, bool init_memory) {
PFN_vkCreateAccelerationStructureKHR vkCreateAccelerationStructureKHR =
(PFN_vkCreateAccelerationStructureKHR)vk::GetDeviceProcAddr(dev.handle(), "vkCreateAccelerationStructureKHR");
assert(vkCreateAccelerationStructureKHR != nullptr);
NON_DISPATCHABLE_HANDLE_INIT(vkCreateAccelerationStructureKHR, dev, &info);
info_ = info;
}

vk_testing::Buffer AccelerationStructureKHR::create_scratch_buffer(const Device &device,
const VkBufferCreateInfo *pCreateInfo /*= nullptr*/,
bool buffer_device_address /*= false*/) const {
VkBufferCreateInfo create_info = {};
create_info.size = 0;
if (pCreateInfo) {
create_info.sType = pCreateInfo->sType;
create_info.usage = pCreateInfo->usage;
create_info.size = pCreateInfo->size;
} else {
create_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
create_info.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
if (buffer_device_address) create_info.usage |= VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT;
}

auto alloc_flags = LvlInitStruct<VkMemoryAllocateFlagsInfo>();
void *pNext = nullptr;
if (buffer_device_address) {
alloc_flags.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;
pNext = &alloc_flags;
}

return vk_testing::Buffer(device, create_info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, pNext);
}

NON_DISPATCHABLE_HANDLE_DTOR(ShaderModule, vk::DestroyShaderModule)

void ShaderModule::init(const Device &dev, const VkShaderModuleCreateInfo &info) {
Expand Down
26 changes: 0 additions & 26 deletions tests/framework/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -733,32 +733,6 @@ class AccelerationStructure : public internal::NonDispHandle<VkAccelerationStruc
uint64_t opaque_handle_;
};

class AccelerationStructureKHR : public internal::NonDispHandle<VkAccelerationStructureKHR> {
public:
explicit AccelerationStructureKHR(){};
explicit AccelerationStructureKHR(const Device &dev, const VkAccelerationStructureCreateInfoKHR &info,
bool init_memory = true) {
init(dev, info, init_memory);
}
~AccelerationStructureKHR() noexcept;
void destroy() noexcept;

// vkCreateAccelerationStructureNV
void init(const Device &dev, const VkAccelerationStructureCreateInfoKHR &info, bool init_memory = true);
uint64_t opaque_handle() const { return opaque_handle_; }

const VkAccelerationStructureCreateInfoKHR &info() const { return info_; }

const VkDevice &dev() const { return device(); }

[[nodiscard]] vk_testing::Buffer create_scratch_buffer(const Device &device, const VkBufferCreateInfo *pCreateInfo = nullptr,
bool buffer_device_address = false) const;

private:
VkAccelerationStructureCreateInfoKHR info_;
uint64_t opaque_handle_;
};

class ShaderModule : public internal::NonDispHandle<VkShaderModule> {
public:
~ShaderModule() noexcept;
Expand Down
1 change: 0 additions & 1 deletion tests/framework/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ typedef vk_testing::Fence VkFenceObj;
typedef vk_testing::Semaphore VkSemaphoreObj;
typedef vk_testing::Buffer VkBufferObj;
typedef vk_testing::AccelerationStructure VkAccelerationStructureObj;
typedef vk_testing::AccelerationStructureKHR VkAccelerationStructurekhrObj;
class VkCommandPoolObj : public vk_testing::CommandPool {
public:
VkCommandPoolObj() : vk_testing::CommandPool(){};
Expand Down

0 comments on commit 8927ab2

Please sign in to comment.