Commit 14873305 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

d3d11_fmt: pass the whole texture array to AllocateShaderView()

For CPU formats mapped to GPU each texture of the array may be different.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent d895ea98
......@@ -819,7 +819,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, const video_forma
break;
}
AllocateShaderView(VLC_OBJECT(va), dx_sys->d3ddev, textureFmt, pic->p_sys->texture[KNOWN_DXGI_INDEX], pic->p_sys->slice_index, pic->p_sys->resourceView);
AllocateShaderView(VLC_OBJECT(va), dx_sys->d3ddev, textureFmt, pic->p_sys->texture, pic->p_sys->slice_index, pic->p_sys->resourceView);
dx_sys->hw_surface[surface_idx] = pic->p_sys->decoder;
}
......@@ -888,7 +888,10 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id, const video_forma
}
if (texDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE)
AllocateShaderView(VLC_OBJECT(va), dx_sys->d3ddev, textureFmt, p_texture, dx_sys->surface_count, &sys->resourceView[dx_sys->surface_count * D3D11_MAX_SHADER_VIEW]);
{
ID3D11Texture2D *textures[D3D11_MAX_SHADER_VIEW] = {p_texture, p_texture, p_texture};
AllocateShaderView(VLC_OBJECT(va), dx_sys->d3ddev, textureFmt, textures, dx_sys->surface_count, &sys->resourceView[dx_sys->surface_count * D3D11_MAX_SHADER_VIEW]);
}
}
}
msg_Dbg(va, "ID3D11VideoDecoderOutputView succeed with %d surfaces (%dx%d)",
......
......@@ -107,14 +107,14 @@ static inline void ReleasePictureSys(picture_sys_t *p_sys)
/* map texture planes to resource views */
static inline int AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
const d3d_format_t *format,
ID3D11Texture2D *p_texture, UINT slice_index,
ID3D11Texture2D *p_texture[D3D11_MAX_SHADER_VIEW], UINT slice_index,
ID3D11ShaderResourceView *resourceView[D3D11_MAX_SHADER_VIEW])
{
HRESULT hr;
int i;
D3D11_SHADER_RESOURCE_VIEW_DESC resviewDesc = { 0 };
D3D11_TEXTURE2D_DESC texDesc;
ID3D11Texture2D_GetDesc(p_texture, &texDesc);
ID3D11Texture2D_GetDesc(p_texture[0], &texDesc);
assert(texDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE);
if (texDesc.ArraySize == 1)
......@@ -136,7 +136,7 @@ static inline int AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
resourceView[i] = NULL;
else
{
hr = ID3D11Device_CreateShaderResourceView(d3ddevice, (ID3D11Resource*)p_texture, &resviewDesc, &resourceView[i]);
hr = ID3D11Device_CreateShaderResourceView(d3ddevice, (ID3D11Resource*)p_texture[i], &resviewDesc, &resourceView[i]);
if (FAILED(hr)) {
msg_Err(obj, "Could not Create the Texture ResourceView %d slice %d. (hr=0x%lX)", i, slice_index, hr);
break;
......
......@@ -761,7 +761,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
sys->stagingSys.texture[plane] = textures[plane];
if (AllocateShaderView(VLC_OBJECT(vd), sys->d3ddevice, sys->picQuadConfig,
textures[0], 0, sys->stagingSys.resourceView))
textures, 0, sys->stagingSys.resourceView))
goto error;
} else
#endif
......@@ -773,7 +773,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
for (picture_count = 0; picture_count < pool_size; picture_count++) {
if (AllocateShaderView(VLC_OBJECT(vd), sys->d3ddevice, sys->picQuadConfig,
pictures[picture_count]->p_sys->texture[0], picture_count,
pictures[picture_count]->p_sys->texture, picture_count,
pictures[picture_count]->p_sys->resourceView))
goto error;
}
......@@ -2769,7 +2769,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
d3dquad->picSys.texture[plane] = textures[plane];
}
if (AllocateShaderView(VLC_OBJECT(vd), sys->d3ddevice, sys->d3dregion_format,
d3dquad->picSys.texture[0], 0,
d3dquad->picSys.texture, 0,
d3dquad->picSys.resourceView)) {
msg_Err(vd, "Failed to create %dx%d shader view for OSD",
r->fmt.i_visible_width, r->fmt.i_visible_height);
......
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