[PATCH vkd3d 4/5] vkd3d-shader: Sanity-check the offset data type in hlsl_reg_from_deref().

Zebediah Figura zfigura at codeweavers.com
Sun May 16 12:47:53 CDT 2021


Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 libs/vkd3d-shader/hlsl_codegen.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 7dd919b8..10bf80b6 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -1171,6 +1171,11 @@ static struct hlsl_reg hlsl_reg_from_deref(const struct hlsl_deref *deref, const
     struct hlsl_reg ret = {0};
     unsigned int offset = 0;
 
+    /* We should always have generated a cast to UINT. */
+    if (offset_node)
+        assert(offset_node->data_type->type == HLSL_CLASS_SCALAR
+                && offset_node->data_type->base_type == HLSL_TYPE_UINT);
+
     if (offset_node && offset_node->type != HLSL_IR_CONSTANT)
     {
         FIXME("Dereference with non-constant offset of type %s.\n", hlsl_node_type_to_string(offset_node->type));
-- 
2.31.1




More information about the wine-devel mailing list