[vlc-commits] d3d11_shaders: add a function to clear a render target
Steve Lhomme
git at videolan.org
Wed Oct 17 16:07:38 CEST 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jan 9 15:03:37 2018 +0100| [3ff6847df95ec075034d6992300d3ae86b110f9e] | committer: Steve Lhomme
d3d11_shaders: add a function to clear a render target
(cherry picked from commit 2758d6bd4e5c1d85f097e668ec157493c6c873ef)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=3ff6847df95ec075034d6992300d3ae86b110f9e
---
modules/video_output/win32/d3d11_shaders.c | 36 ++++++++++++++++++++++++++++++
modules/video_output/win32/d3d11_shaders.h | 3 +++
2 files changed, 39 insertions(+)
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index 747916f1bb..35405811e3 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -537,3 +537,39 @@ HRESULT D3D11_CreateRenderTargets( d3d11_device_t *d3d_dev, ID3D11Resource *text
}
return S_OK;
}
+
+void D3D11_ClearRenderTargets(d3d11_device_t *d3d_dev, const d3d_format_t *cfg,
+ ID3D11RenderTargetView *targets[D3D11_MAX_SHADER_VIEW])
+{
+ static const FLOAT blackY[1] = {0.0f};
+ static const FLOAT blackUV[2] = {0.5f, 0.5f};
+ static const FLOAT blackRGBA[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+ static const FLOAT blackYUY2[4] = {0.0f, 0.5f, 0.0f, 0.5f};
+ static const FLOAT blackVUYA[4] = {0.5f, 0.5f, 0.0f, 1.0f};
+
+ switch (cfg->formatTexture)
+ {
+ case DXGI_FORMAT_NV12:
+ case DXGI_FORMAT_P010:
+ ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[0], blackY);
+ ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[1], blackUV);
+ break;
+ case DXGI_FORMAT_R8G8B8A8_UNORM:
+ case DXGI_FORMAT_B8G8R8A8_UNORM:
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
+ case DXGI_FORMAT_R10G10B10A2_UNORM:
+ ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[0], blackRGBA);
+ break;
+ case DXGI_FORMAT_YUY2:
+ ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[0], blackYUY2);
+ break;
+ case DXGI_FORMAT_AYUV:
+ ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[0], blackVUYA);
+ break;
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[0], blackRGBA);
+ break;
+ default:
+ vlc_assert_unreachable();
+ }
+}
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index 5eb7e3bade..8049ec945c 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -93,4 +93,7 @@ float GetFormatLuminance(vlc_object_t *, const video_format_t *);
HRESULT D3D11_CreateRenderTargets(d3d11_device_t *, ID3D11Resource *, const d3d_format_t *,
ID3D11RenderTargetView *output[D3D11_MAX_SHADER_VIEW]);
+void D3D11_ClearRenderTargets(d3d11_device_t *, const d3d_format_t *,
+ ID3D11RenderTargetView *targets[D3D11_MAX_SHADER_VIEW]);
+
#endif /* VLC_D3D11_SHADERS_H */
More information about the vlc-commits
mailing list