vkd3d: Add more detailed breadcrumb logging for TraceRays.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Hans-Kristian Arntzen 2 months ago
parent 1614aa43ef
commit 5306d7be10
  1. 17
      libs/vkd3d/command.c
  2. 25
      libs/vkd3d/raytracing_pipeline.c
  3. 16
      libs/vkd3d/vkd3d_private.h

@ -10013,10 +10013,19 @@ static void STDMETHODCALLTYPE d3d12_command_list_SetPipelineState1(d3d12_command
if ((vkd3d_config_flags & VKD3D_CONFIG_FLAG_BREADCRUMBS) && state)
{
struct vkd3d_breadcrumb_command cmd;
cmd.type = VKD3D_BREADCRUMB_COMMAND_SET_SHADER_HASH;
cmd.shader.stage = VK_SHADER_STAGE_RAYGEN_BIT_KHR;
cmd.shader.hash = 0;
vkd3d_breadcrumb_tracer_add_command(list, &cmd);
size_t i;
for (i = 0; i < state->breadcrumb_shaders_count; i++)
{
cmd.type = VKD3D_BREADCRUMB_COMMAND_SET_SHADER_HASH;
cmd.shader.stage = state->breadcrumb_shaders[i].stage;
cmd.shader.hash = state->breadcrumb_shaders[i].hash;
vkd3d_breadcrumb_tracer_add_command(list, &cmd);
cmd.type = VKD3D_BREADCRUMB_COMMAND_TAG;
cmd.tag = state->breadcrumb_shaders[i].name;
vkd3d_breadcrumb_tracer_add_command(list, &cmd);
}
}
#endif
}

@ -137,6 +137,10 @@ static void d3d12_state_object_cleanup(struct d3d12_state_object *object)
vkd3d_sampler_state_free_descriptor_set(&object->device->sampler_state, object->device,
object->local_static_sampler.desc_set, object->local_static_sampler.desc_pool);
}
#ifdef VKD3D_ENABLE_BREADCRUMBS
vkd3d_free(object->breadcrumb_shaders);
#endif
}
static ULONG d3d12_state_object_release(struct d3d12_state_object *state_object)
@ -1673,6 +1677,17 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
return E_OUTOFMEMORY;
}
#ifdef VKD3D_ENABLE_BREADCRUMBS
vkd3d_array_reserve((void**)&object->breadcrumb_shaders, &object->breadcrumb_shaders_size,
object->breadcrumb_shaders_count + 1, sizeof(*object->breadcrumb_shaders));
object->breadcrumb_shaders[object->breadcrumb_shaders_count].hash = spirv.meta.hash;
object->breadcrumb_shaders[object->breadcrumb_shaders_count].stage = entry->stage;
snprintf(object->breadcrumb_shaders[object->breadcrumb_shaders_count].name,
sizeof(object->breadcrumb_shaders[object->breadcrumb_shaders_count].name),
"%s", entry->real_entry_point);
object->breadcrumb_shaders_count++;
#endif
vkd3d_free(local_bindings);
if (!d3d12_device_validate_shader_meta(object->device, &spirv.meta))
return E_INVALIDARG;
@ -1978,6 +1993,16 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
{
object->collections[i] = data->collections[i].object;
d3d12_state_object_inc_ref(object->collections[i]);
#ifdef VKD3D_ENABLE_BREADCRUMBS
vkd3d_array_reserve((void**)&object->breadcrumb_shaders, &object->breadcrumb_shaders_size,
object->breadcrumb_shaders_count + object->collections[i]->breadcrumb_shaders_count,
sizeof(*object->breadcrumb_shaders));
memcpy(object->breadcrumb_shaders + object->breadcrumb_shaders_count,
object->collections[i]->breadcrumb_shaders,
object->collections[i]->breadcrumb_shaders_count * sizeof(*object->breadcrumb_shaders));
object->breadcrumb_shaders_count += object->collections[i]->breadcrumb_shaders_count;
#endif
}
}

@ -3403,6 +3403,15 @@ struct d3d12_state_object_stack_info
uint32_t max_closest;
};
#ifdef VKD3D_ENABLE_BREADCRUMBS
struct d3d12_state_object_breadcrumb_shader
{
vkd3d_shader_hash_t hash;
VkShaderStageFlagBits stage;
char name[64];
};
#endif
struct d3d12_state_object
{
d3d12_state_object_iface ID3D12StateObject_iface;
@ -3450,6 +3459,13 @@ struct d3d12_state_object
struct d3d12_root_signature *global_root_signature;
#ifdef VKD3D_ENABLE_BREADCRUMBS
/* For breadcrumbs. */
struct d3d12_state_object_breadcrumb_shader *breadcrumb_shaders;
size_t breadcrumb_shaders_size;
size_t breadcrumb_shaders_count;
#endif
struct vkd3d_private_store private_store;
};

Loading…
Cancel
Save