mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-27 04:11:05 +00:00
Number of mips should be clamped to MAX_LEVEL+1
* Even this isn't quite enough. We're actually assuming a 'complete' texture, i.e. one which has had all mips uploaded/init'd. It's actually valid to have a texture that doesn't have all of its mips initialised but as long as you don't use them, ie. you bind a point sampler or you use it as a framebuffer attachments, it's valid. So REALLY in the non-immutable case, we need to iterate over every level and query to see if it's been configured, e.g. by fetching its width. Sigh.
This commit is contained in:
@@ -193,7 +193,7 @@ bool GLResourceManager::Prepare_InitialState(GLResource res)
|
||||
|
||||
GLint maxLevel = 1000;
|
||||
gl.glGetTexParameteriv(details.curType, eGL_TEXTURE_MAX_LEVEL, &maxLevel);
|
||||
mips = RDCMIN(mips, maxLevel);
|
||||
mips = RDCMIN(mips, maxLevel+1);
|
||||
|
||||
gl.glBindTexture(details.curType, tex);
|
||||
|
||||
@@ -421,7 +421,7 @@ bool GLResourceManager::Serialise_InitialState(GLResource res)
|
||||
|
||||
GLint maxLevel = 1000;
|
||||
gl.glGetTexParameteriv(details.curType, eGL_TEXTURE_MAX_LEVEL, &maxLevel);
|
||||
imgmips = RDCMIN(imgmips, maxLevel);
|
||||
imgmips = RDCMIN(imgmips, maxLevel+1);
|
||||
|
||||
TextureStateInitialData *state = (TextureStateInitialData *)GetInitialContents(Id).blob;
|
||||
|
||||
@@ -792,7 +792,7 @@ void GLResourceManager::Apply_InitialState(GLResource live, InitialContentData i
|
||||
|
||||
GLint maxLevel = 1000;
|
||||
gl.glGetTexParameteriv(details.curType, eGL_TEXTURE_MAX_LEVEL, &maxLevel);
|
||||
mips = RDCMIN(mips, maxLevel);
|
||||
mips = RDCMIN(mips, maxLevel+1);
|
||||
|
||||
// copy over mips
|
||||
for(int i=0; i < mips; i++)
|
||||
|
||||
@@ -517,7 +517,7 @@ void GLReplay::CacheTexture(ResourceId id)
|
||||
|
||||
GLuint maxLevel = 1000;
|
||||
gl.glGetTexParameteriv(target, eGL_TEXTURE_MAX_LEVEL, (GLint *)&maxLevel);
|
||||
tex.mips = RDCMIN(tex.mips, maxLevel);
|
||||
tex.mips = RDCMIN(tex.mips, maxLevel+1);
|
||||
|
||||
tex.numSubresources = tex.mips*tex.arraysize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user