[Mesa-dev] [PATCH 19/43] st/nine: Add D3DFMT_DF16 support
Axel Davy
axel.davy at ens.fr
Fri Jan 30 12:34:18 PST 2015
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.
Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
src/gallium/state_trackers/nine/basetexture9.c | 12 ++++++++++--
src/gallium/state_trackers/nine/nine_pipe.h | 6 ++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index 8d183e6..f2ca35b 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -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);
diff --git a/src/gallium/state_trackers/nine/nine_pipe.h b/src/gallium/state_trackers/nine/nine_pipe.h
index 6e4ee43..640bbdb 100644
--- a/src/gallium/state_trackers/nine/nine_pipe.h
+++ b/src/gallium/state_trackers/nine/nine_pipe.h
@@ -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:
--
2.1.0
More information about the mesa-dev
mailing list