Skip to content

vkd3d-shader/hlsl: Always work with the extern resource's component type.

Francisco Casas requested to merge fcasas/vkd3d:fix_rasteriser_ordered into master

This fixes runtime errors reported by UBSan, such as this:

vkd3d/libs/vkd3d-shader/tpf.c:6075:87: runtime error: load of value 7, which is not a valid value for type '_Bool'

when trying to compile shaders that contain UAV arrays on 4.0 profiles.

Before this commit, tpf.c accesses the

hlsl_type->e.resource.rasteriser_ordered

field, but on 4.0 and 4.1 profiles these code paths can also be reached by UAV arrays which are HLSL_CLASS_ARRAY and this field is not supposed to be accessed.

By coincidence, the value of hlsl_type->e.array.elements_count is being read because these fields have the same offset in the hlsl_type.e union.

Merge request reports

Loading