mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-24 19:00:55 +00:00
Alias serialisation of a few gl*Parameteri functions, to display enums
* Since sizeof(GLenum) == sizeof(int32_t), we can make a backwards compatible change to the serialisation so that depending on the param name we either serialise the value as an int or a GLenum. This only makes a difference in the text representation, as the enum name is displayed instead of its integer value.
This commit is contained in:
@@ -214,12 +214,34 @@ bool WrappedOpenGL::Serialise_glSamplerParameteri(GLuint sampler, GLenum pname,
|
||||
{
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(SamplerRes(GetCtx(), sampler)));
|
||||
SERIALISE_ELEMENT(GLenum, PName, pname);
|
||||
SERIALISE_ELEMENT(int32_t, Param, param);
|
||||
|
||||
int32_t ParamValue = 0;
|
||||
|
||||
RDCCOMPILE_ASSERT(sizeof(int32_t) == sizeof(GLenum), "int32_t isn't the same size as GLenum - aliased serialising will break");
|
||||
// special case a few parameters to serialise their value as an enum, not an int
|
||||
if(PName == GL_TEXTURE_WRAP_S ||
|
||||
PName == GL_TEXTURE_WRAP_T ||
|
||||
PName == GL_TEXTURE_WRAP_R ||
|
||||
PName == GL_TEXTURE_MIN_FILTER ||
|
||||
PName == GL_TEXTURE_MAG_FILTER ||
|
||||
PName == GL_TEXTURE_COMPARE_MODE ||
|
||||
PName == GL_TEXTURE_COMPARE_FUNC)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Param, (GLenum)param);
|
||||
|
||||
ParamValue = (int32_t)Param;
|
||||
}
|
||||
else
|
||||
{
|
||||
SERIALISE_ELEMENT(int32_t, Param, param);
|
||||
|
||||
ParamValue = Param;
|
||||
}
|
||||
|
||||
if(m_State < WRITING)
|
||||
{
|
||||
GLResource res = GetResourceManager()->GetLiveResource(id);
|
||||
m_Real.glSamplerParameteri(res.name, PName, Param);
|
||||
m_Real.glSamplerParameteri(res.name, PName, ParamValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1279,11 +1279,27 @@ void WrappedOpenGL::glPointSize(GLfloat size)
|
||||
bool WrappedOpenGL::Serialise_glPointParameteri(GLenum pname, GLint param)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, PName, pname);
|
||||
SERIALISE_ELEMENT(int32_t, Param, param);
|
||||
|
||||
int32_t ParamValue = 0;
|
||||
|
||||
RDCCOMPILE_ASSERT(sizeof(int32_t) == sizeof(GLenum), "int32_t isn't the same size as GLenum - aliased serialising will break");
|
||||
// special case a few parameters to serialise their value as an enum, not an int
|
||||
if(PName == GL_POINT_SPRITE_COORD_ORIGIN)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Param, (GLenum)param);
|
||||
|
||||
ParamValue = (int32_t)Param;
|
||||
}
|
||||
else
|
||||
{
|
||||
SERIALISE_ELEMENT(int32_t, Param, param);
|
||||
|
||||
ParamValue = Param;
|
||||
}
|
||||
|
||||
if(m_State <= EXECUTING)
|
||||
{
|
||||
m_Real.glPointParameteri(PName, Param);
|
||||
m_Real.glPointParameteri(PName, ParamValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1075,15 +1075,43 @@ bool WrappedOpenGL::Serialise_glTextureParameteriEXT(GLuint texture, GLenum targ
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Target, target);
|
||||
SERIALISE_ELEMENT(GLenum, PName, pname);
|
||||
SERIALISE_ELEMENT(int32_t, Param, param);
|
||||
|
||||
int32_t ParamValue = 0;
|
||||
|
||||
RDCCOMPILE_ASSERT(sizeof(int32_t) == sizeof(GLenum), "int32_t isn't the same size as GLenum - aliased serialising will break");
|
||||
// special case a few parameters to serialise their value as an enum, not an int
|
||||
if(PName == GL_DEPTH_STENCIL_TEXTURE_MODE ||
|
||||
PName == GL_TEXTURE_COMPARE_FUNC ||
|
||||
PName == GL_TEXTURE_COMPARE_MODE ||
|
||||
PName == GL_TEXTURE_MIN_FILTER ||
|
||||
PName == GL_TEXTURE_MAG_FILTER ||
|
||||
PName == GL_TEXTURE_SWIZZLE_R ||
|
||||
PName == GL_TEXTURE_SWIZZLE_G ||
|
||||
PName == GL_TEXTURE_SWIZZLE_B ||
|
||||
PName == GL_TEXTURE_SWIZZLE_A ||
|
||||
PName == GL_TEXTURE_WRAP_S ||
|
||||
PName == GL_TEXTURE_WRAP_T ||
|
||||
PName == GL_TEXTURE_WRAP_R)
|
||||
{
|
||||
SERIALISE_ELEMENT(GLenum, Param, (GLenum)param);
|
||||
|
||||
ParamValue = (int32_t)Param;
|
||||
}
|
||||
else
|
||||
{
|
||||
SERIALISE_ELEMENT(int32_t, Param, param);
|
||||
|
||||
ParamValue = Param;
|
||||
}
|
||||
|
||||
SERIALISE_ELEMENT(ResourceId, id, GetResourceManager()->GetID(TextureRes(GetCtx(), texture)));
|
||||
|
||||
if(m_State < WRITING)
|
||||
{
|
||||
if(Target != eGL_NONE)
|
||||
m_Real.glTextureParameteriEXT(GetResourceManager()->GetLiveResource(id).name, Target, PName, Param);
|
||||
m_Real.glTextureParameteriEXT(GetResourceManager()->GetLiveResource(id).name, Target, PName, ParamValue);
|
||||
else
|
||||
m_Real.glTextureParameteri(GetResourceManager()->GetLiveResource(id).name, PName, Param);
|
||||
m_Real.glTextureParameteri(GetResourceManager()->GetLiveResource(id).name, PName, ParamValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user