mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-21 13:15:57 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -100,6 +100,8 @@ struct GLRenderState
|
||||
eEnabled_Count,
|
||||
};
|
||||
|
||||
bool ContextPresent;
|
||||
|
||||
bool Enabled[eEnabled_Count];
|
||||
|
||||
uint32_t Tex1D[128];
|
||||
|
||||
Reference in New Issue
Block a user