dzn: Remove #if D3D12_SDK_VERSION blocks now that 610 is required

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22504>
This commit is contained in:
Jesse Natalie
2023-04-14 09:21:26 -07:00
committed by Marge Bot
parent 290bb7a706
commit 5672b6cb02
6 changed files with 6 additions and 71 deletions
-2
View File
@@ -58,7 +58,6 @@ dzn_ID3D12Device4_GetResourceAllocationInfo(ID3D12Device4 *dev, UINT visible_mas
return ret;
}
#if D3D12_SDK_VERSION >= 610
static inline D3D12_RESOURCE_ALLOCATION_INFO
dzn_ID3D12Device12_GetResourceAllocationInfo3(ID3D12Device12 *dev, UINT visible_mask, UINT num_resource_descs, const D3D12_RESOURCE_DESC1 *resource_descs,
const UINT *num_castable_formats, const DXGI_FORMAT *const *castable_formats,
@@ -72,7 +71,6 @@ dzn_ID3D12Device12_GetResourceAllocationInfo3(ID3D12Device12 *dev, UINT visible_
#endif
return ret;
}
#endif
static inline D3D12_RESOURCE_DESC
dzn_ID3D12Resource_GetDesc(ID3D12Resource *res)
+4 -8
View File
@@ -30,10 +30,6 @@
#include "dxil_spirv_nir.h"
#if D3D12_SDK_VERSION >= 608
static const D3D12_BARRIER_SYNC D3D12_BARRIER_SYNC_INPUT_ASSEMBLER = D3D12_BARRIER_SYNC_INDEX_INPUT;
#endif
static void
dzn_cmd_buffer_exec_transition_barriers(struct dzn_cmd_buffer *cmdbuf,
D3D12_RESOURCE_BARRIER *barriers,
@@ -1193,7 +1189,7 @@ translate_sync(VkPipelineStageFlags2 flags, bool before)
if (flags & (VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT |
VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT |
VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT))
ret |= D3D12_BARRIER_SYNC_INPUT_ASSEMBLER;
ret |= D3D12_BARRIER_SYNC_INDEX_INPUT;
if (flags & VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT)
ret |= D3D12_BARRIER_SYNC_VERTEX_SHADING;
if (flags & (VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT |
@@ -1405,7 +1401,7 @@ adjust_sync_for_access(D3D12_BARRIER_SYNC in, D3D12_BARRIER_ACCESS access)
D3D12_BARRIER_SYNC_ALL_SHADING |
D3D12_BARRIER_SYNC_NON_PIXEL_SHADING);
if (access & D3D12_BARRIER_ACCESS_INDEX_BUFFER)
out |= in & D3D12_BARRIER_SYNC_INPUT_ASSEMBLER;
out |= in & D3D12_BARRIER_SYNC_INDEX_INPUT;
if (access & D3D12_BARRIER_ACCESS_RENDER_TARGET)
out |= in & D3D12_BARRIER_SYNC_RENDER_TARGET;
if (access & D3D12_BARRIER_ACCESS_UNORDERED_ACCESS)
@@ -3579,7 +3575,7 @@ dzn_cmd_buffer_triangle_fan_rewrite_index(struct dzn_cmd_buffer *cmdbuf,
if (cmdbuf->enhanced_barriers) {
dzn_cmd_buffer_buffer_barrier(cmdbuf, new_index_buf,
D3D12_BARRIER_SYNC_COMPUTE_SHADING, D3D12_BARRIER_SYNC_INPUT_ASSEMBLER,
D3D12_BARRIER_SYNC_COMPUTE_SHADING, D3D12_BARRIER_SYNC_INDEX_INPUT,
D3D12_BARRIER_ACCESS_UNORDERED_ACCESS, D3D12_BARRIER_ACCESS_INDEX_BUFFER);
} else {
dzn_cmd_buffer_queue_transition_barriers(cmdbuf, new_index_buf, 0, 1,
@@ -3864,7 +3860,7 @@ dzn_cmd_buffer_indirect_draw(struct dzn_cmd_buffer *cmdbuf,
if (cmdbuf->enhanced_barriers) {
buf_barriers[enhanced_barriers.NumBarriers++] = (D3D12_BUFFER_BARRIER){
.SyncBefore = D3D12_BARRIER_SYNC_COMPUTE_SHADING,
.SyncAfter = D3D12_BARRIER_SYNC_INPUT_ASSEMBLER,
.SyncAfter = D3D12_BARRIER_SYNC_INDEX_INPUT,
.AccessBefore = D3D12_BARRIER_ACCESS_UNORDERED_ACCESS,
.AccessAfter = D3D12_BARRIER_ACCESS_INDEX_BUFFER,
.pResource = triangle_fan_index_buf,
+1 -4
View File
@@ -858,7 +858,6 @@ dzn_pipeline_layout_create(struct dzn_device *device,
if (device->bindless)
root_flags |= D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED |
D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED;
#if D3D12_SDK_VERSION >= 609
if (pdev->root_sig_version >= D3D_ROOT_SIGNATURE_VERSION_1_2) {
root_sig_desc.Desc_1_2 = (D3D12_ROOT_SIGNATURE_DESC2){
.NumParameters = layout->root.param_count,
@@ -867,9 +866,7 @@ dzn_pipeline_layout_create(struct dzn_device *device,
.pStaticSamplers = static_sampler_descs,
.Flags = root_flags,
};
} else
#endif
{
} else {
root_sig_desc.Desc_1_1 = (D3D12_ROOT_SIGNATURE_DESC1){
.NumParameters = layout->root.param_count,
.pParameters = layout->root.param_count ? root_params : NULL,
-23
View File
@@ -167,10 +167,8 @@ dzn_physical_device_destroy(struct vk_physical_device *physical)
if (pdev->dev11)
ID3D12Device1_Release(pdev->dev11);
#if D3D12_SDK_VERSION >= 610
if (pdev->dev12)
ID3D12Device1_Release(pdev->dev12);
#endif
if (pdev->adapter)
IUnknown_Release(pdev->adapter);
@@ -435,9 +433,7 @@ dzn_physical_device_cache_caps(struct dzn_physical_device *pdev)
}
D3D_ROOT_SIGNATURE_VERSION root_sig_versions[] = {
#if D3D12_SDK_VERSION >= 609
D3D_ROOT_SIGNATURE_VERSION_1_2,
#endif
D3D_ROOT_SIGNATURE_VERSION_1_1
};
for (UINT i = 0; i < ARRAY_SIZE(root_sig_versions); ++i) {
@@ -458,16 +454,12 @@ dzn_physical_device_cache_caps(struct dzn_physical_device *pdev)
ID3D12Device1_CheckFeatureSupport(pdev->dev, D3D12_FEATURE_D3D12_OPTIONS13, &pdev->options13, sizeof(pdev->options13));
ID3D12Device1_CheckFeatureSupport(pdev->dev, D3D12_FEATURE_D3D12_OPTIONS14, &pdev->options14, sizeof(pdev->options14));
ID3D12Device1_CheckFeatureSupport(pdev->dev, D3D12_FEATURE_D3D12_OPTIONS15, &pdev->options15, sizeof(pdev->options15));
#if D3D12_SDK_VERSION >= 609
ID3D12Device1_CheckFeatureSupport(pdev->dev, D3D12_FEATURE_D3D12_OPTIONS17, &pdev->options17, sizeof(pdev->options17));
#endif
#if D3D12_SDK_VERSION >= 610
if (FAILED(ID3D12Device1_CheckFeatureSupport(pdev->dev, D3D12_FEATURE_D3D12_OPTIONS19, &pdev->options19, sizeof(pdev->options19)))) {
pdev->options19.MaxSamplerDescriptorHeapSize = D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE;
pdev->options19.MaxSamplerDescriptorHeapSizeWithStaticSamplers = pdev->options19.MaxSamplerDescriptorHeapSize;
pdev->options19.MaxViewDescriptorHeapSize = D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1;
}
#endif
pdev->queue_families[pdev->queue_family_count++] = (struct dzn_queue_family) {
.props = {
@@ -662,10 +654,8 @@ dzn_physical_device_get_d3d12_dev(struct dzn_physical_device *pdev)
pdev->dev10 = NULL;
if (FAILED(ID3D12Device1_QueryInterface(pdev->dev, &IID_ID3D12Device11, (void **)&pdev->dev11)))
pdev->dev11 = NULL;
#if D3D12_SDK_VERSION >= 610
if (FAILED(ID3D12Device1_QueryInterface(pdev->dev, &IID_ID3D12Device12, (void **)&pdev->dev12)))
pdev->dev12 = NULL;
#endif
dzn_physical_device_cache_caps(pdev);
dzn_physical_device_init_memory(pdev);
dzn_physical_device_init_uuids(pdev);
@@ -2230,10 +2220,8 @@ dzn_device_destroy(struct dzn_device *device, const VkAllocationCallbacks *pAllo
if (device->dev11)
ID3D12Device1_Release(device->dev11);
#if D3D12_SDK_VERSION >= 610
if (device->dev12)
ID3D12Device1_Release(device->dev12);
#endif
vk_device_finish(&device->vk);
vk_free2(&instance->vk.alloc, pAllocator, device);
@@ -2335,12 +2323,10 @@ dzn_device_create(struct dzn_physical_device *pdev,
ID3D12Device1_AddRef(device->dev11);
}
#if D3D12_SDK_VERSION >= 610
if (pdev->dev12) {
device->dev12 = pdev->dev12;
ID3D12Device1_AddRef(device->dev12);
}
#endif
ID3D12InfoQueue *info_queue;
if (SUCCEEDED(ID3D12Device1_QueryInterface(device->dev,
@@ -2425,13 +2411,8 @@ dzn_device_create(struct dzn_physical_device *pdev,
device->vk.enabled_extensions.EXT_descriptor_indexing;
if (device->bindless) {
#if D3D12_SDK_VERSION >= 610
uint32_t sampler_count = MIN2(pdev->options19.MaxSamplerDescriptorHeapSize, 4000);
device->support_static_samplers = pdev->options19.MaxSamplerDescriptorHeapSizeWithStaticSamplers >= sampler_count;
#else
uint32_t sampler_count = D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE;
device->support_static_samplers = true;
#endif
dzn_foreach_pool_type(type) {
uint32_t descriptor_count = type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER ?
sampler_count : D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1;
@@ -3251,9 +3232,7 @@ dzn_sampler_create(struct dzn_device *device,
const VkAllocationCallbacks *pAllocator,
VkSampler *out)
{
#if D3D12_SDK_VERSION >= 609
struct dzn_physical_device *pdev = container_of(device->vk.physical, struct dzn_physical_device, vk);
#endif
struct dzn_sampler *sampler =
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*sampler), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
@@ -3339,10 +3318,8 @@ dzn_sampler_create(struct dzn_device *device,
}
}
#if D3D12_SDK_VERSION >= 609
if (pCreateInfo->unnormalizedCoordinates && pdev->options17.NonNormalizedCoordinateSamplersSupported)
sampler->desc.Flags |= D3D12_SAMPLER_FLAG_NON_NORMALIZED_COORDINATES;
#endif
sampler->bindless_slot = -1;
if (device->bindless) {
+1 -4
View File
@@ -909,7 +909,6 @@ dzn_GetImageMemoryRequirements2(VkDevice _device,
}
D3D12_RESOURCE_ALLOCATION_INFO info;
#if D3D12_SDK_VERSION >= 610
if (device->dev12 && image->castable_format_count > 0) {
D3D12_RESOURCE_DESC1 desc1;
memcpy(&desc1, &image->desc, sizeof(image->desc));
@@ -917,9 +916,7 @@ dzn_GetImageMemoryRequirements2(VkDevice _device,
info = dzn_ID3D12Device12_GetResourceAllocationInfo3(device->dev12, 0, 1, &desc1,
&image->castable_format_count, &image->castable_formats,
NULL);
} else
#endif
{
} else {
info = dzn_ID3D12Device4_GetResourceAllocationInfo(device->dev, 0, 1, &image->desc);
}
-30
View File
@@ -202,9 +202,7 @@ struct dzn_physical_device {
ID3D12Device4 *dev;
ID3D12Device10 *dev10;
ID3D12Device11 *dev11;
#if D3D12_SDK_VERSION >= 610
ID3D12Device12 *dev12;
#endif
D3D_FEATURE_LEVEL feature_level;
D3D_SHADER_MODEL shader_model;
D3D_ROOT_SIGNATURE_VERSION root_sig_version;
@@ -218,12 +216,8 @@ struct dzn_physical_device {
D3D12_FEATURE_DATA_D3D12_OPTIONS13 options13;
D3D12_FEATURE_DATA_D3D12_OPTIONS14 options14;
D3D12_FEATURE_DATA_D3D12_OPTIONS15 options15;
#if D3D12_SDK_VERSION >= 609
D3D12_FEATURE_DATA_D3D12_OPTIONS17 options17;
#endif
#if D3D12_SDK_VERSION >= 610
D3D12_FEATURE_DATA_D3D12_OPTIONS19 options19;
#endif
VkPhysicalDeviceMemoryProperties memory;
D3D12_HEAP_FLAGS heap_flags_for_mem_type[VK_MAX_MEMORY_TYPES];
const struct vk_sync_type *sync_types[MAX_SYNC_TYPES + 1];
@@ -290,9 +284,7 @@ struct dzn_device {
ID3D12Device4 *dev;
ID3D12Device10 *dev10;
ID3D12Device11 *dev11;
#if D3D12_SDK_VERSION >= 610
ID3D12Device12 *dev12;
#endif
ID3D12DeviceConfiguration *dev_config;
struct dzn_meta_indirect_draw indirect_draws[DZN_NUM_INDIRECT_DRAW_TYPES];
@@ -753,28 +745,6 @@ struct dzn_descriptor_set_layout_binding {
bool variable_size;
};
#if D3D12_SDK_VERSION < 609
typedef struct D3D12_STATIC_SAMPLER_DESC1
{
D3D12_FILTER Filter;
D3D12_TEXTURE_ADDRESS_MODE AddressU;
D3D12_TEXTURE_ADDRESS_MODE AddressV;
D3D12_TEXTURE_ADDRESS_MODE AddressW;
FLOAT MipLODBias;
UINT MaxAnisotropy;
D3D12_COMPARISON_FUNC ComparisonFunc;
D3D12_STATIC_BORDER_COLOR BorderColor;
FLOAT MinLOD;
FLOAT MaxLOD;
UINT ShaderRegister;
UINT RegisterSpace;
D3D12_SHADER_VISIBILITY ShaderVisibility;
D3D12_SAMPLER_FLAGS Flags;
} D3D12_STATIC_SAMPLER_DESC1;
static const D3D_ROOT_SIGNATURE_VERSION D3D_ROOT_SIGNATURE_VERSION_1_2 = 0x3;
#endif
struct dzn_descriptor_set_layout {
struct vk_descriptor_set_layout vk;