vkd3d-shader: Fix multiple constant buffers with RAW_VA

Consider we have declarations of CB0 of size 36 and CB1 of size 153.
Previously we'd just return the struct of CB0 when accessing CB1 because it came first as we didn't consider the size.

Psychonauts 2 indexes into CB1 by constant values above 36.
There is no reason a compiler could not eliminate these reads as it is technically out of bounds for the underlying array type.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
Joshua Ashton 2021-08-26 00:45:08 +01:00 committed by Hans-Kristian Arntzen
parent 5ef3d4bff9
commit 56e12d88ce
1 changed files with 1 additions and 1 deletions

View File

@ -5575,7 +5575,7 @@ static const struct vkd3d_shader_buffer_reference_type *vkd3d_dxbc_compiler_get_
{
type = &compiler->buffer_ref_types[i];
if (type->data_type == data_type && type->flags == flags)
if (type->data_type == data_type && type->flags == flags && type->length == length)
return type;
}