descriptor fixed
This commit is contained in:
parent
5e3a7738ed
commit
1d0b7a615b
2 changed files with 14 additions and 9 deletions
|
|
@ -16,15 +16,15 @@ int main() {
|
|||
This must be called before any vulkan related things.
|
||||
Things like VkDevice are static members of the VulkanDevice class.
|
||||
*/
|
||||
VulkanDevice::CreateDevice();
|
||||
VulkanDevice::CreateDevice();
|
||||
Raygenspv::CreateShader();
|
||||
Closesthitspv::CreateShader();
|
||||
Misspv::CreateShader();
|
||||
DescriptorLayoutVulkan<Raygenspv, Closesthitspv, Misspv>::Init();
|
||||
PipelineRTVulkan<Raygenspv, Closesthitspv, Misspv, Raygenspv, Closesthitspv, Misspv>::Init();
|
||||
DescriptorPool<1, Raygenspv, Closesthitspv, Misspv> pool;
|
||||
pool.setsCount = 2;
|
||||
pool.BuildPool(0);
|
||||
std::array<VkDescriptorSetLayout, 3> layouts {{Raygenspv::layout, Raygenspv::layout, Raygenspv::layout}};
|
||||
PipelineRTVulkan<Raygenspv, Closesthitspv, Misspv, Raygenspv, Closesthitspv, Misspv>::Init(layouts);
|
||||
DescriptorPool pool;
|
||||
pool.sets.resize(3);
|
||||
pool.BuildPool(DescriptorPool::GetPoolSizes<Raygenspv, Raygenspv, Raygenspv>(), layouts);
|
||||
|
||||
WindowVulkan window(1280, 720, "HelloVulkan");
|
||||
|
||||
|
|
@ -41,12 +41,13 @@ int main() {
|
|||
RenderingElement3DVulkan& el = RenderingElement3DVulkan::elements.emplace_back(triangleMesh);
|
||||
MatrixRowMajor<float, 4, 3, 1> transform = MatrixRowMajor<float, 4, 3, 1>::Identity();
|
||||
std::memcpy(el.instance.transform.matrix, transform.m, sizeof(transform.m));
|
||||
RenderingElement3DVulkan::tlases.resize(2);
|
||||
RenderingElement3DVulkan::tlases.resize(3);
|
||||
|
||||
window.SetPipelineRT<Raygenspv, Closesthitspv, Misspv, Raygenspv, Closesthitspv, Misspv>();
|
||||
window.descriptorsRt = pool.sets;
|
||||
|
||||
RenderingElement3DVulkan::BuildTLAS(cmd, 0);
|
||||
RenderingElement3DVulkan::BuildTLAS(cmd, 1);
|
||||
RenderingElement3DVulkan::BuildTLAS(cmd, 2);
|
||||
VkDescriptorImageInfo imageInfo = {
|
||||
.imageView = window.imageViews[0],
|
||||
.imageLayout = VK_IMAGE_LAYOUT_GENERAL
|
||||
|
|
@ -79,6 +80,7 @@ int main() {
|
|||
}
|
||||
};
|
||||
vkUpdateDescriptorSets(VulkanDevice::device, 2, write, 0, nullptr);
|
||||
window.descriptorsRt = {pool.sets[0]};
|
||||
|
||||
/*
|
||||
FinishInit executes all commands recorded to StartInit.
|
||||
|
|
@ -87,6 +89,7 @@ int main() {
|
|||
window.FinishInit();
|
||||
|
||||
EventListener<VkCommandBuffer> updateListener(&window.onRender, [&](VkCommandBuffer cmd){
|
||||
std::cout << window.currentBuffer << std::endl;
|
||||
RenderingElement3DVulkan::BuildTLAS(cmd, window.currentBuffer);
|
||||
VkDescriptorImageInfo imageInfo = {
|
||||
.imageView = window.imageViews[window.currentBuffer],
|
||||
|
|
@ -120,6 +123,8 @@ int main() {
|
|||
}
|
||||
};
|
||||
vkUpdateDescriptorSets(VulkanDevice::device, 2, write, 0, nullptr);
|
||||
|
||||
window.descriptorsRt[0] = pool.sets[window.currentBuffer];
|
||||
});
|
||||
|
||||
window.Render();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ int main() {
|
|||
Raygenspv::CreateShader();
|
||||
Closesthitspv::CreateShader();
|
||||
Misspv::CreateShader();
|
||||
std::array<VkDescriptorSetLayout, 3> layouts {{Raygenspv::layout, Closesthitspv::layout, Misspv::layout}};
|
||||
std::array<VkDescriptorSetLayout, 1> layouts {{Raygenspv::layout}};
|
||||
PipelineRTVulkan<Raygenspv, Closesthitspv, Misspv, Raygenspv, Closesthitspv, Misspv>::Init(layouts);
|
||||
DescriptorPool pool;
|
||||
pool.sets.resize(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue