GetSizedFormat better depth decision based on data type, if available.

This commit is contained in:
Michael Rennie
2017-04-26 04:28:01 -07:00
committed by Baldur Karlsson
parent 6a1db47870
commit 58ac90e831
3 changed files with 12 additions and 6 deletions
+7 -2
View File
@@ -502,7 +502,7 @@ int GetNumMips(const GLHookSet &gl, GLenum target, GLuint tex, GLuint w, GLuint
return RDCMAX(1, mips);
}
GLenum GetSizedFormat(const GLHookSet &gl, GLenum target, GLenum internalFormat)
GLenum GetSizedFormat(const GLHookSet &gl, GLenum target, GLenum internalFormat, GLenum type)
{
switch(internalFormat)
{
@@ -556,7 +556,12 @@ GLenum GetSizedFormat(const GLHookSet &gl, GLenum target, GLenum internalFormat)
{
// without the query function, just default to sensible defaults
red = 8;
depth = 32;
if(type == eGL_FLOAT)
depth = 32;
else if(type == eGL_UNSIGNED_SHORT)
depth = 16;
else
depth = 24;
stencil = 8;
}
+2 -1
View File
@@ -34,7 +34,8 @@ size_t GetCompressedByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum internalfor
size_t GetByteSize(GLsizei w, GLsizei h, GLsizei d, GLenum format, GLenum type);
GLenum GetBaseFormat(GLenum internalFormat);
GLenum GetDataType(GLenum internalFormat);
GLenum GetSizedFormat(const GLHookSet &gl, GLenum target, GLenum internalFormat);
GLenum GetSizedFormat(const GLHookSet &gl, GLenum target, GLenum internalFormat,
GLenum type = eGL_NONE);
void GetFramebufferMipAndLayer(const GLHookSet &gl, GLenum framebuffer, GLenum attachment,
GLint *mip, GLint *layer);
void GetTextureSwizzle(const GLHookSet &gl, GLuint tex, GLenum target, GLenum *swizzleRGBA);
@@ -2027,7 +2027,7 @@ void WrappedOpenGL::Common_glTextureImage1DEXT(ResourceId texId, GLenum target,
if(IsProxyTarget(target) || internalformat == 0)
return;
internalformat = GetSizedFormat(m_Real, target, (GLenum)internalformat);
internalformat = GetSizedFormat(m_Real, target, (GLenum)internalformat, type);
bool fromunpackbuf = false;
{
@@ -2259,7 +2259,7 @@ void WrappedOpenGL::Common_glTextureImage2DEXT(ResourceId texId, GLenum target,
if(IsProxyTarget(target) || internalformat == 0)
return;
internalformat = GetSizedFormat(m_Real, target, (GLenum)internalformat);
internalformat = GetSizedFormat(m_Real, target, (GLenum)internalformat, type);
bool fromunpackbuf = false;
{
@@ -2473,7 +2473,7 @@ void WrappedOpenGL::Common_glTextureImage3DEXT(ResourceId texId, GLenum target,
if(IsProxyTarget(target) || internalformat == 0)
return;
internalformat = GetSizedFormat(m_Real, target, (GLenum)internalformat);
internalformat = GetSizedFormat(m_Real, target, (GLenum)internalformat, type);
bool fromunpackbuf = false;
{