Code cleanup
This commit is contained in:
parent
3019e4a7a6
commit
f211a64153
1 changed files with 34 additions and 42 deletions
|
|
@ -55,17 +55,17 @@ public:
|
||||||
} uboParams;
|
} uboParams;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
VkPipeline skybox;
|
VkPipeline skybox{ VK_NULL_HANDLE };
|
||||||
VkPipeline pbr;
|
VkPipeline pbr{ VK_NULL_HANDLE };
|
||||||
} pipelines;
|
} pipelines;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
VkDescriptorSet object;
|
VkDescriptorSet object{ VK_NULL_HANDLE };
|
||||||
VkDescriptorSet skybox;
|
VkDescriptorSet skybox{ VK_NULL_HANDLE };
|
||||||
} descriptorSets;
|
} descriptorSets;
|
||||||
|
|
||||||
VkPipelineLayout pipelineLayout;
|
VkPipelineLayout pipelineLayout{ VK_NULL_HANDLE };
|
||||||
VkDescriptorSetLayout descriptorSetLayout;
|
VkDescriptorSetLayout descriptorSetLayout{ VK_NULL_HANDLE };
|
||||||
|
|
||||||
VulkanExample() : VulkanExampleBase()
|
VulkanExample() : VulkanExampleBase()
|
||||||
{
|
{
|
||||||
|
|
@ -82,25 +82,27 @@ public:
|
||||||
|
|
||||||
~VulkanExample()
|
~VulkanExample()
|
||||||
{
|
{
|
||||||
vkDestroyPipeline(device, pipelines.skybox, nullptr);
|
if (device) {
|
||||||
vkDestroyPipeline(device, pipelines.pbr, nullptr);
|
vkDestroyPipeline(device, pipelines.skybox, nullptr);
|
||||||
|
vkDestroyPipeline(device, pipelines.pbr, nullptr);
|
||||||
|
|
||||||
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
|
vkDestroyPipelineLayout(device, pipelineLayout, nullptr);
|
||||||
vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
|
vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
|
||||||
|
|
||||||
uniformBuffers.object.destroy();
|
uniformBuffers.object.destroy();
|
||||||
uniformBuffers.skybox.destroy();
|
uniformBuffers.skybox.destroy();
|
||||||
uniformBuffers.params.destroy();
|
uniformBuffers.params.destroy();
|
||||||
|
|
||||||
textures.environmentCube.destroy();
|
textures.environmentCube.destroy();
|
||||||
textures.irradianceCube.destroy();
|
textures.irradianceCube.destroy();
|
||||||
textures.prefilteredCube.destroy();
|
textures.prefilteredCube.destroy();
|
||||||
textures.lutBrdf.destroy();
|
textures.lutBrdf.destroy();
|
||||||
textures.albedoMap.destroy();
|
textures.albedoMap.destroy();
|
||||||
textures.normalMap.destroy();
|
textures.normalMap.destroy();
|
||||||
textures.aoMap.destroy();
|
textures.aoMap.destroy();
|
||||||
textures.metallicMap.destroy();
|
textures.metallicMap.destroy();
|
||||||
textures.roughnessMap.destroy();
|
textures.roughnessMap.destroy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void getEnabledFeatures()
|
virtual void getEnabledFeatures()
|
||||||
|
|
@ -1300,17 +1302,6 @@ public:
|
||||||
memcpy(uniformBuffers.params.mapped, &uboParams, sizeof(uboParams));
|
memcpy(uniformBuffers.params.mapped, &uboParams, sizeof(uboParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw()
|
|
||||||
{
|
|
||||||
VulkanExampleBase::prepareFrame();
|
|
||||||
|
|
||||||
submitInfo.commandBufferCount = 1;
|
|
||||||
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
|
|
||||||
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
|
|
||||||
|
|
||||||
VulkanExampleBase::submitFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
void prepare()
|
void prepare()
|
||||||
{
|
{
|
||||||
VulkanExampleBase::prepare();
|
VulkanExampleBase::prepare();
|
||||||
|
|
@ -1325,20 +1316,21 @@ public:
|
||||||
prepared = true;
|
prepared = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw()
|
||||||
|
{
|
||||||
|
VulkanExampleBase::prepareFrame();
|
||||||
|
submitInfo.commandBufferCount = 1;
|
||||||
|
submitInfo.pCommandBuffers = &drawCmdBuffers[currentBuffer];
|
||||||
|
VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE));
|
||||||
|
VulkanExampleBase::submitFrame();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void render()
|
virtual void render()
|
||||||
{
|
{
|
||||||
if (!prepared)
|
if (!prepared)
|
||||||
return;
|
return;
|
||||||
draw();
|
|
||||||
if (camera.updated)
|
|
||||||
{
|
|
||||||
updateUniformBuffers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void viewChanged()
|
|
||||||
{
|
|
||||||
updateUniformBuffers();
|
updateUniformBuffers();
|
||||||
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
virtual void OnUpdateUIOverlay(vks::UIOverlay *overlay)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue