@@ -285,7 +285,7 @@ bool DebugPrintf::InstrumentShader(const VkShaderModuleCreateInfo *pCreateInfo,
285
285
opt_options.set_run_validator (true );
286
286
opt_options.set_validator_options (val_options);
287
287
Optimizer optimizer (target_env);
288
- const spvtools::MessageConsumer DebugPrintfConsoleMessageConsumer =
288
+ const spvtools::MessageConsumer debug_printf_console_message_consumer =
289
289
[this ](spv_message_level_t level, const char *, const spv_position_t &position, const char *message) -> void {
290
290
switch (level) {
291
291
case SPV_MSG_FATAL:
@@ -298,7 +298,7 @@ bool DebugPrintf::InstrumentShader(const VkShaderModuleCreateInfo *pCreateInfo,
298
298
break ;
299
299
}
300
300
};
301
- optimizer.SetMessageConsumer (DebugPrintfConsoleMessageConsumer );
301
+ optimizer.SetMessageConsumer (debug_printf_console_message_consumer );
302
302
optimizer.RegisterPass (CreateInstDebugPrintfPass (desc_set_bind_index, unique_shader_module_id));
303
303
bool pass = optimizer.Run (new_pgm.data (), new_pgm.size (), &new_pgm, opt_options);
304
304
if (!pass) {
@@ -372,10 +372,10 @@ std::vector<DPFSubstring> DebugPrintf::ParseFormatString(const std::string forma
372
372
}
373
373
// Find the type of the value
374
374
pos = format_string.find_first_of (types, pos);
375
- if (pos == format_string.npos )
375
+ if (pos == format_string.npos ) {
376
376
// This really shouldn't happen with a legal value string
377
377
pos = format_string.length ();
378
- else {
378
+ } else {
379
379
char tempstring[32 ];
380
380
int count = 0 ;
381
381
std::string specifier = {};
@@ -537,13 +537,14 @@ void DebugPrintf::AnalyzeAndGenerateMessages(VkCommandBuffer command_buffer, VkQ
537
537
break ;
538
538
}
539
539
values = static_cast <uint32_t *>(values) + 1 ;
540
- } else
540
+ } else {
541
541
needed = snprintf (temp_string, static_size, substring.string .c_str ());
542
+ }
542
543
}
543
544
544
- if (needed < static_size)
545
+ if (needed < static_size) {
545
546
shader_message << temp_string;
546
- else {
547
+ } else {
547
548
// Static buffer not big enough for message, use malloc to get enough
548
549
snprintf_with_malloc (shader_message, substring, needed, values);
549
550
}
@@ -601,8 +602,8 @@ void DebugPrintf::PostCallRecordQueueSubmit(VkQueue queue, uint32_t submitCount,
601
602
for (uint32_t i = 0 ; i < submit->commandBufferCount ; i++) {
602
603
auto cb_node = GetCBState (submit->pCommandBuffers [i]);
603
604
if (GetBufferInfo (cb_node->commandBuffer ).size ()) buffers_present = true ;
604
- for (auto secondaryCmdBuffer : cb_node->linkedCommandBuffers ) {
605
- if (GetBufferInfo (secondaryCmdBuffer ->commandBuffer ).size ()) buffers_present = true ;
605
+ for (auto secondary_cmd_buffer : cb_node->linkedCommandBuffers ) {
606
+ if (GetBufferInfo (secondary_cmd_buffer ->commandBuffer ).size ()) buffers_present = true ;
606
607
}
607
608
}
608
609
}
@@ -617,8 +618,8 @@ void DebugPrintf::PostCallRecordQueueSubmit(VkQueue queue, uint32_t submitCount,
617
618
for (uint32_t i = 0 ; i < submit->commandBufferCount ; i++) {
618
619
auto cb_node = GetCBState (submit->pCommandBuffers [i]);
619
620
UtilProcessInstrumentationBuffer (queue, cb_node, this );
620
- for (auto secondaryCmdBuffer : cb_node->linkedCommandBuffers ) {
621
- UtilProcessInstrumentationBuffer (queue, secondaryCmdBuffer , this );
621
+ for (auto secondary_cmd_buffer : cb_node->linkedCommandBuffers ) {
622
+ UtilProcessInstrumentationBuffer (queue, secondary_cmd_buffer , this );
622
623
}
623
624
}
624
625
}
@@ -814,23 +815,23 @@ void DebugPrintf::AllocateDebugPrintfResources(const VkCommandBuffer cmd_buffer,
814
815
815
816
// Allocate memory for the output block that the gpu will use to return values for printf
816
817
DPFDeviceMemoryBlock output_block = {};
817
- VkBufferCreateInfo bufferInfo = {VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
818
- bufferInfo .size = output_buffer_size;
819
- bufferInfo .usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
820
- VmaAllocationCreateInfo allocInfo = {};
821
- allocInfo .usage = VMA_MEMORY_USAGE_GPU_TO_CPU;
822
- result = vmaCreateBuffer (vmaAllocator, &bufferInfo , &allocInfo , &output_block.buffer , &output_block.allocation , nullptr );
818
+ VkBufferCreateInfo buffer_info = {VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO};
819
+ buffer_info .size = output_buffer_size;
820
+ buffer_info .usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
821
+ VmaAllocationCreateInfo alloc_info = {};
822
+ alloc_info .usage = VMA_MEMORY_USAGE_GPU_TO_CPU;
823
+ result = vmaCreateBuffer (vmaAllocator, &buffer_info , &alloc_info , &output_block.buffer , &output_block.allocation , nullptr );
823
824
if (result != VK_SUCCESS) {
824
825
ReportSetupProblem (device, " Unable to allocate device memory. Device could become unstable." );
825
826
aborted = true ;
826
827
return ;
827
828
}
828
829
829
830
// Clear the output block to zeros so that only printf values from the gpu will be present
830
- uint32_t *pData ;
831
- result = vmaMapMemory (vmaAllocator, output_block.allocation , ( void **)&pData );
831
+ uint32_t *data ;
832
+ result = vmaMapMemory (vmaAllocator, output_block.allocation , reinterpret_cast < void **>(&data) );
832
833
if (result == VK_SUCCESS) {
833
- memset (pData , 0 , output_buffer_size);
834
+ memset (data , 0 , output_buffer_size);
834
835
vmaUnmapMemory (vmaAllocator, output_block.allocation );
835
836
}
836
837
0 commit comments