st/nine: Add D3DFMT_DF16 support

This depth buffer format, like D3DFMT_INTZ, can be used to read
the depth buffer values when bound to a shader.

Some apps may use this format to get better performance when
they don't need the precision of INTZ (24 bits for depth, 8 for
stencil, whereas DF16 is just 16 bits for depth)

We don't add support for DF24 yet, because it implies support
for FETCH4, which we don't support for now.

Reviewed-by: Tiziano Bacocco <tizbac2@gmail.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
This commit is contained in:
Axel Davy 2015-01-14 12:10:48 +01:00
parent 34292754d2
commit bf0adf248f
2 changed files with 14 additions and 4 deletions

View file

@ -69,8 +69,16 @@ NineBaseTexture9_ctor( struct NineBaseTexture9 *This,
D3DTEXF_LINEAR : D3DTEXF_NONE;
This->lod = 0;
This->lod_resident = -1;
This->shadow = This->format != D3DFMT_INTZ && util_format_has_depth(
util_format_description(This->base.info.format));
/* When a depth buffer is sampled, it is for shadow mapping, except for
* D3DFMT_INTZ, D3DFMT_DF16 and D3DFMT_DF24.
* In addition D3DFMT_INTZ can be used for both texturing and depth buffering
* if z write is disabled. This particular feature may not work for us in
* practice because OGL doesn't have that. However apparently it is known
* some cards have performance issues with this feature, so real apps
* shouldn't use it. */
This->shadow = (This->format != D3DFMT_INTZ && This->format != D3DFMT_DF16 &&
This->format != D3DFMT_DF24) &&
util_format_has_depth(util_format_description(This->base.info.format));
list_inithead(&This->list);

View file

@ -182,6 +182,7 @@ d3d9_to_pipe_format_internal(D3DFORMAT format)
return nine_d3d9_to_pipe_format_map[format];
switch (format) {
case D3DFMT_INTZ: return PIPE_FORMAT_S8_UINT_Z24_UNORM;
case D3DFMT_DF16: return PIPE_FORMAT_Z16_UNORM;
case D3DFMT_DXT1: return PIPE_FORMAT_DXT1_RGBA;
case D3DFMT_DXT2: return PIPE_FORMAT_DXT3_RGBA; /* XXX */
case D3DFMT_DXT3: return PIPE_FORMAT_DXT3_RGBA;
@ -199,8 +200,9 @@ d3d9_to_pipe_format_internal(D3DFORMAT format)
case D3DFMT_Y210: /* XXX */
case D3DFMT_Y216:
case D3DFMT_NV11:
case D3DFMT_DF16: /* useless, not supported by wine either */
case D3DFMT_DF24: /* useless, not supported by wine either */
case D3DFMT_DF24: /* Similar to D3DFMT_DF16 but for 24-bits.
We don't advertise it because when it is supported, Fetch-4 is
supposed to be supported, which we don't support yet. */
case D3DFMT_NULL: /* special cased, only for surfaces */
return PIPE_FORMAT_NONE;
default: