From 56e49feea3956d66e41b819c26628c65b3c28197 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Wed, 22 Nov 2017 11:28:29 -0800 Subject: Fix emitting of loop attributes for HLSL pass-through (#296) Fixes #295. The code previously had a white list of attributes that it passed through, implemented in `emit.cpp` in an ad hoc fashion. The fix here is to just pass through whatever attributes the user wrote, and then let the downstream compiler diagnose if any of them are errorneous. --- source/slang/emit.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'source') diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index 4cad7b28d..22dcf4333 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -2708,18 +2708,12 @@ struct EmitVisitor for(auto attr : decl->GetModifiersOfType()) { - if(getText(attr->getName()) == "loop") - { - Emit("[loop]"); - } - else if(getText(attr->getName()) == "unroll") - { - Emit("[unroll]"); - } - else if(getText(attr->getName()) == "allow_uav_condition") - { - Emit("[allow_uav_condition]"); - } + // Emit whatever attributes the user might have attached, + // whether or not we think they make semantic sense. + // + Emit("["); + emit(attr->getName()); + Emit("]"); } } -- cgit v1.2.3