Fetch initial buffer contents for dirty resources in GL

* Huge hack, but it works for now...
This commit is contained in:
Baldur Karlsson
2014-06-27 12:36:44 +01:00
parent de9fb483f0
commit 740a6c80e9
2 changed files with 17 additions and 2 deletions
+15
View File
@@ -32,3 +32,18 @@ bool GLResourceManager::SerialisableResource(ResourceId id, GLResourceRecord *re
return false;
return true;
}
bool GLResourceManager::Prepare_InitialState(GLResource res)
{
if(res.Namespace == eResBuffer)
{
GLResourceRecord *record = GetResourceRecord(res);
GLint length;
m_GL->glGetNamedBufferParameterivEXT(res.name, eGL_BUFFER_SIZE, &length);
m_GL->glGetNamedBufferSubDataEXT(res.name, 0, length, record->GetDataPtr());
}
return true;
}
+2 -2
View File
@@ -140,8 +140,8 @@ class GLResourceManager : public ResourceManager<GLResource, GLResourceRecord>
bool ResourceTypeRelease(GLResource res) { return true; }
bool Need_InitialState(GLResource res) { return false; }
bool Need_InitialStateChunk(GLResource res) { return false; }
bool Prepare_InitialState(GLResource res) { return true; }
bool Need_InitialStateChunk(GLResource res) { return res.Namespace != eResBuffer; }
bool Prepare_InitialState(GLResource res);
bool Serialise_InitialState(GLResource res) { return true; }
void Create_InitialState(ResourceId id, GLResource live, bool hasData) { }
void Apply_InitialState(GLResource live, GLResource initial, uint32_t count) { }