Don't fetch/serialise/apply render state if no context is bound.

* Note that we serialise out the new render state any time we reach a
  MakeCurrent call, so we can safely 'skip' the initial render state
  at the start of a frame.
This commit is contained in:
baldurk
2015-02-24 23:01:17 +00:00
parent 8f10523b7e
commit 07d65b8f9a
3 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ struct GLInitParams : public RDCInitParams
uint32_t width;
uint32_t height;
static const uint32_t GL_SERIALISE_VERSION = 0x0000008;
static const uint32_t GL_SERIALISE_VERSION = 0x0000009;
// version number internal to opengl stream
uint32_t SerialiseVersion;
+16
View File
@@ -259,6 +259,12 @@ void GLRenderState::FetchState(void *ctx, WrappedOpenGL *gl)
GLint boolread = 0;
// TODO check GL_MAX_*
// TODO check the extensions/core version for these is around
if(ctx == NULL)
{
ContextPresent = false;
return;
}
{
GLenum pnames[] =
@@ -582,6 +588,9 @@ void GLRenderState::FetchState(void *ctx, WrappedOpenGL *gl)
void GLRenderState::ApplyState(void *ctx, WrappedOpenGL *gl)
{
if(!ContextPresent || ctx == NULL)
return;
{
GLenum pnames[] =
{
@@ -870,6 +879,8 @@ void GLRenderState::ApplyState(void *ctx, WrappedOpenGL *gl)
void GLRenderState::Clear()
{
ContextPresent = true;
RDCEraseEl(Enabled);
RDCEraseEl(Tex1D);
@@ -957,6 +968,11 @@ void GLRenderState::Serialise(LogState state, void *ctx, WrappedOpenGL *gl)
GLResourceManager *rm = gl->GetResourceManager();
// TODO check GL_MAX_*
m_pSerialiser->Serialise("Context Present", ContextPresent);
if(!ContextPresent)
return;
m_pSerialiser->Serialise<eEnabled_Count>("GL_ENABLED", Enabled);
ResourceId ids[128];
+2
View File
@@ -100,6 +100,8 @@ struct GLRenderState
eEnabled_Count,
};
bool ContextPresent;
bool Enabled[eEnabled_Count];
uint32_t Tex1D[128];