From 6839d5b534bb5eb46a84fd3d8afe12e93754da2d Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 5 Apr 2024 08:22:04 +1100 Subject: [PATCH] Updated vkd3d-latest patchset --- ...-166dc24b2f73b0541a14815081ee4c8d9ea.patch | 2 +- ...-b1eaf8327bf59b516f80e232e86332473ed.patch | 2 +- ...-4b0a328a2b58a86e3529ddcc2cdc785a086.patch | 2 +- ...-9c0d04c86204fd360a7528faf2b53acc730.patch | 1616 +++++++++++++++++ 4 files changed, 1619 insertions(+), 3 deletions(-) create mode 100644 patches/vkd3d-latest/0004-Updated-vkd3d-to-9c0d04c86204fd360a7528faf2b53acc730.patch diff --git a/patches/vkd3d-latest/0001-Updated-vkd3d-to-166dc24b2f73b0541a14815081ee4c8d9ea.patch b/patches/vkd3d-latest/0001-Updated-vkd3d-to-166dc24b2f73b0541a14815081ee4c8d9ea.patch index 0dfa12e7..4812bc1c 100644 --- a/patches/vkd3d-latest/0001-Updated-vkd3d-to-166dc24b2f73b0541a14815081ee4c8d9ea.patch +++ b/patches/vkd3d-latest/0001-Updated-vkd3d-to-166dc24b2f73b0541a14815081ee4c8d9ea.patch @@ -1,4 +1,4 @@ -From 5fd26d60c60215be2b8c8355e2520ff13b8578e0 Mon Sep 17 00:00:00 2001 +From c1f714e2b6dd6ea60e58506a85237fb3adee2467 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 7 Mar 2024 10:40:41 +1100 Subject: [PATCH] Updated vkd3d to 166dc24b2f73b0541a14815081ee4c8d9eab3269. diff --git a/patches/vkd3d-latest/0002-Updated-vkd3d-to-b1eaf8327bf59b516f80e232e86332473ed.patch b/patches/vkd3d-latest/0002-Updated-vkd3d-to-b1eaf8327bf59b516f80e232e86332473ed.patch index 0d2500aa..be871b78 100644 --- a/patches/vkd3d-latest/0002-Updated-vkd3d-to-b1eaf8327bf59b516f80e232e86332473ed.patch +++ b/patches/vkd3d-latest/0002-Updated-vkd3d-to-b1eaf8327bf59b516f80e232e86332473ed.patch @@ -1,4 +1,4 @@ -From fe3714ac04e56180db0ac935c92bba21308de94d Mon Sep 17 00:00:00 2001 +From b2202d65c0c1ea4fcd083e4fbacb7dfc1c2d7bca Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 28 Mar 2024 10:39:27 +1100 Subject: [PATCH] Updated vkd3d to b1eaf8327bf59b516f80e232e86332473ed97edc. diff --git a/patches/vkd3d-latest/0003-Updated-vkd3d-to-4b0a328a2b58a86e3529ddcc2cdc785a086.patch b/patches/vkd3d-latest/0003-Updated-vkd3d-to-4b0a328a2b58a86e3529ddcc2cdc785a086.patch index e2a8bf37..cb531e01 100644 --- a/patches/vkd3d-latest/0003-Updated-vkd3d-to-4b0a328a2b58a86e3529ddcc2cdc785a086.patch +++ b/patches/vkd3d-latest/0003-Updated-vkd3d-to-4b0a328a2b58a86e3529ddcc2cdc785a086.patch @@ -1,4 +1,4 @@ -From 5541aae5a354e5610a3a054a4ff71aee60562542 Mon Sep 17 00:00:00 2001 +From 5785aacc06fe654c69632c9f95449015e379fa24 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 4 Apr 2024 09:47:35 +1100 Subject: [PATCH] Updated vkd3d to 4b0a328a2b58a86e3529ddcc2cdc785a08625f81. diff --git a/patches/vkd3d-latest/0004-Updated-vkd3d-to-9c0d04c86204fd360a7528faf2b53acc730.patch b/patches/vkd3d-latest/0004-Updated-vkd3d-to-9c0d04c86204fd360a7528faf2b53acc730.patch new file mode 100644 index 00000000..ea5b5f49 --- /dev/null +++ b/patches/vkd3d-latest/0004-Updated-vkd3d-to-9c0d04c86204fd360a7528faf2b53acc730.patch @@ -0,0 +1,1616 @@ +From 315fe78a04bc6e851f29d38ab3ab82e725967ae1 Mon Sep 17 00:00:00 2001 +From: Alistair Leslie-Hughes +Date: Fri, 5 Apr 2024 08:20:45 +1100 +Subject: [PATCH] Updated vkd3d to 9c0d04c86204fd360a7528faf2b53acc7301b598. + +--- + libs/vkd3d/libs/vkd3d-shader/ir.c | 216 +++++++++- + libs/vkd3d/libs/vkd3d/device.c | 543 ++++++++++++++++++++------ + libs/vkd3d/libs/vkd3d/resource.c | 2 +- + libs/vkd3d/libs/vkd3d/vkd3d_main.c | 4 +- + libs/vkd3d/libs/vkd3d/vkd3d_private.h | 12 +- + 5 files changed, 635 insertions(+), 142 deletions(-) + +diff --git a/libs/vkd3d/libs/vkd3d-shader/ir.c b/libs/vkd3d/libs/vkd3d-shader/ir.c +index 7230d0e8b61..8af537390f9 100644 +--- a/libs/vkd3d/libs/vkd3d-shader/ir.c ++++ b/libs/vkd3d/libs/vkd3d-shader/ir.c +@@ -3050,6 +3050,8 @@ struct vsir_cfg_structure + STRUCTURE_TYPE_BLOCK, + /* Execute a loop, which is identified by an index. */ + STRUCTURE_TYPE_LOOP, ++ /* Execute a selection construct. */ ++ STRUCTURE_TYPE_SELECTION, + /* Execute a `return' or a (possibly) multilevel `break' or + * `continue', targeting a loop by its index. If `condition' + * is non-NULL, then the jump is conditional (this is +@@ -3065,6 +3067,13 @@ struct vsir_cfg_structure + unsigned idx; + } loop; + struct ++ { ++ struct vkd3d_shader_src_param *condition; ++ struct vsir_cfg_structure_list if_body; ++ struct vsir_cfg_structure_list else_body; ++ bool invert_condition; ++ } selection; ++ struct + { + enum vsir_cfg_jump_type + { +@@ -3110,6 +3119,20 @@ static struct vsir_cfg_structure *vsir_cfg_structure_list_append(struct vsir_cfg + return ret; + } + ++static enum vkd3d_result vsir_cfg_structure_list_append_from_region(struct vsir_cfg_structure_list *list, ++ struct vsir_cfg_structure *begin, size_t size) ++{ ++ if (!vkd3d_array_reserve((void **)&list->structures, &list->capacity, list->count + size, ++ sizeof(*list->structures))) ++ return VKD3D_ERROR_OUT_OF_MEMORY; ++ ++ memcpy(&list->structures[list->count], begin, size * sizeof(*begin)); ++ ++ list->count += size; ++ ++ return VKD3D_OK; ++} ++ + static void vsir_cfg_structure_init(struct vsir_cfg_structure *structure, enum vsir_cfg_structure_type type) + { + memset(structure, 0, sizeof(*structure)); +@@ -3118,8 +3141,20 @@ static void vsir_cfg_structure_init(struct vsir_cfg_structure *structure, enum v + + static void vsir_cfg_structure_cleanup(struct vsir_cfg_structure *structure) + { +- if (structure->type == STRUCTURE_TYPE_LOOP) +- vsir_cfg_structure_list_cleanup(&structure->u.loop.body); ++ switch (structure->type) ++ { ++ case STRUCTURE_TYPE_LOOP: ++ vsir_cfg_structure_list_cleanup(&structure->u.loop.body); ++ break; ++ ++ case STRUCTURE_TYPE_SELECTION: ++ vsir_cfg_structure_list_cleanup(&structure->u.selection.if_body); ++ vsir_cfg_structure_list_cleanup(&structure->u.selection.else_body); ++ break; ++ ++ default: ++ break; ++ } + } + + struct vsir_cfg +@@ -3295,6 +3330,25 @@ static void vsir_cfg_structure_dump(struct vsir_cfg *cfg, struct vsir_cfg_struct + TRACE("%s} # %u\n", cfg->debug_buffer.buffer, structure->u.loop.idx); + break; + ++ case STRUCTURE_TYPE_SELECTION: ++ TRACE("%sif {\n", cfg->debug_buffer.buffer); ++ ++ vsir_cfg_structure_list_dump(cfg, &structure->u.selection.if_body); ++ ++ if (structure->u.selection.else_body.count == 0) ++ { ++ TRACE("%s}\n", cfg->debug_buffer.buffer); ++ } ++ else ++ { ++ TRACE("%s} else {\n", cfg->debug_buffer.buffer); ++ ++ vsir_cfg_structure_list_dump(cfg, &structure->u.selection.else_body); ++ ++ TRACE("%s}\n", cfg->debug_buffer.buffer); ++ } ++ break; ++ + case STRUCTURE_TYPE_JUMP: + { + const char *type_str; +@@ -4115,11 +4169,29 @@ static enum vkd3d_result vsir_cfg_build_structured_program(struct vsir_cfg *cfg) + * next block, in which case we make sure it's the + * false branch. */ + if (action_true.jump_type == JUMP_NONE) ++ { ++ invert_condition = true; ++ } ++ else if (stack_depth >= 2) ++ { ++ struct vsir_cfg_structure_list *inner_loop_frame = stack[stack_depth - 2]; ++ struct vsir_cfg_structure *inner_loop = &inner_loop_frame->structures[inner_loop_frame->count - 1]; ++ ++ assert(inner_loop->type == STRUCTURE_TYPE_LOOP); ++ ++ /* Otherwise, if one of the branches is ++ * continueing the inner loop we're inside, ++ * make sure it's the false branch (because it ++ * will be optimized out later). */ ++ if (action_true.jump_type == JUMP_CONTINUE && action_true.target == inner_loop->u.loop.idx) ++ invert_condition = true; ++ } ++ ++ if (invert_condition) + { + struct vsir_cfg_edge_action tmp = action_true; + action_true = action_false; + action_false = tmp; +- invert_condition = true; + } + + assert(action_true.jump_type != JUMP_NONE); +@@ -4178,6 +4250,103 @@ fail: + return VKD3D_ERROR_OUT_OF_MEMORY; + } + ++static void vsir_cfg_remove_trailing_continue(struct vsir_cfg_structure_list *list, unsigned int target) ++{ ++ struct vsir_cfg_structure *last = &list->structures[list->count - 1]; ++ ++ if (last->type == STRUCTURE_TYPE_JUMP && last->u.jump.type == JUMP_CONTINUE ++ && !last->u.jump.condition && last->u.jump.target == target) ++ --list->count; ++} ++ ++static enum vkd3d_result vsir_cfg_synthesize_selections(struct vsir_cfg_structure_list *list) ++{ ++ enum vkd3d_result ret; ++ size_t i; ++ ++ for (i = 0; i < list->count; ++i) ++ { ++ struct vsir_cfg_structure *structure = &list->structures[i], new_selection, *new_jump; ++ ++ if (structure->type != STRUCTURE_TYPE_JUMP || !structure->u.jump.condition) ++ continue; ++ ++ vsir_cfg_structure_init(&new_selection, STRUCTURE_TYPE_SELECTION); ++ new_selection.u.selection.condition = structure->u.jump.condition; ++ new_selection.u.selection.invert_condition = structure->u.jump.invert_condition; ++ ++ if (!(new_jump = vsir_cfg_structure_list_append(&new_selection.u.selection.if_body, ++ STRUCTURE_TYPE_JUMP))) ++ return VKD3D_ERROR_OUT_OF_MEMORY; ++ new_jump->u.jump.type = structure->u.jump.type; ++ new_jump->u.jump.target = structure->u.jump.target; ++ ++ /* Move the rest of the structure list in the else branch ++ * rather than leaving it after the selection construct. The ++ * reason is that this is more conducive to further ++ * optimization, because all the conditional `break's appear ++ * as the last instruction of a branch of a cascade of ++ * selection constructs at the end of the structure list we're ++ * processing, instead of being buried in the middle of the ++ * structure list itself. */ ++ if ((ret = vsir_cfg_structure_list_append_from_region(&new_selection.u.selection.else_body, ++ &list->structures[i + 1], list->count - i - 1)) < 0) ++ return ret; ++ ++ *structure = new_selection; ++ list->count = i + 1; ++ ++ if ((ret = vsir_cfg_synthesize_selections(&structure->u.selection.else_body)) < 0) ++ return ret; ++ ++ break; ++ } ++ ++ return VKD3D_OK; ++} ++ ++static enum vkd3d_result vsir_cfg_optimize_recurse(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list) ++{ ++ enum vkd3d_result ret; ++ size_t i; ++ ++ for (i = 0; i < list->count; ++i) ++ { ++ struct vsir_cfg_structure *loop = &list->structures[i]; ++ struct vsir_cfg_structure_list *loop_body; ++ ++ if (loop->type != STRUCTURE_TYPE_LOOP) ++ continue; ++ ++ loop_body = &loop->u.loop.body; ++ ++ if (loop_body->count == 0) ++ continue; ++ ++ vsir_cfg_remove_trailing_continue(loop_body, loop->u.loop.idx); ++ ++ if ((ret = vsir_cfg_optimize_recurse(cfg, loop_body)) < 0) ++ return ret; ++ ++ if ((ret = vsir_cfg_synthesize_selections(loop_body)) < 0) ++ return ret; ++ } ++ ++ return VKD3D_OK; ++} ++ ++static enum vkd3d_result vsir_cfg_optimize(struct vsir_cfg *cfg) ++{ ++ enum vkd3d_result ret; ++ ++ ret = vsir_cfg_optimize_recurse(cfg, &cfg->structured_program); ++ ++ if (TRACE_ON()) ++ vsir_cfg_dump_structured_program(cfg); ++ ++ return ret; ++} ++ + static enum vkd3d_result vsir_cfg_structure_list_emit(struct vsir_cfg *cfg, + struct vsir_cfg_structure_list *list, unsigned int loop_idx) + { +@@ -4274,6 +4443,41 @@ static enum vkd3d_result vsir_cfg_structure_list_emit(struct vsir_cfg *cfg, + break; + } + ++ case STRUCTURE_TYPE_SELECTION: ++ if (!reserve_instructions(&cfg->instructions, &cfg->ins_capacity, cfg->ins_count + 1)) ++ return VKD3D_ERROR_OUT_OF_MEMORY; ++ ++ if (!vsir_instruction_init_with_params(cfg->program, &cfg->instructions[cfg->ins_count], &no_loc, ++ VKD3DSIH_IF, 0, 1)) ++ return VKD3D_ERROR_OUT_OF_MEMORY; ++ ++ cfg->instructions[cfg->ins_count].src[0] = *structure->u.selection.condition; ++ ++ if (structure->u.selection.invert_condition) ++ cfg->instructions[cfg->ins_count].flags |= VKD3D_SHADER_CONDITIONAL_OP_Z; ++ ++ ++cfg->ins_count; ++ ++ if ((ret = vsir_cfg_structure_list_emit(cfg, &structure->u.selection.if_body, loop_idx)) < 0) ++ return ret; ++ ++ if (structure->u.selection.else_body.count != 0) ++ { ++ if (!reserve_instructions(&cfg->instructions, &cfg->ins_capacity, cfg->ins_count + 1)) ++ return VKD3D_ERROR_OUT_OF_MEMORY; ++ ++ vsir_instruction_init(&cfg->instructions[cfg->ins_count++], &no_loc, VKD3DSIH_ELSE); ++ ++ if ((ret = vsir_cfg_structure_list_emit(cfg, &structure->u.selection.else_body, loop_idx)) < 0) ++ return ret; ++ } ++ ++ if (!reserve_instructions(&cfg->instructions, &cfg->ins_capacity, cfg->ins_count + 1)) ++ return VKD3D_ERROR_OUT_OF_MEMORY; ++ ++ vsir_instruction_init(&cfg->instructions[cfg->ins_count++], &no_loc, VKD3DSIH_ENDIF); ++ break; ++ + case STRUCTURE_TYPE_JUMP: + { + /* Encode the jump target as the loop index plus a bit to remember whether +@@ -5299,6 +5503,12 @@ enum vkd3d_result vsir_program_normalise(struct vsir_program *program, uint64_t + return result; + } + ++ if ((result = vsir_cfg_optimize(&cfg)) < 0) ++ { ++ vsir_cfg_cleanup(&cfg); ++ return result; ++ } ++ + if ((result = vsir_cfg_emit_structured_program(&cfg)) < 0) + { + vsir_cfg_cleanup(&cfg); +diff --git a/libs/vkd3d/libs/vkd3d/device.c b/libs/vkd3d/libs/vkd3d/device.c +index 7841a811bf7..65db8b70bfd 100644 +--- a/libs/vkd3d/libs/vkd3d/device.c ++++ b/libs/vkd3d/libs/vkd3d/device.c +@@ -2523,18 +2523,224 @@ static void vkd3d_desc_object_cache_cleanup(struct vkd3d_desc_object_cache *cach + } + } + ++/* ID3D12ShaderCacheSession */ ++struct d3d12_cache_session ++{ ++ ID3D12ShaderCacheSession ID3D12ShaderCacheSession_iface; ++ unsigned int refcount; ++ ++ struct d3d12_device *device; ++ struct vkd3d_private_store private_store; ++ D3D12_SHADER_CACHE_SESSION_DESC desc; ++}; ++ ++static inline struct d3d12_cache_session *impl_from_ID3D12ShaderCacheSession(ID3D12ShaderCacheSession *iface) ++{ ++ return CONTAINING_RECORD(iface, struct d3d12_cache_session, ID3D12ShaderCacheSession_iface); ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_cache_session_QueryInterface(ID3D12ShaderCacheSession *iface, ++ REFIID iid, void **object) ++{ ++ TRACE("iface %p, iid %s, object %p.\n", iface, debugstr_guid(iid), object); ++ ++ if (!object) ++ { ++ WARN("Output pointer is NULL, returning E_POINTER.\n"); ++ return E_POINTER; ++ } ++ ++ if (IsEqualGUID(iid, &IID_ID3D12ShaderCacheSession) ++ || IsEqualGUID(iid, &IID_ID3D12DeviceChild) ++ || IsEqualGUID(iid, &IID_ID3D12Object) ++ || IsEqualGUID(iid, &IID_IUnknown)) ++ { ++ ID3D12ShaderCacheSession_AddRef(iface); ++ *object = iface; ++ return S_OK; ++ } ++ ++ WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); ++ ++ *object = NULL; ++ return E_NOINTERFACE; ++} ++ ++static ULONG STDMETHODCALLTYPE d3d12_cache_session_AddRef(ID3D12ShaderCacheSession *iface) ++{ ++ struct d3d12_cache_session *session = impl_from_ID3D12ShaderCacheSession(iface); ++ unsigned int refcount = vkd3d_atomic_increment_u32(&session->refcount); ++ ++ TRACE("%p increasing refcount to %u.\n", session, refcount); ++ ++ return refcount; ++} ++ ++static void d3d12_cache_session_destroy(struct d3d12_cache_session *session) ++{ ++ struct d3d12_device *device = session->device; ++ ++ TRACE("Destroying cache session %p.\n", session); ++ ++ vkd3d_private_store_destroy(&session->private_store); ++ vkd3d_free(session); ++ ++ d3d12_device_release(device); ++} ++ ++static ULONG STDMETHODCALLTYPE d3d12_cache_session_Release(ID3D12ShaderCacheSession *iface) ++{ ++ struct d3d12_cache_session *session = impl_from_ID3D12ShaderCacheSession(iface); ++ unsigned int refcount = vkd3d_atomic_decrement_u32(&session->refcount); ++ ++ TRACE("%p decreasing refcount to %u.\n", session, refcount); ++ ++ if (!refcount) ++ d3d12_cache_session_destroy(session); ++ ++ return refcount; ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_cache_session_GetPrivateData(ID3D12ShaderCacheSession *iface, ++ REFGUID guid, UINT *data_size, void *data) ++{ ++ struct d3d12_cache_session *session = impl_from_ID3D12ShaderCacheSession(iface); ++ ++ TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data); ++ ++ return vkd3d_get_private_data(&session->private_store, guid, data_size, data); ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetPrivateData(ID3D12ShaderCacheSession *iface, ++ REFGUID guid, UINT data_size, const void *data) ++{ ++ struct d3d12_cache_session *session = impl_from_ID3D12ShaderCacheSession(iface); ++ ++ TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data); ++ ++ return vkd3d_set_private_data(&session->private_store, guid, data_size, data); ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetPrivateDataInterface( ++ ID3D12ShaderCacheSession *iface, REFGUID guid, const IUnknown *data) ++{ ++ struct d3d12_cache_session *session = impl_from_ID3D12ShaderCacheSession(iface); ++ ++ TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); ++ ++ return vkd3d_set_private_data_interface(&session->private_store, guid, data); ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_cache_session_SetName(ID3D12ShaderCacheSession *iface, ++ const WCHAR *name) ++{ ++ struct d3d12_cache_session *session = impl_from_ID3D12ShaderCacheSession(iface); ++ ++ TRACE("iface %p, name %s.\n", iface, debugstr_w(name, session->device->wchar_size)); ++ ++ return name ? S_OK : E_INVALIDARG; ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_cache_session_GetDevice(ID3D12ShaderCacheSession *iface, ++ REFIID iid, void **device) ++{ ++ struct d3d12_cache_session *session = impl_from_ID3D12ShaderCacheSession(iface); ++ ++ TRACE("iface %p, iid %s, device %p.\n", iface, debugstr_guid(iid), device); ++ ++ return d3d12_device_query_interface(session->device, iid, device); ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_cache_session_FindValue(ID3D12ShaderCacheSession *iface, ++ const void *key, UINT key_size, void *value, UINT *value_size) ++{ ++ FIXME("iface %p, key %p, key_size %#x, value %p, value_size %p stub!\n", ++ iface, key, key_size, value, value_size); ++ ++ return DXGI_ERROR_NOT_FOUND; ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_cache_session_StoreValue(ID3D12ShaderCacheSession *iface, ++ const void *key, UINT key_size, const void *value, UINT value_size) ++{ ++ FIXME("iface %p, key %p, key_size %#x, value %p, value_size %u stub!\n", iface, key, key_size, ++ value, value_size); ++ ++ return E_NOTIMPL; ++} ++ ++static void STDMETHODCALLTYPE d3d12_cache_session_SetDeleteOnDestroy(ID3D12ShaderCacheSession *iface) ++{ ++ FIXME("iface %p stub!\n", iface); ++} ++ ++static D3D12_SHADER_CACHE_SESSION_DESC * STDMETHODCALLTYPE d3d12_cache_session_GetDesc( ++ ID3D12ShaderCacheSession *iface, D3D12_SHADER_CACHE_SESSION_DESC *desc) ++{ ++ struct d3d12_cache_session *session = impl_from_ID3D12ShaderCacheSession(iface); ++ ++ TRACE("iface %p.\n", iface); ++ *desc = session->desc; ++ return desc; ++} ++ ++static const struct ID3D12ShaderCacheSessionVtbl d3d12_cache_session_vtbl = ++{ ++ /* IUnknown methods */ ++ d3d12_cache_session_QueryInterface, ++ d3d12_cache_session_AddRef, ++ d3d12_cache_session_Release, ++ /* ID3D12Object methods */ ++ d3d12_cache_session_GetPrivateData, ++ d3d12_cache_session_SetPrivateData, ++ d3d12_cache_session_SetPrivateDataInterface, ++ d3d12_cache_session_SetName, ++ /* ID3D12DeviceChild methods */ ++ d3d12_cache_session_GetDevice, ++ /* ID3D12ShaderCacheSession methods */ ++ d3d12_cache_session_FindValue, ++ d3d12_cache_session_StoreValue, ++ d3d12_cache_session_SetDeleteOnDestroy, ++ d3d12_cache_session_GetDesc, ++}; ++ ++static HRESULT d3d12_cache_session_init(struct d3d12_cache_session *session, ++ struct d3d12_device *device, const D3D12_SHADER_CACHE_SESSION_DESC *desc) ++{ ++ HRESULT hr; ++ ++ session->ID3D12ShaderCacheSession_iface.lpVtbl = &d3d12_cache_session_vtbl; ++ session->refcount = 1; ++ session->desc = *desc; ++ ++ if (!session->desc.MaximumValueFileSizeBytes) ++ session->desc.MaximumValueFileSizeBytes = 128 * 1024 * 1024; ++ if (!session->desc.MaximumInMemoryCacheSizeBytes) ++ session->desc.MaximumInMemoryCacheSizeBytes = 1024 * 1024; ++ if (!session->desc.MaximumInMemoryCacheEntries) ++ session->desc.MaximumInMemoryCacheEntries = 128; ++ ++ if (FAILED(hr = vkd3d_private_store_init(&session->private_store))) ++ return hr; ++ ++ d3d12_device_add_ref(session->device = device); ++ ++ return S_OK; ++} ++ + /* ID3D12Device */ +-static inline struct d3d12_device *impl_from_ID3D12Device8(ID3D12Device8 *iface) ++static inline struct d3d12_device *impl_from_ID3D12Device9(ID3D12Device9 *iface) + { +- return CONTAINING_RECORD(iface, struct d3d12_device, ID3D12Device8_iface); ++ return CONTAINING_RECORD(iface, struct d3d12_device, ID3D12Device9_iface); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_QueryInterface(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_QueryInterface(ID3D12Device9 *iface, + REFIID riid, void **object) + { + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + +- if (IsEqualGUID(riid, &IID_ID3D12Device8) ++ if (IsEqualGUID(riid, &IID_ID3D12Device9) ++ || IsEqualGUID(riid, &IID_ID3D12Device8) + || IsEqualGUID(riid, &IID_ID3D12Device7) + || IsEqualGUID(riid, &IID_ID3D12Device6) + || IsEqualGUID(riid, &IID_ID3D12Device5) +@@ -2557,9 +2763,9 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_QueryInterface(ID3D12Device8 *ifac + return E_NOINTERFACE; + } + +-static ULONG STDMETHODCALLTYPE d3d12_device_AddRef(ID3D12Device8 *iface) ++static ULONG STDMETHODCALLTYPE d3d12_device_AddRef(ID3D12Device9 *iface) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + unsigned int refcount = vkd3d_atomic_increment_u32(&device->refcount); + + TRACE("%p increasing refcount to %u.\n", device, refcount); +@@ -2589,9 +2795,9 @@ static HRESULT device_worker_stop(struct d3d12_device *device) + return S_OK; + } + +-static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device8 *iface) ++static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device9 *iface) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + unsigned int refcount = vkd3d_atomic_decrement_u32(&device->refcount); + + TRACE("%p decreasing refcount to %u.\n", device, refcount); +@@ -2628,10 +2834,10 @@ static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device8 *iface) + return refcount; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_GetPrivateData(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_GetPrivateData(ID3D12Device9 *iface, + REFGUID guid, UINT *data_size, void *data) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, guid %s, data_size %p, data %p.\n", + iface, debugstr_guid(guid), data_size, data); +@@ -2639,10 +2845,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_GetPrivateData(ID3D12Device8 *ifac + return vkd3d_get_private_data(&device->private_store, guid, data_size, data); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateData(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateData(ID3D12Device9 *iface, + REFGUID guid, UINT data_size, const void *data) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, guid %s, data_size %u, data %p.\n", + iface, debugstr_guid(guid), data_size, data); +@@ -2650,19 +2856,19 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateData(ID3D12Device8 *ifac + return vkd3d_set_private_data(&device->private_store, guid, data_size, data); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateDataInterface(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_SetPrivateDataInterface(ID3D12Device9 *iface, + REFGUID guid, const IUnknown *data) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); + + return vkd3d_set_private_data_interface(&device->private_store, guid, data); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_SetName(ID3D12Device8 *iface, const WCHAR *name) ++static HRESULT STDMETHODCALLTYPE d3d12_device_SetName(ID3D12Device9 *iface, const WCHAR *name) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_w(name, device->wchar_size)); + +@@ -2670,17 +2876,17 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_SetName(ID3D12Device8 *iface, cons + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT, name); + } + +-static UINT STDMETHODCALLTYPE d3d12_device_GetNodeCount(ID3D12Device8 *iface) ++static UINT STDMETHODCALLTYPE d3d12_device_GetNodeCount(ID3D12Device9 *iface) + { + TRACE("iface %p.\n", iface); + + return 1; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandQueue(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandQueue(ID3D12Device9 *iface, + const D3D12_COMMAND_QUEUE_DESC *desc, REFIID riid, void **command_queue) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_command_queue *object; + HRESULT hr; + +@@ -2694,10 +2900,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandQueue(ID3D12Device8 * + riid, command_queue); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandAllocator(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandAllocator(ID3D12Device9 *iface, + D3D12_COMMAND_LIST_TYPE type, REFIID riid, void **command_allocator) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_command_allocator *object; + HRESULT hr; + +@@ -2711,10 +2917,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandAllocator(ID3D12Devic + riid, command_allocator); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateGraphicsPipelineState(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateGraphicsPipelineState(ID3D12Device9 *iface, + const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc, REFIID riid, void **pipeline_state) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_pipeline_state *object; + HRESULT hr; + +@@ -2728,10 +2934,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateGraphicsPipelineState(ID3D12 + &IID_ID3D12PipelineState, riid, pipeline_state); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateComputePipelineState(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateComputePipelineState(ID3D12Device9 *iface, + const D3D12_COMPUTE_PIPELINE_STATE_DESC *desc, REFIID riid, void **pipeline_state) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_pipeline_state *object; + HRESULT hr; + +@@ -2745,11 +2951,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateComputePipelineState(ID3D12D + &IID_ID3D12PipelineState, riid, pipeline_state); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList(ID3D12Device9 *iface, + UINT node_mask, D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator *command_allocator, + ID3D12PipelineState *initial_pipeline_state, REFIID riid, void **command_list) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_command_list *object; + HRESULT hr; + +@@ -2872,10 +3078,10 @@ bool d3d12_device_is_uma(struct d3d12_device *device, bool *coherent) + return true; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device9 *iface, + D3D12_FEATURE feature, void *feature_data, UINT feature_data_size) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, feature %#x, feature_data %p, feature_data_size %u.\n", + iface, feature, feature_data, feature_data_size); +@@ -3547,10 +3753,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device8 + } + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateDescriptorHeap(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateDescriptorHeap(ID3D12Device9 *iface, + const D3D12_DESCRIPTOR_HEAP_DESC *desc, REFIID riid, void **descriptor_heap) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_descriptor_heap *object; + HRESULT hr; + +@@ -3564,7 +3770,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateDescriptorHeap(ID3D12Device8 + &IID_ID3D12DescriptorHeap, riid, descriptor_heap); + } + +-static UINT STDMETHODCALLTYPE d3d12_device_GetDescriptorHandleIncrementSize(ID3D12Device8 *iface, ++static UINT STDMETHODCALLTYPE d3d12_device_GetDescriptorHandleIncrementSize(ID3D12Device9 *iface, + D3D12_DESCRIPTOR_HEAP_TYPE descriptor_heap_type) + { + TRACE("iface %p, descriptor_heap_type %#x.\n", iface, descriptor_heap_type); +@@ -3587,11 +3793,11 @@ static UINT STDMETHODCALLTYPE d3d12_device_GetDescriptorHandleIncrementSize(ID3D + } + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature(ID3D12Device9 *iface, + UINT node_mask, const void *bytecode, SIZE_T bytecode_length, + REFIID riid, void **root_signature) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_root_signature *object; + HRESULT hr; + +@@ -3607,10 +3813,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateRootSignature(ID3D12Device8 + &IID_ID3D12RootSignature, riid, root_signature); + } + +-static void STDMETHODCALLTYPE d3d12_device_CreateConstantBufferView(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CreateConstantBufferView(ID3D12Device9 *iface, + const D3D12_CONSTANT_BUFFER_VIEW_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_desc tmp = {0}; + + TRACE("iface %p, desc %p, descriptor %s.\n", iface, desc, debug_cpu_handle(descriptor)); +@@ -3619,11 +3825,11 @@ static void STDMETHODCALLTYPE d3d12_device_CreateConstantBufferView(ID3D12Device + d3d12_desc_write_atomic(d3d12_desc_from_cpu_handle(descriptor), &tmp, device); + } + +-static void STDMETHODCALLTYPE d3d12_device_CreateShaderResourceView(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CreateShaderResourceView(ID3D12Device9 *iface, + ID3D12Resource *resource, const D3D12_SHADER_RESOURCE_VIEW_DESC *desc, + D3D12_CPU_DESCRIPTOR_HANDLE descriptor) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_desc tmp = {0}; + + TRACE("iface %p, resource %p, desc %p, descriptor %s.\n", +@@ -3633,11 +3839,11 @@ static void STDMETHODCALLTYPE d3d12_device_CreateShaderResourceView(ID3D12Device + d3d12_desc_write_atomic(d3d12_desc_from_cpu_handle(descriptor), &tmp, device); + } + +-static void STDMETHODCALLTYPE d3d12_device_CreateUnorderedAccessView(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CreateUnorderedAccessView(ID3D12Device9 *iface, + ID3D12Resource *resource, ID3D12Resource *counter_resource, + const D3D12_UNORDERED_ACCESS_VIEW_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_desc tmp = {0}; + + TRACE("iface %p, resource %p, counter_resource %p, desc %p, descriptor %s.\n", +@@ -3648,7 +3854,7 @@ static void STDMETHODCALLTYPE d3d12_device_CreateUnorderedAccessView(ID3D12Devic + d3d12_desc_write_atomic(d3d12_desc_from_cpu_handle(descriptor), &tmp, device); + } + +-static void STDMETHODCALLTYPE d3d12_device_CreateRenderTargetView(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CreateRenderTargetView(ID3D12Device9 *iface, + ID3D12Resource *resource, const D3D12_RENDER_TARGET_VIEW_DESC *desc, + D3D12_CPU_DESCRIPTOR_HANDLE descriptor) + { +@@ -3656,10 +3862,10 @@ static void STDMETHODCALLTYPE d3d12_device_CreateRenderTargetView(ID3D12Device8 + iface, resource, desc, debug_cpu_handle(descriptor)); + + d3d12_rtv_desc_create_rtv(d3d12_rtv_desc_from_cpu_handle(descriptor), +- impl_from_ID3D12Device8(iface), unsafe_impl_from_ID3D12Resource(resource), desc); ++ impl_from_ID3D12Device9(iface), unsafe_impl_from_ID3D12Resource(resource), desc); + } + +-static void STDMETHODCALLTYPE d3d12_device_CreateDepthStencilView(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CreateDepthStencilView(ID3D12Device9 *iface, + ID3D12Resource *resource, const D3D12_DEPTH_STENCIL_VIEW_DESC *desc, + D3D12_CPU_DESCRIPTOR_HANDLE descriptor) + { +@@ -3667,13 +3873,13 @@ static void STDMETHODCALLTYPE d3d12_device_CreateDepthStencilView(ID3D12Device8 + iface, resource, desc, debug_cpu_handle(descriptor)); + + d3d12_dsv_desc_create_dsv(d3d12_dsv_desc_from_cpu_handle(descriptor), +- impl_from_ID3D12Device8(iface), unsafe_impl_from_ID3D12Resource(resource), desc); ++ impl_from_ID3D12Device9(iface), unsafe_impl_from_ID3D12Resource(resource), desc); + } + +-static void STDMETHODCALLTYPE d3d12_device_CreateSampler(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CreateSampler(ID3D12Device9 *iface, + const D3D12_SAMPLER_DESC *desc, D3D12_CPU_DESCRIPTOR_HANDLE descriptor) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_desc tmp = {0}; + + TRACE("iface %p, desc %p, descriptor %s.\n", iface, desc, debug_cpu_handle(descriptor)); +@@ -3682,14 +3888,14 @@ static void STDMETHODCALLTYPE d3d12_device_CreateSampler(ID3D12Device8 *iface, + d3d12_desc_write_atomic(d3d12_desc_from_cpu_handle(descriptor), &tmp, device); + } + +-static void STDMETHODCALLTYPE d3d12_device_CopyDescriptors(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CopyDescriptors(ID3D12Device9 *iface, + UINT dst_descriptor_range_count, const D3D12_CPU_DESCRIPTOR_HANDLE *dst_descriptor_range_offsets, + const UINT *dst_descriptor_range_sizes, + UINT src_descriptor_range_count, const D3D12_CPU_DESCRIPTOR_HANDLE *src_descriptor_range_offsets, + const UINT *src_descriptor_range_sizes, + D3D12_DESCRIPTOR_HEAP_TYPE descriptor_heap_type) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + unsigned int dst_range_idx, dst_idx, src_range_idx, src_idx; + unsigned int dst_range_size, src_range_size; + struct d3d12_descriptor_heap *dst_heap; +@@ -3745,7 +3951,7 @@ static void STDMETHODCALLTYPE d3d12_device_CopyDescriptors(ID3D12Device8 *iface, + } + } + +-static void STDMETHODCALLTYPE d3d12_device_CopyDescriptorsSimple(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CopyDescriptorsSimple(ID3D12Device9 *iface, + UINT descriptor_count, const D3D12_CPU_DESCRIPTOR_HANDLE dst_descriptor_range_offset, + const D3D12_CPU_DESCRIPTOR_HANDLE src_descriptor_range_offset, + D3D12_DESCRIPTOR_HEAP_TYPE descriptor_heap_type) +@@ -3876,10 +4082,10 @@ static void d3d12_device_get_resource_allocation_info(struct d3d12_device *devic + } + + static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo( +- ID3D12Device8 *iface, D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask, ++ ID3D12Device9 *iface, D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask, + UINT count, const D3D12_RESOURCE_DESC *resource_descs) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p.\n", + iface, info, visible_mask, count, resource_descs); +@@ -3891,10 +4097,10 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour + return info; + } + +-static D3D12_HEAP_PROPERTIES * STDMETHODCALLTYPE d3d12_device_GetCustomHeapProperties(ID3D12Device8 *iface, ++static D3D12_HEAP_PROPERTIES * STDMETHODCALLTYPE d3d12_device_GetCustomHeapProperties(ID3D12Device9 *iface, + D3D12_HEAP_PROPERTIES *heap_properties, UINT node_mask, D3D12_HEAP_TYPE heap_type) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + bool coherent; + + TRACE("iface %p, heap_properties %p, node_mask 0x%08x, heap_type %#x.\n", +@@ -3934,12 +4140,12 @@ static D3D12_HEAP_PROPERTIES * STDMETHODCALLTYPE d3d12_device_GetCustomHeapPrope + return heap_properties; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource(ID3D12Device9 *iface, + const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, + const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, + const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + D3D12_RESOURCE_DESC1 resource_desc; + struct d3d12_resource *object; + HRESULT hr; +@@ -3961,10 +4167,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource(ID3D12Devi + return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap(ID3D12Device9 *iface, + const D3D12_HEAP_DESC *desc, REFIID iid, void **heap) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_heap *object; + HRESULT hr; + +@@ -3980,12 +4186,12 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap(ID3D12Device8 *iface, + return return_interface(&object->ID3D12Heap_iface, &IID_ID3D12Heap, iid, heap); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource(ID3D12Device9 *iface, + ID3D12Heap *heap, UINT64 heap_offset, + const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, + const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + D3D12_RESOURCE_DESC1 resource_desc; + struct d3d12_heap *heap_object; + struct d3d12_resource *object; +@@ -4006,11 +4212,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource(ID3D12Device8 + return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource(ID3D12Device9 *iface, + const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, + const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + D3D12_RESOURCE_DESC1 resource_desc; + struct d3d12_resource *object; + HRESULT hr; +@@ -4027,11 +4233,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource(ID3D12Devic + return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateSharedHandle(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateSharedHandle(ID3D12Device9 *iface, + ID3D12DeviceChild *object, const SECURITY_ATTRIBUTES *attributes, DWORD access, + const WCHAR *name, HANDLE *handle) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + FIXME("iface %p, object %p, attributes %p, access %#x, name %s, handle %p stub!\n", + iface, object, attributes, (uint32_t)access, debugstr_w(name, device->wchar_size), handle); +@@ -4039,7 +4245,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateSharedHandle(ID3D12Device8 * + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandle(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandle(ID3D12Device9 *iface, + HANDLE handle, REFIID riid, void **object) + { + FIXME("iface %p, handle %p, riid %s, object %p stub!\n", +@@ -4048,10 +4254,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandle(ID3D12Device8 *if + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandleByName(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandleByName(ID3D12Device9 *iface, + const WCHAR *name, DWORD access, HANDLE *handle) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + FIXME("iface %p, name %s, access %#x, handle %p stub!\n", + iface, debugstr_w(name, device->wchar_size), (uint32_t)access, handle); +@@ -4059,7 +4265,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandleByName(ID3D12Devic + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_MakeResident(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_MakeResident(ID3D12Device9 *iface, + UINT object_count, ID3D12Pageable * const *objects) + { + ID3D12Fence *fence; +@@ -4067,17 +4273,17 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_MakeResident(ID3D12Device8 *iface, + + TRACE("iface %p, object_count %u, objects %p.\n", iface, object_count, objects); + +- if (FAILED(hr = ID3D12Device8_CreateFence(iface, 0, 0, &IID_ID3D12Fence, (void **)&fence))) ++ if (FAILED(hr = ID3D12Device9_CreateFence(iface, 0, 0, &IID_ID3D12Fence, (void **)&fence))) + return hr; + +- hr = ID3D12Device8_EnqueueMakeResident(iface, 0, object_count, objects, fence, 1); ++ hr = ID3D12Device9_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(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_Evict(ID3D12Device9 *iface, + UINT object_count, ID3D12Pageable * const *objects) + { + FIXME_ONCE("iface %p, object_count %u, objects %p stub!\n", +@@ -4086,10 +4292,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_Evict(ID3D12Device8 *iface, + return S_OK; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateFence(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateFence(ID3D12Device9 *iface, + UINT64 initial_value, D3D12_FENCE_FLAGS flags, REFIID riid, void **fence) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_fence *object; + HRESULT hr; + +@@ -4102,9 +4308,9 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateFence(ID3D12Device8 *iface, + return return_interface(&object->ID3D12Fence1_iface, &IID_ID3D12Fence1, riid, fence); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_GetDeviceRemovedReason(ID3D12Device8 *iface) ++static HRESULT STDMETHODCALLTYPE d3d12_device_GetDeviceRemovedReason(ID3D12Device9 *iface) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p.\n", iface); + +@@ -4189,12 +4395,12 @@ static void d3d12_device_get_copyable_footprints(struct d3d12_device *device, + *total_bytes = total; + } + +-static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device9 *iface, + const D3D12_RESOURCE_DESC *desc, UINT first_sub_resource, UINT sub_resource_count, + UINT64 base_offset, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *layouts, + UINT *row_counts, UINT64 *row_sizes, UINT64 *total_bytes) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + D3D12_RESOURCE_DESC1 resource_desc; + + TRACE("iface %p, desc %p, first_sub_resource %u, sub_resource_count %u, base_offset %#"PRIx64", " +@@ -4208,10 +4414,10 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device8 * + base_offset, layouts, row_counts, row_sizes, total_bytes); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateQueryHeap(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateQueryHeap(ID3D12Device9 *iface, + const D3D12_QUERY_HEAP_DESC *desc, REFIID iid, void **heap) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_query_heap *object; + HRESULT hr; + +@@ -4224,18 +4430,18 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateQueryHeap(ID3D12Device8 *ifa + return return_interface(&object->ID3D12QueryHeap_iface, &IID_ID3D12QueryHeap, iid, heap); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_SetStablePowerState(ID3D12Device8 *iface, BOOL enable) ++static HRESULT STDMETHODCALLTYPE d3d12_device_SetStablePowerState(ID3D12Device9 *iface, BOOL enable) + { + FIXME("iface %p, enable %#x stub!\n", iface, enable); + + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandSignature(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandSignature(ID3D12Device9 *iface, + const D3D12_COMMAND_SIGNATURE_DESC *desc, ID3D12RootSignature *root_signature, + REFIID iid, void **command_signature) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_command_signature *object; + HRESULT hr; + +@@ -4249,14 +4455,14 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandSignature(ID3D12Devic + &IID_ID3D12CommandSignature, iid, command_signature); + } + +-static void STDMETHODCALLTYPE d3d12_device_GetResourceTiling(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_GetResourceTiling(ID3D12Device9 *iface, + ID3D12Resource *resource, UINT *total_tile_count, + D3D12_PACKED_MIP_INFO *packed_mip_info, D3D12_TILE_SHAPE *standard_tile_shape, + UINT *sub_resource_tiling_count, UINT first_sub_resource_tiling, + D3D12_SUBRESOURCE_TILING *sub_resource_tilings) + { + const struct d3d12_resource *resource_impl = impl_from_ID3D12Resource(resource); +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, resource %p, total_tile_count %p, packed_mip_info %p, " + "standard_title_shape %p, sub_resource_tiling_count %p, " +@@ -4269,9 +4475,9 @@ static void STDMETHODCALLTYPE d3d12_device_GetResourceTiling(ID3D12Device8 *ifac + sub_resource_tiling_count, first_sub_resource_tiling, sub_resource_tilings); + } + +-static LUID * STDMETHODCALLTYPE d3d12_device_GetAdapterLuid(ID3D12Device8 *iface, LUID *luid) ++static LUID * STDMETHODCALLTYPE d3d12_device_GetAdapterLuid(ID3D12Device9 *iface, LUID *luid) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, luid %p.\n", iface, luid); + +@@ -4280,7 +4486,7 @@ static LUID * STDMETHODCALLTYPE d3d12_device_GetAdapterLuid(ID3D12Device8 *iface + return luid; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineLibrary(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineLibrary(ID3D12Device9 *iface, + const void *blob, SIZE_T blob_size, REFIID iid, void **lib) + { + FIXME("iface %p, blob %p, blob_size %"PRIuPTR", iid %s, lib %p stub!\n", +@@ -4289,7 +4495,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineLibrary(ID3D12Device + return DXGI_ERROR_UNSUPPORTED; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_SetEventOnMultipleFenceCompletion(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_SetEventOnMultipleFenceCompletion(ID3D12Device9 *iface, + ID3D12Fence *const *fences, const UINT64 *values, UINT fence_count, + D3D12_MULTIPLE_FENCE_WAIT_FLAGS flags, HANDLE event) + { +@@ -4299,7 +4505,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_SetEventOnMultipleFenceCompletion( + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_SetResidencyPriority(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_SetResidencyPriority(ID3D12Device9 *iface, + UINT object_count, ID3D12Pageable *const *objects, const D3D12_RESIDENCY_PRIORITY *priorities) + { + FIXME_ONCE("iface %p, object_count %u, objects %p, priorities %p stub!\n", iface, object_count, objects, priorities); +@@ -4307,10 +4513,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_SetResidencyPriority(ID3D12Device8 + return S_OK; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineState(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineState(ID3D12Device9 *iface, + const D3D12_PIPELINE_STATE_STREAM_DESC *desc, REFIID iid, void **pipeline_state) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_pipeline_state *object; + HRESULT hr; + +@@ -4322,7 +4528,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePipelineState(ID3D12Device8 + return return_interface(&object->ID3D12PipelineState_iface, &IID_ID3D12PipelineState, iid, pipeline_state); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromAddress(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromAddress(ID3D12Device9 *iface, + const void *address, REFIID iid, void **heap) + { + FIXME("iface %p, address %p, iid %s, heap %p stub!\n", iface, address, debugstr_guid(iid), heap); +@@ -4330,7 +4536,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromAddress(ID3D12 + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromFileMapping(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromFileMapping(ID3D12Device9 *iface, + HANDLE file_mapping, REFIID iid, void **heap) + { + FIXME("iface %p, file_mapping %p, iid %s, heap %p stub!\n", iface, file_mapping, debugstr_guid(iid), heap); +@@ -4338,7 +4544,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_OpenExistingHeapFromFileMapping(ID + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_EnqueueMakeResident(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_EnqueueMakeResident(ID3D12Device9 *iface, + D3D12_RESIDENCY_FLAGS flags, UINT num_objects, ID3D12Pageable *const *objects, + ID3D12Fence *fence, UINT64 fence_value) + { +@@ -4349,7 +4555,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_EnqueueMakeResident(ID3D12Device8 + return S_OK; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList1(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList1(ID3D12Device9 *iface, + UINT node_mask, D3D12_COMMAND_LIST_TYPE type, D3D12_COMMAND_LIST_FLAGS flags, + REFIID iid, void **command_list) + { +@@ -4359,7 +4565,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList1(ID3D12Device8 * + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession(ID3D12Device9 *iface, + const D3D12_PROTECTED_RESOURCE_SESSION_DESC *desc, REFIID iid, void **session) + { + FIXME("iface %p, desc %p, iid %s, session %p stub!\n", iface, desc, debugstr_guid(iid), session); +@@ -4367,13 +4573,13 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession(ID3 + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource1(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource1(ID3D12Device9 *iface, + const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, + const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, + const D3D12_CLEAR_VALUE *optimized_clear_value, + ID3D12ProtectedResourceSession *protected_session, REFIID iid, void **resource) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + D3D12_RESOURCE_DESC1 resource_desc; + struct d3d12_resource *object; + HRESULT hr; +@@ -4395,11 +4601,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource1(ID3D12Dev + return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap1(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap1(ID3D12Device9 *iface, + const D3D12_HEAP_DESC *desc, ID3D12ProtectedResourceSession *protected_session, + REFIID iid, void **heap) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_heap *object; + HRESULT hr; + +@@ -4415,7 +4621,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap1(ID3D12Device8 *iface, + return return_interface(&object->ID3D12Heap_iface, &IID_ID3D12Heap, iid, heap); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource1(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource1(ID3D12Device9 *iface, + const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, + const D3D12_CLEAR_VALUE *optimized_clear_value, + ID3D12ProtectedResourceSession *protected_session, REFIID iid, void **resource) +@@ -4429,11 +4635,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource1(ID3D12Devi + } + + static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo1( +- ID3D12Device8 *iface, D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask, ++ ID3D12Device9 *iface, D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask, + UINT count, const D3D12_RESOURCE_DESC *resource_descs, + D3D12_RESOURCE_ALLOCATION_INFO1 *info1) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p, info1 %p.\n", + iface, info, visible_mask, count, resource_descs, info1); +@@ -4445,7 +4651,7 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour + return info; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateLifetimeTracker(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateLifetimeTracker(ID3D12Device9 *iface, + ID3D12LifetimeOwner *owner, REFIID iid, void **tracker) + { + FIXME("iface %p, owner %p, iid %s, tracker %p stub!\n", iface, owner, debugstr_guid(iid), tracker); +@@ -4453,12 +4659,12 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateLifetimeTracker(ID3D12Device + return E_NOTIMPL; + } + +-static void STDMETHODCALLTYPE d3d12_device_RemoveDevice(ID3D12Device8 *iface) ++static void STDMETHODCALLTYPE d3d12_device_RemoveDevice(ID3D12Device9 *iface) + { + FIXME("iface %p stub!\n", iface); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommands(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommands(ID3D12Device9 *iface, + UINT *num_meta_commands, D3D12_META_COMMAND_DESC *command_desc) + { + FIXME("iface %p, num_meta_commands %p, command_desc %p stub!\n", iface, +@@ -4467,7 +4673,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommands(ID3D12Device + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommandParameters(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommandParameters(ID3D12Device9 *iface, + REFGUID command_id, D3D12_META_COMMAND_PARAMETER_STAGE stage, + UINT *size_in_bytes, UINT *parameter_count, + D3D12_META_COMMAND_PARAMETER_DESC *parameter_desc) +@@ -4479,7 +4685,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_EnumerateMetaCommandParameters(ID3 + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateMetaCommand(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateMetaCommand(ID3D12Device9 *iface, + REFGUID command_id, UINT node_mask, const void *parameters_data, + SIZE_T data_size_in_bytes, REFIID iid, void **meta_command) + { +@@ -4491,7 +4697,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateMetaCommand(ID3D12Device8 *i + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateStateObject(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateStateObject(ID3D12Device9 *iface, + const D3D12_STATE_OBJECT_DESC *desc, REFIID iid, void **state_object) + { + FIXME("iface %p, desc %p, iid %s, state_object %p stub!\n", iface, desc, debugstr_guid(iid), state_object); +@@ -4499,14 +4705,14 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateStateObject(ID3D12Device8 *i + return E_NOTIMPL; + } + +-static void STDMETHODCALLTYPE d3d12_device_GetRaytracingAccelerationStructurePrebuildInfo(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_GetRaytracingAccelerationStructurePrebuildInfo(ID3D12Device9 *iface, + const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_INPUTS *desc, + D3D12_RAYTRACING_ACCELERATION_STRUCTURE_PREBUILD_INFO *info) + { + FIXME("iface %p, desc %p, info %p stub!\n", iface, desc, info); + } + +-static D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS STDMETHODCALLTYPE d3d12_device_CheckDriverMatchingIdentifier(ID3D12Device8 *iface, ++static D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS STDMETHODCALLTYPE d3d12_device_CheckDriverMatchingIdentifier(ID3D12Device9 *iface, + D3D12_SERIALIZED_DATA_TYPE data_type, const D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER *identifier) + { + FIXME("iface %p, data_type %u, identifier %p stub!\n", iface, data_type, identifier); +@@ -4514,7 +4720,7 @@ static D3D12_DRIVER_MATCHING_IDENTIFIER_STATUS STDMETHODCALLTYPE d3d12_device_Ch + return D3D12_DRIVER_MATCHING_IDENTIFIER_UNRECOGNIZED; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_SetBackgroundProcessingMode(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_SetBackgroundProcessingMode(ID3D12Device9 *iface, + D3D12_BACKGROUND_PROCESSING_MODE mode, D3D12_MEASUREMENTS_ACTION action, HANDLE event, + BOOL *further_measurements_desired) + { +@@ -4524,7 +4730,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_SetBackgroundProcessingMode(ID3D12 + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_AddToStateObject(ID3D12Device8 *iface, ++ ++static HRESULT STDMETHODCALLTYPE d3d12_device_AddToStateObject(ID3D12Device9 *iface, + const D3D12_STATE_OBJECT_DESC *addition, ID3D12StateObject *state_object_to_grow_from, + REFIID riid, void **new_state_object) + { +@@ -4534,7 +4741,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_AddToStateObject(ID3D12Device8 *if + return E_NOTIMPL; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession1(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession1(ID3D12Device9 *iface, + const D3D12_PROTECTED_RESOURCE_SESSION_DESC1 *desc, REFIID riid, void **session) + { + FIXME("iface %p, desc %p, riid %s, session %p stub!\n", iface, desc, debugstr_guid(riid), session); +@@ -4542,11 +4749,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession1(ID + return E_NOTIMPL; + } + +-static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo2(ID3D12Device8 *iface, ++static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo2(ID3D12Device9 *iface, + D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask, UINT count, + const D3D12_RESOURCE_DESC1 *resource_descs, D3D12_RESOURCE_ALLOCATION_INFO1 *info1) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p, info1 %p.\n", + iface, info, visible_mask, count, resource_descs, info1); +@@ -4558,12 +4765,12 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour + return info; + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource2(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource2(ID3D12Device9 *iface, + const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC1 *desc, + D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, + ID3D12ProtectedResourceSession *protected_session, REFIID iid, void **resource) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_resource *object; + HRESULT hr; + +@@ -4582,12 +4789,12 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource2(ID3D12Dev + return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource); + } + +-static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource1(ID3D12Device8 *iface, ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource1(ID3D12Device9 *iface, + ID3D12Heap *heap, UINT64 heap_offset, const D3D12_RESOURCE_DESC1 *resource_desc, + D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, + REFIID iid, void **resource) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + struct d3d12_heap *heap_object; + struct d3d12_resource *object; + HRESULT hr; +@@ -4606,19 +4813,19 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource1(ID3D12Device + return return_interface(&object->ID3D12Resource2_iface, &IID_ID3D12Resource2, iid, resource); + } + +-static void STDMETHODCALLTYPE d3d12_device_CreateSamplerFeedbackUnorderedAccessView(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_CreateSamplerFeedbackUnorderedAccessView(ID3D12Device9 *iface, + ID3D12Resource *target_resource, ID3D12Resource *feedback_resource, D3D12_CPU_DESCRIPTOR_HANDLE descriptor) + { + FIXME("iface %p, target_resource %p, feedback_resource %p, descriptor %s stub!\n", + iface, target_resource, feedback_resource, debug_cpu_handle(descriptor)); + } + +-static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints1(ID3D12Device8 *iface, ++static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints1(ID3D12Device9 *iface, + const D3D12_RESOURCE_DESC1 *desc, UINT first_sub_resource, UINT sub_resource_count, + UINT64 base_offset, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *layouts, UINT *row_counts, + UINT64 *row_sizes, UINT64 *total_bytes) + { +- struct d3d12_device *device = impl_from_ID3D12Device8(iface); ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); + + TRACE("iface %p, desc %p, first_sub_resource %u, sub_resource_count %u, base_offset %#"PRIx64", " + "layouts %p, row_counts %p, row_sizes %p, total_bytes %p.\n", +@@ -4629,7 +4836,79 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints1(ID3D12Device8 + base_offset, layouts, row_counts, row_sizes, total_bytes); + } + +-static const struct ID3D12Device8Vtbl d3d12_device_vtbl = ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateShaderCacheSession(ID3D12Device9 *iface, ++ const D3D12_SHADER_CACHE_SESSION_DESC *desc, REFIID iid, void **session) ++{ ++ struct d3d12_device *device = impl_from_ID3D12Device9(iface); ++ struct d3d12_cache_session *object; ++ static const GUID guid_null = {0}; ++ HRESULT hr; ++ ++ static const UINT valid_flags = D3D12_SHADER_CACHE_FLAG_DRIVER_VERSIONED ++ | D3D12_SHADER_CACHE_FLAG_USE_WORKING_DIR; ++ ++ TRACE("iface %p, desc %p, iid %s, session %p.\n", iface, desc, debugstr_guid(iid), session); ++ ++ if (!desc || !memcmp(&desc->Identifier, &guid_null, sizeof(desc->Identifier))) ++ { ++ WARN("No description or identifier, returning E_INVALIDARG.\n"); ++ return E_INVALIDARG; ++ } ++ if (desc->MaximumValueFileSizeBytes > 1024 * 1024 * 1024) ++ { ++ WARN("Requested size is larger than 1GiB, returning E_INVALIDARG.\n"); ++ return E_INVALIDARG; ++ } ++ if (desc->Flags & ~valid_flags) ++ { ++ WARN("Invalid flags %#x, returning E_INVALIDARG.\n", desc->Flags); ++ return E_INVALIDARG; ++ } ++ if (desc->Mode != D3D12_SHADER_CACHE_MODE_MEMORY && desc->Mode != D3D12_SHADER_CACHE_MODE_DISK) ++ { ++ WARN("Invalid mode %#x, returning E_INVALIDARG.\n", desc->Mode); ++ return E_INVALIDARG; ++ } ++ if (!session) ++ { ++ WARN("No output pointer, returning S_FALSE.\n"); ++ return S_FALSE; ++ } ++ ++ if (!(object = vkd3d_malloc(sizeof(*object)))) ++ return E_OUTOFMEMORY; ++ ++ if (FAILED(hr = d3d12_cache_session_init(object, device, desc))) ++ { ++ vkd3d_free(object); ++ return hr; ++ } ++ ++ hr = ID3D12ShaderCacheSession_QueryInterface(&object->ID3D12ShaderCacheSession_iface, iid, ++ session); ++ ID3D12ShaderCacheSession_Release(&object->ID3D12ShaderCacheSession_iface); ++ return hr; ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_device_ShaderCacheControl(ID3D12Device9 *iface, ++ D3D12_SHADER_CACHE_KIND_FLAGS kinds, D3D12_SHADER_CACHE_CONTROL_FLAGS control) ++{ ++ FIXME("iface %p, kinds %#x control %#x stub!\n", iface, kinds, control); ++ ++ return E_NOTIMPL; ++} ++ ++static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandQueue1(ID3D12Device9 *iface, ++ const D3D12_COMMAND_QUEUE_DESC *desc, REFIID creator_id, REFIID iid, ++ void **command_queue) ++{ ++ FIXME("iface %p, desc %p, creator %s, iid %s, queue %p stub!\n", iface, desc, ++ debugstr_guid(creator_id), debugstr_guid(iid), command_queue); ++ ++ return E_NOTIMPL; ++} ++ ++static const struct ID3D12Device9Vtbl d3d12_device_vtbl = + { + /* IUnknown methods */ + d3d12_device_QueryInterface, +@@ -4715,14 +4994,18 @@ static const struct ID3D12Device8Vtbl d3d12_device_vtbl = + d3d12_device_CreatePlacedResource1, + d3d12_device_CreateSamplerFeedbackUnorderedAccessView, + d3d12_device_GetCopyableFootprints1, ++ /* ID3D12Device9 methods */ ++ d3d12_device_CreateShaderCacheSession, ++ d3d12_device_ShaderCacheControl, ++ d3d12_device_CreateCommandQueue1, + }; + +-struct d3d12_device *unsafe_impl_from_ID3D12Device8(ID3D12Device8 *iface) ++struct d3d12_device *unsafe_impl_from_ID3D12Device9(ID3D12Device9 *iface) + { + if (!iface) + return NULL; + assert(iface->lpVtbl == &d3d12_device_vtbl); +- return impl_from_ID3D12Device8(iface); ++ return impl_from_ID3D12Device9(iface); + } + + static void *device_worker_main(void *arg) +@@ -4765,7 +5048,7 @@ static HRESULT d3d12_device_init(struct d3d12_device *device, + const struct vkd3d_vk_device_procs *vk_procs; + HRESULT hr; + +- device->ID3D12Device8_iface.lpVtbl = &d3d12_device_vtbl; ++ device->ID3D12Device9_iface.lpVtbl = &d3d12_device_vtbl; + device->refcount = 1; + + vkd3d_instance_incref(device->vkd3d_instance = instance); +@@ -5013,28 +5296,28 @@ HRESULT vkd3d_join_thread(struct vkd3d_instance *instance, union vkd3d_thread_ha + + IUnknown *vkd3d_get_device_parent(ID3D12Device *device) + { +- struct d3d12_device *d3d12_device = impl_from_ID3D12Device8((ID3D12Device8 *)device); ++ struct d3d12_device *d3d12_device = impl_from_ID3D12Device9((ID3D12Device9 *)device); + + return d3d12_device->parent; + } + + VkDevice vkd3d_get_vk_device(ID3D12Device *device) + { +- struct d3d12_device *d3d12_device = impl_from_ID3D12Device8((ID3D12Device8 *)device); ++ struct d3d12_device *d3d12_device = impl_from_ID3D12Device9((ID3D12Device9 *)device); + + return d3d12_device->vk_device; + } + + VkPhysicalDevice vkd3d_get_vk_physical_device(ID3D12Device *device) + { +- struct d3d12_device *d3d12_device = impl_from_ID3D12Device8((ID3D12Device8 *)device); ++ struct d3d12_device *d3d12_device = impl_from_ID3D12Device9((ID3D12Device9 *)device); + + return d3d12_device->vk_physical_device; + } + + struct vkd3d_instance *vkd3d_instance_from_device(ID3D12Device *device) + { +- struct d3d12_device *d3d12_device = impl_from_ID3D12Device8((ID3D12Device8 *)device); ++ struct d3d12_device *d3d12_device = impl_from_ID3D12Device9((ID3D12Device9 *)device); + + return d3d12_device->vkd3d_instance; + } +diff --git a/libs/vkd3d/libs/vkd3d/resource.c b/libs/vkd3d/libs/vkd3d/resource.c +index 446ef3ab0db..b83a45d0606 100644 +--- a/libs/vkd3d/libs/vkd3d/resource.c ++++ b/libs/vkd3d/libs/vkd3d/resource.c +@@ -2260,7 +2260,7 @@ HRESULT d3d12_reserved_resource_create(struct d3d12_device *device, + HRESULT vkd3d_create_image_resource(ID3D12Device *device, + const struct vkd3d_image_resource_create_info *create_info, ID3D12Resource **resource) + { +- struct d3d12_device *d3d12_device = unsafe_impl_from_ID3D12Device8((ID3D12Device8 *)device); ++ struct d3d12_device *d3d12_device = unsafe_impl_from_ID3D12Device9((ID3D12Device9 *)device); + struct d3d12_resource *object; + HRESULT hr; + +diff --git a/libs/vkd3d/libs/vkd3d/vkd3d_main.c b/libs/vkd3d/libs/vkd3d/vkd3d_main.c +index f6925d47bdf..e0345deaa0f 100644 +--- a/libs/vkd3d/libs/vkd3d/vkd3d_main.c ++++ b/libs/vkd3d/libs/vkd3d/vkd3d_main.c +@@ -71,11 +71,11 @@ HRESULT vkd3d_create_device(const struct vkd3d_device_create_info *create_info, + + if (!device) + { +- ID3D12Device_Release(&object->ID3D12Device8_iface); ++ ID3D12Device_Release(&object->ID3D12Device9_iface); + return S_FALSE; + } + +- return return_interface(&object->ID3D12Device8_iface, &IID_ID3D12Device, iid, device); ++ return return_interface(&object->ID3D12Device9_iface, &IID_ID3D12Device, iid, device); + } + + /* ID3D12RootSignatureDeserializer */ +diff --git a/libs/vkd3d/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/libs/vkd3d/vkd3d_private.h +index 39d892a6fa7..14c8eb54574 100644 +--- a/libs/vkd3d/libs/vkd3d/vkd3d_private.h ++++ b/libs/vkd3d/libs/vkd3d/vkd3d_private.h +@@ -1669,7 +1669,7 @@ struct vkd3d_desc_object_cache + /* ID3D12Device */ + struct d3d12_device + { +- ID3D12Device8 ID3D12Device8_iface; ++ ID3D12Device9 ID3D12Device9_iface; + unsigned int refcount; + + VkDevice vk_device; +@@ -1744,29 +1744,29 @@ struct vkd3d_queue *d3d12_device_get_vkd3d_queue(struct d3d12_device *device, D3 + bool d3d12_device_is_uma(struct d3d12_device *device, bool *coherent); + void d3d12_device_mark_as_removed(struct d3d12_device *device, HRESULT reason, + const char *message, ...) VKD3D_PRINTF_FUNC(3, 4); +-struct d3d12_device *unsafe_impl_from_ID3D12Device8(ID3D12Device8 *iface); ++struct d3d12_device *unsafe_impl_from_ID3D12Device9(ID3D12Device9 *iface); + HRESULT d3d12_device_add_descriptor_heap(struct d3d12_device *device, struct d3d12_descriptor_heap *heap); + void d3d12_device_remove_descriptor_heap(struct d3d12_device *device, struct d3d12_descriptor_heap *heap); + + static inline HRESULT d3d12_device_query_interface(struct d3d12_device *device, REFIID iid, void **object) + { +- return ID3D12Device8_QueryInterface(&device->ID3D12Device8_iface, iid, object); ++ return ID3D12Device9_QueryInterface(&device->ID3D12Device9_iface, iid, object); + } + + static inline ULONG d3d12_device_add_ref(struct d3d12_device *device) + { +- return ID3D12Device8_AddRef(&device->ID3D12Device8_iface); ++ return ID3D12Device9_AddRef(&device->ID3D12Device9_iface); + } + + static inline ULONG d3d12_device_release(struct d3d12_device *device) + { +- return ID3D12Device8_Release(&device->ID3D12Device8_iface); ++ return ID3D12Device9_Release(&device->ID3D12Device9_iface); + } + + static inline unsigned int d3d12_device_get_descriptor_handle_increment_size(struct d3d12_device *device, + D3D12_DESCRIPTOR_HEAP_TYPE descriptor_type) + { +- return ID3D12Device8_GetDescriptorHandleIncrementSize(&device->ID3D12Device8_iface, descriptor_type); ++ return ID3D12Device9_GetDescriptorHandleIncrementSize(&device->ID3D12Device9_iface, descriptor_type); + } + + /* utils */ +-- +2.43.0 +