From: Józef Kucia jkucia@codeweavers.com
The hardcoded value makes a real app happy and it is close to values returned by various Windows drivers (AMD, Intel, Nvidia). In the long term, we might try to derive the values from maxResourceSize and/or sparseAddressSpaceSize.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- include/vkd3d_d3d12.idl | 6 ++++++ libs/vkd3d/device.c | 16 ++++++++++++++++ tests/d3d12.c | 19 +++++++++++++++---- 3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/include/vkd3d_d3d12.idl b/include/vkd3d_d3d12.idl index c025dbe8b2bb..754bba380876 100644 --- a/include/vkd3d_d3d12.idl +++ b/include/vkd3d_d3d12.idl @@ -1535,6 +1535,12 @@ typedef struct D3D12_FEATURE_DATA_ROOT_SIGNATURE D3D_ROOT_SIGNATURE_VERSION HighestVersion; } D3D12_FEATURE_DATA_ROOT_SIGNATURE;
+typedef struct D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT +{ + UINT MaxGPUVirtualAddressBitsPerResource; + UINT MaxGPUVirtualAddressBitsPerProcess; +} D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT; + typedef enum D3D_SHADER_MODEL { D3D_SHADER_MODEL_5_1 = 0x51, diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 93af06cb1b5b..709c61fd5ccb 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -1840,6 +1840,22 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device * return S_OK; }
+ case D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT: + { + D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT *data = feature_data; + + if (feature_data_size != sizeof(*data)) + { + WARN("Invalid size %u.\n", feature_data_size); + return E_INVALIDARG; + } + + FIXME("Returning 40 GPU virtual address bits.\n"); + data->MaxGPUVirtualAddressBitsPerResource = 40; + data->MaxGPUVirtualAddressBitsPerProcess = 40; + return S_OK; + } + case D3D12_FEATURE_SHADER_MODEL: { D3D12_FEATURE_DATA_SHADER_MODEL *data = feature_data; diff --git a/tests/d3d12.c b/tests/d3d12.c index 26a216251646..4af52a5553d5 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -962,6 +962,7 @@ static void test_node_count(void)
static void test_check_feature_support(void) { + D3D12_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT gpu_virtual_address; D3D12_FEATURE_DATA_FEATURE_LEVELS feature_levels; D3D_FEATURE_LEVEL max_supported_feature_level; D3D12_FEATURE_DATA_ARCHITECTURE architecture; @@ -1038,7 +1039,7 @@ static void test_check_feature_support(void) feature_levels.MaxSupportedFeatureLevel = 0; hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS, &feature_levels, sizeof(feature_levels)); - ok(SUCCEEDED(hr), "Failed to check feature support, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to check feature support, hr %#x.\n", hr); trace("Max supported feature level %#x.\n", feature_levels.MaxSupportedFeatureLevel); max_supported_feature_level = feature_levels.MaxSupportedFeatureLevel;
@@ -1047,7 +1048,7 @@ static void test_check_feature_support(void) feature_levels.MaxSupportedFeatureLevel = 0; hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS, &feature_levels, sizeof(feature_levels)); - ok(SUCCEEDED(hr), "Failed to check feature support, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to check feature support, hr %#x.\n", hr); ok(feature_levels.MaxSupportedFeatureLevel == max_supported_feature_level, "Got unexpected feature level %#x, expected %#x.\n", feature_levels.MaxSupportedFeatureLevel, max_supported_feature_level); @@ -1065,7 +1066,7 @@ static void test_check_feature_support(void) feature_levels.MaxSupportedFeatureLevel = 0; hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS, &feature_levels, sizeof(feature_levels)); - ok(SUCCEEDED(hr), "Failed to check feature support, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to check feature support, hr %#x.\n", hr); ok(feature_levels.MaxSupportedFeatureLevel == D3D_FEATURE_LEVEL_9_3, "Got unexpected max feature level %#x.\n", feature_levels.MaxSupportedFeatureLevel);
@@ -1074,10 +1075,20 @@ static void test_check_feature_support(void) feature_levels.MaxSupportedFeatureLevel = 0; hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FEATURE_LEVELS, &feature_levels, sizeof(feature_levels)); - ok(SUCCEEDED(hr), "Failed to check feature support, hr %#x.\n", hr); + ok(hr == S_OK, "Failed to check feature support, hr %#x.\n", hr); ok(feature_levels.MaxSupportedFeatureLevel == 0x3000, "Got unexpected max feature level %#x.\n", feature_levels.MaxSupportedFeatureLevel);
+ /* GPU virtual address */ + memset(&gpu_virtual_address, 0, sizeof(gpu_virtual_address)); + hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT, + &gpu_virtual_address, sizeof(gpu_virtual_address)); + ok(hr == S_OK, "Failed to check GPU virtual address support, hr %#x.\n", hr); + trace("GPU virtual address bits per resource: %u.\n", + gpu_virtual_address.MaxGPUVirtualAddressBitsPerResource); + trace("GPU virtual address bits per process: %u.\n", + gpu_virtual_address.MaxGPUVirtualAddressBitsPerProcess); + refcount = ID3D12Device_Release(device); ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount); }