vulkan: remove internal Shader::attach call

Shader::attach() should not be called internally
by a graphics backend.
This commit is contained in:
niki
2023-01-27 14:10:19 +01:00
parent fdc860e6b6
commit f01457a610
3 changed files with 4 additions and 12 deletions
+3 -6
View File
@@ -1007,6 +1007,8 @@ graphics::StreamBuffer *Graphics::newStreamBuffer(BufferUsage type, size_t size)
bool Graphics::dispatch(int x, int y, int z) bool Graphics::dispatch(int x, int y, int z)
{ {
usedShadersInFrame.insert(computeShader);
if (renderPassState.active) if (renderPassState.active)
endRenderPass(); endRenderPass();
@@ -2226,7 +2228,7 @@ void Graphics::prepareDraw(const VertexAttributes &attributes, const BufferBindi
if (!renderPassState.active) if (!renderPassState.active)
startRenderPass(); startRenderPass();
Shader::current->attach(); usedShadersInFrame.insert((dynamic_cast<Shader*>(Shader::current)));
GraphicsPipelineConfiguration configuration{}; GraphicsPipelineConfiguration configuration{};
@@ -2489,11 +2491,6 @@ void Graphics::setComputeShader(Shader *shader)
computeShader = shader; computeShader = shader;
} }
void Graphics::markShaderUsed(Shader *shader)
{
usedShadersInFrame.insert(shader);
}
VkSampler Graphics::getCachedSampler(const SamplerState &samplerState) VkSampler Graphics::getCachedSampler(const SamplerState &samplerState)
{ {
auto samplerkey = samplerState.toKey(); auto samplerkey = samplerState.toKey();
+1 -2
View File
@@ -293,7 +293,6 @@ public:
graphics::Texture *getDefaultTexture() const; graphics::Texture *getDefaultTexture() const;
VkSampler getCachedSampler(const SamplerState &sampler); VkSampler getCachedSampler(const SamplerState &sampler);
void setComputeShader(Shader *computeShader); void setComputeShader(Shader *computeShader);
void markShaderUsed(Shader*);
graphics::Shader::BuiltinUniformData getCurrentBuiltinUniformData(); graphics::Shader::BuiltinUniformData getCurrentBuiltinUniformData();
const OptionalDeviceFeatures &getEnabledOptionalDeviceExtensions() const; const OptionalDeviceFeatures &getEnabledOptionalDeviceExtensions() const;
VkSampleCountFlagBits getMsaaCount(int requestedMsaa) const; VkSampleCountFlagBits getMsaaCount(int requestedMsaa) const;
@@ -394,7 +393,7 @@ private:
VkImageView depthImageView = VK_NULL_HANDLE; VkImageView depthImageView = VK_NULL_HANDLE;
VmaAllocation depthImageAllocation = VK_NULL_HANDLE; VmaAllocation depthImageAllocation = VK_NULL_HANDLE;
VkRenderPass defaultRenderPass = VK_NULL_HANDLE; VkRenderPass defaultRenderPass = VK_NULL_HANDLE;
VkPipelineCache pipelineCache; VkPipelineCache pipelineCache = VK_NULL_HANDLE;
std::vector<VkFramebuffer> defaultFramebuffers; std::vector<VkFramebuffer> defaultFramebuffers;
std::unordered_map<RenderPassConfiguration, VkRenderPass, RenderPassConfigurationHasher> renderPasses; std::unordered_map<RenderPassConfiguration, VkRenderPass, RenderPassConfigurationHasher> renderPasses;
std::unordered_map<FramebufferConfiguration, VkFramebuffer, FramebufferConfigurationHasher> framebuffers; std::unordered_map<FramebufferConfiguration, VkFramebuffer, FramebufferConfigurationHasher> framebuffers;
-4
View File
@@ -25,8 +25,6 @@
#include "libraries/glslang/SPIRV/GlslangToSpv.h" #include "libraries/glslang/SPIRV/GlslangToSpv.h"
#include <vector>
namespace love namespace love
{ {
namespace graphics namespace graphics
@@ -473,8 +471,6 @@ Shader::~Shader()
void Shader::attach() void Shader::attach()
{ {
vgfx->markShaderUsed(this);
if (!isCompute) if (!isCompute)
{ {
if (Shader::current != this) if (Shader::current != this)