mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
vo_gpu: d3d11: set the ra_format.storable flag
This flag was added in e2976e662d, but it was only set for Vulkan. In
D3D11 it can be set from info in D3D11_FEATURE_FORMAT_SUPPORT2.
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#ifndef D3D11_1_UAV_SLOT_COUNT
|
#ifndef D3D11_1_UAV_SLOT_COUNT
|
||||||
#define D3D11_1_UAV_SLOT_COUNT (64)
|
#define D3D11_1_UAV_SLOT_COUNT (64)
|
||||||
#endif
|
#endif
|
||||||
|
#define D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE (0x80)
|
||||||
|
|
||||||
struct dll_version {
|
struct dll_version {
|
||||||
uint16_t major;
|
uint16_t major;
|
||||||
@@ -210,6 +211,9 @@ static void setup_formats(struct ra *ra)
|
|||||||
// RA requires renderable surfaces to be blendable as well
|
// RA requires renderable surfaces to be blendable as well
|
||||||
static const UINT sup_render = D3D11_FORMAT_SUPPORT_RENDER_TARGET |
|
static const UINT sup_render = D3D11_FORMAT_SUPPORT_RENDER_TARGET |
|
||||||
D3D11_FORMAT_SUPPORT_BLENDABLE;
|
D3D11_FORMAT_SUPPORT_BLENDABLE;
|
||||||
|
// Typed UAVs are equivalent to images. RA only cares if they're storable.
|
||||||
|
static const UINT sup_store = D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW;
|
||||||
|
static const UINT sup2_store = D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE;
|
||||||
|
|
||||||
struct ra_d3d11 *p = ra->priv;
|
struct ra_d3d11 *p = ra->priv;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@@ -223,6 +227,11 @@ static void setup_formats(struct ra *ra)
|
|||||||
if ((support & sup_basic) != sup_basic)
|
if ((support & sup_basic) != sup_basic)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
D3D11_FEATURE_DATA_FORMAT_SUPPORT2 sup2 = { .InFormat = d3dfmt->fmt };
|
||||||
|
ID3D11Device_CheckFeatureSupport(p->dev, D3D11_FEATURE_FORMAT_SUPPORT2,
|
||||||
|
², sizeof(sup2));
|
||||||
|
UINT support2 = sup2.OutFormatSupport2;
|
||||||
|
|
||||||
struct ra_format *fmt = talloc_zero(ra, struct ra_format);
|
struct ra_format *fmt = talloc_zero(ra, struct ra_format);
|
||||||
*fmt = (struct ra_format) {
|
*fmt = (struct ra_format) {
|
||||||
.name = d3dfmt->name,
|
.name = d3dfmt->name,
|
||||||
@@ -233,9 +242,9 @@ static void setup_formats(struct ra *ra)
|
|||||||
.pixel_size = d3dfmt->bytes,
|
.pixel_size = d3dfmt->bytes,
|
||||||
.linear_filter = (support & sup_filter) == sup_filter,
|
.linear_filter = (support & sup_filter) == sup_filter,
|
||||||
.renderable = (support & sup_render) == sup_render,
|
.renderable = (support & sup_render) == sup_render,
|
||||||
// TODO: Check whether it's a storage format
|
.storable = p->fl >= D3D_FEATURE_LEVEL_11_0 &&
|
||||||
// https://docs.microsoft.com/en-us/windows/desktop/direct3d12/typed-unordered-access-view-loads
|
(support & sup_store) == sup_store &&
|
||||||
.storable = true,
|
(support2 & sup2_store) == sup2_store,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (support & D3D11_FORMAT_SUPPORT_TEXTURE1D)
|
if (support & D3D11_FORMAT_SUPPORT_TEXTURE1D)
|
||||||
|
|||||||
Reference in New Issue
Block a user