@@ -13,8 +13,7 @@ using namespace nbl;
13
13
using namespace core ;
14
14
15
15
_NBL_STATIC_INLINE_CONSTEXPR size_t WORK_GROUP_SIZE = 32 ; // ! work-items per work-group
16
- _NBL_STATIC_INLINE_CONSTEXPR size_t MAX_TEST_RGB_VALUES = WORK_GROUP_SIZE * 1 ; // ! total number of rgb values to test
17
- _NBL_STATIC_INLINE_CONSTEXPR size_t FRAMES_IN_FLIGHT = 3u ;
16
+ _NBL_STATIC_INLINE_CONSTEXPR size_t MAX_TEST_RGB_VALUES = WORK_GROUP_SIZE * 1 ; // ! total number of rgb values to test
18
17
19
18
enum E_SSBO
20
19
{
@@ -45,7 +44,7 @@ int main()
45
44
constexpr std::string_view APP_NAME = " RGB18E7S3 utility test" ;
46
45
47
46
CommonAPI::InitOutput initOutput;
48
- CommonAPI::InitWithNoExt (initOutput, video::EAT_OPENGL , APP_NAME.data ());
47
+ CommonAPI::InitWithNoExt (initOutput, video::EAT_VULKAN , APP_NAME.data ());
49
48
auto system = std::move (initOutput.system );
50
49
auto gl = std::move (initOutput.apiConnection );
51
50
auto logger = std::move (initOutput.logger );
@@ -81,6 +80,7 @@ int main()
81
80
{
82
81
auto cpuComputeShader = core::smart_refctd_ptr_static_cast<asset::ICPUSpecializedShader>(computeShaderBundle.getContents ().begin ()[0 ]);
83
82
83
+ cpu2gpuParams.beginCommandBuffers ();
84
84
auto gpu_array = cpu2gpu.getGPUObjectsFromAssets (&cpuComputeShader, &cpuComputeShader + 1 , cpu2gpuParams);
85
85
if (!gpu_array || gpu_array->size () < 1u || !(*gpu_array)[0 ])
86
86
assert (false );
@@ -128,9 +128,9 @@ int main()
128
128
ssboMemoryReqs.mappingCapability = video::IDriverMemoryAllocation::EMCAF_READ_AND_WRITE;
129
129
130
130
video::IGPUBuffer::SCreationParams ssboCreationParams;
131
- ssboCreationParams.usage = asset::IBuffer::EUF_STORAGE_BUFFER_BIT;
131
+ ssboCreationParams.usage = core::bitflag ( asset::IBuffer::EUF_STORAGE_BUFFER_BIT)|asset::IBuffer::EUF_TRANSFER_DST_BIT ;
132
132
ssboCreationParams.canUpdateSubRange = true ;
133
- ssboCreationParams.sharingMode = asset::E_SHARING_MODE::ESM_CONCURRENT ;
133
+ ssboCreationParams.sharingMode = asset::E_SHARING_MODE::ESM_EXCLUSIVE ;
134
134
ssboCreationParams.queueFamilyIndexCount = 0u ;
135
135
ssboCreationParams.queueFamilyIndices = nullptr ;
136
136
@@ -182,13 +182,10 @@ int main()
182
182
auto gpuCPipelineLayout = logicalDevice->createGPUPipelineLayout (nullptr , nullptr , std::move (gpuCDescriptorSetLayout), nullptr , nullptr , nullptr );
183
183
auto gpuComputePipeline = logicalDevice->createGPUComputePipeline (nullptr , std::move (gpuCPipelineLayout), std::move (gpuComputeShader));
184
184
185
- core::smart_refctd_ptr<video::IGPUCommandBuffer> commandBuffers[FRAMES_IN_FLIGHT] ;
186
- logicalDevice->createCommandBuffers (commandPools[CommonAPI::InitOutput::EQT_COMPUTE].get (), video::IGPUCommandBuffer::EL_PRIMARY, FRAMES_IN_FLIGHT, commandBuffers );
185
+ core::smart_refctd_ptr<video::IGPUCommandBuffer> commandBuffer ;
186
+ logicalDevice->createCommandBuffers (commandPools[CommonAPI::InitOutput::EQT_COMPUTE].get (), video::IGPUCommandBuffer::EL_PRIMARY, 1u , &commandBuffer );
187
187
auto gpuFence = logicalDevice->createFence (static_cast <video::IGPUFence::E_CREATE_FLAGS>(0 ));
188
-
189
- for (size_t i = 0 ; i < FRAMES_IN_FLIGHT; ++i)
190
188
{
191
- auto & commandBuffer = commandBuffers[i];
192
189
193
190
commandBuffer->begin (0 );
194
191
@@ -216,18 +213,7 @@ int main()
216
213
queues[decltype (initOutput)::EQT_COMPUTE]->submit (1u , &submit, gpuFence.get ());
217
214
}
218
215
}
219
-
220
- {
221
- video::IGPUFence::E_STATUS waitStatus = video::IGPUFence::ES_NOT_READY;
222
- while (waitStatus != video::IGPUFence::ES_SUCCESS)
223
- {
224
- waitStatus = logicalDevice->waitForFences (1u , &gpuFence.get (), false , 99999999999ull );
225
- if (waitStatus == video::IGPUFence::ES_ERROR)
226
- assert (false );
227
- else if (waitStatus == video::IGPUFence::ES_TIMEOUT)
228
- break ;
229
- }
230
- }
216
+ logicalDevice->blockForFences (1u ,&gpuFence.get ());
231
217
232
218
video::IDriverMemoryAllocation::MappedMemoryRange mappedMemoryRange (gpuDownloadSSBOmapped->getBoundMemory (), 0u , gpuDownloadSSBOmapped->getSize ());
233
219
logicalDevice->mapMemory (mappedMemoryRange, video::IDriverMemoryAllocation::EMCAF_READ);
0 commit comments