@@ -39,7 +39,7 @@ Material::Material(Shader vertShader, Shader fragShader, bool isWritingDepth) :
39
39
bufferUpdates = MHArray<MHArray<UniformBufferUpdate>>(framesCount);
40
40
imageUpdates = MHArray<MHArray<UniformImageUpdate>>(framesCount);
41
41
42
- for (size_t i = 0 ; i < framesCount; i++)
42
+ for (size_t i = 0 ; i < framesCount; i++)
43
43
{
44
44
bufferUpdates.Append (MHArray<UniformBufferUpdate>(10 ));
45
45
imageUpdates.Append (MHArray<UniformImageUpdate>(MAX_TEXTURES));
@@ -96,7 +96,7 @@ Material::Material(Shader vertShader, Shader fragShader, bool isWritingDepth) :
96
96
WriteSet (slotIt.GetIndex (), slot);
97
97
}
98
98
99
- for (size_t i = 0 ; i < framesCount; i++) UpdateUniforms (bufferUpdates[i], imageUpdates[i]);
99
+ for (size_t i = 0 ; i < framesCount; i++) UpdateUniforms (bufferUpdates[i], imageUpdates[i]);
100
100
101
101
// Create Pipeline
102
102
Recreate ();
@@ -294,7 +294,7 @@ void Material::Update()
294
294
295
295
using Vulkan::Context;
296
296
297
- // Write(targetSets);
297
+ // Write(targetSets);
298
298
UpdateUniforms (targetBuffers, targetImages);
299
299
300
300
targetBuffers.Clear ();
@@ -310,7 +310,7 @@ void Material::Update(Hash::StringId id)
310
310
311
311
auto & buffersToWrite = bufferUpdates[Renderer::GetCurrentFrameIndex ()];
312
312
auto & imagesToWrite = imageUpdates[Renderer::GetCurrentFrameIndex ()];
313
- // Write(setsToWrite);
313
+ // Write(setsToWrite);
314
314
UpdateUniforms (buffersToWrite, imagesToWrite);
315
315
316
316
buffersToWrite.Clear ();
@@ -331,7 +331,6 @@ void Material::WriteSet(uint32_t set, PropertiesSlot& slot)
331
331
332
332
for (auto setIt = perFrameDescriptorSets.CreateFIterator (); setIt; ++setIt)
333
333
{
334
-
335
334
auto sets = *setIt;
336
335
if (IsTexture2D (prop.type ))
337
336
QueueImageUpdate (imageUpdates[setIt.GetIndex ()], sets[set], propIt.GetIndex ());
@@ -346,36 +345,48 @@ void Material::WriteSet(uint32_t set, PropertiesSlot& slot)
346
345
}
347
346
}
348
347
349
- void Material::UpdateUniforms (MHArray<UniformBufferUpdate>& buffers, MHArray<UniformImageUpdate>& images)
348
+ void Material::UpdateUniforms (MHArray<UniformBufferUpdate>& buffers,
349
+ MHArray<UniformImageUpdate>& images)
350
350
{
351
351
using namespace Vulkan ::Utils::Descriptor;
352
352
353
353
MSArray<VkWriteDescriptorSet, 10 > writeSets;
354
354
MSArray<VkDescriptorBufferInfo, MAX_UNIFORM_SETS * 10 > bufferInfs;
355
355
MSArray<VkDescriptorImageInfo, MAX_TEXTURES> imageInfos;
356
356
357
- for (auto it = buffers.CreateIterator (); it; ++it)
357
+ for (auto it = buffers.CreateIterator (); it; ++it)
358
358
{
359
359
auto & update = it->update ;
360
360
auto & bufferInfo = it->bufferUpdate ;
361
361
362
362
bufferInfs.Append ({bufferInfo.buffer , bufferInfo.offset , bufferInfo.range });
363
- writeSets.Append (CreateWriteSet (update.dstBinding , update.set , update.descriptors , Utils::ToVkDescriptorType (update.type ), &bufferInfs.Back ()));
363
+ writeSets.Append (CreateWriteSet (update.dstBinding ,
364
+ update.set ,
365
+ update.descriptors ,
366
+ Utils::ToVkDescriptorType (update.type ),
367
+ &bufferInfs.Back ()));
364
368
}
365
369
366
- for (auto it = textureInfos.CreateIterator (); it; ++it)
370
+ for (auto it = textureInfos.CreateIterator (); it; ++it)
367
371
{
368
372
imageInfos.Append ({it->sampler , it->view , Utils::ToVkImageLayout (it->layout )});
369
373
}
370
374
371
- for (auto it = images.CreateIterator (); it; ++it)
375
+ for (auto it = images.CreateIterator (); it; ++it)
372
376
{
373
377
auto & update = it->update ;
374
378
375
- writeSets.Append (WriteDescriptorImage (VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, update.set , imageInfos.Data (), update.dstBinding , update.descriptors , update.dstIndex ));
379
+ writeSets.Append (WriteDescriptorImage (VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
380
+ update.set ,
381
+ imageInfos.Data (),
382
+ update.dstBinding ,
383
+ update.descriptors ,
384
+ update.dstIndex ));
376
385
}
377
386
378
- Utils::Descriptor::WriteSets (Context::GetVkLogicalDevice (), writeSets.Data (), writeSets.Count ());
387
+ Utils::Descriptor::WriteSets (Context::GetVkLogicalDevice (),
388
+ writeSets.Data (),
389
+ writeSets.Count ());
379
390
buffers.Clear ();
380
391
images.Clear ();
381
392
}
0 commit comments