[vlc-commits] direct3d11: compile 9.x compatible shaders only for 9.x feature levels
Steve Lhomme
git at videolan.org
Wed Mar 14 11:52:13 CET 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Mar 13 14:26:28 2018 +0100| [4909be7a3c8b8ddee7aea4abe63e249cfa7cc1c8] | committer: Hugo Beauzée-Luyssen
direct3d11: compile 9.x compatible shaders only for 9.x feature levels
That only happens when D3D11 is forced on Win7
(cherry picked from commit e3d92eec71eb5d7ecfb54485b6bd8dbf87d4b4e3)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4909be7a3c8b8ddee7aea4abe63e249cfa7cc1c8
---
modules/video_output/win32/direct3d11.c | 39 +++++++++++++++++++--------------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 4e5ac5eb4f..da55cf93ac 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1724,12 +1724,28 @@ static ID3DBlob* CompileShader(vout_display_t *vd, const char *psz_shader, bool
{
vout_display_sys_t *sys = vd->sys;
ID3DBlob* pShaderBlob = NULL, *pErrBlob;
+ const char *target;
+ if (pixel)
+ {
+ if (likely(sys->d3d_dev.feature_level >= D3D_FEATURE_LEVEL_10_0))
+ target = "ps_4_0";
+ else if (sys->d3d_dev.feature_level >= D3D_FEATURE_LEVEL_9_3)
+ target = "ps_4_0_level_9_3";
+ else
+ target = "ps_4_0_level_9_1";
+ }
+ else
+ {
+ if (likely(sys->d3d_dev.feature_level >= D3D_FEATURE_LEVEL_10_0))
+ target = "vs_4_0";
+ else if (sys->d3d_dev.feature_level >= D3D_FEATURE_LEVEL_9_3)
+ target = "vs_4_0_level_9_3";
+ else
+ target = "vs_4_0_level_9_1";
+ }
- /* TODO : Match the version to the D3D_FEATURE_LEVEL */
HRESULT hr = D3DCompile(psz_shader, strlen(psz_shader),
- NULL, NULL, NULL, "main",
- pixel ? (sys->legacy_shader ? "ps_4_0_level_9_1" : "ps_4_0") :
- (sys->legacy_shader ? "vs_4_0_level_9_1" : "vs_4_0"),
+ NULL, NULL, NULL, "main", target,
0, 0, &pShaderBlob, &pErrBlob);
if (FAILED(hr)) {
@@ -2032,19 +2048,8 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
hr = CompilePixelShader(vd, sys->picQuadConfig, fmt->transfer, fmt->b_color_range_full, &sys->picQuadPixelShader);
if (FAILED(hr))
{
-#ifdef HAVE_ID3D11VIDEODECODER
- if (!sys->legacy_shader)
- {
- sys->legacy_shader = true;
- msg_Dbg(vd, "fallback to legacy shader mode");
- hr = CompilePixelShader(vd, sys->picQuadConfig, fmt->transfer, fmt->b_color_range_full, &sys->picQuadPixelShader);
- }
-#endif
- if (FAILED(hr))
- {
- msg_Err(vd, "Failed to create the pixel shader. (hr=0x%lX)", hr);
- return VLC_EGENERIC;
- }
+ msg_Err(vd, "Failed to create the pixel shader. (hr=0x%lX)", hr);
+ return VLC_EGENERIC;
}
sys->picQuad.i_width = fmt->i_width;
More information about the vlc-commits
mailing list