aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glformats.c
diff options
context:
space:
mode:
authorEduardo Lima Mitev <[email protected]>2016-02-03 10:57:10 +0100
committerEduardo Lima Mitev <[email protected]>2016-03-03 15:14:07 +0100
commite064f43485b63053f5786f680407f15bc203763f (patch)
treee25c4224acf151d5f4dbfef76b0b964b0b6bbd6e /src/mesa/main/glformats.c
parentec299602a6a1db209e8e93c0853ccad1eb4ffa72 (diff)
mesa/glformats: Consider DEPTH/STENCIL when resolving a mesa_format
_mesa_format_from_format_and_type() is currently not considering DEPTH and STENCIL formats, which are not array formats and are not handled anywhere. This patch adds cases for common combinations of DEPTH/STENCIL format and types. Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/main/glformats.c')
-rw-r--r--src/mesa/main/glformats.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index d29d70d4604..edfd7d6ed53 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -3521,6 +3521,27 @@ _mesa_format_from_format_and_type(GLenum format, GLenum type)
case GL_UNSIGNED_INT_10F_11F_11F_REV:
if (format == GL_RGB)
return MESA_FORMAT_R11G11B10_FLOAT;
+ break;
+ case GL_FLOAT:
+ if (format == GL_DEPTH_COMPONENT)
+ return MESA_FORMAT_Z_FLOAT32;
+ break;
+ case GL_UNSIGNED_INT:
+ if (format == GL_DEPTH_COMPONENT)
+ return MESA_FORMAT_Z_UNORM32;
+ break;
+ case GL_UNSIGNED_SHORT:
+ if (format == GL_DEPTH_COMPONENT)
+ return MESA_FORMAT_Z_UNORM16;
+ break;
+ case GL_UNSIGNED_INT_24_8:
+ if (format == GL_DEPTH_STENCIL)
+ return MESA_FORMAT_Z24_UNORM_S8_UINT;
+ break;
+ case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
+ if (format == GL_DEPTH_STENCIL)
+ return MESA_FORMAT_Z32_FLOAT_S8X24_UINT;
+ break;
default:
break;
}