mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 13:10:10 +01:00
gfxstream: vulkan: fix issue with GCC
With newer versions of libstdc++, debug builds of gfxstream
hit this assert:
0x00007ffff6ed2d60 in std::__glibcxx_assert_fail
(file=<optimized out>, line=<optimized out>, function=<optimized out>,
condition=<optimized out>)
at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/assert_fail.cc:41
std::allocator<VkDescriptorBufferInfo> >::operator[]
(this=0x555555609380, __n=0)
at /usr/include/c++/14.1.1/bits/stl_vector.h:1130
(pDescriptorSets=0x7fffffffcc30, descriptorSetCount=2,
bufferInfos=std::vector of length 1, capacity 1 = {...})
at ../guest/vulkan/gfxstream_vk_device.cpp:718
(device=0x55555562f400, descriptorWriteCount=2,
pDescriptorWrites=0x7fffffffcc30, descriptorCopyCount=0,
pDescriptorCopies=0x0)
at ../guest/vulkan/gfxstream_vk_device.cpp:746
Use resize instead of reserve + memset.
"That way the vector size would be initialized, bounds checks would
be happy, and default-init would automatically zero out POD structs
for us." -- dextero@
Reviewed-by: Aaron Ruby <aruby@blackberry.com>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:
parent
435102e266
commit
5cb32d45a8
2 changed files with 2 additions and 3 deletions
|
|
@ -392,8 +392,7 @@ class VulkanFuncTable(VulkanWrapperGenerator):
|
|||
cgen.stmt("%s = %s.size()" % (countParamName, nestedOutName))
|
||||
else:
|
||||
# Standard translation
|
||||
cgen.stmt("%s.reserve(%s)" % (nestedOutName, countParamName))
|
||||
cgen.stmt("memset(&%s[0], 0, sizeof(%s) * %s)" % (nestedOutName, member.typeName, countParamName))
|
||||
cgen.stmt("%s.resize(%s)" % (nestedOutName, countParamName))
|
||||
if not nextLoopVar:
|
||||
nextLoopVar = getNextLoopVar()
|
||||
internalArray = genInternalArray(member, countParamName, nestedOutName, inArrayName, nextLoopVar)
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ static std::vector<VkWriteDescriptorSet> transformDescriptorSetList(
|
|||
outDescriptorSet = srcDescriptorSet;
|
||||
|
||||
bufferInfos.push_back(std::vector<VkDescriptorBufferInfo>());
|
||||
bufferInfos[i].reserve(descriptorCount);
|
||||
bufferInfos[i].resize(descriptorCount);
|
||||
memset(&bufferInfos[i][0], 0, sizeof(VkDescriptorBufferInfo) * descriptorCount);
|
||||
for (uint32_t j = 0; j < descriptorCount; ++j) {
|
||||
const auto* srcBufferInfo = srcDescriptorSet.pBufferInfo;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue