39
39
#include " state_tracker/shader_module.h"
40
40
#include " utils/action_command_utils.h"
41
41
42
- #include < iostream>
43
-
44
42
namespace gpuav {
45
43
46
44
// If application is using shader objects, bindings count will be computed from bound shaders
@@ -304,9 +302,9 @@ void UpdateInstrumentationDescSet(Validator &gpuav, CommandBufferSubState &cb_st
304
302
assert (root_node_ptr->inst_action_index_buffer );
305
303
306
304
// Buffer holding a resource index from the per command buffer command resources list
307
- root_node_ptr->inst_cmd_resource_index_buffer =
305
+ root_node_ptr->inst_error_logger_index_buffer =
308
306
gpuav.indices_buffer_ .Address () + error_logger_i * gpuav.indices_buffer_alignment_ ;
309
- assert (root_node_ptr->inst_cmd_resource_index_buffer );
307
+ assert (root_node_ptr->inst_error_logger_index_buffer );
310
308
311
309
// Errors count buffer
312
310
root_node_ptr->inst_cmd_errors_count_buffer = cb_state.GetCmdErrorsCountsBuffer ().Address ();
@@ -379,24 +377,6 @@ void UpdateInstrumentationDescSet(Validator &gpuav, CommandBufferSubState &cb_st
379
377
wds.pBufferInfo = &dbi;
380
378
381
379
DispatchUpdateDescriptorSets (gpuav.device , 1 , &wds, 0 , nullptr );
382
- #if 0
383
- std::cout << "root_node_ptr:\n---\n";
384
- std::cout << "root_node_ptr: " << std::hex << "0x" << root_node_ptr_buffer_range.offset_address << std::endl;
385
- std::cout << "root_node_ptr->debug_printf_buffer: " << std::hex << "0x" << root_node_ptr->debug_printf_buffer << std::endl;
386
- std::cout << "root_node_ptr->inst_errors_buffer: " << std::hex << "0x" << root_node_ptr->inst_errors_buffer << std::endl;
387
- std::cout << "root_node_ptr->inst_action_index_buffer: " << std::hex << "0x" << root_node_ptr->inst_action_index_buffer
388
- << std::endl;
389
- std::cout << "root_node_ptr->inst_cmd_resource_index_buffer: " << std::hex << "0x"
390
- << root_node_ptr->inst_cmd_resource_index_buffer << std::endl;
391
- std::cout << "root_node_ptr->inst_cmd_errors_count_buffer: " << std::hex << "0x" << root_node_ptr->inst_cmd_errors_count_buffer
392
- << std::endl;
393
- std::cout << "root_node_ptr->vertex_attribute_fetch_limits_buffer: " << std::hex << "0x"
394
- << root_node_ptr->vertex_attribute_fetch_limits_buffer << std::endl;
395
- std::cout << "root_node_ptr->bda_input_buffer: " << std::hex << "0x" << root_node_ptr->bda_input_buffer << std::endl;
396
- std::cout << "root_node_ptr->post_process_ssbo: " << std::hex << "0x" << root_node_ptr->post_process_ssbo << std::endl;
397
- std::cout << "root_node_ptr->bound_desc_sets_state_ssbo: " << std::hex << "0x" << root_node_ptr->bound_desc_sets_state_ssbo
398
- << std::endl;
399
- #endif
400
380
}
401
381
402
382
static bool WasInstrumented (const LastBound &last_bound) {
@@ -456,11 +436,11 @@ void PreCallSetupShaderInstrumentationResources(Validator &gpuav, CommandBufferS
456
436
assert (gpuav.instrumentation_bindings_ .size () == 1 );
457
437
458
438
InstrumentationErrorBlob instrumentation_error_blob;
459
- instrumentation_error_blob.operation_index = (bind_point == VK_PIPELINE_BIND_POINT_GRAPHICS) ? cb_state.draw_index
460
- : (bind_point == VK_PIPELINE_BIND_POINT_COMPUTE) ? cb_state.compute_index
461
- : (bind_point == VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR)
462
- ? cb_state.trace_rays_index
463
- : 0 ;
439
+ instrumentation_error_blob.action_command_i = (bind_point == VK_PIPELINE_BIND_POINT_GRAPHICS) ? cb_state.draw_index
440
+ : (bind_point == VK_PIPELINE_BIND_POINT_COMPUTE) ? cb_state.compute_index
441
+ : (bind_point == VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR)
442
+ ? cb_state.trace_rays_index
443
+ : 0 ;
464
444
465
445
instrumentation_error_blob.pipeline_bind_point = bind_point;
466
446
instrumentation_error_blob.uses_shader_object = last_bound.pipeline_state == nullptr ;
@@ -507,13 +487,14 @@ void PreCallSetupShaderInstrumentationResources(Validator &gpuav, CommandBufferS
507
487
508
488
// TODO: Using cb_state.per_command_resources.size() is kind of a hack? Worth considering passing the resource index as a
509
489
// parameter
510
- const uint32_t error_logger_i = static_cast <uint32_t >(cb_state.per_command_error_loggers .size ());
490
+ const uint32_t error_logger_i = static_cast <uint32_t >(cb_state.command_error_loggers .size ());
511
491
512
492
UpdateInstrumentationDescSet (gpuav, cb_state, bind_point, instrumentation_desc_set, loc,
513
- instrumentation_error_blob.operation_index , error_logger_i, instrumentation_error_blob);
493
+ instrumentation_error_blob.action_command_i , error_logger_i, instrumentation_error_blob);
514
494
515
- if (inst_binding_pipe_layout_state) {
516
- if ((uint32_t )inst_binding_pipe_layout_state->set_layouts .size () > gpuav.instrumentation_desc_set_bind_index_ ) {
495
+ if (inst_binding_pipe_layout) {
496
+ if (inst_binding_pipe_layout_state &&
497
+ (uint32_t )inst_binding_pipe_layout_state->set_layouts .size () > gpuav.instrumentation_desc_set_bind_index_ ) {
517
498
gpuav.InternalWarning (cb_state.Handle (), loc,
518
499
" Unable to bind instrumentation descriptor set, it would override application's bound set" );
519
500
return ;
@@ -525,7 +506,7 @@ void PreCallSetupShaderInstrumentationResources(Validator &gpuav, CommandBufferS
525
506
assert (false );
526
507
break ;
527
508
case PipelineLayoutSource::LastBoundPipeline:
528
- DispatchCmdBindDescriptorSets (cb_state.VkHandle (), bind_point, inst_binding_pipe_layout_state-> VkHandle () ,
509
+ DispatchCmdBindDescriptorSets (cb_state.VkHandle (), bind_point, inst_binding_pipe_layout ,
529
510
gpuav.instrumentation_desc_set_bind_index_ , 1 , &instrumentation_desc_set, 0 , nullptr );
530
511
break ;
531
512
case PipelineLayoutSource::LastBoundDescriptorSet:
0 commit comments