mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Remove texture alignment tracking and save texture units in initial state
* Tracking the alignment was pointless and it isn't implemented yet anyway. * Relevant state should be saved at the start of each captured frame, so include the active texture bindings in this
This commit is contained in:
@@ -31,12 +31,9 @@
|
||||
bool WrappedOpenGL::Serialise_glGenTextures(GLsizei n, GLuint* textures)
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(TextureRes(*textures)));
|
||||
SERIALISE_ELEMENT(GLint, activeTexUnit, m_TextureUnit);
|
||||
RDCWARN("HACK! serialising active tex with gen - need to grab initial pipeline state to fix");
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
m_Real.glActiveTexture(RDCGLenum(GL_TEXTURE0 + activeTexUnit));
|
||||
GLuint real = 0;
|
||||
m_Real.glGenTextures(1, &real);
|
||||
|
||||
@@ -217,7 +214,10 @@ bool WrappedOpenGL::Serialise_glTexSubImage2D(GLenum target, GLint level, GLint
|
||||
SERIALISE_ELEMENT(GLenum, Type, type);
|
||||
SERIALISE_ELEMENT(ResourceId, id, m_TextureRecord[m_TextureUnit]->GetResourceID());
|
||||
|
||||
size_t subimageSize = GetByteSize(Width, Height, 1, Format, Type, Level, m_TextureAlignment);
|
||||
GLint align = 1;
|
||||
m_Real.glGetIntegerv(eGL_UNPACK_ALIGNMENT, &align);
|
||||
|
||||
size_t subimageSize = GetByteSize(Width, Height, 1, Format, Type, Level, align);
|
||||
|
||||
SERIALISE_ELEMENT_BUF(byte *, buf, pixels, subimageSize);
|
||||
|
||||
@@ -347,12 +347,7 @@ bool WrappedOpenGL::Serialise_glPixelStorei(GLenum pname, GLint param)
|
||||
SERIALISE_ELEMENT(GLint, Param, param);
|
||||
|
||||
if(m_State == READING)
|
||||
{
|
||||
if(pname == eGL_UNPACK_ALIGNMENT)
|
||||
m_TextureAlignment = param;
|
||||
|
||||
m_Real.glPixelStorei(PName, Param);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -361,9 +356,6 @@ void WrappedOpenGL::glPixelStorei(GLenum pname, GLint param)
|
||||
{
|
||||
m_Real.glPixelStorei(pname, param);
|
||||
|
||||
if(pname == eGL_UNPACK_ALIGNMENT)
|
||||
m_TextureAlignment = param;
|
||||
|
||||
RDCASSERT(m_TextureRecord[m_TextureUnit]);
|
||||
{
|
||||
SCOPED_SERIALISE_CONTEXT(PIXELSTORE);
|
||||
|
||||
@@ -191,7 +191,6 @@ WrappedOpenGL::WrappedOpenGL(const wchar_t *logfile, const GLHookSet &funcs)
|
||||
m_CurDrawcallID = 1;
|
||||
|
||||
RDCEraseEl(m_TextureRecord);
|
||||
m_TextureAlignment = 0;
|
||||
m_TextureUnit = 0;
|
||||
|
||||
m_LastIndexSize = eGL_UNKNOWN_ENUM;
|
||||
@@ -688,28 +687,44 @@ void WrappedOpenGL::AttemptCapture()
|
||||
|
||||
bool WrappedOpenGL::Serialise_BeginCaptureFrame(bool applyInitialState)
|
||||
{
|
||||
//GLRenderState state(m_pSerialiser);
|
||||
// TODO check GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS bound
|
||||
// TODO fetch bindings for other types than 2D
|
||||
ResourceId textures2D[128];
|
||||
|
||||
if(m_State >= WRITING)
|
||||
{
|
||||
//state = *m_CurrentPipelineState;
|
||||
for(int i=0; i < ARRAY_COUNT(textures2D); i++)
|
||||
{
|
||||
GLint binding = 0;
|
||||
|
||||
//state.SetSerialiser(m_pSerialiser);
|
||||
m_Real.glActiveTexture(GLenum(eGL_TEXTURE0 + i));
|
||||
m_Real.glGetIntegerv(eGL_TEXTURE_BINDING_2D, &binding);
|
||||
|
||||
//state.MarkReferenced(this, true);
|
||||
if(binding == 0)
|
||||
textures2D[i] = ResourceId();
|
||||
else
|
||||
textures2D[i] = GetResourceManager()->GetID(TextureRes(binding));
|
||||
}
|
||||
}
|
||||
|
||||
//state.Serialise(m_State, this);
|
||||
m_pSerialiser->Serialise<128>("textures", textures2D);
|
||||
|
||||
if(m_State <= EXECUTING && applyInitialState)
|
||||
{
|
||||
m_DoStateVerify = false;
|
||||
{
|
||||
//*m_CurrentPipelineState = state;
|
||||
//state.ApplyState(this);
|
||||
|
||||
for(int i=0; i < ARRAY_COUNT(textures2D); i++)
|
||||
{
|
||||
m_Real.glActiveTexture(GLenum(eGL_TEXTURE0 + i));
|
||||
if(textures2D[i] == ResourceId())
|
||||
m_Real.glBindTexture(eGL_TEXTURE_2D, 0);
|
||||
else
|
||||
m_Real.glBindTexture(eGL_TEXTURE_2D, GetResourceManager()->GetLiveResource(textures2D[i]).name);
|
||||
}
|
||||
|
||||
}
|
||||
m_DoStateVerify = true;
|
||||
//VerifyState();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -102,7 +102,6 @@ class WrappedOpenGL
|
||||
GLResourceRecord *m_BufferRecord[16];
|
||||
GLResourceRecord *m_VertexArrayRecord;
|
||||
GLint m_TextureUnit;
|
||||
GLint m_TextureAlignment;
|
||||
|
||||
size_t BufferIdx(GLenum buf);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user