mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-29 02:41:08 +00:00
Don't use FetchTexture in GLReplay, as overlay texture doesn't have it
* Instead of using FetchTexture we store the internal format in the texture data in the driver, so it's available for use. * This fixes some issues with the overlay textures
This commit is contained in:
@@ -558,8 +558,6 @@ void GLReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, uint32_t sl
|
||||
|
||||
bool GLReplay::RenderTexture(TextureDisplay cfg)
|
||||
{
|
||||
FetchTexture tex = GetTexture(cfg.texid);
|
||||
|
||||
MakeCurrentReplayContext(m_DebugCtx);
|
||||
|
||||
WrappedOpenGL &gl = *m_pDriver;
|
||||
@@ -597,7 +595,7 @@ bool GLReplay::RenderTexture(TextureDisplay cfg)
|
||||
}
|
||||
|
||||
RDCGLenum dsTexMode = eGL_NONE;
|
||||
if (tex.creationFlags & eTextureCreate_DSV)
|
||||
if(IsDepthStencilFormat(texDetails.internalFormat))
|
||||
{
|
||||
if (!cfg.Red && cfg.Green)
|
||||
{
|
||||
@@ -606,7 +604,7 @@ bool GLReplay::RenderTexture(TextureDisplay cfg)
|
||||
// Stencil texture sampling is not normalized in OpenGL
|
||||
resType |= TEXDISPLAY_UINT_TEX;
|
||||
float rangeScale;
|
||||
switch (tex.format.rawType)
|
||||
switch (texDetails.internalFormat)
|
||||
{
|
||||
case eGL_STENCIL_INDEX1:
|
||||
rangeScale = 1.0f;
|
||||
@@ -633,17 +631,10 @@ bool GLReplay::RenderTexture(TextureDisplay cfg)
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (tex.format.compType)
|
||||
{
|
||||
case eCompType_UInt:
|
||||
if(IsUIntFormat(texDetails.internalFormat))
|
||||
resType |= TEXDISPLAY_UINT_TEX;
|
||||
break;
|
||||
case eCompType_SInt:
|
||||
if(IsSIntFormat(texDetails.internalFormat))
|
||||
resType |= TEXDISPLAY_SINT_TEX;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gl.glActiveTexture((RDCGLenum)(eGL_TEXTURE0 + resType));
|
||||
|
||||
@@ -179,11 +179,12 @@ class WrappedOpenGL
|
||||
|
||||
struct TextureData
|
||||
{
|
||||
TextureData() : width(0), height(0), depth(0), creationFlags(0) {}
|
||||
TextureData() : width(0), height(0), depth(0), creationFlags(0), internalFormat(eGL_NONE) {}
|
||||
GLResource resource;
|
||||
GLenum curType;
|
||||
GLint width, height, depth;
|
||||
uint32_t creationFlags;
|
||||
GLenum internalFormat;
|
||||
};
|
||||
|
||||
map<ResourceId, TextureData> m_Textures;
|
||||
|
||||
@@ -324,3 +324,59 @@ GLenum GetDataType(GLenum internalFormat)
|
||||
|
||||
return eGL_NONE;
|
||||
}
|
||||
|
||||
bool IsDepthStencilFormat(GLenum internalFormat)
|
||||
{
|
||||
GLenum fmt = GetBaseFormat(internalFormat);
|
||||
|
||||
return (fmt == eGL_DEPTH_COMPONENT || fmt == eGL_STENCIL || fmt == eGL_DEPTH_STENCIL);
|
||||
}
|
||||
|
||||
bool IsUIntFormat(GLenum internalFormat)
|
||||
{
|
||||
switch(internalFormat)
|
||||
{
|
||||
case eGL_R8UI:
|
||||
case eGL_RG8UI:
|
||||
case eGL_RGB8UI:
|
||||
case eGL_RGBA8UI:
|
||||
case eGL_R16UI:
|
||||
case eGL_RG16UI:
|
||||
case eGL_RGB16UI:
|
||||
case eGL_RGBA16UI:
|
||||
case eGL_R32UI:
|
||||
case eGL_RG32UI:
|
||||
case eGL_RGB32UI:
|
||||
case eGL_RGBA32UI:
|
||||
case eGL_RGB10_A2UI:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsSIntFormat(GLenum internalFormat)
|
||||
{
|
||||
switch(internalFormat)
|
||||
{
|
||||
case eGL_R8I:
|
||||
case eGL_RG8I:
|
||||
case eGL_RGB8I:
|
||||
case eGL_RGBA8I:
|
||||
case eGL_R16I:
|
||||
case eGL_RG16I:
|
||||
case eGL_RGB16I:
|
||||
case eGL_RGBA16I:
|
||||
case eGL_R32I:
|
||||
case eGL_RG32I:
|
||||
case eGL_RGB32I:
|
||||
case eGL_RGBA32I:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@ size_t GetByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum format, GLenum type,
|
||||
GLenum GetBaseFormat(GLenum internalFormat);
|
||||
GLenum GetDataType(GLenum internalFormat);
|
||||
|
||||
bool IsDepthStencilFormat(GLenum internalFormat);
|
||||
bool IsUIntFormat(GLenum internalFormat);
|
||||
bool IsSIntFormat(GLenum internalFormat);
|
||||
|
||||
enum GLNamespace
|
||||
{
|
||||
eResUnknown = 0,
|
||||
|
||||
@@ -236,6 +236,7 @@ bool WrappedOpenGL::Serialise_glTextureView(GLuint texture, GLenum target, GLuin
|
||||
ResourceId liveOrigId = GetResourceManager()->GetLiveID(origid);
|
||||
|
||||
m_Textures[liveTexId].curType = Target;
|
||||
m_Textures[liveTexId].internalFormat = InternalFormat;
|
||||
m_Textures[liveTexId].width = m_Textures[liveOrigId].width;
|
||||
m_Textures[liveTexId].height = m_Textures[liveOrigId].height;
|
||||
m_Textures[liveTexId].depth = m_Textures[liveOrigId].depth;
|
||||
@@ -270,7 +271,8 @@ void WrappedOpenGL::glTextureView(GLuint texture, GLenum target, GLuint origtext
|
||||
{
|
||||
ResourceId texId = GetResourceManager()->GetID(TextureRes(GetCtx(), texture));
|
||||
ResourceId origId = GetResourceManager()->GetID(TextureRes(GetCtx(), origtexture));
|
||||
|
||||
|
||||
m_Textures[texId].internalFormat = internalformat;
|
||||
m_Textures[texId].width = m_Textures[origId].width;
|
||||
m_Textures[texId].height = m_Textures[origId].height;
|
||||
m_Textures[texId].depth = m_Textures[origId].depth;
|
||||
@@ -796,6 +798,7 @@ bool WrappedOpenGL::Serialise_glTextureStorage1DEXT(GLuint texture, GLenum targe
|
||||
m_Textures[liveId].height = 1;
|
||||
m_Textures[liveId].depth = 1;
|
||||
m_Textures[liveId].curType = Target;
|
||||
m_Textures[liveId].internalFormat = Format;
|
||||
|
||||
m_Real.glTextureStorage1DEXT(GetResourceManager()->GetLiveResource(id).name, Target, Levels, Format, Width);
|
||||
}
|
||||
@@ -830,6 +833,7 @@ void WrappedOpenGL::glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei
|
||||
m_Textures[texId].width = width;
|
||||
m_Textures[texId].height = 1;
|
||||
m_Textures[texId].depth = 1;
|
||||
m_Textures[texId].internalFormat = internalformat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -857,6 +861,7 @@ void WrappedOpenGL::glTexStorage1D(GLenum target, GLsizei levels, GLenum interna
|
||||
m_Textures[texId].width = width;
|
||||
m_Textures[texId].height = 1;
|
||||
m_Textures[texId].depth = 1;
|
||||
m_Textures[texId].internalFormat = internalformat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -876,6 +881,7 @@ bool WrappedOpenGL::Serialise_glTextureStorage2DEXT(GLuint texture, GLenum targe
|
||||
m_Textures[liveId].height = Height;
|
||||
m_Textures[liveId].depth = 1;
|
||||
m_Textures[liveId].curType = Target;
|
||||
m_Textures[liveId].internalFormat = Format;
|
||||
|
||||
m_Real.glTextureStorage2DEXT(GetResourceManager()->GetLiveResource(id).name, Target, Levels, Format, Width, Height);
|
||||
}
|
||||
@@ -910,6 +916,7 @@ void WrappedOpenGL::glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei
|
||||
m_Textures[texId].width = width;
|
||||
m_Textures[texId].height = height;
|
||||
m_Textures[texId].depth = 1;
|
||||
m_Textures[texId].internalFormat = internalformat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -943,6 +950,7 @@ void WrappedOpenGL::glTexStorage2D(GLenum target, GLsizei levels, GLenum interna
|
||||
m_Textures[texId].width = width;
|
||||
m_Textures[texId].height = height;
|
||||
m_Textures[texId].depth = 1;
|
||||
m_Textures[texId].internalFormat = internalformat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -963,6 +971,7 @@ bool WrappedOpenGL::Serialise_glTextureStorage3DEXT(GLuint texture, GLenum targe
|
||||
m_Textures[liveId].height = Height;
|
||||
m_Textures[liveId].depth = Depth;
|
||||
m_Textures[liveId].curType = Target;
|
||||
m_Textures[liveId].internalFormat = Format;
|
||||
|
||||
m_Real.glTextureStorage3DEXT(GetResourceManager()->GetLiveResource(id).name, Target, Levels, Format, Width, Height, Depth);
|
||||
}
|
||||
@@ -997,6 +1006,7 @@ void WrappedOpenGL::glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei
|
||||
m_Textures[texId].width = width;
|
||||
m_Textures[texId].height = height;
|
||||
m_Textures[texId].depth = depth;
|
||||
m_Textures[texId].internalFormat = internalformat;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1030,6 +1040,7 @@ void WrappedOpenGL::glTexStorage3D(GLenum target, GLsizei levels, GLenum interna
|
||||
m_Textures[texId].width = width;
|
||||
m_Textures[texId].height = height;
|
||||
m_Textures[texId].depth = depth;
|
||||
m_Textures[texId].internalFormat = internalformat;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user