Invalidates CDeviceCommandContext texture bind cache properly.
Tested By: Langbart Differential Revision: https://code.wildfiregames.com/D4553 This was SVN commit r26664.
This commit is contained in:
parent
ce3a47e49a
commit
2ed2e9de0c
@ -693,6 +693,8 @@ void CSceneRenderer::RenderSilhouettes(
|
||||
// inverted depth test so any behind an occluder will get drawn in a constant
|
||||
// color.
|
||||
|
||||
deviceCommandContext->SetGraphicsPipelineState(
|
||||
Renderer::Backend::MakeDefaultGraphicsPipelineStateDesc());
|
||||
deviceCommandContext->ClearFramebuffer(false, true, true);
|
||||
|
||||
// Render occluders:
|
||||
|
@ -390,6 +390,14 @@ void CDeviceCommandContext::BindBuffer(const CBuffer::Type type, CBuffer* buffer
|
||||
glBindBufferARB(BufferTypeToGLTarget(type), buffer ? buffer->GetHandle() : 0);
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::OnTextureDestroy(CTexture* texture)
|
||||
{
|
||||
ENSURE(texture);
|
||||
for (size_t index = 0; index < m_BoundTextures.size(); ++index)
|
||||
if (m_BoundTextures[index].second == texture->GetHandle())
|
||||
BindTexture(index, GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
void CDeviceCommandContext::Flush()
|
||||
{
|
||||
ResetStates();
|
||||
|
@ -105,6 +105,8 @@ public:
|
||||
// TODO: remove direct binding after moving shaders.
|
||||
void BindTexture(const uint32_t unit, const GLenum target, const GLuint handle);
|
||||
void BindBuffer(const CBuffer::Type type, CBuffer* buffer);
|
||||
// We need to know when to invalidate our texture bind cache.
|
||||
void OnTextureDestroy(CTexture* texture);
|
||||
|
||||
void Flush();
|
||||
|
||||
|
@ -293,6 +293,7 @@ CTexture::CTexture() = default;
|
||||
|
||||
CTexture::~CTexture()
|
||||
{
|
||||
m_Device->GetActiveCommandContext()->OnTextureDestroy(this);
|
||||
if (m_Handle)
|
||||
glDeleteTextures(1, &m_Handle);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user