The branch, master has been updated via efd484cb2dc3e3aa0eaf1855535186ccde3dc97c (commit) via 00ddb408c53c39b8462931a06b28f56bd64bf8af (commit) from a0936b9769718f13662812eb9ea4ae377916c6a8 (commit)
- Log ----------------------------------------------------------------- commit efd484cb2dc3e3aa0eaf1855535186ccde3dc97c Author: Timo Rothenpieler <t...@rothenpieler.org> AuthorDate: Tue Sep 9 21:46:25 2025 +0200 Commit: Timo Rothenpieler <t...@rothenpieler.org> CommitDate: Wed Sep 17 14:50:41 2025 +0000 avutil/hwcontext_d3d11va: remove D3D11_BIND_RENDER_TARGET restriction for array textures This was added in 4f78711f9c28b11dae4e4b96be46b6b4925eb8c6, with the commit message claiming that it's a Microsoft restriction that array textures with ArraySize > 2 cannot be created with D3D11_BIND_RENDER_TARGET. I was unable to find any documentation or other references on that, and a quick test also found it to not be the case. So this patch removes that restriction. This enables frame sources, like the d3d11 capture filters, to output frames in an array texture, which is neccesary to pass those frames as input to some hardware encoders. diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 9831f530c1..83414ad0d4 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -318,7 +318,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) ctx->initial_pool_size = texDesc2.ArraySize; hwctx->BindFlags = texDesc2.BindFlags; hwctx->MiscFlags = texDesc2.MiscFlags; - } else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && texDesc.ArraySize > 0) { + } else if (texDesc.ArraySize > 0) { hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, NULL, &hwctx->texture); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Could not create the texture (%lx)\n", (long)hr); commit 00ddb408c53c39b8462931a06b28f56bd64bf8af Author: Timo Rothenpieler <t...@rothenpieler.org> AuthorDate: Tue Sep 9 20:08:22 2025 +0200 Commit: Timo Rothenpieler <t...@rothenpieler.org> CommitDate: Wed Sep 17 14:50:41 2025 +0000 avfilter/vsrc_ddagrab: support rendering mouse cursor onto array textures diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 6533e2b66e..e035ac9bc4 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -818,6 +818,8 @@ static av_cold int init_hwframes_ctx(AVFilterContext *avctx) dda->frames_ctx->format = AV_PIX_FMT_D3D11; dda->frames_ctx->width = dda->width; dda->frames_ctx->height = dda->height; + if (avctx->extra_hw_frames > 0) + dda->frames_ctx->initial_pool_size = 8 + avctx->extra_hw_frames; switch (dda->raw_format) { case DXGI_FORMAT_B8G8R8A8_UNORM: @@ -936,7 +938,7 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame) D3D11_RENDER_TARGET_VIEW_DESC target_desc = { 0 }; ID3D11RenderTargetView* target_view = NULL; ID3D11Buffer *mouse_vertex_buffer = NULL; - D3D11_TEXTURE2D_DESC tex_desc; + D3D11_TEXTURE2D_DESC tex_desc, frame_desc; int num_vertices = 0; int x, y; HRESULT hr; @@ -946,6 +948,7 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame) return 0; ID3D11Texture2D_GetDesc(dda->mouse_texture, &tex_desc); + ID3D11Texture2D_GetDesc(frame_tex, &frame_desc); x = dda->mouse_x - dda->offset_x; y = dda->mouse_y - dda->offset_y; @@ -954,9 +957,17 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame) -x >= (int)tex_desc.Width || -y >= (int)tex_desc.Height) return 0; - target_desc.Format = dda->raw_format; - target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; - target_desc.Texture2D.MipSlice = 0; + target_desc.Format = frame_desc.Format; + + if (frame_desc.ArraySize > 1) { + target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; + target_desc.Texture2DArray.ArraySize = 1; + target_desc.Texture2DArray.FirstArraySlice = (uintptr_t)frame->data[1]; + target_desc.Texture2DArray.MipSlice = 0; + } else { + target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + target_desc.Texture2D.MipSlice = 0; + } hr = ID3D11Device_CreateRenderTargetView(dda->device_hwctx->device, (ID3D11Resource*)frame_tex, ----------------------------------------------------------------------- Summary of changes: libavfilter/vsrc_ddagrab.c | 19 +++++++++++++++---- libavutil/hwcontext_d3d11va.c | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) hooks/post-receive -- _______________________________________________ ffmpeg-cvslog mailing list -- ffmpeg-cvslog@ffmpeg.org To unsubscribe send an email to ffmpeg-cvslog-le...@ffmpeg.org