From 8d4080e846b03a63494fb71f3890046143be85f5 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Tue, 28 Nov 2023 10:20:40 +1100 Subject: [PATCH] Updated vkd3d to 6a4a9a4518689a7db5eff362cc5e0fff0994a7af. --- libs/vkd3d/libs/vkd3d-shader/dxil.c | 6 ++---- libs/vkd3d/libs/vkd3d-shader/hlsl.c | 2 ++ libs/vkd3d/libs/vkd3d-shader/hlsl.h | 3 ++- libs/vkd3d/libs/vkd3d-shader/hlsl.l | 1 + libs/vkd3d/libs/vkd3d-shader/hlsl.y | 5 +++++ libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c | 10 +++++----- libs/vkd3d/libs/vkd3d-shader/tpf.c | 3 ++- libs/vkd3d/libs/vkd3d/command.c | 4 ++-- libs/vkd3d/libs/vkd3d/device.c | 20 +++++++++++++++----- libs/vkd3d/libs/vkd3d/state.c | 2 +- libs/vkd3d/libs/vkd3d/vkd3d_private.h | 4 +--- 11 files changed, 38 insertions(+), 22 deletions(-) diff --git a/libs/vkd3d/libs/vkd3d-shader/dxil.c b/libs/vkd3d/libs/vkd3d-shader/dxil.c index 1709212fa99..c03948aef53 100644 --- a/libs/vkd3d/libs/vkd3d-shader/dxil.c +++ b/libs/vkd3d/libs/vkd3d-shader/dxil.c @@ -4895,8 +4895,7 @@ static enum vkd3d_result sm6_parser_resources_init(struct sm6_parser *sm6) static void signature_element_read_additional_element_values(struct signature_element *e, const struct sm6_metadata_node *node, struct sm6_parser *sm6) { - unsigned int i, operand_count, value; - enum dxil_element_additional_tag tag; + unsigned int i, operand_count, value, tag; if (node->operand_count < 11 || !node->operands[10]) return; @@ -5254,8 +5253,7 @@ static enum vkd3d_result sm6_parser_entry_point_init(struct sm6_parser *sm6) { const struct sm6_metadata_value *m = sm6_parser_find_named_metadata(sm6, "dx.entryPoints"); const struct sm6_metadata_node *node, *entry_node = m ? m->u.node : NULL; - enum dxil_shader_properties_tag tag; - unsigned int i, operand_count; + unsigned int i, operand_count, tag; const struct sm6_value *value; enum vkd3d_result ret; diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.c b/libs/vkd3d/libs/vkd3d-shader/hlsl.c index 501bff8cfb8..da3bbda1bc3 100644 --- a/libs/vkd3d/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.c @@ -2255,6 +2255,8 @@ struct vkd3d_string_buffer *hlsl_modifiers_to_string(struct hlsl_ctx *ctx, unsig if (modifiers & HLSL_STORAGE_EXTERN) vkd3d_string_buffer_printf(string, "extern "); + if (modifiers & HLSL_STORAGE_LINEAR) + vkd3d_string_buffer_printf(string, "linear "); if (modifiers & HLSL_STORAGE_NOINTERPOLATION) vkd3d_string_buffer_printf(string, "nointerpolation "); if (modifiers & HLSL_STORAGE_CENTROID) diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.h b/libs/vkd3d/libs/vkd3d-shader/hlsl.h index a0065572539..bd6682be6ac 100644 --- a/libs/vkd3d/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.h @@ -357,13 +357,14 @@ struct hlsl_attribute #define HLSL_MODIFIER_INLINE 0x00002000 #define HLSL_STORAGE_CENTROID 0x00004000 #define HLSL_STORAGE_NOPERSPECTIVE 0x00008000 +#define HLSL_STORAGE_LINEAR 0x00010000 #define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \ HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \ HLSL_MODIFIER_COLUMN_MAJOR) #define HLSL_INTERPOLATION_MODIFIERS_MASK (HLSL_STORAGE_NOINTERPOLATION | HLSL_STORAGE_CENTROID | \ - HLSL_STORAGE_NOPERSPECTIVE) + HLSL_STORAGE_NOPERSPECTIVE | HLSL_STORAGE_LINEAR) #define HLSL_MODIFIERS_MAJORITY_MASK (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR) diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.l b/libs/vkd3d/libs/vkd3d-shader/hlsl.l index 401fba60422..fe838750747 100644 --- a/libs/vkd3d/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.l @@ -95,6 +95,7 @@ if {return KW_IF; } in {return KW_IN; } inline {return KW_INLINE; } inout {return KW_INOUT; } +linear {return KW_LINEAR; } matrix {return KW_MATRIX; } namespace {return KW_NAMESPACE; } nointerpolation {return KW_NOINTERPOLATION; } diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl.y b/libs/vkd3d/libs/vkd3d-shader/hlsl.y index 67b01293683..0dde4c18587 100644 --- a/libs/vkd3d/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d/libs/vkd3d-shader/hlsl.y @@ -4893,6 +4893,7 @@ static void check_duplicated_switch_cases(struct hlsl_ctx *ctx, const struct hls %token KW_IN %token KW_INLINE %token KW_INOUT +%token KW_LINEAR %token KW_MATRIX %token KW_NAMESPACE %token KW_NOINTERPOLATION @@ -6262,6 +6263,10 @@ var_modifiers: { $$ = add_modifiers(ctx, $2, HLSL_STORAGE_CENTROID, &@1); } + | KW_LINEAR var_modifiers + { + $$ = add_modifiers(ctx, $2, HLSL_STORAGE_LINEAR, &@1); + } | KW_NOPERSPECTIVE var_modifiers { $$ = add_modifiers(ctx, $2, HLSL_STORAGE_NOPERSPECTIVE, &@1); diff --git a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c index 5a70878bca7..628de79676e 100644 --- a/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d/libs/vkd3d-shader/hlsl_codegen.c @@ -1304,12 +1304,10 @@ static struct copy_propagation_value *copy_propagation_get_value(const struct co { struct copy_propagation_var_def *var_def = RB_ENTRY_VALUE(entry, struct copy_propagation_var_def, entry); unsigned int component_count = hlsl_type_component_count(var->data_type); - enum copy_propagation_value_state state; assert(component < component_count); - state = var_def->values[component].state; - switch (state) + switch (var_def->values[component].state) { case VALUE_STATE_STATICALLY_WRITTEN: return &var_def->values[component]; @@ -4089,7 +4087,7 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var [VKD3D_SHADER_TYPE_COMPUTE] = "Compute", }; - unsigned int type; + enum vkd3d_shader_register_type type; uint32_t reg; bool builtin; @@ -4097,6 +4095,7 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var if (ctx->profile->major_version < 4) { + D3DSHADER_PARAM_REGISTER_TYPE sm1_type; D3DDECLUSAGE usage; uint32_t usage_idx; @@ -4104,7 +4103,7 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var if (ctx->profile->major_version == 1 && output && ctx->profile->type == VKD3D_SHADER_TYPE_PIXEL) return; - builtin = hlsl_sm1_register_from_semantic(ctx, &var->semantic, output, &type, ®); + builtin = hlsl_sm1_register_from_semantic(ctx, &var->semantic, output, &sm1_type, ®); if (!builtin && !hlsl_sm1_usage_from_semantic(&var->semantic, &usage, &usage_idx)) { hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC, @@ -4114,6 +4113,7 @@ static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var if ((!output && !var->last_read) || (output && !var->first_write)) return; + type = (enum vkd3d_shader_register_type)sm1_type; } else { diff --git a/libs/vkd3d/libs/vkd3d-shader/tpf.c b/libs/vkd3d/libs/vkd3d-shader/tpf.c index 61d14e30d3c..80f8ab98c08 100644 --- a/libs/vkd3d/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d/libs/vkd3d-shader/tpf.c @@ -3528,8 +3528,8 @@ static void write_sm4_rdef(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc) { const unsigned int var_size = (profile->major_version >= 5 ? 10 : 6); size_t var_offset = vars_start + j * var_size * sizeof(uint32_t); - size_t string_offset = put_string(&buffer, var->name); + string_offset = put_string(&buffer, var->name); set_u32(&buffer, var_offset, string_offset); write_sm4_type(ctx, &buffer, var->data_type); set_u32(&buffer, var_offset + 4 * sizeof(uint32_t), var->data_type->bytecode_offset); @@ -4311,6 +4311,7 @@ static void write_sm4_dcl_semantic(const struct tpf_writer *tpf, const struct hl { HLSL_STORAGE_CENTROID | HLSL_STORAGE_NOPERSPECTIVE, VKD3DSIM_LINEAR_NOPERSPECTIVE_CENTROID }, { HLSL_STORAGE_NOPERSPECTIVE, VKD3DSIM_LINEAR_NOPERSPECTIVE }, { HLSL_STORAGE_CENTROID, VKD3DSIM_LINEAR_CENTROID }, + { HLSL_STORAGE_CENTROID | HLSL_STORAGE_LINEAR, VKD3DSIM_LINEAR_CENTROID }, }; unsigned int i; diff --git a/libs/vkd3d/libs/vkd3d/command.c b/libs/vkd3d/libs/vkd3d/command.c index 77d0f2751cf..15c8317b191 100644 --- a/libs/vkd3d/libs/vkd3d/command.c +++ b/libs/vkd3d/libs/vkd3d/command.c @@ -6852,7 +6852,7 @@ fail: static HRESULT d3d12_command_queue_wait_binary_semaphore_locked(struct d3d12_command_queue *command_queue, struct d3d12_fence *fence, uint64_t value) { - static const VkPipelineStageFlagBits wait_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; + static const VkPipelineStageFlags wait_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; const struct vkd3d_vk_device_procs *vk_procs; struct vkd3d_signaled_semaphore *semaphore; uint64_t completed_value = 0; @@ -6948,7 +6948,7 @@ fail: static HRESULT d3d12_command_queue_wait_locked(struct d3d12_command_queue *command_queue, struct d3d12_fence *fence, uint64_t value) { - static const VkPipelineStageFlagBits wait_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; + static const VkPipelineStageFlags wait_stage_mask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT; VkTimelineSemaphoreSubmitInfoKHR timeline_submit_info; const struct vkd3d_vk_device_procs *vk_procs; struct vkd3d_queue *queue; diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c index 79028fc3dd8..5c801ca4676 100644 --- a/libs/vkd3d/libs/vkd3d/device.c +++ b/libs/vkd3d/libs/vkd3d/device.c @@ -3736,10 +3736,19 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandleByName(ID3D12Devic static HRESULT STDMETHODCALLTYPE d3d12_device_MakeResident(ID3D12Device5 *iface, UINT object_count, ID3D12Pageable * const *objects) { - FIXME_ONCE("iface %p, object_count %u, objects %p stub!\n", - iface, object_count, objects); + ID3D12Fence *fence; + HRESULT hr; - return S_OK; + TRACE("iface %p, object_count %u, objects %p.\n", iface, object_count, objects); + + if (FAILED(hr = ID3D12Device5_CreateFence(iface, 0, 0, &IID_ID3D12Fence, (void **)&fence))) + return hr; + + hr = ID3D12Device5_EnqueueMakeResident(iface, 0, object_count, objects, fence, 1); + if (SUCCEEDED(hr)) + ID3D12Fence_SetEventOnCompletion(fence, 1, NULL); + ID3D12Fence_Release(fence); + return hr; } static HRESULT STDMETHODCALLTYPE d3d12_device_Evict(ID3D12Device5 *iface, @@ -3994,10 +4003,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_EnqueueMakeResident(ID3D12Device5 D3D12_RESIDENCY_FLAGS flags, UINT num_objects, ID3D12Pageable *const *objects, ID3D12Fence *fence, UINT64 fence_value) { - FIXME("iface %p, flags %#x, num_objects %u, objects %p, fence %p, fence_value %#"PRIx64" stub!\n", + FIXME_ONCE("iface %p, flags %#x, num_objects %u, objects %p, fence %p, fence_value %#"PRIx64" stub!\n", iface, flags, num_objects, objects, fence, fence_value); - return E_NOTIMPL; + ID3D12Fence_Signal(fence, fence_value); + return S_OK; } static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList1(ID3D12Device5 *iface, diff --git a/libs/vkd3d/libs/vkd3d/state.c b/libs/vkd3d/libs/vkd3d/state.c index de0e04ea1e6..6665a1fd6cb 100644 --- a/libs/vkd3d/libs/vkd3d/state.c +++ b/libs/vkd3d/libs/vkd3d/state.c @@ -1839,7 +1839,7 @@ static HRESULT pipeline_state_desc_from_d3d12_stream_desc(struct d3d12_pipeline_ [D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_INPUT_LAYOUT] = DCL_SUBOBJECT_INFO(D3D12_INPUT_LAYOUT_DESC, input_layout), [D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_IB_STRIP_CUT_VALUE] = DCL_SUBOBJECT_INFO(D3D12_INDEX_BUFFER_STRIP_CUT_VALUE, strip_cut_value), [D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY] = DCL_SUBOBJECT_INFO(D3D12_PRIMITIVE_TOPOLOGY_TYPE, primitive_topology_type), - [D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS] = DCL_SUBOBJECT_INFO(D3D12_RT_FORMAT_ARRAY, rtv_formats), + [D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_RENDER_TARGET_FORMATS] = DCL_SUBOBJECT_INFO(struct D3D12_RT_FORMAT_ARRAY, rtv_formats), [D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL_FORMAT] = DCL_SUBOBJECT_INFO(DXGI_FORMAT, dsv_format), [D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_SAMPLE_DESC] = DCL_SUBOBJECT_INFO(DXGI_SAMPLE_DESC, sample_desc), [D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_NODE_MASK] = DCL_SUBOBJECT_INFO(UINT, node_mask), diff --git a/libs/vkd3d/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/libs/vkd3d/vkd3d_private.h index 231bc615e5c..e0eb9f3d3fe 100644 --- a/libs/vkd3d/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/libs/vkd3d/vkd3d_private.h @@ -22,9 +22,7 @@ #define COBJMACROS #define NONAMELESSUNION #define VK_NO_PROTOTYPES -#ifndef CONST_VTABLE #define CONST_VTABLE -#endif #ifdef _WIN32 # define _WIN32_WINNT 0x0600 /* for condition variables */ @@ -1336,7 +1334,7 @@ struct d3d12_pipeline_state_desc D3D12_INPUT_LAYOUT_DESC input_layout; D3D12_INDEX_BUFFER_STRIP_CUT_VALUE strip_cut_value; D3D12_PRIMITIVE_TOPOLOGY_TYPE primitive_topology_type; - D3D12_RT_FORMAT_ARRAY rtv_formats; + struct D3D12_RT_FORMAT_ARRAY rtv_formats; DXGI_FORMAT dsv_format; DXGI_SAMPLE_DESC sample_desc; D3D12_VIEW_INSTANCING_DESC view_instancing_desc; -- 2.43.0