aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/frontends/nine
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2019-06-04 00:24:15 +0200
committerMarge Bot <[email protected]>2020-05-15 15:43:57 +0000
commit54a7a6908597e016912609db16532cc8eba16864 (patch)
tree1cc098e9afe5c5426bf2af3e4463ff040e0e0468 /src/gallium/frontends/nine
parentedff31c0d902cd83495a1e49f306d8f031cf118b (diff)
st/nine: Pass more adapter formats for CheckDepthStencilMatch
It seems CheckDepthStencilMatch should accept A8R8G8B8 as adapter format. Given the lack of clarity of the doc relative to the difference between display format and adapter format (== display format modulo alpha bits), for now just accept display formats with and without alpha bits. Fixes: https://github.com/iXit/Mesa-3D/issues/317 Signed-off-by: Axel Davy <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5015>
Diffstat (limited to 'src/gallium/frontends/nine')
-rw-r--r--src/gallium/frontends/nine/adapter9.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/gallium/frontends/nine/adapter9.c b/src/gallium/frontends/nine/adapter9.c
index e8d4697986c..200e5389949 100644
--- a/src/gallium/frontends/nine/adapter9.c
+++ b/src/gallium/frontends/nine/adapter9.c
@@ -255,6 +255,26 @@ display_format( D3DFORMAT fmt,
return FALSE;
}
+static inline boolean
+adapter_format( D3DFORMAT fmt )
+{
+ /* Formats that are compatible to display_format (modulo alpha bits) */
+ static const D3DFORMAT allowed[] = {
+ D3DFMT_A2R10G10B10,
+ D3DFMT_X8R8G8B8,
+ D3DFMT_A8R8G8B8,
+ D3DFMT_X1R5G5B5,
+ D3DFMT_A1R5G5B5,
+ D3DFMT_R5G6B5,
+ };
+ unsigned i;
+
+ for (i = 0; i < sizeof(allowed)/sizeof(D3DFORMAT); i++) {
+ if (fmt == allowed[i]) { return TRUE; }
+ }
+ return FALSE;
+}
+
HRESULT NINE_WINAPI
NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This,
D3DDEVTYPE DeviceType,
@@ -460,7 +480,10 @@ NineAdapter9_CheckDepthStencilMatch( struct NineAdapter9 *This,
d3dformat_to_string(RenderTargetFormat),
d3dformat_to_string(DepthStencilFormat));
- user_assert(display_format(AdapterFormat, FALSE), D3DERR_NOTAVAILABLE);
+ /* TODO: does it check AdapterFormat at all ?
+ * It seems to need to pass at least for A8R8G8B8:
+ * https://github.com/iXit/Mesa-3D/issues/317 */
+ user_assert(adapter_format(AdapterFormat), D3DERR_NOTAVAILABLE);
user_assert(depth_stencil_format(DepthStencilFormat), D3DERR_NOTAVAILABLE);
hr = NineAdapter9_GetScreen(This, DeviceType, &screen);