Compare commits

...

7 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen 2138e3a543 debug: Add shader override build for ray tracing as well. 2 months ago
Hans-Kristian Arntzen 1a132c7a85 vkd3d-shader: Normalize root signature compatibility hashing. 2 months ago
Hans-Kristian Arntzen 4c06c9259f vkd3d: Dump TraceRays parameters to breadcrumbs. 2 months ago
Hans-Kristian Arntzen 263a278f14 vkd3d: Add detailed tracing for RTPSO creation. 2 months ago
Hans-Kristian Arntzen 5306d7be10 vkd3d: Add more detailed breadcrumb logging for TraceRays. 2 months ago
Hans-Kristian Arntzen 1614aa43ef vkd3d: Add support for tag logging in breadcrumbs. 2 months ago
Hans-Kristian Arntzen bd9316a2e5 vkd3d: Trivially ensure tighter packing of entry point struct. 2 months ago
  1. 32
      include/shader-debug/GNUmakefile
  2. 11
      include/vkd3d_shader.h
  3. 30
      libs/vkd3d-shader/dxbc.c
  4. 6
      libs/vkd3d/breadcrumbs.c
  5. 32
      libs/vkd3d/command.c
  6. 109
      libs/vkd3d/raytracing_pipeline.c
  7. 7
      libs/vkd3d/state.c
  8. 29
      libs/vkd3d/vkd3d_main.c
  9. 28
      libs/vkd3d/vkd3d_private.h

@ -6,6 +6,12 @@ COMP_SOURCES := $(wildcard $(M)/*.comp)
TESC_SOURCES := $(wildcard $(M)/*.tesc)
TESE_SOURCES := $(wildcard $(M)/*.tese)
GEOM_SOURCES := $(wildcard $(M)/*.geom)
RGEN_SOURCES := $(wildcard $(M)/*.rgen)
RINT_SOURCES := $(wildcard $(M)/*.rint)
RAHIT_SOURCES := $(wildcard $(M)/*.rahit)
RCHIT_SOURCES := $(wildcard $(M)/*.rchit)
RMISS_SOURCES := $(wildcard $(M)/*.rmiss)
RCALL_SOURCES := $(wildcard $(M)/*.rcall)
SPV_OBJECTS := \
$(VERT_SOURCES:.vert=.spv) \
@ -13,7 +19,13 @@ SPV_OBJECTS := \
$(COMP_SOURCES:.comp=.spv) \
$(TESC_SOURCES:.tesc=.spv) \
$(TESE_SOURCES:.tese=.spv) \
$(GEOM_SOURCES:.geom=.spv)
$(GEOM_SOURCES:.geom=.spv) \
$(RGEN_SOURCES:.rgen=.spv) \
$(RINT_SOURCES:.rint=.spv) \
$(RAHIT_SOURCES:.rahit=.spv) \
$(RCHIT_SOURCES:.rchit=.spv) \
$(RMISS_SOURCES:.rmiss=.spv) \
$(RCALL_SOURCES:.rcall=.spv)
%.spv: %.vert
glslc -o $@ $< -I$(INCLUDE_DIR) --target-env=vulkan1.1
@ -33,6 +45,24 @@ SPV_OBJECTS := \
%.spv: %.tese
glslc -o $@ $< -I$(INCLUDE_DIR) --target-env=vulkan1.1
%.spv: %.rgen
glslc -o $@ $< -I$(INCLUDE_DIR) --target-env=vulkan1.1 --target-spv=spv1.4
%.spv: %.rint
glslc -o $@ $< -I$(INCLUDE_DIR) --target-env=vulkan1.1 --target-spv=spv1.4
%.spv: %.rahit
glslc -o $@ $< -I$(INCLUDE_DIR) --target-env=vulkan1.1 --target-spv=spv1.4
%.spv: %.rchit
glslc -o $@ $< -I$(INCLUDE_DIR) --target-env=vulkan1.1 --target-spv=spv1.4
%.spv: %.rmiss
glslc -o $@ $< -I$(INCLUDE_DIR) --target-env=vulkan1.1 --target-spv=spv1.4
%.spv: %.rcall
glslc -o $@ $< -I$(INCLUDE_DIR) --target-env=vulkan1.1 --target-spv=spv1.4
all: $(SPV_OBJECTS)
clean:

@ -749,9 +749,11 @@ int vkd3d_shader_compile_dxbc(const struct vkd3d_shader_code *dxbc,
void vkd3d_shader_free_shader_code(struct vkd3d_shader_code *code);
int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *root_signature);
struct vkd3d_versioned_root_signature_desc *root_signature,
vkd3d_shader_hash_t *compatibility_hash);
int vkd3d_shader_parse_root_signature_raw(const char *data, unsigned int data_size,
struct vkd3d_versioned_root_signature_desc *desc);
struct vkd3d_versioned_root_signature_desc *desc,
vkd3d_shader_hash_t *compatibility_hash);
void vkd3d_shader_free_root_signature(struct vkd3d_versioned_root_signature_desc *root_signature);
/* FIXME: Add support for returning error messages (ID3DBlob). */
@ -777,10 +779,10 @@ void vkd3d_shader_free_shader_signature(struct vkd3d_shader_signature *signature
struct vkd3d_shader_library_entry_point
{
unsigned int identifier;
VkShaderStageFlagBits stage;
WCHAR *mangled_entry_point;
WCHAR *plain_entry_point;
char *real_entry_point;
VkShaderStageFlagBits stage;
};
enum vkd3d_shader_subobject_kind
@ -861,7 +863,8 @@ typedef int (*PFN_vkd3d_shader_compile_dxbc)(const struct vkd3d_shader_code *dxb
typedef void (*PFN_vkd3d_shader_free_shader_code)(struct vkd3d_shader_code *code);
typedef int (*PFN_vkd3d_shader_parse_root_signature)(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *root_signature);
struct vkd3d_versioned_root_signature_desc *root_signature,
vkd3d_shader_hash_t *compatibility_hash);
typedef void (*PFN_vkd3d_shader_free_root_signature)(struct vkd3d_versioned_root_signature_desc *root_signature);
typedef int (*PFN_vkd3d_shader_serialize_root_signature)(

@ -2756,7 +2756,8 @@ static int shader_parse_static_samplers(struct root_signature_parser_context *co
}
int vkd3d_shader_parse_root_signature_raw(const char *data, unsigned int data_size,
struct vkd3d_versioned_root_signature_desc *desc)
struct vkd3d_versioned_root_signature_desc *desc,
vkd3d_shader_hash_t *compatibility_hash)
{
struct vkd3d_root_signature_desc *v_1_0 = &desc->v_1_0;
struct root_signature_parser_context context;
@ -2837,27 +2838,46 @@ int vkd3d_shader_parse_root_signature_raw(const char *data, unsigned int data_si
read_uint32(&ptr, &v_1_0->flags);
TRACE("Flags %#x.\n", v_1_0->flags);
if (compatibility_hash)
{
struct vkd3d_shader_code code = { data, data_size };
*compatibility_hash = vkd3d_shader_hash(&code);
}
return VKD3D_OK;
}
static int rts0_handler(const char *data, DWORD data_size, DWORD tag, void *context)
{
struct vkd3d_versioned_root_signature_desc *desc = context;
struct vkd3d_shader_code *payload = context;
if (tag != TAG_RTS0)
return VKD3D_OK;
return vkd3d_shader_parse_root_signature_raw(data, data_size, desc);
payload->code = data;
payload->size = data_size;
return VKD3D_OK;
}
int vkd3d_shader_parse_root_signature(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *root_signature)
struct vkd3d_versioned_root_signature_desc *root_signature,
vkd3d_shader_hash_t *compatibility_hash)
{
struct vkd3d_shader_code raw_payload;
int ret;
TRACE("dxbc {%p, %zu}, root_signature %p.\n", dxbc->code, dxbc->size, root_signature);
if ((ret = parse_dxbc(dxbc->code, dxbc->size, rts0_handler, root_signature)) < 0)
memset(&raw_payload, 0, sizeof(raw_payload));
if ((ret = parse_dxbc(dxbc->code, dxbc->size, rts0_handler, &raw_payload)) < 0)
return ret;
if (!raw_payload.code)
return VKD3D_OK;
if ((ret = vkd3d_shader_parse_root_signature_raw(raw_payload.code, raw_payload.size,
root_signature, compatibility_hash)) < 0)
{
vkd3d_shader_free_root_signature(root_signature);
return ret;

@ -82,6 +82,8 @@ static const char *vkd3d_breadcrumb_command_type_to_str(enum vkd3d_breadcrumb_co
return "root_desc";
case VKD3D_BREADCRUMB_COMMAND_ROOT_CONST:
return "root_const";
case VKD3D_BREADCRUMB_COMMAND_TAG:
return "tag";
default:
return "?";
@ -306,6 +308,10 @@ static void vkd3d_breadcrumb_tracer_report_command_list(
{
ERR(" Set arg: %"PRIu64" (#%"PRIx64")\n", cmd->word_64bit, cmd->word_64bit);
}
else if (cmd->type == VKD3D_BREADCRUMB_COMMAND_TAG)
{
ERR(" Tag: %s\n", cmd->tag);
}
else
{
ERR(" Command: %s\n", vkd3d_breadcrumb_command_type_to_str(cmd->type));

@ -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
}
@ -10067,6 +10076,21 @@ static void STDMETHODCALLTYPE d3d12_command_list_DispatchRays(d3d12_command_list
&raygen_table, &miss_table, &hit_table, &callable_table,
desc->Width, desc->Height, desc->Depth));
VKD3D_BREADCRUMB_AUX32(desc->Width);
VKD3D_BREADCRUMB_AUX32(desc->Height);
VKD3D_BREADCRUMB_AUX32(desc->Depth);
VKD3D_BREADCRUMB_AUX64(raygen_table.deviceAddress);
VKD3D_BREADCRUMB_AUX64(raygen_table.size);
VKD3D_BREADCRUMB_AUX32(raygen_table.stride);
VKD3D_BREADCRUMB_AUX64(miss_table.deviceAddress);
VKD3D_BREADCRUMB_AUX64(miss_table.size);
VKD3D_BREADCRUMB_AUX32(miss_table.stride);
VKD3D_BREADCRUMB_AUX64(hit_table.deviceAddress);
VKD3D_BREADCRUMB_AUX64(hit_table.size);
VKD3D_BREADCRUMB_AUX32(hit_table.stride);
VKD3D_BREADCRUMB_AUX64(callable_table.deviceAddress);
VKD3D_BREADCRUMB_AUX64(callable_table.size);
VKD3D_BREADCRUMB_AUX32(callable_table.stride);
VKD3D_BREADCRUMB_COMMAND(TRACE_RAYS);
}

@ -20,6 +20,8 @@
#include "vkd3d_private.h"
#include "vkd3d_string.h"
#define RT_TRACE INFO
static inline struct d3d12_state_object *impl_from_ID3D12StateObjectProperties(ID3D12StateObjectProperties *iface)
{
return CONTAINING_RECORD(iface, struct d3d12_state_object, ID3D12StateObjectProperties_iface);
@ -137,6 +139,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)
@ -461,6 +467,8 @@ static HRESULT d3d12_state_object_add_collection(
struct d3d12_state_object_pipeline_data *data,
const D3D12_EXPORT_DESC *exports, unsigned int num_exports)
{
VKD3D_UNUSED size_t i;
if (!vkd3d_array_reserve((void **)&data->collections, &data->collections_size,
data->collections_count + 1, sizeof(*data->collections)))
return E_OUTOFMEMORY;
@ -469,6 +477,17 @@ static HRESULT d3d12_state_object_add_collection(
data->associations_count + 3, sizeof(*data->associations)))
return E_OUTOFMEMORY;
RT_TRACE("EXISTING_COLLECTION:\n");
for (i = 0; i < collection->exports_count; i++)
{
if (collection->exports[i].plain_export)
RT_TRACE(" Plain export: %s\n", debugstr_w(collection->exports[i].plain_export));
if (collection->exports[i].mangled_export)
RT_TRACE(" Mangled export: %s\n", debugstr_w(collection->exports[i].mangled_export));
}
RT_TRACE(" Global Root Signature compat hash: %016"PRIx64".\n",
collection->global_root_signature->compatibility_hash);
/* If a PSO only declares collections, but no pipelines, just inherit various state.
* Also, validates later that we have a match across different PSOs if we end up with mismatches. */
data->associations[data->associations_count].kind = VKD3D_SHADER_SUBOBJECT_KIND_GLOBAL_ROOT_SIGNATURE;
@ -581,6 +600,8 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
FIXME("Object config flag #%x is not supported.\n", object->flags);
return E_INVALIDARG;
}
RT_TRACE("%p || STATE_OBJECT_CONFIG: #%x.\n", obj->pDesc, object_config->Flags);
break;
}
@ -608,6 +629,14 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
data->associations[data->associations_count].root_signature =
impl_from_ID3D12RootSignature(rs->pLocalRootSignature);
data->associations[data->associations_count].priority = association_priority;
RT_TRACE("%p || %s (compat hash %016"PRIx64") (prio %u).\n",
obj->pDesc,
obj->Type == D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE ?
"GLOBAL_ROOT_SIGNATURE" : "LOCAL_ROOT_SIGNATURE",
data->associations[data->associations_count].root_signature->compatibility_hash,
association_priority);
data->associations_count++;
break;
}
@ -615,6 +644,11 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
case D3D12_STATE_SUBOBJECT_TYPE_DXIL_LIBRARY:
{
const D3D12_DXIL_LIBRARY_DESC *lib = obj->pDesc;
VKD3D_UNUSED size_t old_obj_count, old_count, j;
old_count = data->entry_points_count;
old_obj_count = data->subobjects_count;
if (vkd3d_shader_dxil_append_library_entry_points_and_subobjects(lib, data->dxil_libraries_count,
&data->entry_points, &data->entry_points_size,
&data->entry_points_count,
@ -627,6 +661,16 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
vkd3d_array_reserve((void**)&data->dxil_libraries, &data->dxil_libraries_size,
data->dxil_libraries_count + 1, sizeof(*data->dxil_libraries));
data->dxil_libraries[data->dxil_libraries_count++] = lib;
RT_TRACE("Adding DXIL library:\n");
for (j = old_count; j < data->entry_points_count; j++)
{
RT_TRACE(" Entry point: %s (stage #%x).\n",
data->entry_points[j].real_entry_point, data->entry_points[j].stage);
}
for (j = old_obj_count; j < data->subobjects_count; j++)
RT_TRACE(" RDAT subobject: %s (type #%x).\n", data->subobjects[j].name, data->subobjects[j].kind);
break;
}
@ -636,6 +680,12 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
vkd3d_array_reserve((void**)&data->hit_groups, &data->hit_groups_size,
data->hit_groups_count + 1, sizeof(*data->hit_groups));
data->hit_groups[data->hit_groups_count++] = group;
RT_TRACE("Adding HIT_GROUP:\n");
RT_TRACE(" Type: %s\n", group->Type == D3D12_HIT_GROUP_TYPE_TRIANGLES ? "Triangle" : "Procedural");
RT_TRACE(" Name: %s\n", debugstr_w(group->HitGroupExport));
RT_TRACE(" AnyHit: %s\n", debugstr_w(group->AnyHitShaderImport));
RT_TRACE(" ClosestHit: %s\n", debugstr_w(group->ClosestHitShaderImport));
RT_TRACE(" Intersection: %s\n", debugstr_w(group->IntersectionShaderImport));
break;
}
@ -651,6 +701,9 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
data->associations[data->associations_count].priority = association_priority;
data->associations[data->associations_count].shader_config = *config;
data->associations[data->associations_count].export = NULL;
RT_TRACE("%p || Adding SHADER_CONFIG: MaxPayloadSize = %u, MaxAttributeSize = %u\n",
obj->pDesc,
config->MaxPayloadSizeInBytes, config->MaxAttributeSizeInBytes);
data->associations_count++;
break;
}
@ -669,6 +722,7 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
pipeline_config->MaxTraceRecursionDepth;
data->associations[data->associations_count].pipeline_config.Flags = 0;
data->associations[data->associations_count].export = NULL;
RT_TRACE("%p || Adding PIPELINE_CONFIG: MaxRecursion = %u\n", obj->pDesc, pipeline_config->MaxTraceRecursionDepth);
data->associations_count++;
break;
}
@ -685,6 +739,9 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
data->associations[data->associations_count].priority = association_priority;
data->associations[data->associations_count].pipeline_config = *pipeline_config;
data->associations[data->associations_count].export = NULL;
RT_TRACE("%p || Adding PIPELINE_CONFIG1: MaxRecursion = %u, Flags = #%x\n",
obj->pDesc,
pipeline_config->MaxTraceRecursionDepth, pipeline_config->Flags);
data->associations_count++;
break;
}
@ -696,6 +753,8 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
const struct vkd3d_shader_library_subobject *subobject;
unsigned int root_signature_index = 0;
RT_TRACE("Adding DXIL_SUBOBJECT_TO_EXPORTS: %s\n", debugstr_w(association->SubobjectToAssociate));
for (i = 0; i < data->subobjects_count; i++)
{
if (vkd3d_export_strequal_mixed(association->SubobjectToAssociate, data->subobjects[i].name))
@ -767,6 +826,10 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
VKD3D_ASSOCIATION_PRIORITY_DXIL_SUBOBJECT_ASSIGNMENT_DEFAULT;
}
RT_TRACE(" Export: %s (prio %u)\n",
association->NumExports ? debugstr_w(association->pExports[i]) : "NULL",
data->associations[data->associations_count].priority);
data->associations_count++;
}
@ -782,6 +845,10 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
data->associations_count + num_associations,
sizeof(*data->associations));
RT_TRACE("SUBOBJECT_TO_EXPORTS: %p (type %u):\n",
association->pSubobjectToAssociate->pDesc,
association->pSubobjectToAssociate->Type);
switch (association->pSubobjectToAssociate->Type)
{
case D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_SHADER_CONFIG:
@ -799,6 +866,11 @@ static HRESULT d3d12_state_object_parse_subobject(struct d3d12_state_object *obj
data->associations[data->associations_count].priority = association->NumExports ?
VKD3D_ASSOCIATION_PRIORITY_EXPLICIT :
VKD3D_ASSOCIATION_PRIORITY_EXPLICIT_DEFAULT;
RT_TRACE(" Export: %s (priority %u):\n",
association->NumExports ? debugstr_w(association->pExports[i]) : "NULL",
data->associations[data->associations_count].priority);
data->associations_count++;
}
break;
@ -1562,6 +1634,9 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
ID3D12RootSignature_Release(&default_global_root_signature->ID3D12RootSignature_iface);
}
RT_TRACE("Selecting Global Root Signature compat hash %016"PRIx64".\n",
global_signature->compatibility_hash);
shader_interface_local_info.descriptor_size = VKD3D_RESOURCE_DESC_INCREMENT;
local_static_sampler_bindings = NULL;
@ -1573,12 +1648,16 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
{
entry = &data->entry_points[i];
RT_TRACE("Compiling entry point: %s (stage = #%x).\n", debugstr_w(entry->plain_entry_point), entry->stage);
local_signature = d3d12_state_object_pipeline_data_get_root_signature(
VKD3D_SHADER_SUBOBJECT_KIND_LOCAL_ROOT_SIGNATURE, data, entry);
local_bindings = NULL;
if (local_signature)
{
RT_TRACE(" Local root signature: %016"PRIx64".\n", local_signature->compatibility_hash);
shader_interface_local_info.local_root_parameters = local_signature->parameters;
shader_interface_local_info.local_root_parameter_count = local_signature->parameter_count;
shader_interface_local_info.shader_record_constant_buffers = local_signature->root_constants;
@ -1613,7 +1692,10 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
shader_interface_info.offset_buffer_binding = &local_signature->offset_buffer_binding;
}
else
{
RT_TRACE(" Local root signature: N/A\n");
memset(&shader_interface_local_info, 0, sizeof(shader_interface_local_info));
}
if (vkd3d_stage_is_global_group(entry->stage))
{
@ -1673,6 +1755,19 @@ static HRESULT d3d12_state_object_compile_pipeline(struct d3d12_state_object *ob
return E_OUTOFMEMORY;
}
RT_TRACE(" DXIL hash: %016"PRIx64".\n", spirv.meta.hash);
#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 +2073,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
}
}
@ -2040,7 +2145,11 @@ HRESULT d3d12_state_object_create(struct d3d12_device *device, const D3D12_STATE
if (!(object = vkd3d_calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
INFO("==== Create %s ====\n",
desc->Type == D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE ? "RTPSO" : "Collection");
hr = d3d12_state_object_init(object, device, desc, parent);
INFO("==== Done (hr = #%x) ====\n", hr);
if (FAILED(hr))
{
vkd3d_free(object);

@ -1506,13 +1506,14 @@ static HRESULT d3d12_root_signature_create_from_blob(struct d3d12_device *device
D3D12_VERSIONED_ROOT_SIGNATURE_DESC d3d12;
struct vkd3d_versioned_root_signature_desc vkd3d;
} root_signature_desc;
vkd3d_shader_hash_t compatibility_hash;
struct d3d12_root_signature *object;
HRESULT hr;
int ret;
if (raw_payload)
{
if ((ret = vkd3d_parse_root_signature_v_1_1_from_raw_payload(&dxbc, &root_signature_desc.vkd3d)))
if ((ret = vkd3d_parse_root_signature_v_1_1_from_raw_payload(&dxbc, &root_signature_desc.vkd3d, &compatibility_hash)))
{
WARN("Failed to parse root signature, vkd3d result %d.\n", ret);
return hresult_from_vkd3d_result(ret);
@ -1520,7 +1521,7 @@ static HRESULT d3d12_root_signature_create_from_blob(struct d3d12_device *device
}
else
{
if ((ret = vkd3d_parse_root_signature_v_1_1(&dxbc, &root_signature_desc.vkd3d)) < 0)
if ((ret = vkd3d_parse_root_signature_v_1_1(&dxbc, &root_signature_desc.vkd3d, &compatibility_hash)) < 0)
{
WARN("Failed to parse root signature, vkd3d result %d.\n", ret);
return hresult_from_vkd3d_result(ret);
@ -1537,7 +1538,7 @@ static HRESULT d3d12_root_signature_create_from_blob(struct d3d12_device *device
/* For pipeline libraries, (and later DXR to some degree), we need a way to
* compare root signature objects. */
object->compatibility_hash = vkd3d_shader_hash(&dxbc);
object->compatibility_hash = compatibility_hash;
vkd3d_shader_free_root_signature(&root_signature_desc.vkd3d);
if (FAILED(hr))

@ -166,14 +166,15 @@ static CONST_VTBL struct ID3D12RootSignatureDeserializerVtbl d3d12_root_signatur
static int vkd3d_parse_root_signature_for_version(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *out_desc,
enum vkd3d_root_signature_version target_version,
bool raw_payload)
bool raw_payload,
vkd3d_shader_hash_t *compatibility_hash)
{
struct vkd3d_versioned_root_signature_desc desc, converted_desc;
int ret;
if (raw_payload)
{
if ((ret = vkd3d_shader_parse_root_signature_raw(dxbc->code, dxbc->size, &desc)) < 0)
if ((ret = vkd3d_shader_parse_root_signature_raw(dxbc->code, dxbc->size, &desc, compatibility_hash)) < 0)
{
WARN("Failed to parse root signature, vkd3d result %d.\n", ret);
return ret;
@ -181,7 +182,7 @@ static int vkd3d_parse_root_signature_for_version(const struct vkd3d_shader_code
}
else
{
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &desc)) < 0)
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &desc, compatibility_hash)) < 0)
{
WARN("Failed to parse root signature, vkd3d result %d.\n", ret);
return ret;
@ -209,21 +210,27 @@ static int vkd3d_parse_root_signature_for_version(const struct vkd3d_shader_code
}
int vkd3d_parse_root_signature_v_1_0(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *out_desc)
struct vkd3d_versioned_root_signature_desc *out_desc,
vkd3d_shader_hash_t *compatibility_hash)
{
return vkd3d_parse_root_signature_for_version(dxbc, out_desc, VKD3D_ROOT_SIGNATURE_VERSION_1_0, false);
return vkd3d_parse_root_signature_for_version(dxbc, out_desc, VKD3D_ROOT_SIGNATURE_VERSION_1_0, false,
compatibility_hash);
}
int vkd3d_parse_root_signature_v_1_1(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *out_desc)
struct vkd3d_versioned_root_signature_desc *out_desc,
vkd3d_shader_hash_t *compatibility_hash)
{
return vkd3d_parse_root_signature_for_version(dxbc, out_desc, VKD3D_ROOT_SIGNATURE_VERSION_1_1, false);
return vkd3d_parse_root_signature_for_version(dxbc, out_desc, VKD3D_ROOT_SIGNATURE_VERSION_1_1, false,
compatibility_hash);
}
int vkd3d_parse_root_signature_v_1_1_from_raw_payload(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *out_desc)
struct vkd3d_versioned_root_signature_desc *out_desc,
vkd3d_shader_hash_t *compatibility_hash)
{
return vkd3d_parse_root_signature_for_version(dxbc, out_desc, VKD3D_ROOT_SIGNATURE_VERSION_1_1, true);
return vkd3d_parse_root_signature_for_version(dxbc, out_desc, VKD3D_ROOT_SIGNATURE_VERSION_1_1, true,
compatibility_hash);
}
static HRESULT d3d12_root_signature_deserializer_init(struct d3d12_root_signature_deserializer *deserializer,
@ -234,7 +241,7 @@ static HRESULT d3d12_root_signature_deserializer_init(struct d3d12_root_signatur
deserializer->ID3D12RootSignatureDeserializer_iface.lpVtbl = &d3d12_root_signature_deserializer_vtbl;
deserializer->refcount = 1;
if ((ret = vkd3d_parse_root_signature_v_1_0(dxbc, &deserializer->desc.vkd3d)) < 0)
if ((ret = vkd3d_parse_root_signature_v_1_0(dxbc, &deserializer->desc.vkd3d, NULL)) < 0)
return hresult_from_vkd3d_result(ret);
return S_OK;
@ -412,7 +419,7 @@ static HRESULT d3d12_versioned_root_signature_deserializer_init(struct d3d12_ver
deserializer->ID3D12VersionedRootSignatureDeserializer_iface.lpVtbl = &d3d12_versioned_root_signature_deserializer_vtbl;
deserializer->refcount = 1;
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &deserializer->desc.vkd3d)) < 0)
if ((ret = vkd3d_shader_parse_root_signature(dxbc, &deserializer->desc.vkd3d, NULL)) < 0)
{
WARN("Failed to parse root signature, vkd3d result %d.\n", ret);
return hresult_from_vkd3d_result(ret);

@ -1421,11 +1421,14 @@ HRESULT vkd3d_create_pipeline_layout(struct d3d12_device *device,
VkPipelineLayout *pipeline_layout);
int vkd3d_parse_root_signature_v_1_0(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *desc);
struct vkd3d_versioned_root_signature_desc *desc,
vkd3d_shader_hash_t *compatibility_hash);
int vkd3d_parse_root_signature_v_1_1(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *desc);
struct vkd3d_versioned_root_signature_desc *desc,
vkd3d_shader_hash_t *compatibility_hash);
int vkd3d_parse_root_signature_v_1_1_from_raw_payload(const struct vkd3d_shader_code *dxbc,
struct vkd3d_versioned_root_signature_desc *desc);
struct vkd3d_versioned_root_signature_desc *desc,
vkd3d_shader_hash_t *compatibility_hash);
VkShaderStageFlags vkd3d_vk_stage_flags_from_visibility(D3D12_SHADER_VISIBILITY visibility);
enum vkd3d_shader_visibility vkd3d_shader_visibility_from_d3d12(D3D12_SHADER_VISIBILITY visibility);
@ -2476,6 +2479,7 @@ enum vkd3d_breadcrumb_command_type
VKD3D_BREADCRUMB_COMMAND_IBO,
VKD3D_BREADCRUMB_COMMAND_ROOT_DESC,
VKD3D_BREADCRUMB_COMMAND_ROOT_CONST,
VKD3D_BREADCRUMB_COMMAND_TAG,
};
#ifdef VKD3D_ENABLE_BREADCRUMBS
@ -2499,6 +2503,8 @@ struct vkd3d_breadcrumb_command
uint32_t word_32bit;
uint64_t word_64bit;
uint32_t count;
/* Pointer must remain alive. */
const char *tag;
};
};
@ -3400,6 +3406,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;
@ -3447,6 +3462,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