Graphics/ForwardFramePipeline: Handle material invalidation correctly
This commit is contained in:
@@ -87,6 +87,7 @@ namespace Nz
|
||||
RenderQueue<RenderElement*> depthPrepassRenderQueue;
|
||||
RenderQueue<RenderElement*> forwardRenderQueue;
|
||||
ShaderBindingPtr blitShaderBinding;
|
||||
bool prepare = true;
|
||||
bool rebuildDepthPrepass = true;
|
||||
bool rebuildForwardPass = true;
|
||||
};
|
||||
|
||||
@@ -110,6 +110,7 @@ namespace Nz
|
||||
NazaraSignal(OnMaterialRelease, const MaterialPass* /*material*/);
|
||||
|
||||
private:
|
||||
inline void InvalidateCommandBuffer();
|
||||
inline void InvalidatePipeline();
|
||||
inline void InvalidateTextureSampler(std::size_t textureIndex);
|
||||
inline void InvalidateUniformData(std::size_t uniformBufferIndex);
|
||||
|
||||
@@ -608,7 +608,8 @@ namespace Nz
|
||||
if (m_textures[textureIndex].texture != texture)
|
||||
{
|
||||
m_textures[textureIndex].texture = std::move(texture);
|
||||
OnMaterialInvalidated(this);
|
||||
|
||||
InvalidateCommandBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,6 +619,7 @@ namespace Nz
|
||||
if (m_textures[textureIndex].samplerInfo != samplerInfo)
|
||||
{
|
||||
m_textures[textureIndex].samplerInfo = std::move(samplerInfo);
|
||||
|
||||
InvalidateTextureSampler(textureIndex);
|
||||
}
|
||||
}
|
||||
@@ -630,10 +632,16 @@ namespace Nz
|
||||
m_uniformBuffers[bufferIndex].buffer = std::move(uniformBuffer);
|
||||
m_uniformBuffers[bufferIndex].dataInvalidated = true;
|
||||
|
||||
OnMaterialInvalidated(this);
|
||||
InvalidateCommandBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
inline void MaterialPass::InvalidateCommandBuffer()
|
||||
{
|
||||
m_forceCommandBufferRegeneration = true;
|
||||
OnMaterialInvalidated(this);
|
||||
}
|
||||
|
||||
inline void MaterialPass::InvalidatePipeline()
|
||||
{
|
||||
m_forceCommandBufferRegeneration = true;
|
||||
@@ -647,7 +655,7 @@ namespace Nz
|
||||
assert(textureIndex < m_textures.size());
|
||||
m_textures[textureIndex].sampler.reset();
|
||||
|
||||
OnMaterialInvalidated(this);
|
||||
InvalidateCommandBuffer();
|
||||
}
|
||||
|
||||
inline void MaterialPass::InvalidateUniformData(std::size_t uniformBufferIndex)
|
||||
|
||||
Reference in New Issue
Block a user