PR #20659 opened by Dmitrii Ovchinnikov (OvchinnikovDmitrii) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20659 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20659.patch
>From 06c3e466890b71232e36f1859fe64bcb2dc33476 Mon Sep 17 00:00:00 2001 From: Dmitrii Ovchinnikov <[email protected]> Date: Tue, 7 Oct 2025 16:12:42 +0200 Subject: [PATCH] avutil/hwcontext_d3d11va: added resource and heap flags to DeviceContext --- doc/APIchanges | 3 +++ libavutil/hwcontext_d3d11va.c | 15 +++++++++++++++ libavutil/hwcontext_d3d11va.h | 14 ++++++++++++++ libavutil/version.h | 2 +- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 6e7f5d2037..5e2068767e 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28 API changes, most recent first: +2025-10-xx - xxxxxxxxxx - lavu 60.14.100 - hwcontext_d3d11va.h + Add BindFlags and MiscFlags to AVD3D11VADeviceContext + 2025-08-xx - xxxxxxxxxx - lavf 62.6.100 - oggparsevorbis.h oggparseopus.h oggparseflac.h Drop header packets from secondary chained ogg/{flac, opus, vorbis} streams from demuxer output. diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 83414ad0d4..418fe9dfda 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -290,6 +290,9 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) return AVERROR(EINVAL); } + hwctx->BindFlags |= device_hwctx->BindFlags; + hwctx->MiscFlags |= device_hwctx->MiscFlags; + ctx->initial_pool_size = FFMIN(ctx->initial_pool_size, MAX_ARRAY_SIZE); texDesc = (D3D11_TEXTURE2D_DESC){ @@ -710,6 +713,18 @@ static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device, } #endif + if (av_dict_get(opts, "SHADER", NULL, 0)) + device_hwctx->BindFlags |= D3D11_BIND_SHADER_RESOURCE; + + if (av_dict_get(opts, "UAV", NULL, 0)) + device_hwctx->BindFlags |= D3D11_BIND_UNORDERED_ACCESS; + + if (av_dict_get(opts, "RTV", NULL, 0)) + device_hwctx->BindFlags |= D3D11_BIND_RENDER_TARGET; + + if (av_dict_get(opts, "SHARED", NULL, 0)) + device_hwctx->MiscFlags |= D3D11_RESOURCE_MISC_SHARED; + return 0; } diff --git a/libavutil/hwcontext_d3d11va.h b/libavutil/hwcontext_d3d11va.h index 77d2d72f1b..b87b1e8fa2 100644 --- a/libavutil/hwcontext_d3d11va.h +++ b/libavutil/hwcontext_d3d11va.h @@ -94,6 +94,20 @@ typedef struct AVD3D11VADeviceContext { void (*lock)(void *lock_ctx); void (*unlock)(void *lock_ctx); void *lock_ctx; + /** + * D3D11_TEXTURE2D_DESC.BindFlags to be applied to D3D11 resources allocated + * for frames using this device context. + * + * It applies globally to all AVD3D11VAFramesContext allocated from this device context. + */ + UINT BindFlags; + /** + * D3D11_TEXTURE2D_DESC.MiscFlags to be applied to D3D11 resources allocated + * for frames using this device context. + * + * It applies globally to all AVD3D11VAFramesContext allocated from this device context. + */ + UINT MiscFlags; } AVD3D11VADeviceContext; /** diff --git a/libavutil/version.h b/libavutil/version.h index 1099715076..176b99aef3 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -79,7 +79,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 60 -#define LIBAVUTIL_VERSION_MINOR 13 +#define LIBAVUTIL_VERSION_MINOR 14 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
