Skip to content

Commit dac9956

Browse files
author
devsh
committed
fix concurrent sharing with repeat family indices
1 parent 4e48f0b commit dac9956

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

07_StagingAndMultipleQueues/main.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ class StagingAndMultipleQueuesApp final : public application_templates::BasicMul
104104

105105
void loadImages()
106106
{
107+
const core::set<uint32_t> uniqueFamilyIndices = { getTransferUpQueue()->getFamilyIndex(), getComputeQueue()->getFamilyIndex() };
108+
const std::vector<uint32_t> familyIndices(uniqueFamilyIndices.begin(),uniqueFamilyIndices.end());
109+
const bool multipleQueueFamilies = familyIndices.size()>1;
110+
107111
IAssetLoader::SAssetLoadParams lp;
108112
lp.logger = m_logger.get();
109113

@@ -161,10 +165,11 @@ class StagingAndMultipleQueuesApp final : public application_templates::BasicMul
161165
imgParams.arrayLayers = 1u;
162166
imgParams.samples = IImage::E_SAMPLE_COUNT_FLAGS::ESCF_1_BIT;
163167
imgParams.usage = asset::IImage::EUF_TRANSFER_DST_BIT | asset::IImage::EUF_SAMPLED_BIT;
164-
// constexpr uint32_t FAMILY_INDICES_CNT = 3; // TODO: test on intel integrated GPU (which allows only one queue family)
165-
std::array familyIndices = { getTransferUpQueue()->getFamilyIndex(), getComputeQueue()->getFamilyIndex() };
166-
imgParams.queueFamilyIndexCount = familyIndices.size();
167-
imgParams.queueFamilyIndices = familyIndices.data();
168+
if (multipleQueueFamilies)
169+
{
170+
imgParams.queueFamilyIndexCount = familyIndices.size();
171+
imgParams.queueFamilyIndices = familyIndices.data();
172+
}
168173
imgParams.preinitialized = false;
169174

170175
images[imageIdx] = m_device->createImage(std::move(imgParams));

0 commit comments

Comments
 (0)