diff --git a/src/modules/graphics/vulkan/Graphics.cpp b/src/modules/graphics/vulkan/Graphics.cpp index 869ff8531..7166b22f9 100644 --- a/src/modules/graphics/vulkan/Graphics.cpp +++ b/src/modules/graphics/vulkan/Graphics.cpp @@ -1007,6 +1007,8 @@ graphics::StreamBuffer *Graphics::newStreamBuffer(BufferUsage type, size_t size) bool Graphics::dispatch(int x, int y, int z) { + usedShadersInFrame.insert(computeShader); + if (renderPassState.active) endRenderPass(); @@ -2226,7 +2228,7 @@ void Graphics::prepareDraw(const VertexAttributes &attributes, const BufferBindi if (!renderPassState.active) startRenderPass(); - Shader::current->attach(); + usedShadersInFrame.insert((dynamic_cast(Shader::current))); GraphicsPipelineConfiguration configuration{}; @@ -2489,11 +2491,6 @@ void Graphics::setComputeShader(Shader *shader) computeShader = shader; } -void Graphics::markShaderUsed(Shader *shader) -{ - usedShadersInFrame.insert(shader); -} - VkSampler Graphics::getCachedSampler(const SamplerState &samplerState) { auto samplerkey = samplerState.toKey(); diff --git a/src/modules/graphics/vulkan/Graphics.h b/src/modules/graphics/vulkan/Graphics.h index a1cb0bbf2..3606cf842 100644 --- a/src/modules/graphics/vulkan/Graphics.h +++ b/src/modules/graphics/vulkan/Graphics.h @@ -293,7 +293,6 @@ public: graphics::Texture *getDefaultTexture() const; VkSampler getCachedSampler(const SamplerState &sampler); void setComputeShader(Shader *computeShader); - void markShaderUsed(Shader*); graphics::Shader::BuiltinUniformData getCurrentBuiltinUniformData(); const OptionalDeviceFeatures &getEnabledOptionalDeviceExtensions() const; VkSampleCountFlagBits getMsaaCount(int requestedMsaa) const; @@ -394,7 +393,7 @@ private: VkImageView depthImageView = VK_NULL_HANDLE; VmaAllocation depthImageAllocation = VK_NULL_HANDLE; VkRenderPass defaultRenderPass = VK_NULL_HANDLE; - VkPipelineCache pipelineCache; + VkPipelineCache pipelineCache = VK_NULL_HANDLE; std::vector defaultFramebuffers; std::unordered_map renderPasses; std::unordered_map framebuffers; diff --git a/src/modules/graphics/vulkan/Shader.cpp b/src/modules/graphics/vulkan/Shader.cpp index 8d71c7f43..4a33e87d7 100644 --- a/src/modules/graphics/vulkan/Shader.cpp +++ b/src/modules/graphics/vulkan/Shader.cpp @@ -25,8 +25,6 @@ #include "libraries/glslang/SPIRV/GlslangToSpv.h" -#include - namespace love { namespace graphics @@ -473,8 +471,6 @@ Shader::~Shader() void Shader::attach() { - vgfx->markShaderUsed(this); - if (!isCompute) { if (Shader::current != this)