mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
vulkan: fix shader crash
This commit is contained in:
@@ -1131,6 +1131,8 @@ void Graphics::beginFrame()
|
||||
|
||||
Vulkan::resetShaderSwitches();
|
||||
|
||||
for (const auto shader : usedShadersInFrame)
|
||||
shader->newFrame();
|
||||
usedShadersInFrame.clear();
|
||||
}
|
||||
|
||||
@@ -2478,9 +2480,9 @@ void Graphics::setComputeShader(Shader *shader)
|
||||
computeShader = shader;
|
||||
}
|
||||
|
||||
std::set<Shader*> &Graphics::getUsedShadersInFrame()
|
||||
void Graphics::markShaderUsed(Shader *shader)
|
||||
{
|
||||
return usedShadersInFrame;
|
||||
usedShadersInFrame.insert(shader);
|
||||
}
|
||||
|
||||
VkSampler Graphics::getCachedSampler(const SamplerState &samplerState)
|
||||
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
graphics::Texture *getDefaultTexture() const;
|
||||
VkSampler getCachedSampler(const SamplerState &sampler);
|
||||
void setComputeShader(Shader *computeShader);
|
||||
std::set<Shader*> &getUsedShadersInFrame();
|
||||
void markShaderUsed(Shader*);
|
||||
graphics::Shader::BuiltinUniformData getCurrentBuiltinUniformData();
|
||||
const OptionalDeviceFeatures &getEnabledOptionalDeviceExtensions() const;
|
||||
VkSampleCountFlagBits getMsaaCount(int requestedMsaa) const;
|
||||
|
||||
@@ -200,6 +200,7 @@ bool Shader::loadVolatile()
|
||||
currentFrame = 0;
|
||||
currentUsedUniformStreamBuffersCount = 0;
|
||||
currentUsedDescriptorSetsCount = 0;
|
||||
newFrame();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -384,7 +385,7 @@ void Shader::cmdPushDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBind
|
||||
for (const auto &u : uniformInfos)
|
||||
{
|
||||
if (updatedUniforms.find(u.second.location) == updatedUniforms.end())
|
||||
updateUniform(&u.second, u.second.count);
|
||||
updateUniform(&u.second, u.second.count, true);
|
||||
}
|
||||
|
||||
vkCmdBindDescriptorSets(commandBuffer, bindPoint, pipelineLayout, 0, 1, ¤tDescriptorSet, 0, nullptr);
|
||||
@@ -406,12 +407,7 @@ Shader::~Shader()
|
||||
|
||||
void Shader::attach()
|
||||
{
|
||||
auto &usedShadersInFrame = vgfx->getUsedShadersInFrame();
|
||||
if (usedShadersInFrame.find(this) == usedShadersInFrame.end())
|
||||
{
|
||||
newFrame();
|
||||
usedShadersInFrame.insert(this);
|
||||
}
|
||||
vgfx->markShaderUsed(this);
|
||||
|
||||
if (!isCompute)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user