Fixes crash in `wined3d_unordered_access_view_vk_clear()`.
From: Jacek Caban jacek@codeweavers.com
Fixes crash in wined3d_unordered_access_view_vk_clear(). --- dlls/winevulkan/make_vulkan | 41 +++++++++++++++++++++++++-------- dlls/winevulkan/vulkan_thunks.c | 4 ++-- 2 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 75121c8eef6..45948088fec 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -267,6 +267,25 @@ STRUCT_CHAIN_CONVERSIONS = { "VkInstanceCreateInfo": ["VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO"], }
+# Some struct members are conditionally ignored and callers are free to leave them uninitialized. +# We can't deduce that from XML, so we allow expressing it here. +MEMBER_LENGTH_EXPRESSIONS = { + "VkWriteDescriptorSet": { + "pImageInfo": + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM ? {len} : 0", + "pBufferInfo": + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC || " + + "{struct}descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC ? {len} : 0", + } +}
class Direction(Enum): """ Parameter direction: input, output, input_output. """ @@ -1129,12 +1148,16 @@ class VkVariable(object): parent = var.struct.members
len += len_str - if not len_str in parent: - return len + if len_str in parent: + var = parent[parent.index(len_str)] + if var.is_pointer(): + len = "*" + len + + if isinstance(self.parent, VkStruct) and self.parent.name in MEMBER_LENGTH_EXPRESSIONS: + exprs = MEMBER_LENGTH_EXPRESSIONS[self.parent.name] + if self.name in exprs: + len = exprs[self.name].format(struct=prefix, len=len)
- var = parent[parent.index(len_str)] - if var.is_pointer(): - len = "*" + len return len
def is_const(self): @@ -1786,12 +1809,12 @@ class VkStruct(Sequence): structextends = struct.attrib.get("structextends") structextends = structextends.split(",") if structextends else []
- members = [] + s = VkStruct(name, [], returnedonly, structextends, union=union) for member in struct.findall("member"): - vk_member = VkMember.from_xml(member, returnedonly, members) - members.append(vk_member) + vk_member = VkMember.from_xml(member, returnedonly, s) + s.members.append(vk_member)
- return VkStruct(name, members, returnedonly, structextends, union=union) + return s
@staticmethod def decouple_structs(structs): diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 6b45146fb88..d853986c9d5 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -3327,8 +3327,8 @@ static inline void convert_VkWriteDescriptorSet_win32_to_host(struct conversion_ out->dstArrayElement = in->dstArrayElement; out->descriptorCount = in->descriptorCount; out->descriptorType = in->descriptorType; - out->pImageInfo = convert_VkDescriptorImageInfo_array_win32_to_host(ctx, in->pImageInfo, in->descriptorCount); - out->pBufferInfo = convert_VkDescriptorBufferInfo_array_win32_to_host(ctx, in->pBufferInfo, in->descriptorCount); + out->pImageInfo = convert_VkDescriptorImageInfo_array_win32_to_host(ctx, in->pImageInfo, in->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER || in->descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER || in->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE || in->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE || in->descriptorType == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT || in->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM || in->descriptorType == VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM ? in->descriptorCount : 0); + out->pBufferInfo = convert_VkDescriptorBufferInfo_array_win32_to_host(ctx, in->pBufferInfo, in->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER || in->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER || in->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC || in->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC ? in->descriptorCount : 0); out->pTexelBufferView = in->pTexelBufferView; } #endif /* USE_STRUCT_CONVERSION */
From: Jacek Caban jacek@codeweavers.com
--- dlls/winevulkan/make_vulkan | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 45948088fec..3257481b746 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -1956,19 +1956,7 @@ class VkStruct(Sequence): # so that we have a chance to allocate buffers if e.needs_conversion(conv, True, Direction.OUTPUT, is_const, check_extensions=False): return True - elif not needs_output_copy and not is_const: - for m in e: - if m.name in ["sType", "pNext"]: - continue - # pointers will be handled by needs_conversion, but if we have any other non-const - # member, we may need to copy output - if not m.is_pointer() and not m.is_const(): - needs_output_copy = True - break
- # if output needs any copy and we need input conversion, then we also need output conversion - if needs_output_copy and self.needs_extensions_conversion(conv, Direction.INPUT): - return True return False
def needs_conversion(self, conv, unwrap, direction, is_const, check_extensions=True): @@ -1982,6 +1970,8 @@ class VkStruct(Sequence): if direction == Direction.OUTPUT and self.name == "VkImageCompressionControlEXT": return False
+ needs_output_copy = False + for m in self.members: if self.name == m.type: continue @@ -2011,6 +2001,15 @@ class VkStruct(Sequence): if m.needs_conversion(conv, unwrap, direction, is_const): return True
+ # pointers will be handled by needs_conversion, but if we have any other non-const + # member, we may need to copy output + if direction == Direction.OUTPUT and not m.is_pointer() and not is_const and not m.is_const(): + needs_output_copy = True + + # if output needs any copy and we need input conversion, then we also need output conversion + if needs_output_copy and self.needs_conversion(conv, unwrap, Direction.INPUT, check_extensions): + return True + return check_extensions and self.needs_extensions_conversion(conv, direction)
def needs_alloc(self, conv, unwrap):
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126135
Your paranoid android.
=== debian11 (32 bit report) ===
crypt32: cert.c:4191: Test failed: success cert.c:4192: Test failed: got 00000000 cert.c:4193: Test failed: got 00000000