Commit 79a2accc authored by Steve Lhomme's avatar Steve Lhomme

direct3d11: we only support 2 render target view

When rendering to NV12/P010 otherwise we only need one.
parent ed79d19a
......@@ -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;
......
......@@ -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)
......
......@@ -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:
......
......@@ -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 *);
......
......@@ -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]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment