working RT

This commit is contained in:
Jorijn van der Graaf 2026-01-29 02:05:18 +01:00
commit 8b2fd773b1
6 changed files with 52 additions and 53 deletions

View file

@ -36,6 +36,41 @@ int main() {
RenderingElement3DVulkan::elements.emplace_back(triangleMesh);
RenderingElement3DVulkan::BuildTLAS(cmd);
VkDescriptorImageInfo imageInfo = {
.imageView = window.imageViews[0],
.imageLayout = VK_IMAGE_LAYOUT_GENERAL
};
std::cout << pool.sets.size() << std::endl;
VkWriteDescriptorSetAccelerationStructureKHR writeDescriptorSetAccelerationStructure {
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,
.accelerationStructureCount = 1,
.pAccelerationStructures = &RenderingElement3DVulkan::accelerationStructure
};
VkWriteDescriptorSet write[2] = {
{
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
.pNext = &writeDescriptorSetAccelerationStructure,
.dstSet = pool.sets[0],
.dstBinding = 0,
.descriptorCount = 1,
.descriptorType = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR,
.pBufferInfo = &RenderingElement3DVulkan::tlasBuffer.descriptor
},
{
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
.dstSet = pool.sets[0],
.dstBinding = 1,
.descriptorCount = 1,
.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
.pImageInfo = &imageInfo
}
};
vkUpdateDescriptorSets(VulkanDevice::device, 2, write, 0, nullptr);
/*
FinishInit executes all commands recorded to StartInit.
This must be called before the the event loops starts if you called StartInit before.