[vlc-commits] direct3d11: support rendering from Y210 (4:2:2 10 bit) to RGB
Steve Lhomme
git at videolan.org
Fri Mar 13 10:28:45 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Mar 13 08:16:55 2020 +0100| [5b7d9e132f0be2dde57bd6c11de7df5f1b960c88] | committer: Steve Lhomme
direct3d11: support rendering from Y210 (4:2:2 10 bit) to RGB
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5b7d9e132f0be2dde57bd6c11de7df5f1b960c88
---
modules/video_output/win32/d3d11_quad.c | 1 +
modules/video_output/win32/d3d11_shaders.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index e62e6e7932..a286b4b5b8 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -1089,6 +1089,7 @@ void D3D11_UpdateViewport(d3d_quad_t *quad, const RECT *rect, const d3d_format_t
case DXGI_FORMAT_R16G16B16A16_UNORM:
case DXGI_FORMAT_YUY2:
case DXGI_FORMAT_AYUV:
+ case DXGI_FORMAT_Y210:
if ( display->formatTexture == DXGI_FORMAT_NV12 ||
display->formatTexture == DXGI_FORMAT_P010 )
{
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index ad8e39e0a2..6dfbc27163 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -204,6 +204,7 @@ bool IsRGBShader(const d3d_format_t *cfg)
cfg->resourceFormat[0] != DXGI_FORMAT_R16_UNORM &&
cfg->formatTexture != DXGI_FORMAT_YUY2 &&
cfg->formatTexture != DXGI_FORMAT_AYUV &&
+ cfg->formatTexture != DXGI_FORMAT_Y210 &&
cfg->formatTexture != DXGI_FORMAT_420_OPAQUE;
}
@@ -376,6 +377,13 @@ HRESULT (D3D11_CompilePixelShader)(vlc_object_t *o, const d3d11_shaders_t *shade
"sample.z = shaderTexture[0].Sample(samplerState, coords).a;\n"
"sample.a = 1;";
break;
+ case DXGI_FORMAT_Y210:
+ psz_sampler[0] =
+ "sample.x = shaderTexture[0].Sample(samplerState, coords).r;\n"
+ "sample.y = shaderTexture[0].Sample(samplerState, coords).g;\n"
+ "sample.z = shaderTexture[0].Sample(samplerState, coords).a;\n"
+ "sample.a = 1;";
+ break;
case DXGI_FORMAT_AYUV:
psz_sampler[0] =
"sample.x = shaderTexture[0].Sample(samplerState, coords).z;\n"
@@ -734,6 +742,7 @@ void D3D11_ClearRenderTargets(d3d11_device_t *d3d_dev, const d3d_format_t *cfg,
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};
+ static const FLOAT blackY210[4] = {0.0f, 0.5f, 0.5f, 0.0f};
static_assert(D3D11_MAX_RENDER_TARGET >= 2, "we need at least 2 RenderTargetView for NV12/P010");
@@ -754,6 +763,9 @@ void D3D11_ClearRenderTargets(d3d11_device_t *d3d_dev, const d3d_format_t *cfg,
case DXGI_FORMAT_YUY2:
ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[0], blackYUY2);
break;
+ case DXGI_FORMAT_Y210:
+ ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[0], blackY210);
+ break;
case DXGI_FORMAT_AYUV:
ID3D11DeviceContext_ClearRenderTargetView( d3d_dev->d3dcontext, targets[0], blackVUYA);
break;
More information about the vlc-commits
mailing list