diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index d42b6110..66a7de9b 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -1507,6 +1507,10 @@ struct vkd3d_shader_combined_resource_sampler_info * particularly useful when targeting environments without separate binding * points for samplers and resources, like OpenGL. * + * No resource-sampler pairs are returned for dynamic accesses to + * resource/sampler descriptor arrays, as can occur in Direct3D shader model + * 5.1 shaders. + * * Members of this structure are allocated by vkd3d-shader and should be freed * with vkd3d_shader_free_scan_combined_resource_sampler_info() when no longer * needed. diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 85210a8b..1517f970 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -655,6 +655,16 @@ static VKD3D_PRINTF_FUNC(3, 4) void vkd3d_shader_scan_error(struct vkd3d_shader_ va_end(args); } +static void VKD3D_PRINTF_FUNC(3, 4) vkd3d_shader_scan_warning(struct vkd3d_shader_scan_context *context, + enum vkd3d_shader_error error, const char *format, ...) +{ + va_list args; + + va_start(args, format); + vkd3d_shader_vwarning(context->message_context, &context->location, error, format, args); + va_end(args); +} + static void vkd3d_shader_scan_context_init(struct vkd3d_shader_scan_context *context, const struct vkd3d_shader_version *version, const struct vkd3d_shader_compile_info *compile_info, @@ -907,6 +917,18 @@ static void vkd3d_shader_scan_combined_sampler_usage(struct vkd3d_shader_scan_co { const struct vkd3d_shader_scan_descriptor_info1 *info = context->scan_descriptor_info; const struct vkd3d_shader_descriptor_info1 *d; + bool dynamic_resource, dynamic_sampler; + + if ((dynamic_resource = resource->idx[1].rel_addr)) + vkd3d_shader_scan_warning(context, VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY, + "Resource descriptor array %u is being dynamically indexed, " + "not recording a combined resource-sampler pair.", resource->idx[0].offset); + if ((dynamic_sampler = sampler && sampler->idx[1].rel_addr)) + vkd3d_shader_scan_warning(context, VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY, + "Sampler descriptor array %u is being dynamically indexed, " + "not recording a combined resource-sampler pair.", sampler->idx[0].offset); + if (dynamic_resource || dynamic_sampler) + return; for (i = 0; i < info->descriptor_count; ++i) { diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index bff49453..41fcf577 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -213,6 +213,8 @@ enum vkd3d_shader_error VKD3D_SHADER_ERROR_VSIR_INVALID_DCL_TEMPS = 9014, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX = 9015, VKD3D_SHADER_ERROR_VSIR_INVALID_INSTRUCTION_NESTING = 9016, + + VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY = 9300, }; enum vkd3d_shader_opcode