mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 15:06:32 +00:00
fixed vrapi swapchain mip level inaccuracy
This commit is contained in:
committed by
Baldur Karlsson
parent
310ada841a
commit
517251caee
@@ -2538,8 +2538,8 @@ void WrappedOpenGL::SwapBuffers(void *windowHandle)
|
||||
}
|
||||
}
|
||||
|
||||
void WrappedOpenGL::CreateVRAPITextureSwapChain(GLuint tex, GLenum textureType,
|
||||
GLenum internalformat, GLsizei width, GLsizei height)
|
||||
void WrappedOpenGL::CreateVRAPITextureSwapChain(GLuint tex, GLenum textureType, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLint levels)
|
||||
{
|
||||
GLResource res = TextureRes(GetCtx(), tex);
|
||||
ResourceId id = GetResourceManager()->RegisterResource(res);
|
||||
@@ -2559,21 +2559,33 @@ void WrappedOpenGL::CreateVRAPITextureSwapChain(GLuint tex, GLenum textureType,
|
||||
RDCASSERT(record);
|
||||
|
||||
record->AddChunk(chunk);
|
||||
|
||||
Common_glTextureParameteriEXT(record, textureType, eGL_TEXTURE_MAX_LEVEL, levels);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetResourceManager()->AddLiveResource(id, res);
|
||||
}
|
||||
|
||||
if(textureType == eGL_TEXTURE_2D_ARRAY)
|
||||
for(GLint i = 0; i < levels; ++i)
|
||||
{
|
||||
Common_glTextureImage3DEXT(id, eGL_TEXTURE_2D_ARRAY, 0, internalformat, width, height, 2, 0, eGL_RGBA,
|
||||
eGL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
Common_glTextureImage2DEXT(id, eGL_TEXTURE_2D, 0, internalformat, width, height, 0, eGL_RGBA,
|
||||
eGL_UNSIGNED_BYTE, NULL);
|
||||
if(textureType == eGL_TEXTURE_2D_ARRAY)
|
||||
{
|
||||
Common_glTextureImage3DEXT(id, eGL_TEXTURE_2D_ARRAY, i, internalformat, width, height, 2, 0,
|
||||
eGL_RGBA, eGL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
else if(textureType == eGL_TEXTURE_2D)
|
||||
{
|
||||
Common_glTextureImage2DEXT(id, eGL_TEXTURE_2D, i, internalformat, width, height, 0, eGL_RGBA,
|
||||
eGL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
RDCERR("Unexpected textureType (%u) in CreateVRAPITextureSwapChain", textureType);
|
||||
}
|
||||
|
||||
width = RDCMAX(1, (width / 2));
|
||||
height = RDCMAX(1, (height / 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -587,7 +587,7 @@ public:
|
||||
void WindowSize(void *windowHandle, uint32_t w, uint32_t h);
|
||||
void SwapBuffers(void *windowHandle);
|
||||
void CreateVRAPITextureSwapChain(GLuint tex, GLenum textureType, GLenum internalformat,
|
||||
GLsizei width, GLsizei height);
|
||||
GLsizei width, GLsizei height, GLint levels);
|
||||
|
||||
void FirstFrame(void *ctx, void *wndHandle);
|
||||
|
||||
|
||||
@@ -204,7 +204,8 @@ __attribute__((visibility("default"))) ovrTextureSwapChain *vrapi_CreateTextureS
|
||||
GLenum internalformat = GetInternalFormat(format);
|
||||
GLenum textureType = GetTextureType(type);
|
||||
|
||||
m_GLDriver->CreateVRAPITextureSwapChain(tex, textureType, internalformat, width, height);
|
||||
m_GLDriver->CreateVRAPITextureSwapChain(tex, textureType, internalformat, width, height,
|
||||
levels);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +237,8 @@ __attribute__((visibility("default"))) ovrTextureSwapChain *vrapi_CreateTextureS
|
||||
GLenum internalformat = GetInternalFormat(format);
|
||||
GLenum textureType = GetTextureType(type);
|
||||
|
||||
m_GLDriver->CreateVRAPITextureSwapChain(tex, textureType, internalformat, width, height);
|
||||
m_GLDriver->CreateVRAPITextureSwapChain(tex, textureType, internalformat, width, height,
|
||||
levels);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user