Skip to content

Commit

Permalink
direct3d11: fix the size of 10 bits I420 planes
Browse files Browse the repository at this point in the history
The pitch is for 16 bits data so we need to reduce the 16 bits texture width by
that much.

We we using twice too big textures and adjusting for the bug in the sampler.
  • Loading branch information
robUx4 committed Feb 10, 2021
1 parent 8ec8428 commit 65d4eb8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion modules/video_chroma/d3d11_fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
ID3D11Texture2D_AddRef(slicedTexture);
} else {
texDesc.Height = planes[plane].i_lines;
texDesc.Width = planes[plane].i_pitch;
texDesc.Width = planes[plane].i_pitch / p_chroma_desc->pixel_size;
hr = ID3D11Device_CreateTexture2D( d3d_dev->d3ddevice, &texDesc, NULL, &textures[plane] );
if (FAILED(hr)) {
msg_Err(obj, "CreateTexture2D failed for plane %d. (hr=0x%lX)", plane, hr);
Expand Down
14 changes: 3 additions & 11 deletions modules/video_output/win32/d3d_dynamic_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,20 +428,12 @@ HRESULT (D3D_CompilePixelShader)(vlc_object_t *o, const d3d_shader_compiler_t *c
{
case VLC_CODEC_I420_10L:
psz_sampler[0] =
"float3 coords_2 = float3(coords.x/2, coords.y, coords.z);\n"
"sample.x = shaderTexture[0].Sample(samplerState, coords_2).x * 64;\n"
"sample.y = shaderTexture[1].Sample(samplerState, coords_2).x * 64;\n"
"sample.z = shaderTexture[2].Sample(samplerState, coords_2).x * 64;\n"
"sample.x = shaderTexture[0].Sample(samplerState, coords).x * 64;\n"
"sample.y = shaderTexture[1].Sample(samplerState, coords).x * 64;\n"
"sample.z = shaderTexture[2].Sample(samplerState, coords).x * 64;\n"
"sample.a = 1;";
break;
case VLC_CODEC_I444_16L:
psz_sampler[0] =
"float3 coords_2 = float3(coords.x/2, coords.y, coords.z);\n"
"sample.x = shaderTexture[0].Sample(samplerState, coords_2).x;\n"
"sample.y = shaderTexture[1].Sample(samplerState, coords_2).x;\n"
"sample.z = shaderTexture[2].Sample(samplerState, coords_2).x;\n"
"sample.a = 1;";
break;
case VLC_CODEC_I420:
psz_sampler[0] =
"sample.x = shaderTexture[0].Sample(samplerState, coords).x;\n"
Expand Down

0 comments on commit 65d4eb8

Please sign in to comment.