Skip to content

Commit

Permalink
address validation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
goopey7 committed Jan 1, 2024
1 parent a90813f commit 5875629
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions goop/sys/platform/vulkan/Descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void Descriptor::createDescriptorPool()
{
std::array<VkDescriptorPoolSize, 2> poolSizes{};
poolSizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
poolSizes[0].descriptorCount = static_cast<uint32_t>(maxFramesInFlight);
poolSizes[0].descriptorCount = 10 * static_cast<uint32_t>(maxFramesInFlight);
poolSizes[1].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
poolSizes[1].descriptorCount = 10 * static_cast<uint32_t>(maxFramesInFlight);

Expand All @@ -63,7 +63,7 @@ void Descriptor::createDescriptorPool()
}
}

void Descriptor::createDescriptorSet(UniformBuffer* ub, Texture* texture)
void Descriptor::createDescriptorSet(Texture* texture)
{
std::vector<VkDescriptorSetLayout> layouts(maxFramesInFlight, descriptorSetLayout);
VkDescriptorSetAllocateInfo allocInfo{};
Expand Down Expand Up @@ -118,3 +118,4 @@ Descriptor::~Descriptor()
vkDestroyDescriptorPool(device, descriptorPool, nullptr);
vkDestroyDescriptorSetLayout(device, descriptorSetLayout, nullptr);
}

2 changes: 1 addition & 1 deletion goop/sys/platform/vulkan/Descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Descriptor
return &descriptorSets[texture][index];
}

void createDescriptorSet(UniformBuffer* ub, Texture* texture);
void createDescriptorSet(Texture* texture);

private:
void createDescriptorSetLayout();
Expand Down
6 changes: 5 additions & 1 deletion goop/sys/platform/vulkan/Renderer_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ int Renderer_Vulkan::destroy()
#ifdef GOOP_APPTYPE_EDITOR
delete viewTexture;
#endif
for (auto& [key, value] : textures)
{
delete value;
}
ImGui_ImplVulkan_Shutdown();
vkDestroyDescriptorPool(*ctx, imguiPool, nullptr);
delete sampler;
Expand Down Expand Up @@ -726,7 +730,7 @@ void Renderer_Vulkan::endFrame() { renderFrame(imageIndex); }
void Renderer_Vulkan::addTexture(unsigned char* pixels, int width, int height, const char* path)
{
Texture* texture = new Texture(ctx, pixels, width, height, path);
descriptor->createDescriptorSet(uniformBuffer, texture);
descriptor->createDescriptorSet(texture);
textures[path] = texture;
}

Expand Down

0 comments on commit 5875629

Please sign in to comment.