Commit de40ab5d authored by Steve Lhomme's avatar Steve Lhomme

direct3d11: only give initialized resource views to the shader

May help solving 394ea0e5-7f32-4463-86d4-5a30f65ae243
parent 95487410
......@@ -147,3 +147,13 @@ const char *DxgiVendorStr(int gpu_vendor)
}
return vendors[i].name;
}
UINT DxgiResourceCount(const d3d_format_t *d3d_fmt)
{
for (UINT count=0; count<D3D11_MAX_SHADER_VIEW; count++)
{
if (d3d_fmt->resourceFormat[count] == DXGI_FORMAT_UNKNOWN)
return count;
}
return D3D11_MAX_SHADER_VIEW;
}
......@@ -54,5 +54,6 @@ vlc_fourcc_t DxgiFormatFourcc(DXGI_FORMAT format);
const d3d_format_t *GetRenderFormatList(void);
void DxgiFormatMask(DXGI_FORMAT format, video_format_t *);
const char *DxgiVendorStr(int gpu_vendor);
UINT DxgiResourceCount(const d3d_format_t *);
#endif /* include-guard */
......@@ -103,6 +103,7 @@ typedef struct {
typedef struct
{
picture_sys_t picSys;
UINT resourceCount;
ID3D11Buffer *pVertexBuffer;
UINT vertexCount;
ID3D11VertexShader *d3dvertexShader;
......@@ -647,6 +648,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
if (is_d3d11_opaque(surface_fmt.i_chroma) && !sys->legacy_shader)
#endif
{
sys->picQuad.resourceCount = DxgiResourceCount(sys->picQuadConfig);
for (picture_count = 0; picture_count < pool_size; picture_count++) {
if (AllocateShaderView(VLC_OBJECT(vd), sys->d3d_dev.d3ddevice, sys->picQuadConfig,
pictures[picture_count]->p_sys->texture, picture_count,
......@@ -1079,7 +1081,7 @@ static void DisplayD3DPicture(vout_display_sys_t *sys, d3d_quad_t *quad, ID3D11S
ID3D11DeviceContext_PSSetShader(sys->d3d_dev.d3dcontext, quad->d3dpixelShader, NULL, 0);
ID3D11DeviceContext_PSSetConstantBuffers(sys->d3d_dev.d3dcontext, 0, quad->PSConstantsCount, quad->pPixelShaderConstants);
ID3D11DeviceContext_PSSetShaderResources(sys->d3d_dev.d3dcontext, 0, D3D11_MAX_SHADER_VIEW, resourceView);
ID3D11DeviceContext_PSSetShaderResources(sys->d3d_dev.d3dcontext, 0, quad->resourceCount, resourceView);
ID3D11DeviceContext_RSSetViewports(sys->d3d_dev.d3dcontext, 1, &quad->cropViewport);
......@@ -2061,6 +2063,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
return VLC_EGENERIC;
}
sys->picQuad.resourceCount = DxgiResourceCount(sys->picQuadConfig);
if (AllocateShaderView(VLC_OBJECT(vd), sys->d3d_dev.d3ddevice, sys->picQuadConfig,
textures, 0, sys->stagingSys.resourceView))
{
......@@ -2944,6 +2947,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
continue;
}
d3dquad->resourceCount = DxgiResourceCount(sys->d3dregion_format);
if (AllocateShaderView(VLC_OBJECT(vd), sys->d3d_dev.d3ddevice, sys->d3dregion_format,
d3dquad->picSys.texture, 0,
d3dquad->picSys.resourceView)) {
......
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