mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-29 17:52:18 +01:00
[d3d11] Implement support for D3D11_FEATURE_FORMAT_SUPPORT2
This commit is contained in:
parent
09151f3616
commit
efcd5c6b4d
@ -1292,7 +1292,7 @@ namespace dxvk {
|
||||
HRESULT STDMETHODCALLTYPE D3D11Device::CheckFormatSupport(
|
||||
DXGI_FORMAT Format,
|
||||
UINT* pFormatSupport) {
|
||||
return GetFormatSupportFlags(Format, pFormatSupport);
|
||||
return GetFormatSupportFlags(Format, pFormatSupport, nullptr);
|
||||
}
|
||||
|
||||
|
||||
@ -1385,7 +1385,15 @@ namespace dxvk {
|
||||
return E_INVALIDARG;
|
||||
|
||||
auto info = static_cast<D3D11_FEATURE_DATA_FORMAT_SUPPORT*>(pFeatureSupportData);
|
||||
return GetFormatSupportFlags(info->InFormat, &info->OutFormatSupport);
|
||||
return GetFormatSupportFlags(info->InFormat, &info->OutFormatSupport, nullptr);
|
||||
} return S_OK;
|
||||
|
||||
case D3D11_FEATURE_FORMAT_SUPPORT2: {
|
||||
if (FeatureSupportDataSize != sizeof(D3D11_FEATURE_DATA_FORMAT_SUPPORT2))
|
||||
return E_INVALIDARG;
|
||||
|
||||
auto info = static_cast<D3D11_FEATURE_DATA_FORMAT_SUPPORT2*>(pFeatureSupportData);
|
||||
return GetFormatSupportFlags(info->InFormat, nullptr, &info->OutFormatSupport2);
|
||||
} return S_OK;
|
||||
|
||||
case D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS: {
|
||||
@ -1761,58 +1769,71 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11Device::GetFormatSupportFlags(DXGI_FORMAT Format, UINT* pFlags) const {
|
||||
HRESULT D3D11Device::GetFormatSupportFlags(DXGI_FORMAT Format, UINT* pFlags1, UINT* pFlags2) const {
|
||||
const VkFormat fmt = m_dxgiAdapter->LookupFormat(Format, DxgiFormatMode::Any).format;
|
||||
const VkFormatProperties fmtInfo = m_dxvkAdapter->formatProperties(fmt);
|
||||
|
||||
if (fmt == VK_FORMAT_UNDEFINED)
|
||||
return E_FAIL;
|
||||
|
||||
UINT flags = 0;
|
||||
UINT flags1 = 0;
|
||||
UINT flags2 = 0;
|
||||
|
||||
if (fmtInfo.bufferFeatures & VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT)
|
||||
flags |= D3D11_FORMAT_SUPPORT_BUFFER;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_BUFFER;
|
||||
|
||||
if (fmtInfo.bufferFeatures & VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT)
|
||||
flags |= D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER;
|
||||
|
||||
if (Format == DXGI_FORMAT_R16_UINT || Format == DXGI_FORMAT_R32_UINT)
|
||||
flags |= D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER;
|
||||
|
||||
// TODO implement stream output
|
||||
// D3D11_FORMAT_SUPPORT_SO_BUFFER
|
||||
|
||||
if (fmtInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT) {
|
||||
flags |= D3D11_FORMAT_SUPPORT_TEXTURE1D
|
||||
| D3D11_FORMAT_SUPPORT_TEXTURE2D
|
||||
| D3D11_FORMAT_SUPPORT_TEXTURE3D
|
||||
| D3D11_FORMAT_SUPPORT_TEXTURECUBE
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_LOAD
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_GATHER
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_SAMPLE
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON
|
||||
| D3D11_FORMAT_SUPPORT_MIP
|
||||
| D3D11_FORMAT_SUPPORT_MIP_AUTOGEN
|
||||
| D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE
|
||||
| D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_TEXTURE1D
|
||||
| D3D11_FORMAT_SUPPORT_TEXTURE2D
|
||||
| D3D11_FORMAT_SUPPORT_TEXTURE3D
|
||||
| D3D11_FORMAT_SUPPORT_TEXTURECUBE
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_LOAD
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_GATHER
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_SAMPLE
|
||||
| D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON
|
||||
| D3D11_FORMAT_SUPPORT_MIP
|
||||
| D3D11_FORMAT_SUPPORT_MIP_AUTOGEN
|
||||
| D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE
|
||||
| D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT;
|
||||
}
|
||||
|
||||
if (fmtInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)
|
||||
flags |= D3D11_FORMAT_SUPPORT_RENDER_TARGET;
|
||||
if (fmtInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) {
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_RENDER_TARGET;
|
||||
|
||||
if (m_dxvkDevice->features().logicOp)
|
||||
flags2 |= D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP;
|
||||
}
|
||||
|
||||
if (fmtInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT)
|
||||
flags |= D3D11_FORMAT_SUPPORT_BLENDABLE;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_BLENDABLE;
|
||||
|
||||
if (fmtInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)
|
||||
flags |= D3D11_FORMAT_SUPPORT_DEPTH_STENCIL;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_DEPTH_STENCIL;
|
||||
|
||||
if (fmtInfo.optimalTilingFeatures)
|
||||
flags |= D3D11_FORMAT_SUPPORT_CPU_LOCKABLE;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_CPU_LOCKABLE;
|
||||
|
||||
if ((fmtInfo.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT)
|
||||
|| (fmtInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT))
|
||||
flags |= D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW;
|
||||
|| (fmtInfo.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) {
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW;
|
||||
flags2 |= D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE;
|
||||
|
||||
if (m_dxvkDevice->features().shaderStorageImageReadWithoutFormat
|
||||
|| Format == DXGI_FORMAT_R32_UINT
|
||||
|| Format == DXGI_FORMAT_R32_SINT
|
||||
|| Format == DXGI_FORMAT_R32_FLOAT)
|
||||
flags2 |= D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD;
|
||||
}
|
||||
|
||||
// FIXME implement properly. This would require a VkSurface.
|
||||
if (Format == DXGI_FORMAT_R8G8B8A8_UNORM
|
||||
@ -1822,7 +1843,7 @@ namespace dxvk {
|
||||
|| Format == DXGI_FORMAT_R16G16B16A16_FLOAT
|
||||
|| Format == DXGI_FORMAT_R10G10B10A2_UNORM
|
||||
|| Format == DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM)
|
||||
flags |= D3D11_FORMAT_SUPPORT_DISPLAY;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_DISPLAY;
|
||||
|
||||
// Query multisampling info
|
||||
VkImageFormatProperties imgInfo;
|
||||
@ -1834,11 +1855,26 @@ namespace dxvk {
|
||||
0, imgInfo);
|
||||
|
||||
if (status == VK_SUCCESS && imgInfo.sampleCounts > VK_SAMPLE_COUNT_1_BIT) {
|
||||
flags |= D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET
|
||||
| D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD;
|
||||
flags1 |= D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET
|
||||
| D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD;
|
||||
}
|
||||
|
||||
*pFlags = flags;
|
||||
if (Format == DXGI_FORMAT_R32_UINT
|
||||
|| Format == DXGI_FORMAT_R32_SINT) {
|
||||
flags2 |= D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD
|
||||
| D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS
|
||||
| D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE
|
||||
| D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE;
|
||||
}
|
||||
|
||||
if (Format == DXGI_FORMAT_R32_SINT)
|
||||
flags2 |= D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX;
|
||||
|
||||
if (Format == DXGI_FORMAT_R32_UINT)
|
||||
flags2 |= D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX;
|
||||
|
||||
if (pFlags1 != nullptr) *pFlags1 = flags1;
|
||||
if (pFlags2 != nullptr) *pFlags2 = flags2;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,10 @@ namespace dxvk {
|
||||
const Rc<DxvkImage>& image,
|
||||
const D3D11_SUBRESOURCE_DATA* pInitialData);
|
||||
|
||||
HRESULT GetFormatSupportFlags(DXGI_FORMAT Format, UINT* pFlags) const;
|
||||
HRESULT GetFormatSupportFlags(
|
||||
DXGI_FORMAT Format,
|
||||
UINT* pFlags1,
|
||||
UINT* pFlags2) const;
|
||||
|
||||
void CreateCounterBuffer();
|
||||
|
||||
|
@ -25,6 +25,24 @@
|
||||
// directly, although others from the same header work.
|
||||
// Some structures are missing from the mingw headers.
|
||||
#ifndef _MSC_VER
|
||||
typedef enum D3D11_FORMAT_SUPPORT2 {
|
||||
D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = 0x1,
|
||||
D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = 0x2,
|
||||
D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 0x4,
|
||||
D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = 0x8,
|
||||
D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = 0x10,
|
||||
D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 0x20,
|
||||
D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = 0x40,
|
||||
D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = 0x80,
|
||||
D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = 0x100,
|
||||
D3D11_FORMAT_SUPPORT2_TILED = 0x200,
|
||||
D3D11_FORMAT_SUPPORT2_SHAREABLE = 0x400,
|
||||
D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = 0x4000
|
||||
} D3D11_FORMAT_SUPPORT2;
|
||||
typedef struct D3D11_FEATURE_DATA_FORMAT_SUPPORT2 {
|
||||
DXGI_FORMAT InFormat;
|
||||
UINT OutFormatSupport2;
|
||||
} D3D11_FEATURE_DATA_FORMAT_SUPPORT2;
|
||||
typedef struct D3D11_FEATURE_DATA_THREADING {
|
||||
BOOL DriverConcurrentCreates;
|
||||
BOOL DriverCommandLists;
|
||||
|
Loading…
x
Reference in New Issue
Block a user