From 5e31e9f074ea0bb795b50272f904aebc520d3714 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 27 Feb 2020 14:29:00 -0800 Subject: Fix some IR logic around load from a rate-qualified pointer (#1248) We currently represent the `groupshared` qualifier as a kind of "rate" at the IR level (where a rate can qualify a type to indicate the frequency/rate at which a value is stored and/or computed). This means that when computing the type that a pointer points to, we need to handle both, e.g., `Ptr` and `@GroupShared Ptr`. The logic that was trying to handle the rate-qualified case when deducing the "pointee" type of a pointer was somehow written incorrectly, and was querying `getDataType()` on an `IRRateQualifiedType` which is asking for the type of the type itself (null in this case), rather than `getValueType()` which gets the `T` part from a rate-qualified type `@R T`. Somehow none of our tests were hitting this case, and I'm not immediately clear on how to write a targeted reproducer for this, since the problem arose as a debug-only assertion failure in a user shader with thousands of lines. --- source/slang/slang-ir.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source') diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index b121307ee..62bdb171a 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -244,7 +244,7 @@ namespace Slang { if( auto rateQualType = as(type) ) { - type = rateQualType->getDataType(); + type = rateQualType->getValueType(); } // The "true" pointers and the pointer-like stdlib types are the easy cases. -- cgit v1.2.3