diff options
author | Axel Davy <[email protected]> | 2015-01-19 17:13:57 +0100 |
---|---|---|
committer | Axel Davy <[email protected]> | 2015-02-06 00:07:19 +0100 |
commit | 1543defc5ea8a17cf5558bb6468031f9c29b9a15 (patch) | |
tree | cad602eac7521c1b388009f4b6bed393bd3434eb /src/gallium/state_trackers/nine/swapchain9.c | |
parent | 49214a3dfc4f5173e22846d92c5dd0c2b24e3638 (diff) |
st/nine: Fix depth stencil formats bindings flags.
Reviewed-by: Tiziano Bacocco <[email protected]>
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/swapchain9.c')
-rw-r--r-- | src/gallium/state_trackers/nine/swapchain9.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c index 03ed24ee6c8..296d6dcd474 100644 --- a/src/gallium/state_trackers/nine/swapchain9.c +++ b/src/gallium/state_trackers/nine/swapchain9.c @@ -341,8 +341,14 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, pipe_resource_reference(&resource, NULL); } if (pParams->EnableAutoDepthStencil) { - tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_TRANSFER_READ | - PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_DEPTH_STENCIL; + tmplt.bind = d3d9_get_pipe_depth_format_bindings(pParams->AutoDepthStencilFormat); + /* Checking the d3d9 depth format for texture support indicates the app if it can use + * the format for shadow mapping or texturing. If the check returns true, then the app + * is allowed to use this functionnality, so try first to create the buffer + * with PIPE_BIND_SAMPLER_VIEW. If the format can't be created with it, try without. + * If it fails with PIPE_BIND_SAMPLER_VIEW, then the app check for texture support + * would fail too, so we are fine. */ + tmplt.bind |= PIPE_BIND_SAMPLER_VIEW; tmplt.nr_samples = pParams->MultiSampleType; tmplt.format = d3d9_to_pipe_format_checked(This->screen, pParams->AutoDepthStencilFormat, @@ -350,6 +356,16 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, tmplt.nr_samples, tmplt.bind, FALSE); + if (tmplt.format == PIPE_FORMAT_NONE) { + tmplt.bind &= ~PIPE_BIND_SAMPLER_VIEW; + tmplt.format = d3d9_to_pipe_format_checked(This->screen, + pParams->AutoDepthStencilFormat, + PIPE_TEXTURE_2D, + tmplt.nr_samples, + tmplt.bind, + FALSE); + } + if (tmplt.format == PIPE_FORMAT_NONE) return D3DERR_INVALIDCALL; |