cleaned up renderer

This commit is contained in:
Jorijn van der Graaf 2026-03-09 20:10:19 +01:00
commit d661c88ee2
58 changed files with 3030 additions and 4722 deletions

View file

@ -38,8 +38,8 @@ typedef DescriptorSetLayoutVulkanConst<3, {{
}}> descriptorSetLayout;
int main() {
VulkanDevice::CreateDevice();
WindowVulkan window(1280, 720, "HelloVulkan");
Device::Initialize();
Window window(1280, 720, "HelloVulkan");
VkCommandBuffer cmd = window.StartInit();
Raygenspv::CreateShader();
@ -61,7 +61,7 @@ int main() {
std::array<std::uint32_t, 3> index {{2,1,0}};
triangleMesh.Build(verts, index, cmd);
RenderingElement3DVulkan renderer = {
RenderingElement3D renderer = {
.instance = {
.instanceCustomIndex = 0,
.mask = 0xFF,
@ -71,12 +71,12 @@ int main() {
}
};
RenderingElement3DVulkan::elements.emplace_back(&renderer);
RenderingElement3D::elements.emplace_back(&renderer);
MatrixRowMajor<float, 4, 3, 1> transform = MatrixRowMajor<float, 4, 3, 1>::Identity();
std::memcpy(renderer.instance.transform.matrix, transform.m, sizeof(transform.m));
RenderingElement3DVulkan::tlases.resize(1);
RenderingElement3DVulkan::BuildTLAS(cmd, 0);
RenderingElement3D::tlases.resize(1);
RenderingElement3D::BuildTLAS(cmd, 0);
VkDescriptorImageInfo imageInfo = {
.imageView = window.imageViews[0],
@ -86,7 +86,7 @@ int main() {
VkWriteDescriptorSetAccelerationStructureKHR writeDescriptorSetAccelerationStructure {
.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,
.accelerationStructureCount = 1,
.pAccelerationStructures = &RenderingElement3DVulkan::tlases[0].accelerationStructure
.pAccelerationStructures = &RenderingElement3D::tlases[0].accelerationStructure
};
VulkanBuffer<std::uint32_t, true, false, false> lightBuffer;
@ -121,7 +121,7 @@ int main() {
.pBufferInfo = &lightBuffer.descriptor
}
};
vkUpdateDescriptorSets(VulkanDevice::device, 3, write, 0, nullptr);
vkUpdateDescriptorSets(Device::device, 3, write, 0, nullptr);
window.SetPipelineRT<Pipeline>();