diff options
author | Axel Davy <[email protected]> | 2016-10-02 00:58:48 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-10-10 23:43:51 +0200 |
commit | 63367e6c9507dccba4e8bc563e190123e25b6893 (patch) | |
tree | de38b705b6ca4f85d8302e320592b0dbb778941d /src | |
parent | 60624be2033f06b414cf76794c2f3b061dc28332 (diff) |
st/nine: Fix check and remove useless code in swapchain9
The removed code was there for two reasons:
1) Allow DF16, DF24, INTZ to be used as depth buffer
for swapchain, if the driver doesn't support
PIPE_BIND_SAMPLER_VIEW for the underlying format
2) Set PIPE_BIND_SAMPLER_VIEW if possible, such that
if StretchRect is called on the depth texture, it is happy.
1) The reason these formats needed a workaround is because
the check flags for them in CheckDeviceFormat were incorrect,
which led applications to think the formats were valid for
swapchains, even if they weren't supported.
2) StretchRect limitations for depth buffers force
the resource_copy_region path, which should be fine without
PIPE_BIND_SAMPLER_VIEW.
Thus fix the check for 1), and remove the code.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/nine/adapter9.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/swapchain9.c | 16 |
2 files changed, 5 insertions, 17 deletions
diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c index 09bfa3989ff..e9c911b1ea6 100644 --- a/src/gallium/state_trackers/nine/adapter9.c +++ b/src/gallium/state_trackers/nine/adapter9.c @@ -297,7 +297,11 @@ NineAdapter9_CheckDeviceFormat( struct NineAdapter9 *This, bind = 0; if (Usage & D3DUSAGE_RENDERTARGET) bind |= PIPE_BIND_RENDER_TARGET; - if (Usage & D3DUSAGE_DEPTHSTENCIL) bind |= PIPE_BIND_DEPTH_STENCIL; + if (Usage & D3DUSAGE_DEPTHSTENCIL) { + if (!depth_stencil_format(CheckFormat)) + return D3DERR_NOTAVAILABLE; + bind |= d3d9_get_pipe_depth_format_bindings(CheckFormat); + } /* API hack because setting RT[0] to NULL is forbidden */ if (CheckFormat == D3DFMT_NULL && bind == PIPE_BIND_RENDER_TARGET && diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c index 86c9be66ae6..37e433ff746 100644 --- a/src/gallium/state_trackers/nine/swapchain9.c +++ b/src/gallium/state_trackers/nine/swapchain9.c @@ -342,13 +342,6 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, } if (pParams->EnableAutoDepthStencil) { 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 = multisample_type; tmplt.format = d3d9_to_pipe_format_checked(This->screen, pParams->AutoDepthStencilFormat, @@ -356,15 +349,6 @@ NineSwapChain9_Resize( struct NineSwapChain9 *This, tmplt.nr_samples, tmplt.bind, FALSE, 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, FALSE); - } if (tmplt.format == PIPE_FORMAT_NONE) return D3DERR_INVALIDCALL; |