758 changes: 758 additions & 0 deletions VP_D3D12_VKD3D_PROTON_profile.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions include/vkd3d_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,9 @@ int vkd3d_shader_dxil_append_library_entry_points_and_subobjects(
void vkd3d_shader_dxil_free_library_entry_points(struct vkd3d_shader_library_entry_point *entry_points, size_t count);
void vkd3d_shader_dxil_free_library_subobjects(struct vkd3d_shader_library_subobject *subobjects, size_t count);

int vkd3d_shader_dxil_find_global_root_signature_subobject(const void *dxbc, size_t size,
struct vkd3d_shader_code *code);

/* export may be a mangled or demangled name.
* If RTPSO requests the demangled name, it will likely be demangled, otherwise we forward the mangled name directly.
* demangled_export is always a demangled name, for debug purposes. Can be NULL. */
Expand Down
10 changes: 9 additions & 1 deletion libs/vkd3d-shader/dxbc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2876,7 +2876,15 @@ int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc,
return ret;

if (!raw_payload.code)
return VKD3D_ERROR;
{
/* This might be a DXIL lib target in which case we have to parse subobjects. */
if (!shader_is_dxil(dxbc->code, dxbc->size))
return VKD3D_ERROR;

/* Payload subobjects do not own any memory, they point directly to blob. No need to free. */
if ((ret = vkd3d_shader_dxil_find_global_root_signature_subobject(dxbc->code, dxbc->size, &raw_payload)))
return ret;
}

if ((ret = vkd3d_shader_parse_root_signature_raw(raw_payload.code, raw_payload.size,
root_signature, compatibility_hash)) < 0)
Expand Down
56 changes: 56 additions & 0 deletions libs/vkd3d-shader/dxil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,62 @@ static void vkd3d_shader_dxil_copy_subobject(unsigned int identifier,
}
}

int vkd3d_shader_dxil_find_global_root_signature_subobject(const void *dxbc, size_t size,
struct vkd3d_shader_code *code)
{
dxil_spv_parsed_blob blob = NULL;
dxil_spv_rdat_subobject rdat;
unsigned int i, rdat_count;
int found_index = -1;
int ret = VKD3D_OK;

dxil_spv_set_thread_log_callback(vkd3d_dxil_log_callback, NULL);
dxil_spv_begin_thread_allocator_context();

if (dxil_spv_parse_dxil_blob(dxbc, size, &blob) != DXIL_SPV_SUCCESS)
{
ret = VKD3D_ERROR_INVALID_ARGUMENT;
goto end;
}

rdat_count = dxil_spv_parsed_blob_get_num_rdat_subobjects(blob);

for (i = 0; i < rdat_count; i++)
{
dxil_spv_parsed_blob_get_rdat_subobject(blob, i, &rdat);
if (rdat.kind == DXIL_SPV_RDAT_SUBOBJECT_KIND_GLOBAL_ROOT_SIGNATURE)
{
if (found_index >= 0)
{
/* Ambiguous. Must fail. */
ret = VKD3D_ERROR_INVALID_ARGUMENT;
goto end;
}

found_index = (int)i;
}
}

if (found_index < 0)
{
ret = VKD3D_ERROR_INVALID_ARGUMENT;
goto end;
}

dxil_spv_parsed_blob_get_rdat_subobject(blob, found_index, &rdat);
memset(code, 0, sizeof(*code));

/* These point directly to blob. */
code->code = rdat.payload;
code->size = rdat.payload_size;

end:
if (blob)
dxil_spv_parsed_blob_free(blob);
dxil_spv_end_thread_allocator_context();
return ret;
}

int vkd3d_shader_dxil_append_library_entry_points_and_subobjects(
const D3D12_DXIL_LIBRARY_DESC *library_desc,
unsigned int identifier,
Expand Down
312 changes: 285 additions & 27 deletions libs/vkd3d/device.c

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions libs/vkd3d/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ static HRESULT d3d12_heap_init(struct d3d12_heap *heap, struct d3d12_device *dev
heap->refcount = 1;
heap->desc = *desc;
heap->device = device;
heap->priority.allows_dynamic_residency = false;
spinlock_init(&heap->priority.spinlock);
heap->priority.d3d12priority = D3D12_RESIDENCY_PRIORITY_NORMAL;
heap->priority.residency_count = 1;

if (!heap->desc.Properties.CreationNodeMask)
heap->desc.Properties.CreationNodeMask = 1;
Expand All @@ -277,13 +281,39 @@ static HRESULT d3d12_heap_init(struct d3d12_heap *heap, struct d3d12_device *dev
if (FAILED(hr = vkd3d_private_store_init(&heap->private_store)))
return hr;

if (device->device_info.memory_priority_features.memoryPriority)
{
/* this clause isn't trying to reproduce some precise d3d12 behavior,
though it's hinted in the public docs that a similar prioritization
is done there... and it seems like a good idea anyway. :) */
if (heap->desc.Flags & D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES)
{
uint32_t adjust = vkd3d_get_priority_adjust(heap->desc.SizeInBytes);
heap->priority.d3d12priority = D3D12_RESIDENCY_PRIORITY_HIGH | adjust;
}

if (device->device_info.pageable_device_memory_features.pageableDeviceLocalMemory)
{
if (heap->desc.Flags & D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT)
heap->priority.residency_count = 0;
}
}

alloc_info.vk_memory_priority = heap->priority.residency_count ?
vkd3d_convert_to_vk_prio(heap->priority.d3d12priority) : 0.f;

if (FAILED(hr = vkd3d_allocate_heap_memory(device,
&device->memory_allocator, &alloc_info, &heap->allocation)))
{
vkd3d_private_store_destroy(&heap->private_store);
return hr;
}

heap->priority.allows_dynamic_residency =
device->device_info.pageable_device_memory_features.pageableDeviceLocalMemory &&
heap->allocation.chunk == NULL /* not suballocated */ &&
(device->memory_properties.memoryTypes[heap->allocation.device_allocation.vk_memory_type].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);

d3d12_device_add_ref(heap->device);
return S_OK;
}
Expand Down
12 changes: 12 additions & 0 deletions libs/vkd3d/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ static HRESULT vkd3d_memory_allocation_init(struct vkd3d_memory_allocation *allo
struct vkd3d_memory_allocator *allocator, const struct vkd3d_allocate_memory_info *info)
{
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
VkMemoryPriorityAllocateInfoEXT priority_info;
VkMemoryRequirements memory_requirements;
VkMemoryAllocateFlagsInfo flags_info;
VkMemoryPropertyFlags type_flags;
Expand Down Expand Up @@ -1156,6 +1157,15 @@ static HRESULT vkd3d_memory_allocation_init(struct vkd3d_memory_allocation *allo
}
}

if (device->device_info.memory_priority_features.memoryPriority &&
(type_flags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT))
{
priority_info.sType = VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT;
priority_info.pNext = NULL;
priority_info.priority = info->vk_memory_priority;
vk_prepend_struct(&flags_info, &priority_info);
}

if (host_ptr)
{
hr = vkd3d_import_host_memory(device, host_ptr, memory_requirements.size,
Expand Down Expand Up @@ -1530,6 +1540,7 @@ static HRESULT vkd3d_memory_allocator_try_add_chunk(struct vkd3d_memory_allocato
alloc_info.heap_flags = heap_flags;
alloc_info.flags = VKD3D_ALLOCATION_FLAG_NO_FALLBACK;
alloc_info.optional_memory_properties = optional_properties;
alloc_info.vk_memory_priority = vkd3d_convert_to_vk_prio(D3D12_RESIDENCY_PRIORITY_NORMAL);

if (!(heap_flags & D3D12_HEAP_FLAG_DENY_BUFFERS))
{
Expand Down Expand Up @@ -1753,6 +1764,7 @@ HRESULT vkd3d_allocate_heap_memory(struct d3d12_device *device, struct vkd3d_mem
alloc_info.heap_properties = info->heap_desc.Properties;
alloc_info.heap_flags = info->heap_desc.Flags;
alloc_info.host_ptr = info->host_ptr;
alloc_info.vk_memory_priority = info->vk_memory_priority;

alloc_info.flags |= info->extra_allocation_flags;
if (!(info->heap_desc.Flags & D3D12_HEAP_FLAG_DENY_BUFFERS))
Expand Down
3 changes: 2 additions & 1 deletion libs/vkd3d/meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,8 @@ static HRESULT vkd3d_meta_ops_common_init(struct vkd3d_meta_ops_common *meta_ops
{
VkResult vr;

if (device->vk_info.EXT_shader_viewport_index_layer)
if (device->device_info.vulkan_1_2_features.shaderOutputViewportIndex &&
device->device_info.vulkan_1_2_features.shaderOutputLayer)
{
if ((vr = vkd3d_meta_create_shader_module(device, SPIRV_CODE(vs_fullscreen_layer), &meta_ops_common->vk_module_fullscreen_vs)) < 0)
{
Expand Down
35 changes: 35 additions & 0 deletions libs/vkd3d/resource.c
Original file line number Diff line number Diff line change
Expand Up @@ -2759,6 +2759,10 @@ static HRESULT d3d12_resource_create(struct d3d12_device *device, uint32_t flags
D3D12_HEAP_FLAGS heap_flags, D3D12_RESOURCE_STATES initial_state,
const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource)
{
const D3D12_RESOURCE_FLAGS high_priority_resource_flags =
D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET |
D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL |
D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
struct d3d12_resource *object;
HRESULT hr;

Expand Down Expand Up @@ -2792,6 +2796,10 @@ static HRESULT d3d12_resource_create(struct d3d12_device *device, uint32_t flags
object->flags = flags;
object->format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0);
object->res.cookie = vkd3d_allocate_cookie();
spinlock_init(&object->priority.spinlock);
object->priority.allows_dynamic_residency = false;
object->priority.d3d12priority = D3D12_RESIDENCY_PRIORITY_NORMAL;
object->priority.residency_count = 1;
#ifdef VKD3D_ENABLE_DESCRIPTOR_QA
object->view_map.resource_cookie = object->res.cookie;
#endif
Expand Down Expand Up @@ -2819,6 +2827,24 @@ static HRESULT d3d12_resource_create(struct d3d12_device *device, uint32_t flags
FIXME_ONCE("ReadFromSubresource may be buggy on host-visible images with ALLOW_SIMULTANEOUS_ACCESS | ALLOW_UNORDERED_ACCESS.\n");
}

if ((flags & VKD3D_RESOURCE_COMMITTED) &&
device->device_info.memory_priority_features.memoryPriority &&
(desc->Flags & high_priority_resource_flags))
{
size_t resource_size = d3d12_resource_is_texture(object) ?
vkd3d_compute_resource_layouts_from_desc(device, &object->desc, NULL) :
object->desc.Width;
uint32_t adjust = vkd3d_get_priority_adjust(resource_size);

object->priority.d3d12priority = D3D12_RESIDENCY_PRIORITY_HIGH | adjust;

if (device->device_info.pageable_device_memory_features.pageableDeviceLocalMemory)
{
if (object->heap_flags & D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT)
object->priority.residency_count = 0;
}
}

d3d12_device_add_ref(device);

vkd3d_descriptor_debug_register_resource_cookie(device->descriptor_qa_global_info,
Expand Down Expand Up @@ -2916,6 +2942,8 @@ HRESULT d3d12_resource_create_committed(struct d3d12_device *device, const D3D12
else
allocate_info.heap_flags |= D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES;

allocate_info.vk_memory_priority = object->priority.residency_count ? vkd3d_convert_to_vk_prio(object->priority.d3d12priority) : 0.f;

if (heap_flags & D3D12_HEAP_FLAG_SHARED)
{
#ifdef _WIN32
Expand Down Expand Up @@ -3016,6 +3044,7 @@ HRESULT d3d12_resource_create_committed(struct d3d12_device *device, const D3D12
allocate_info.heap_desc.Alignment = desc->Alignment ? desc->Alignment : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
allocate_info.heap_desc.SizeInBytes = align(desc->Width, allocate_info.heap_desc.Alignment);
allocate_info.heap_desc.Flags = heap_flags | D3D12_HEAP_FLAG_ALLOW_ONLY_BUFFERS;
allocate_info.vk_memory_priority = object->priority.residency_count ? vkd3d_convert_to_vk_prio(object->priority.d3d12priority) : 0.f;

/* Be very careful with suballocated buffers. */
if ((vkd3d_config_flags & VKD3D_CONFIG_FLAG_ZERO_MEMORY_WORKAROUNDS_COMMITTED_BUFFER_UAV) &&
Expand All @@ -3033,6 +3062,11 @@ HRESULT d3d12_resource_create_committed(struct d3d12_device *device, const D3D12
object->res.va = object->mem.resource.va;
}

object->priority.allows_dynamic_residency =
device->device_info.pageable_device_memory_features.pageableDeviceLocalMemory &&
object->mem.chunk == NULL /* not suballocated */ &&
(device->memory_properties.memoryTypes[object->mem.device_allocation.vk_memory_type].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);

*resource = object;
return S_OK;

Expand Down Expand Up @@ -3133,6 +3167,7 @@ HRESULT d3d12_resource_create_placed(struct d3d12_device *device, const D3D12_RE
allocate_info.memory_requirements = memory_requirements;
allocate_info.heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT;
allocate_info.heap_flags = 0;
allocate_info.vk_memory_priority = vkd3d_convert_to_vk_prio(D3D12_RESIDENCY_PRIORITY_NORMAL);

if (desc->Flags & (D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET | D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL))
allocate_info.heap_flags |= D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES;
Expand Down
7 changes: 3 additions & 4 deletions libs/vkd3d/shaders/cs_resolve_binary_queries.comp
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#version 450

#extension GL_ARB_gpu_shader_int64 : require
#extension GL_EXT_buffer_reference : require

layout(local_size_x = 64) in;

layout(std430, buffer_reference, buffer_reference_align = 8)
writeonly buffer dst_buffer_t {
uint64_t queries[];
uvec2 queries[];
};

layout(std430, buffer_reference, buffer_reference_align = 8)
readonly buffer src_buffer_t {
uint64_t queries[];
uvec2 queries[];
};

layout(push_constant)
Expand All @@ -26,5 +25,5 @@ void main() {
uint thread_id = gl_GlobalInvocationID.x;

if (thread_id < query_count)
dst_buffer.queries[thread_id] = min(src_buffer.queries[thread_id], uint64_t(1u));
dst_buffer.queries[thread_id] = any(notEqual(src_buffer.queries[thread_id], uvec2(0))) ? uvec2(1, 0) : uvec2(0);
}
18 changes: 12 additions & 6 deletions libs/vkd3d/shaders/cs_resolve_query.comp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#version 450

#extension GL_ARB_gpu_shader_int64 : require
#extension GL_EXT_buffer_reference : require

layout(local_size_x = 64) in;
Expand All @@ -9,12 +8,12 @@ layout(constant_id = 0) const uint c_field_count = 1;

layout(std430, buffer_reference, buffer_reference_align = 8)
buffer writeonly dst_queries_t {
uint64_t queries[];
uvec2 queries[];
};

layout(std430, buffer_reference, buffer_reference_align = 8)
readonly buffer src_queries_t {
uint64_t queries[];
uvec2 queries[];
};

struct query_map_entry_t {
Expand All @@ -36,6 +35,13 @@ uniform u_info_t {
uint query_count;
};

uvec2 uadd64(uvec2 a, uvec2 b) {
uint carry;
uint lo = uaddCarry(a.x, b.x, carry);
uint hi = a.y + b.y + carry;
return uvec2(lo, hi);
}

void main() {
uint thread_id = gl_GlobalInvocationID.x;

Expand All @@ -45,7 +51,7 @@ void main() {
// The query map is an array of linked lists, with the
// first query_count entries guaranteed to be list heads
query_map_entry_t entry = query_map.entries[thread_id];
uint64_t dst_data[c_field_count];
uvec2 dst_data[c_field_count];

// By copying the first query we get the reset for free
for (uint i = 0; i < c_field_count; i++)
Expand All @@ -56,10 +62,10 @@ void main() {
entry = query_map.entries[entry.next];

for (uint i = 0; i < c_field_count; i++)
dst_data[i] += src_buffer.queries[c_field_count * entry.src_index + i];
dst_data[i] = uadd64(dst_data[i], src_buffer.queries[c_field_count * entry.src_index + i]);
}

// dst_index has the same value for all entries in the list
for (uint i = 0; i < c_field_count; i++)
dst_buffer.queries[c_field_count * entry.dst_index + i] = dst_data[i];
}
}
14 changes: 3 additions & 11 deletions libs/vkd3d/state.c
Original file line number Diff line number Diff line change
Expand Up @@ -4407,8 +4407,7 @@ static HRESULT d3d12_pipeline_state_init_graphics_create_info(struct d3d12_pipel
case D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA:
input_rate = VK_VERTEX_INPUT_RATE_INSTANCE;
instance_divisor = e->InstanceDataStepRate;
if (instance_divisor > vk_info->max_vertex_attrib_divisor
|| (!instance_divisor && !vk_info->vertex_attrib_zero_divisor))
if (instance_divisor > vk_info->max_vertex_attrib_divisor)
{
FIXME("Instance divisor %u not supported by Vulkan implementation.\n", instance_divisor);
instance_divisor = 1;
Expand Down Expand Up @@ -4832,11 +4831,7 @@ HRESULT d3d12_pipeline_state_create(struct d3d12_device *device, VkPipelineBindP

/* Mesa's internal cache can bloat indefinitely, so workaround it as needed for now.
* TODO: Find a better solution. */
if (!object->vk_pso_cache &&
(vkd3d_config_flags & VKD3D_CONFIG_FLAG_GLOBAL_PIPELINE_CACHE) &&
(vkd3d_config_flags & VKD3D_CONFIG_FLAG_CURB_MEMORY_PSO_CACHE) &&
!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_SKIP_DRIVER_WORKAROUNDS) &&
device->device_info.vulkan_1_2_properties.driverID == VK_DRIVER_ID_MESA_RADV)
if (!object->vk_pso_cache && device->device_info.workarounds.force_dummy_pipeline_cache)
{
if (vkd3d_create_pipeline_cache(device, 0, NULL, &object->vk_pso_cache) != VK_SUCCESS)
object->vk_pso_cache = VK_NULL_HANDLE;
Expand Down Expand Up @@ -4927,10 +4922,7 @@ HRESULT d3d12_pipeline_state_create(struct d3d12_device *device, VkPipelineBindP
vkd3d_pipeline_library_store_pipeline_to_disk_cache(&device->disk_cache, object);
}

if ((vkd3d_config_flags & VKD3D_CONFIG_FLAG_CURB_MEMORY_PSO_CACHE) &&
(vkd3d_config_flags & VKD3D_CONFIG_FLAG_GLOBAL_PIPELINE_CACHE) &&
!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_SKIP_DRIVER_WORKAROUNDS) &&
device->device_info.vulkan_1_2_properties.driverID == VK_DRIVER_ID_MESA_RADV)
if (device->device_info.workarounds.force_dummy_pipeline_cache)
{
/* Throw the pipeline cache away immediately. Tricks drivers into not retaining the PSO in memory cache. */
VK_CALL(vkDestroyPipelineCache(device->vk_device, object->vk_pso_cache, NULL));
Expand Down
2 changes: 1 addition & 1 deletion libs/vkd3d/swapchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ static float convert_max_luminance(UINT dxgi_luminance)

static float convert_min_luminance(UINT dxgi_luminance)
{
return dxgi_luminance / 0.0001f;
return dxgi_luminance * 0.0001f;
}

static float convert_level(UINT16 dxgi_level)
Expand Down
61 changes: 61 additions & 0 deletions libs/vkd3d/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,67 @@ VkFormat vkd3d_get_vk_format(DXGI_FORMAT format)
return VK_FORMAT_UNDEFINED;
}

/* Get some size-based low bits for memory prioritization in the same
way as d3d12; d3d12 bumps certain resource priorities to
D3D12_RESIDENCY_PRIORITY_HIGH + size-based bits (10MB resolution)
see: https://learn.microsoft.com/en-us/windows/win32/direct3d12/residency#default-priority-algorithm */
uint32_t vkd3d_get_priority_adjust(VkDeviceSize size)
{
return min((size / (10 * 1048576)), 0xffffUL);
}

static float vkd3d_lerp_u32_to_float(uint32_t uval, uint32_t ustart, uint32_t uend, float fstart, float fend)
{
float a;

if (uval <= ustart) return fstart;
else if (uval >= uend) return fend;

a = (float)(uval - ustart) / (float)(uend - ustart);
return fstart * (1.0f - a) + (fend * a);
}

/* map from 32-bit d3d prio to float (0..1) vk prio. */
float vkd3d_convert_to_vk_prio(D3D12_RESIDENCY_PRIORITY d3d12prio)
{
float result;

/* align D3D12_RESIDENCY_PRIORITY_NORMAL (the default d3d12 prio) with
0.5 (the default vk prio) so neither kind wins without explicit prio */
if (d3d12prio <= D3D12_RESIDENCY_PRIORITY_NORMAL)
{
result = vkd3d_lerp_u32_to_float(d3d12prio,
0, D3D12_RESIDENCY_PRIORITY_NORMAL,
0.001f, 0.500f);
}
else if (d3d12prio <= D3D12_RESIDENCY_PRIORITY_HIGH)
{
result = vkd3d_lerp_u32_to_float(d3d12prio,
D3D12_RESIDENCY_PRIORITY_NORMAL, D3D12_RESIDENCY_PRIORITY_HIGH,
0.500f, 0.700f);
}
else if (d3d12prio <= D3D12_RESIDENCY_PRIORITY_HIGH+0xffff)
{
result = vkd3d_lerp_u32_to_float(d3d12prio,
D3D12_RESIDENCY_PRIORITY_HIGH, D3D12_RESIDENCY_PRIORITY_HIGH+0xffff,
0.700f, 0.800f);
}
else
{
result = vkd3d_lerp_u32_to_float(d3d12prio,
D3D12_RESIDENCY_PRIORITY_HIGH+0xffff, UINT32_MAX,
0.800f, 1.000f);
}

/* Note: A naive conversion from a UINT32 d3d priority to a float32 vk priority
loses around 9 of the 16 lower-order bits which encode size-based subranking
in the D3D12_RESIDENCY_PRIORITY_HIGH to HIGH+0xffff domain. The above expansion
of that domain into a proportionally wider range works around this. */

/* 0.0f is reserved for explicitly evicted resources */
return max(min(result, 1.f), 0.001f);
}

DXGI_FORMAT vkd3d_get_dxgi_format(VkFormat format)
{
DXGI_FORMAT dxgi_format;
Expand Down
35 changes: 31 additions & 4 deletions libs/vkd3d/vkd3d_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ struct vkd3d_vulkan_info
bool EXT_image_view_min_lod;
bool EXT_robustness2;
bool EXT_shader_stencil_export;
bool EXT_shader_viewport_index_layer;
bool EXT_transform_feedback;
bool EXT_vertex_attribute_divisor;
bool EXT_extended_dynamic_state2;
Expand All @@ -147,6 +146,9 @@ struct vkd3d_vulkan_info
bool EXT_image_sliced_view_of_3d;
bool EXT_graphics_pipeline_library;
bool EXT_fragment_shader_interlock;
bool EXT_pageable_device_local_memory;
bool EXT_memory_priority;
bool EXT_dynamic_rendering_unused_attachments;
/* AMD device extensions */
bool AMD_buffer_marker;
bool AMD_device_coherent_memory;
Expand All @@ -168,9 +170,6 @@ struct vkd3d_vulkan_info
const char* const* extension_names;

bool rasterization_stream;
bool transform_feedback_queries;

bool vertex_attrib_zero_divisor;
unsigned int max_vertex_attrib_divisor;

VkPhysicalDeviceLimits device_limits;
Expand Down Expand Up @@ -638,13 +637,15 @@ struct vkd3d_allocate_memory_info
uint32_t flags;
VkBufferUsageFlags explicit_global_buffer_usage;
VkMemoryPropertyFlags optional_memory_properties;
float vk_memory_priority;
};

struct vkd3d_allocate_heap_memory_info
{
D3D12_HEAP_DESC heap_desc;
void *host_ptr;
uint32_t extra_allocation_flags;
float vk_memory_priority;
};

struct vkd3d_allocate_resource_memory_info
Expand All @@ -656,6 +657,9 @@ struct vkd3d_allocate_resource_memory_info
void *host_ptr;
};

uint32_t vkd3d_get_priority_adjust(VkDeviceSize size);
float vkd3d_convert_to_vk_prio(D3D12_RESIDENCY_PRIORITY d3d12prio);

struct vkd3d_view_map;

struct vkd3d_unique_resource
Expand Down Expand Up @@ -809,6 +813,16 @@ void vkd3d_memory_allocator_cleanup(struct vkd3d_memory_allocator *allocator, st
/* ID3D12Heap */
typedef ID3D12Heap1 d3d12_heap_iface;

typedef struct
{
bool allows_dynamic_residency;

spinlock_t spinlock; /* covers access to any of the following fields after creation */

D3D12_RESIDENCY_PRIORITY d3d12priority;
LONG residency_count;
} priority_info;

struct d3d12_heap
{
d3d12_heap_iface ID3D12Heap_iface;
Expand All @@ -818,6 +832,8 @@ struct d3d12_heap
D3D12_HEAP_DESC desc;
struct vkd3d_memory_allocation allocation;

priority_info priority;

struct d3d12_device *device;
struct vkd3d_private_store private_store;
};
Expand Down Expand Up @@ -943,6 +959,8 @@ struct d3d12_resource
struct vkd3d_view_map view_map;
struct vkd3d_subresource_layout *subresource_layouts;

priority_info priority;

struct d3d12_device *device;

const struct vkd3d_format *format;
Expand Down Expand Up @@ -3930,6 +3948,7 @@ struct vkd3d_physical_device_info
VkPhysicalDeviceMeshShaderPropertiesEXT mesh_shader_properties;
VkPhysicalDeviceShaderModuleIdentifierPropertiesEXT shader_module_identifier_properties;
VkPhysicalDeviceDescriptorBufferPropertiesEXT descriptor_buffer_properties;
VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT graphics_pipeline_library_properties;

VkPhysicalDeviceProperties2KHR properties2;

Expand Down Expand Up @@ -3967,13 +3986,21 @@ struct vkd3d_physical_device_info
VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT image_sliced_view_of_3d_features;
VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT graphics_pipeline_library_features;
VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT fragment_shader_interlock_features;
VkPhysicalDeviceMemoryPriorityFeaturesEXT memory_priority_features;
VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT pageable_device_memory_features;
VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT dynamic_rendering_unused_attachments_features;

VkPhysicalDeviceFeatures2 features2;

/* others, for extensions that have no feature bits */
uint32_t time_domains; /* vkd3d_time_domain_flag */

bool additional_shading_rates_supported; /* d3d12 additional fragment shading rates cap */

struct
{
bool force_dummy_pipeline_cache;
} workarounds;
};

struct d3d12_caps
Expand Down
3 changes: 3 additions & 0 deletions libs/vkd3d/vulkan_procs.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ VK_DEVICE_EXT_PFN(vkCmdSetDescriptorBufferOffsetsEXT)
VK_DEVICE_EXT_PFN(vkGetDescriptorSetLayoutSizeEXT)
VK_DEVICE_EXT_PFN(vkGetDescriptorSetLayoutBindingOffsetEXT)

/* VK_EXT_pageable_device_local_memory */
VK_DEVICE_EXT_PFN(vkSetDeviceMemoryPriorityEXT)

#undef VK_INSTANCE_PFN
#undef VK_INSTANCE_EXT_PFN
#undef VK_DEVICE_PFN
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('vkd3d-proton', ['c'], version : '2.8', meson_version : '>= 0.49', default_options : [
project('vkd3d-proton', ['c'], version : '2.9', meson_version : '>= 0.49', default_options : [
'warning_level=2',
])

Expand Down
511 changes: 511 additions & 0 deletions profiles/PROFILES.md

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions profiles/generate_profile_solution.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

mkdir -p profiles/vulkan/debug

if [ -z ${VULKAN_PROFILE_PREFIX} ]; then
VULKAN_PROFILE_PREFIX="$HOME/.local"
echo "Using VULKAN_PROFILE_PREFIX=$VULKAN_PROFILE_PREFIX."
fi

# Install Vulkan-Profiles to ~/.local prefix.

python3 "${VULKAN_PROFILE_PREFIX}/share/vulkan/registry/gen_profiles_solution.py" \
--registry subprojects/Vulkan-Headers/registry/vk.xml \
--input . \
--output-library-inc profiles/vulkan \
--output-library-src profiles/vulkan \
--output-doc profiles/PROFILES.md \
--validate --debug
87 changes: 87 additions & 0 deletions profiles/profile-test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright 2023 Hans-Kristian Arntzen for Valve Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/

#include "vulkan/vulkan_profiles.h"
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

/* Crude ad-hoc check. */

int main(void)
{
VkInstanceCreateInfo instance_create_info;
VpInstanceCreateInfo vp_instance_info;
VkPhysicalDeviceProperties gpu_props;
VkApplicationInfo app_info;
VpProfileProperties *props;
VkPhysicalDevice *gpus;
uint32_t profile_count;
VkInstance instance;
uint32_t gpu_count;
VkBool32 supported;
uint32_t i, j;

vpGetProfiles(&profile_count, NULL);
props = (VpProfileProperties*)calloc(profile_count, sizeof(*props));
vpGetProfiles(&profile_count, props);

for (i = 0; i < profile_count; i++)
{
printf("Testing profile %s.\n", props[i].profileName);

memset(&instance_create_info, 0, sizeof(instance_create_info));
memset(&vp_instance_info, 0, sizeof(vp_instance_info));
memset(&app_info, 0, sizeof(app_info));
instance_create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
app_info.apiVersion = VK_API_VERSION_1_3;
app_info.pEngineName = "vkd3d";
instance_create_info.pApplicationInfo = &app_info;
vp_instance_info.pCreateInfo = &instance_create_info;

if (vpGetInstanceProfileSupport(NULL, &props[i], &supported) != VK_SUCCESS || !supported)
{
fprintf(stderr, "Profile %s is not supported at instance level.\n",
props[i].profileName);
}

if (vpCreateInstance(&vp_instance_info, NULL, &instance) != VK_SUCCESS)
{
fprintf(stderr, "Failed to create instance ...\n");
continue;
}

vkEnumeratePhysicalDevices(instance, &gpu_count, NULL);
gpus = (VkPhysicalDevice*)calloc(gpu_count, sizeof(*gpus));
vkEnumeratePhysicalDevices(instance, &gpu_count, gpus);

for (j = 0; j < gpu_count; j++)
{
vkGetPhysicalDeviceProperties(gpus[j], &gpu_props);
if (vpGetPhysicalDeviceProfileSupport(instance, gpus[j], &props[i], &supported) != VK_SUCCESS)
supported = VK_FALSE;

printf("[RESULT] GPU: %s, Profile: %s, supported: %s\n",
gpu_props.deviceName, props[i].profileName, supported ? "yes" : "no");
}

free(gpus);
vkDestroyInstance(instance, NULL);
}
}
10 changes: 10 additions & 0 deletions profiles/setup_profile_environment_common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation:VK_LAYER_KHRONOS_profiles
export VK_KHRONOS_PROFILES_DEFAULT_FEATURE_VALUES=DEFAULT_FEATURE_VALUES_FALSE
export VK_KHRONOS_PROFILES_PROFILE_FILE=$(pwd)/VP_D3D12_VKD3D_PROTON_profile.json
export VK_KHRONOS_PROFILES_PROFILE_NAME=${PROFILE_NAME}
export VK_KHRONOS_PROFILES_SIMULATE_CAPABILITIES=SIMULATE_API_VERSION_BIT,SIMULATE_FEATURES_BIT,SIMULATE_PROPERTIES_BIT,SIMULATE_EXTENSIONS_BIT
export VK_LAYER_PATH=/usr/share/vulkan/explicit_layer.d:~/.local/share/vulkan/explicit_layer.d
export VK_KHRONOS_PROFILES_EMULATE_PORTABILITY=false
export LD_LIBRARY_PATH="$HOME/.local/lib:$LD_LIBRARY_PATH"
export VK_KHRONOS_PROFILES_DEBUG_ACTIONS=DEBUG_ACTION_FILE_BIT
export VK_KHRONOS_PROFILES_DEBUG_FILENAME=/dev/null
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_fl_11_0_baseline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_FL_11_0_baseline
source profiles/setup_profile_environment_common.sh
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_fl_11_1_baseline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_FL_11_1_baseline
source profiles/setup_profile_environment_common.sh
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_fl_12_0_baseline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_FL_12_0_baseline
source profiles/setup_profile_environment_common.sh
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_fl_12_0_optimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_FL_12_0_optimal
source profiles/setup_profile_environment_common.sh
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_fl_12_1_baseline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_FL_12_1_baseline
source profiles/setup_profile_environment_common.sh
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_fl_12_2_baseline.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_FL_12_2_baseline
source profiles/setup_profile_environment_common.sh
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_fl_12_2_optimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_FL_12_2_optimal
source profiles/setup_profile_environment_common.sh
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_maximum_nv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_maximum_nv
source profiles/setup_profile_environment_common.sh
2 changes: 2 additions & 0 deletions profiles/setup_profile_environment_maximum_radv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PROFILE_NAME=VP_D3D12_maximum_radv
source profiles/setup_profile_environment_common.sh
2 changes: 1 addition & 1 deletion subprojects/Vulkan-Headers
2 changes: 1 addition & 1 deletion subprojects/dxil-spirv
Submodule dxil-spirv updated 26 files
+244 −6 cfg_structurizer.cpp
+4 −0 cfg_structurizer.hpp
+53 −75 dxil_converter.cpp
+4 −0 node.cpp
+28 −6 opcodes/converter_impl.hpp
+32 −11 opcodes/dxil/dxil_buffer.cpp
+4 −2 opcodes/dxil/dxil_common.cpp
+1 −1 opcodes/dxil/dxil_common.hpp
+20 −7 opcodes/dxil/dxil_resources.cpp
+1 −0 opcodes/opcodes.hpp
+22 −11 opcodes/opcodes_dxil_builtins.cpp
+27 −31 reference/shaders/asm/cbv.no-legacy-cbuf-layout.sm66-heaps.bc.dxil
+80 −88 reference/shaders/resources/cbv-legacy-fp16-fp64.frag
+69 −79 reference/shaders/resources/cbv-legacy-fp16-fp64.sm60.frag
+76 −84 reference/shaders/resources/cbv-legacy-fp16-fp64.sm60.native-fp16.frag
+160 −146 reference/shaders/resources/cbv.no-legacy-cbuf-layout.bindless.frag
+88 −95 reference/shaders/resources/cbv.no-legacy-cbuf-layout.native-fp16.sm60.frag
+89 −122 reference/shaders/resources/sm66/buffer-64bit-double.ssbo.sm66.comp
+160 −146 reference/shaders/resources/sm66/cbv.no-legacy-cbuf-layout.bindless.sm66.frag
+134 −137 reference/shaders/resources/sm66/cbv.no-legacy-cbuf-layout.sm66.frag
+297 −336 reference/shaders/vectorization/copy-byte-address.ssbo.comp
+12 −24 reference/shaders/vectorization/copy-double2.ssbo.comp
+17 −29 reference/shaders/vectorization/copy-double2.ssbo.ssbo-align.bindless.comp
+13 −26 reference/shaders/vectorization/copy-double3.ssbo.comp
+32 −44 reference/shaders/vectorization/copy-double3.ssbo.ssbo-align.bindless.comp
+14 −28 reference/shaders/vectorization/copy-double4.ssbo.comp
1 change: 1 addition & 0 deletions tests/d3d12.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ START_TEST(d3d12)

parse_args(argc, argv);
enable_d3d12_debug_layer(argc, argv);
enable_feature_level_override(argc, argv);
init_adapter_info();

pfn_D3D12CreateVersionedRootSignatureDeserializer = get_d3d12_pfn(D3D12CreateVersionedRootSignatureDeserializer);
Expand Down
46 changes: 44 additions & 2 deletions tests/d3d12_crosstest.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,48 @@ static inline bool join_thread(HANDLE untyped_thread)
}
#endif

extern D3D_FEATURE_LEVEL vkd3d_device_feature_level;
static inline void enable_feature_level_override(int argc, char **argv)
{
static const struct
{
D3D_FEATURE_LEVEL level;
const char *tag;
} level_map[] = {
{ D3D_FEATURE_LEVEL_11_0, "11_0" },
{ D3D_FEATURE_LEVEL_11_1, "11_1" },
{ D3D_FEATURE_LEVEL_12_0, "12_0" },
{ D3D_FEATURE_LEVEL_12_1, "12_1" },
{ D3D_FEATURE_LEVEL_12_2, "12_2" },
};

const char *level = NULL;
int i;

for (i = 1; i + 1 < argc; ++i)
{
if (!strcmp(argv[i], "--feature-level"))
{
level = argv[i + 1];
break;
}
}

vkd3d_device_feature_level = D3D_FEATURE_LEVEL_11_0;
if (level)
{
for (i = 0; i < (int)ARRAY_SIZE(level_map); i++)
{
if (!strcmp(level_map[i].tag, level))
{
INFO("Overriding feature level %s.\n", level);
vkd3d_device_feature_level = level_map[i].level;
break;
}
}
}
}

static HRESULT wait_for_fence(ID3D12Fence *fence, uint64_t value)
{
unsigned int ret;
Expand Down Expand Up @@ -380,7 +422,7 @@ static ID3D12Device *create_device(void)
if (pfn_D3D12EnableExperimentalFeatures)
pfn_D3D12EnableExperimentalFeatures(1, &D3D12ExperimentalShaderModels, NULL, NULL);

hr = pfn_D3D12CreateDevice(adapter, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&device);
hr = pfn_D3D12CreateDevice(adapter, vkd3d_device_feature_level, &IID_ID3D12Device, (void **)&device);
if (adapter)
IUnknown_Release(adapter);

Expand Down Expand Up @@ -519,7 +561,7 @@ static ID3D12Device *create_device(void)
{
ID3D12Device *device;
HRESULT hr;
hr = D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&device);
hr = D3D12CreateDevice(NULL, vkd3d_device_feature_level, &IID_ID3D12Device, (void **)&device);
return SUCCEEDED(hr) ? device : NULL;
}

Expand Down
14 changes: 10 additions & 4 deletions tests/d3d12_pso.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ void test_create_graphics_pipeline_state(void)
{
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc;
D3D12_FEATURE_DATA_D3D12_OPTIONS options;
ID3D12RootSignature *root_signature;
ID3D12PipelineState *pipeline_state;
ID3D12Device *device, *tmp_device;
Expand Down Expand Up @@ -282,10 +283,15 @@ void test_create_graphics_pipeline_state(void)
blend->IndependentBlendEnable = false;
blend->RenderTarget[0].BlendEnable = false;
blend->RenderTarget[0].LogicOpEnable = true;
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
&IID_ID3D12PipelineState, (void **)&pipeline_state);
ok(hr == S_OK, "Failed to create pipeline, hr %#x.\n", hr);
ID3D12PipelineState_Release(pipeline_state);

if (SUCCEEDED(ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_D3D12_OPTIONS, &options, sizeof(options))) &&
options.OutputMergerLogicOp)
{
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
&IID_ID3D12PipelineState, (void **) &pipeline_state);
ok(hr == S_OK, "Failed to create pipeline, hr %#x.\n", hr);
ID3D12PipelineState_Release(pipeline_state);
}

/* IndependentBlendEnable must be set to false when logic operations are enabled. */
blend->IndependentBlendEnable = true;
Expand Down
9 changes: 4 additions & 5 deletions tests/d3d12_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void test_query_pipeline_statistics(void)
ID3D12QueryHeap *query_heap;
ID3D12Resource *resource;
struct resource_readback rb;
unsigned int pixel_count, i;
unsigned int i;
HRESULT hr;

if (!init_test_context(&context, NULL))
Expand Down Expand Up @@ -227,10 +227,9 @@ void test_query_pipeline_statistics(void)
ok(pipeline_statistics->CPrimitives > 0, "CPrimitives: Got %"PRIu64", expected > 0.\n",
pipeline_statistics->CPrimitives);

/* Exact number of pixel shader invocations depends on the graphics card. */
pixel_count = context.render_target_desc.Width * context.render_target_desc.Height;
ok(pipeline_statistics->PSInvocations >= pixel_count, "PSInvocations: Got %"PRIu64", expected >= %u.\n",
pipeline_statistics->PSInvocations, pixel_count);
/* Exact number of pixel shader invocations depends on the graphics card and VRS can affect it. */
ok(pipeline_statistics->PSInvocations > 0, "PSInvocations: Got %"PRIu64", expected >= %u.\n",
pipeline_statistics->PSInvocations, 0);

/* We used no tessellation or compute shaders at all. */
ok(pipeline_statistics->HSInvocations == 0, "HSInvocations: Got %"PRIu64", expected 0.\n",
Expand Down
351 changes: 351 additions & 0 deletions tests/d3d12_raytracing.c

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions tests/d3d12_render_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ void test_multisample_rendering(void)
void test_rendering_no_attachments_layers(void)
{
D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc;
D3D12_FEATURE_DATA_D3D12_OPTIONS options;
D3D12_ROOT_SIGNATURE_DESC rs_desc;
D3D12_ROOT_PARAMETER root_param;
struct test_context_desc desc;
Expand Down Expand Up @@ -962,6 +963,14 @@ void test_rendering_no_attachments_layers(void)
if (!init_test_context(&context, &desc))
return;

if (FAILED(ID3D12Device_CheckFeatureSupport(context.device, D3D12_FEATURE_D3D12_OPTIONS, &options, sizeof(options))) ||
!options.VPAndRTArrayIndexFromAnyShaderFeedingRasterizerSupportedWithoutGSEmulation)
{
skip("Cannot render layers from VS. Skipping.\n");
destroy_test_context(&context);
return;
}

memset(&root_param, 0, sizeof(root_param));
memset(&rs_desc, 0, sizeof(rs_desc));
rs_desc.NumParameters = 1;
Expand Down
9 changes: 5 additions & 4 deletions tests/d3d12_sm_advanced.c
Original file line number Diff line number Diff line change
Expand Up @@ -5693,7 +5693,7 @@ void test_advanced_cbv_layout(void)
static void test_denorm_behavior(bool use_dxil)
{
D3D12_FEATURE_DATA_D3D12_OPTIONS4 features4;
D3D12_FEATURE_DATA_D3D12_OPTIONS1 features1;
D3D12_FEATURE_DATA_D3D12_OPTIONS features;
D3D12_FEATURE_DATA_SHADER_MODEL model;
D3D12_ROOT_PARAMETER root_param[2];
D3D12_ROOT_SIGNATURE_DESC rs_desc;
Expand Down Expand Up @@ -6406,6 +6406,7 @@ static void test_denorm_behavior(bool use_dxil)
{
skip("SM 6.2 not supported.\n");
destroy_test_context(&context);
return;
}

support_16bit =
Expand All @@ -6414,9 +6415,9 @@ static void test_denorm_behavior(bool use_dxil)
features4.Native16BitShaderOpsSupported;

support_64bit =
SUCCEEDED(ID3D12Device_CheckFeatureSupport(context.device, D3D12_FEATURE_D3D12_OPTIONS1,
&features1, sizeof(features1))) &&
features1.Int64ShaderOps;
SUCCEEDED(ID3D12Device_CheckFeatureSupport(context.device, D3D12_FEATURE_D3D12_OPTIONS,
&features, sizeof(features))) &&
features.DoublePrecisionFloatShaderOps;

memset(&rs_desc, 0, sizeof(rs_desc));
memset(&root_param, 0, sizeof(root_param));
Expand Down
1 change: 1 addition & 0 deletions tests/d3d12_test_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE pfn_D3D12SerializeVersionedRootSign
PFN_D3D12_CREATE_DEVICE pfn_D3D12CreateDevice;
PFN_D3D12_ENABLE_EXPERIMENTAL_FEATURES pfn_D3D12EnableExperimentalFeatures;
PFN_D3D12_GET_DEBUG_INTERFACE pfn_D3D12GetDebugInterface;
D3D_FEATURE_LEVEL vkd3d_device_feature_level = D3D_FEATURE_LEVEL_11_0;
const char *vkd3d_test_platform = "other";
struct vkd3d_test_state_context vkd3d_test_state;

Expand Down
1 change: 1 addition & 0 deletions tests/d3d12_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ decl_test(test_raytracing_reject_duplicate_objects);
decl_test(test_raytracing_embedded_subobjects);
decl_test(test_raytracing_default_association_tiebreak);
decl_test(test_raytracing_collection_identifiers);
decl_test(test_raytracing_root_signature_from_subobject);
decl_test(test_fence_wait_robustness);
decl_test(test_fence_wait_robustness_shared);
decl_test(test_fence_wait_multiple);
Expand Down