vkd3d-shader/ir: Skip recording combined resource/sampler information for dynamically indexed descriptor arrays.

And output a warning instead.
This commit is contained in:
Henri Verbeet 2023-11-20 14:58:40 +01:00 committed by Alexandre Julliard
parent 5b82afb83f
commit 01dad41862
Notes: Alexandre Julliard 2023-11-21 22:48:39 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/485
3 changed files with 28 additions and 0 deletions

View File

@ -1507,6 +1507,10 @@ struct vkd3d_shader_combined_resource_sampler_info
* particularly useful when targeting environments without separate binding * particularly useful when targeting environments without separate binding
* points for samplers and resources, like OpenGL. * 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 * 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 * with vkd3d_shader_free_scan_combined_resource_sampler_info() when no longer
* needed. * needed.

View File

@ -655,6 +655,16 @@ static VKD3D_PRINTF_FUNC(3, 4) void vkd3d_shader_scan_error(struct vkd3d_shader_
va_end(args); 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, static void vkd3d_shader_scan_context_init(struct vkd3d_shader_scan_context *context,
const struct vkd3d_shader_version *version, const struct vkd3d_shader_version *version,
const struct vkd3d_shader_compile_info *compile_info, 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_scan_descriptor_info1 *info = context->scan_descriptor_info;
const struct vkd3d_shader_descriptor_info1 *d; 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) for (i = 0; i < info->descriptor_count; ++i)
{ {

View File

@ -213,6 +213,8 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_VSIR_INVALID_DCL_TEMPS = 9014, VKD3D_SHADER_ERROR_VSIR_INVALID_DCL_TEMPS = 9014,
VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX = 9015, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX = 9015,
VKD3D_SHADER_ERROR_VSIR_INVALID_INSTRUCTION_NESTING = 9016, VKD3D_SHADER_ERROR_VSIR_INVALID_INSTRUCTION_NESTING = 9016,
VKD3D_SHADER_WARNING_VSIR_DYNAMIC_DESCRIPTOR_ARRAY = 9300,
}; };
enum vkd3d_shader_opcode enum vkd3d_shader_opcode