From d0f342c9263a0e47947ac3be9fa4d9f665831e63 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 11 Jul 2025 03:22:59 +0000 Subject: Fix int16_t/uint16_t support for WGSL target (#7692) * Initial plan * Implement int16_t/uint16_t support for WGSL target Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Change int16_t/uint16_t to emit proper diagnostics instead of auto-promoting Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Implement diagnoseOnce to prevent duplicate diagnostics Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Optimize diagnoseOnce to use HashSet::add() return value Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Apply code formatting to slang-emit-c-like.h Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix diagnoseOnce to use all parameters instead of first parameter only Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> --- source/slang/slang-emit-wgsl.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/slang/slang-emit-wgsl.cpp') diff --git a/source/slang/slang-emit-wgsl.cpp b/source/slang/slang-emit-wgsl.cpp index 97b57d352..fbcb54d10 100644 --- a/source/slang/slang-emit-wgsl.cpp +++ b/source/slang/slang-emit-wgsl.cpp @@ -515,8 +515,10 @@ void WGSLSourceEmitter::emitSimpleTypeImpl(IRType* type) return; } case kIROp_Int16Type: + diagnoseOnce(SourceLoc(), Diagnostics::int16NotSupportedInWGSL, "int16_t"); + return; case kIROp_UInt16Type: - SLANG_UNEXPECTED("16 bit integer value emitted"); + diagnoseOnce(SourceLoc(), Diagnostics::int16NotSupportedInWGSL, "uint16_t"); return; case kIROp_Int64Type: case kIROp_IntPtrType: @@ -976,9 +978,13 @@ void WGSLSourceEmitter::emitSimpleValueImpl(IRInst* inst) break; } case BaseType::Int16: + { + diagnoseOnce(SourceLoc(), Diagnostics::int16NotSupportedInWGSL, "int16_t"); + break; + } case BaseType::UInt16: { - SLANG_UNEXPECTED("16 bit integer value emitted"); + diagnoseOnce(SourceLoc(), Diagnostics::int16NotSupportedInWGSL, "uint16_t"); break; } case BaseType::Int: -- cgit v1.2.3