[vlc-commits] direct3d11: we only support 2 render target view
Steve Lhomme
git at videolan.org
Tue Apr 30 11:13:57 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Apr 5 16:22:43 2019 +0200| [79a2accca1028a6e0a7d857b02bf3fdc93b55f07] | committer: Steve Lhomme
direct3d11: we only support 2 render target view
When rendering to NV12/P010 otherwise we only need one.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=79a2accca1028a6e0a7d857b02bf3fdc93b55f07
---
modules/video_output/win32/d3d11_quad.c | 2 +-
modules/video_output/win32/d3d11_quad.h | 2 +-
modules/video_output/win32/d3d11_shaders.c | 6 ++++--
modules/video_output/win32/d3d11_shaders.h | 6 ++++--
modules/video_output/win32/direct3d11.c | 6 +++---
5 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/modules/video_output/win32/d3d11_quad.c b/modules/video_output/win32/d3d11_quad.c
index 6584c82154..0e12e29060 100644
--- a/modules/video_output/win32/d3d11_quad.c
+++ b/modules/video_output/win32/d3d11_quad.c
@@ -44,7 +44,7 @@
void D3D11_RenderQuad(d3d11_device_t *d3d_dev, d3d_quad_t *quad, d3d_vshader_t *vsshader,
ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW],
- ID3D11RenderTargetView *d3drenderTargetView[D3D11_MAX_SHADER_VIEW])
+ ID3D11RenderTargetView *d3drenderTargetView[D3D11_MAX_RENDER_TARGET])
{
UINT offset = 0;
diff --git a/modules/video_output/win32/d3d11_quad.h b/modules/video_output/win32/d3d11_quad.h
index c39eb58307..3e8e82b59a 100644
--- a/modules/video_output/win32/d3d11_quad.h
+++ b/modules/video_output/win32/d3d11_quad.h
@@ -47,7 +47,7 @@ typedef struct d3d_vertex_t {
void D3D11_RenderQuad(d3d11_device_t *, d3d_quad_t *, d3d_vshader_t *,
ID3D11ShaderResourceView *resourceViews[D3D11_MAX_SHADER_VIEW],
- ID3D11RenderTargetView *renderTarget[D3D11_MAX_SHADER_VIEW]);
+ ID3D11RenderTargetView *renderTarget[D3D11_MAX_RENDER_TARGET]);
int D3D11_AllocateQuad(vlc_object_t *, d3d11_device_t *, video_projection_mode_t, d3d_quad_t *);
#define D3D11_AllocateQuad(a,b,c,d) D3D11_AllocateQuad(VLC_OBJECT(a),b,c,d)
diff --git a/modules/video_output/win32/d3d11_shaders.c b/modules/video_output/win32/d3d11_shaders.c
index bec0756229..b24f0eb450 100644
--- a/modules/video_output/win32/d3d11_shaders.c
+++ b/modules/video_output/win32/d3d11_shaders.c
@@ -689,7 +689,7 @@ float GetFormatLuminance(vlc_object_t *o, const video_format_t *fmt)
}
HRESULT D3D11_CreateRenderTargets( d3d11_device_t *d3d_dev, ID3D11Resource *texture,
- const d3d_format_t *cfg, ID3D11RenderTargetView *output[D3D11_MAX_SHADER_VIEW] )
+ const d3d_format_t *cfg, ID3D11RenderTargetView *output[D3D11_MAX_RENDER_TARGET] )
{
D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
@@ -712,7 +712,7 @@ HRESULT D3D11_CreateRenderTargets( d3d11_device_t *d3d_dev, ID3D11Resource *text
}
void D3D11_ClearRenderTargets(d3d11_device_t *d3d_dev, const d3d_format_t *cfg,
- ID3D11RenderTargetView *targets[D3D11_MAX_SHADER_VIEW])
+ ID3D11RenderTargetView *targets[D3D11_MAX_RENDER_TARGET])
{
static const FLOAT blackY[1] = {0.0f};
static const FLOAT blackUV[2] = {0.5f, 0.5f};
@@ -720,6 +720,8 @@ void D3D11_ClearRenderTargets(d3d11_device_t *d3d_dev, const d3d_format_t *cfg,
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_assert(D3D11_MAX_RENDER_TARGET >= 2, "we need at least 2 RenderTargetView for NV12/P010");
+
switch (cfg->formatTexture)
{
case DXGI_FORMAT_NV12:
diff --git a/modules/video_output/win32/d3d11_shaders.h b/modules/video_output/win32/d3d11_shaders.h
index fea6dbdd22..501410a2d5 100644
--- a/modules/video_output/win32/d3d11_shaders.h
+++ b/modules/video_output/win32/d3d11_shaders.h
@@ -104,6 +104,8 @@ typedef struct
PS_CONSTANT_BUFFER shaderConstants;
} d3d_quad_t;
+#define D3D11_MAX_RENDER_TARGET 2
+
ID3DBlob* D3D11_CompileShader(vlc_object_t *, const d3d11_handle_t *, const d3d11_device_t *,
const char *psz_shader, bool pixel);
#define D3D11_CompileShader(a,b,c,d,e) D3D11_CompileShader(VLC_OBJECT(a),b,c,d,e)
@@ -129,10 +131,10 @@ float GetFormatLuminance(vlc_object_t *, const video_format_t *);
#define GetFormatLuminance(a,b) GetFormatLuminance(VLC_OBJECT(a),b)
HRESULT D3D11_CreateRenderTargets(d3d11_device_t *, ID3D11Resource *, const d3d_format_t *,
- ID3D11RenderTargetView *output[D3D11_MAX_SHADER_VIEW]);
+ ID3D11RenderTargetView *output[D3D11_MAX_RENDER_TARGET]);
void D3D11_ClearRenderTargets(d3d11_device_t *, const d3d_format_t *,
- ID3D11RenderTargetView *targets[D3D11_MAX_SHADER_VIEW]);
+ ID3D11RenderTargetView *targets[D3D11_MAX_RENDER_TARGET]);
void D3D11_SetVertexShader(d3d_vshader_t *dst, d3d_vshader_t *src);
void D3D11_ReleaseVertexShader(d3d_vshader_t *);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index cb707da834..cd7480ee41 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -108,7 +108,7 @@ struct vout_display_sys_t
picture_sys_t stagingSys;
picture_pool_t *pool; /* hardware decoding pool */
- ID3D11RenderTargetView *swapchainTargetView[D3D11_MAX_SHADER_VIEW];
+ ID3D11RenderTargetView *swapchainTargetView[D3D11_MAX_RENDER_TARGET];
d3d_vshader_t projectionVShader;
d3d_vshader_t flatVShader;
@@ -238,7 +238,7 @@ static bool Resize(void *opaque, unsigned i_width, unsigned i_height)
if (dsc.Width == i_width && dsc.Height == i_height)
return true; /* nothing changed */
- for (size_t i=0; i < D3D11_MAX_SHADER_VIEW; i++)
+ for (size_t i=0; i < ARRAY_SIZE(sys->swapchainTargetView); i++)
{
if (sys->swapchainTargetView[i]) {
ID3D11RenderTargetView_Release(sys->swapchainTargetView[i]);
@@ -1627,7 +1627,7 @@ static void Direct3D11DestroyResources(vout_display_t *vd)
D3D11_ReleaseVertexShader(&sys->projectionVShader);
D3D11_ReleasePixelShader(&sys->regionQuad);
- for (size_t i=0; i < D3D11_MAX_SHADER_VIEW; i++)
+ for (size_t i=0; i < ARRAY_SIZE(sys->swapchainTargetView); i++)
{
if (sys->swapchainTargetView[i]) {
ID3D11RenderTargetView_Release(sys->swapchainTargetView[i]);
More information about the vlc-commits
mailing list