Fixed handling of constants in source generators
このコミットが含まれているのは:
1 親
30fb7f448c
コミット
3daafd3e16
2ファイル変更
+6
-5
検索条件に一致するファイルはありません
@@ -42,12 +42,11 @@ namespace ComputeSharp.SourceGenerators
|
||||
var structName = structDeclaration.Identifier.Text;
|
||||
var structModifiers = structDeclaration.Modifiers;
|
||||
var fields = (
|
||||
from fieldDeclaration in structDeclaration.Members.OfType<FieldDeclarationSyntax>()
|
||||
let fieldType = fieldDeclaration.Declaration.Type
|
||||
let typeName = semanticModel.GetTypeInfo(fieldType).Type!.ToDisplayString()
|
||||
from fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>()
|
||||
where !fieldSymbol.IsConst
|
||||
let typeName = fieldSymbol.Type!.ToDisplayString()
|
||||
let fieldFullType = ParseTypeName(typeName)
|
||||
from fieldVariable in fieldDeclaration.Declaration.Variables
|
||||
select (Type: fieldFullType, fieldVariable.Identifier)).ToImmutableArray();
|
||||
select (Type: fieldFullType, Identifier: Identifier(fieldSymbol.Name))).ToImmutableArray();
|
||||
|
||||
// Create the constructor declaration for the type. This will
|
||||
// produce a constructor with simple initialization of all variables:
|
||||
|
||||
@@ -141,6 +141,8 @@ namespace ComputeSharp.SourceGenerators
|
||||
}
|
||||
else if (HlslKnownTypes.IsScalarOrVectorType(typeName))
|
||||
{
|
||||
if (fieldSymbol.IsConst) continue;
|
||||
|
||||
var (fieldSize, fieldPack) = HlslKnownSizes.GetTypeInfo(typeName);
|
||||
|
||||
// Calculate the right offset with 16-bytes padding (HLSL constant buffer).
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする