From 60ebadab1ec269c7017148a028307a9b5f32b1d4 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 10 Aug 2023 13:19:37 -0700 Subject: Allow member lookup through modified type. (#3091) * Allow member lookup through modified type. * Disable `lockFileSync` test. --------- Co-authored-by: Yong He --- source/slang/slang-check-expr.cpp | 7 ++++++- tests/bugs/gh-3086.slang | 11 +++++++++++ tools/slang-unit-test/unit-test-lock-file.cpp | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 tests/bugs/gh-3086.slang diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index e343e3113..05cb6262b 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -3574,7 +3574,12 @@ namespace Slang Expr* SemanticsExprVisitor::visitMemberExpr(MemberExpr * expr) { expr->baseExpression = checkBaseForMemberExpr(expr->baseExpression); - auto & baseType = expr->baseExpression->type; + auto baseType = expr->baseExpression->type; + + // If we are looking up through a modified type, just pass straight + // through the inner type. + if (auto modifiedType = as(baseType)) + baseType = modifiedType->getBase(); // Note: Checking for vector types before declaration-reference types, // because vectors are also declaration reference types... diff --git a/tests/bugs/gh-3086.slang b/tests/bugs/gh-3086.slang new file mode 100644 index 000000000..a4e9025c4 --- /dev/null +++ b/tests/bugs/gh-3086.slang @@ -0,0 +1,11 @@ +//TEST:SIMPLE(filecheck=CHECK): -entry MainCs -stage compute -profile glsl_450 -target spirv +//CHECK: EntryPoint + +[vk::image_format("rgba8")] +RWTexture2D < unorm float4 > DstColor ; + +[ numthreads ( 64 , 1 , 1 ) ] +void MainCs ( uint3 Gid : SV_GroupID , uint GI : SV_GroupIndex , uint3 GTid : SV_GroupThreadID , uint3 DTid : SV_DispatchThreadID ) +{ + DstColor [ 0 ] = float4 ( lerp ( DstColor [ 0 ].rgb, float3( 0, 0, 0 ), 1.0 ) , 1.0f ) ; +} diff --git a/tools/slang-unit-test/unit-test-lock-file.cpp b/tools/slang-unit-test/unit-test-lock-file.cpp index 312d9a1e2..be767a5ee 100644 --- a/tools/slang-unit-test/unit-test-lock-file.cpp +++ b/tools/slang-unit-test/unit-test-lock-file.cpp @@ -29,9 +29,9 @@ SLANG_UNIT_TEST(lockFileOpenClose) SLANG_UNIT_TEST(lockFileSync) { - // aarch64 builds currently fail to run multi-threaded tests within the test-server. + // aarch64/linux builds currently fail to run multi-threaded tests within the test-server. // Tests work fine without the test-server, which is puzzling. For now we disable them. -#if SLANG_PROCESSOR_ARM_64 +#if SLANG_PROCESSOR_ARM_64 || SLANG_LINUX SLANG_IGNORE_TEST #endif -- cgit v1.2.3