Use explicit types everywhere

このコミットが含まれているのは:
Sergio Pedri committed 2022-10-15 09:10:18 -07:00
1 親 27c629f3b4
コミット 16c0fc9aab
74ファイル変更
+455 -446

検索条件に一致するファイルはありません

@@ -64,13 +64,13 @@ partial class ID2D1ShaderGenerator
out ImmutableArray<(string Name, string HlslType, int Index)> resourceTextureFields);
// Explore the syntax tree and extract the processed info
var semanticModelProvider = new SemanticModelProvider(compilation);
var (entryPoint, processedMethods) = GetProcessedMethods(diagnostics, structDeclaration, structDeclarationSymbol, semanticModelProvider, discoveredTypes, staticMethods, instanceMethods, constantDefinitions, out bool methodsNeedD2D1RequiresScenePosition);
var staticFields = GetStaticFields(diagnostics, semanticModelProvider, structDeclaration, structDeclarationSymbol, discoveredTypes, constantDefinitions, out bool fieldsNeedD2D1RequiresScenePosition);
SemanticModelProvider semanticModelProvider = new SemanticModelProvider(compilation);
(string entryPoint, ImmutableArray<(string Signature, string Definition)> processedMethods) = GetProcessedMethods(diagnostics, structDeclaration, structDeclarationSymbol, semanticModelProvider, discoveredTypes, staticMethods, instanceMethods, constantDefinitions, out bool methodsNeedD2D1RequiresScenePosition);
ImmutableArray<(string Name, string TypeDeclaration, string? Assignment)> staticFields = GetStaticFields(diagnostics, semanticModelProvider, structDeclaration, structDeclarationSymbol, discoveredTypes, constantDefinitions, out bool fieldsNeedD2D1RequiresScenePosition);
// Process the discovered types and constants
var declaredTypes = GetDeclaredTypes(diagnostics, structDeclarationSymbol, discoveredTypes, instanceMethods);
var definedConstants = GetDefinedConstants(constantDefinitions);
ImmutableArray<(string Name, string Definition)> declaredTypes = GetDeclaredTypes(diagnostics, structDeclarationSymbol, discoveredTypes, instanceMethods);
ImmutableArray<(string Name, string Value)> definedConstants = GetDefinedConstants(constantDefinitions);
// Check whether the scene position is required
bool requiresScenePosition = GetD2DRequiresScenePositionInfo(structDeclarationSymbol);
@@ -111,7 +111,7 @@ partial class ID2D1ShaderGenerator
using ImmutableArrayBuilder<(string, string)> values = ImmutableArrayBuilder<(string, string)>.Rent();
using ImmutableArrayBuilder<(string, string, int)> resourceTextures = ImmutableArrayBuilder<(string, string, int)>.Rent();
foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
foreach (IFieldSymbol fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
{
if (fieldSymbol.IsStatic)
{
@@ -205,9 +205,9 @@ partial class ID2D1ShaderGenerator
needsD2D1RequiresScenePosition = false;
foreach (var fieldDeclaration in structDeclaration.Members.OfType<FieldDeclarationSyntax>())
foreach (FieldDeclarationSyntax fieldDeclaration in structDeclaration.Members.OfType<FieldDeclarationSyntax>())
{
foreach (var variableDeclarator in fieldDeclaration.Declaration.Variables)
foreach (VariableDeclaratorSyntax variableDeclarator in fieldDeclaration.Declaration.Variables)
{
IFieldSymbol fieldSymbol = (IFieldSymbol)semanticModel.For(variableDeclarator).GetDeclaredSymbol(variableDeclarator)!;
@@ -319,7 +319,7 @@ partial class ID2D1ShaderGenerator
needsD2D1RequiresScenePosition |= shaderSourceRewriter.NeedsD2DRequiresScenePositionAttribute;
// Emit the extracted local functions first
foreach (var localFunction in shaderSourceRewriter.LocalFunctions)
foreach (KeyValuePair<string, LocalFunctionStatementSyntax> localFunction in shaderSourceRewriter.LocalFunctions)
{
methods.Add((
localFunction.Value.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString(),
@@ -362,10 +362,10 @@ partial class ID2D1ShaderGenerator
{
using ImmutableArrayBuilder<(string, string)> builder = ImmutableArrayBuilder<(string, string)>.Rent();
foreach (var constant in constantDefinitions)
foreach (KeyValuePair<IFieldSymbol, string> constant in constantDefinitions)
{
var ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
var constantName = $"__{ownerTypeName}__{constant.Key.Name}";
string ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
string constantName = $"__{ownerTypeName}__{constant.Key.Name}";
builder.Add((constantName, constant.Value));
}
@@ -392,13 +392,13 @@ partial class ID2D1ShaderGenerator
IReadOnlyCollection<INamedTypeSymbol> invalidTypes;
// Process the discovered types
foreach (var type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes))
foreach (INamedTypeSymbol type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes))
{
var structType = type.GetFullMetadataName().ToHlslIdentifierName();
var structDeclaration = StructDeclaration(structType);
string structType = type.GetFullMetadataName().ToHlslIdentifierName();
StructDeclarationSyntax structDeclaration = StructDeclaration(structType);
// Declare the fields of the current type
foreach (var field in type.GetMembers().OfType<IFieldSymbol>())
foreach (IFieldSymbol field in type.GetMembers().OfType<IFieldSymbol>())
{
if (field.IsStatic) continue;
@@ -423,7 +423,7 @@ partial class ID2D1ShaderGenerator
}
// Declare the methods of the current type
foreach (var method in instanceMethods.Where(pair => SymbolEqualityComparer.Default.Equals(pair.Key.ContainingType, type)))
foreach (KeyValuePair<IMethodSymbol, MethodDeclarationSyntax> method in instanceMethods.Where(pair => SymbolEqualityComparer.Default.Equals(pair.Key.ContainingType, type)))
{
structDeclaration = structDeclaration.AddMembers(method.Value);
}
@@ -453,7 +453,7 @@ partial class ID2D1ShaderGenerator
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
private static void DetectAndReportInvalidPropertyDeclarations(ImmutableArrayBuilder<DiagnosticInfo> diagnostics, INamedTypeSymbol structDeclarationSymbol)
{
foreach (var memberSymbol in structDeclarationSymbol.GetMembers())
foreach (ISymbol memberSymbol in structDeclarationSymbol.GetMembers())
{
// Detect properties that are not explicit interface implementations
if (memberSymbol is IPropertySymbol { ExplicitInterfaceImplementations.IsEmpty: true })
@@ -574,7 +574,7 @@ partial class ID2D1ShaderGenerator
{
AppendLF();
foreach (var (name, value) in definedConstants)
foreach ((string name, string value) in definedConstants)
{
AppendLineAndLF($"#define {name} {value}");
}
@@ -585,7 +585,7 @@ partial class ID2D1ShaderGenerator
{
AppendLF();
foreach (var field in staticFields)
foreach ((string Name, string TypeDeclaration, string? Assignment) field in staticFields)
{
if (field.Assignment is string assignment)
{
@@ -599,7 +599,7 @@ partial class ID2D1ShaderGenerator
}
// Declared types
foreach (var (_, typeDefinition) in declaredTypes)
foreach ((string _, string typeDefinition) in declaredTypes)
{
AppendLF();
AppendLineAndLF(typeDefinition);
@@ -610,14 +610,14 @@ partial class ID2D1ShaderGenerator
{
AppendLF();
foreach (var (fieldName, fieldType) in valueFields)
foreach ((string fieldName, string fieldType) in valueFields)
{
AppendLineAndLF($"{fieldType} {fieldName};");
}
}
// Resource textures
foreach (var (fieldName, fieldType, index) in resourceTextureFields)
foreach ((string fieldName, string fieldType, int index) in resourceTextureFields)
{
AppendLF();
@@ -626,14 +626,14 @@ partial class ID2D1ShaderGenerator
}
// Forward declarations
foreach (var (forwardDeclaration, _) in processedMethods)
foreach ((string forwardDeclaration, string _) in processedMethods)
{
AppendLF();
AppendLineAndLF(forwardDeclaration);
}
// Captured methods
foreach (var (_, method) in processedMethods)
foreach ((string _, string method) in processedMethods)
{
AppendLF();
AppendLineAndLF(method);
@@ -72,7 +72,7 @@ partial class ID2D1ShaderGenerator
else if (fieldSymbol.Type.IsUnmanagedType)
{
// Custom struct type defined by the user
foreach (var fieldInfo in GetCapturedFieldInfos(fieldSymbol.Type, fieldPath.Add(fieldName), rawDataOffset))
foreach (FieldInfo fieldInfo in GetCapturedFieldInfos(fieldSymbol.Type, fieldPath.Add(fieldName), rawDataOffset))
{
yield return fieldInfo;
}
@@ -117,7 +117,7 @@ partial class ID2D1ShaderGenerator
{
// For scalar, vector and linear matrix types, serialize the value normally.
// Only the initial alignment needs to be considered, while data is packed.
var (fieldSize, fieldPack) = HlslKnownSizes.GetTypeInfo(typeName);
(int fieldSize, int fieldPack) = HlslKnownSizes.GetTypeInfo(typeName);
// Check if the current type is a matrix type with more than one row. In this
// case, each row is aligned as if it was a separate array, so the start of
@@ -33,7 +33,7 @@ partial class ID2D1ShaderGenerator
{
using ImmutableArrayBuilder<(int? Index, int Rank)> resourceTextureInfos = ImmutableArrayBuilder<(int? Index, int Rank)>.Rent();
foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
foreach (IFieldSymbol fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
{
// Only look for fields of a named type symbol (diagnostics is emitted by the HLSL rewriter if it's not the case).
// We're only looking for instance fields of unmanaged types in this case (as resource textures are structs).
+1 -1
ファイルの表示
@@ -12,7 +12,7 @@ partial class HlslKnownKeywords
static partial void AddKnownKeywords(ICollection<string> knownKeywords)
{
// D2D1 intrinsics method names
foreach (var method in typeof(D2D).GetMethods(BindingFlags.Public | BindingFlags.Static))
foreach (MethodInfo? method in typeof(D2D).GetMethods(BindingFlags.Public | BindingFlags.Static))
{
string name = method.GetCustomAttribute<HlslIntrinsicNameAttribute>()?.Name ?? method.Name;
+1 -1
ファイルの表示
@@ -26,7 +26,7 @@ partial class HlslKnownMethods
static partial void AddKnownMethods(IDictionary<string, string> knownMethods)
{
// Programmatically load mappings from the D2D1 class as well
foreach (var method in
foreach (MethodInfo? method in
from method in typeof(D2D).GetMethods(BindingFlags.Public | BindingFlags.Static)
group method by method.Name
into groups
+4 -4
ファイルの表示
@@ -29,10 +29,10 @@ internal sealed class D2D1AffineTransformMapperFactory
Point64 bottomRight = new(rectangle.Right, rectangle.Bottom);
// Transform them with the current matrix
var transformedTopLeft = topLeft.Transform(in matrix);
var transformedTopRight = topRight.Transform(in matrix);
var transformedBottomLeft = bottomLeft.Transform(in matrix);
var transformedBottomRight = bottomRight.Transform(in matrix);
(double X, double Y) transformedTopLeft = topLeft.Transform(in matrix);
(double X, double Y) transformedTopRight = topRight.Transform(in matrix);
(double X, double Y) transformedBottomLeft = bottomLeft.Transform(in matrix);
(double X, double Y) transformedBottomRight = bottomRight.Transform(in matrix);
// Calculate the bounding box of the transformed points
double transformedLeft = Math.Min(Math.Min(transformedTopLeft.X, transformedTopRight.X), Math.Min(transformedBottomLeft.X, transformedBottomRight.X));
+3 -2
ファイルの表示
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -44,13 +45,13 @@ internal static partial class HlslKnownKeywords
});
// HLSL primitive names
foreach (var type in HlslKnownTypes.KnownVectorTypes.Concat(HlslKnownTypes.KnownMatrixTypes))
foreach (Type? type in HlslKnownTypes.KnownVectorTypes.Concat(HlslKnownTypes.KnownMatrixTypes))
{
_ = knownKeywords.Add(type.Name.ToLowerInvariant());
}
// HLSL intrinsics method names
foreach (var method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static))
foreach (MethodInfo? method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static))
{
string name = method.GetCustomAttribute<HlslIntrinsicNameAttribute>()?.Name ?? method.Name;
+2 -2
ファイルの表示
@@ -128,7 +128,7 @@ internal static partial class HlslKnownMethods
};
// Programmatically load mappings from the Hlsl class as well (the ones with no parameter matching)
foreach (var method in
foreach (MethodInfo? method in
from method in typeof(Hlsl).GetMethods(BindingFlags.Public | BindingFlags.Static)
group method by method.Name
into groups
@@ -171,7 +171,7 @@ internal static partial class HlslKnownMethods
Dictionary<string, string> knownMethods = new();
// Go through the previously discovered methods to find the ones requiring parameters mapping
foreach (var pair in KnownMethods)
foreach (KeyValuePair<string, string> pair in KnownMethods)
{
// Only process methods marked as requiring parameters mapping
if (pair.Value != nameof(HlslIntrinsicNameAttribute.RequiresParametersMatching))
+1 -1
ファイルの表示
@@ -24,7 +24,7 @@ internal static partial class HlslKnownOperators
Dictionary<string, string> knownOperators = new();
// Programmatically load mappings for the intrinsic operators on each HLSL primitive type
foreach (var item in
foreach ((Type Type, MethodInfo Operator, string IntrinsicName, bool RequiresParametersMatching) item in
from type in HlslKnownTypes.KnownVectorTypes.Concat(HlslKnownTypes.KnownMatrixTypes)
from method in type.GetMethods(BindingFlags.Static | BindingFlags.Public)
where method.IsSpecialName && method.Name.StartsWith("op_")
+3 -3
ファイルの表示
@@ -140,7 +140,7 @@ internal static partial class HlslKnownProperties
};
// Programmatically load mappings for the instance members of the HLSL vector types
foreach (var item in
foreach ((Type Type, PropertyInfo Property) item in
from type in HlslKnownTypes.KnownVectorTypes
from property in type.GetProperties(BindingFlags.Instance | BindingFlags.Public)
select (Type: type, Property: property))
@@ -149,7 +149,7 @@ internal static partial class HlslKnownProperties
}
// Load mappings for the matrix properties as well
foreach (var item in
foreach ((Type Type, PropertyInfo Property) item in
from type in HlslKnownTypes.KnownMatrixTypes
from property in type.GetProperties(BindingFlags.Instance | BindingFlags.Public)
where Regex.IsMatch(property.Name, "^M[1-4]{2}$")
@@ -282,7 +282,7 @@ internal static partial class HlslKnownProperties
/// <returns>Whether or not a rank and axis could be resolved by the input indexer name.</returns>
public static bool TryGetAccessorRankAndAxis(string name, out int rank, out int axis)
{
if (KnownSizeAccessors.TryGetValue(name, out var info))
if (KnownSizeAccessors.TryGetValue(name, out (int Rank, int Axis) info))
{
(rank, axis) = info;
+2 -1
ファイルの表示
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
@@ -35,7 +36,7 @@ internal static class HlslKnownSizes
};
foreach (
var type in
Type? type in
from type in Assembly.GetExecutingAssembly().ExportedTypes
where Regex.IsMatch(type.FullName, @"^ComputeSharp\.(Bool|Double|Float|Int|UInt)")
select type)
+8 -8
ファイルの表示
@@ -78,13 +78,13 @@ internal static partial class HlslKnownTypes
};
// Add all the vector types
foreach (var type in KnownVectorTypes)
foreach (Type type in KnownVectorTypes)
{
knownTypes.Add(type.FullName, type.Name.ToLowerInvariant());
}
// Add all the matrix types
foreach (var type in KnownMatrixTypes)
foreach (Type type in KnownMatrixTypes)
{
knownTypes.Add(type.FullName, type.Name.ToLowerInvariant());
}
@@ -135,7 +135,7 @@ internal static partial class HlslKnownTypes
{
if (KnownMatrixTypes.Any(type => type.FullName == typeName))
{
var match = Regex.Match(typeName, @"^ComputeSharp\.(Bool|Int|UInt|Float|Double)([2-4])x([1-4])$");
Match match = Regex.Match(typeName, @"^ComputeSharp\.(Bool|Int|UInt|Float|Double)([2-4])x([1-4])$");
if (match.Success)
{
@@ -243,7 +243,7 @@ internal static partial class HlslKnownTypes
if (!customTypes.Add(type)) return;
foreach (var field in type.GetMembers().OfType<IFieldSymbol>())
foreach (IFieldSymbol field in type.GetMembers().OfType<IFieldSymbol>())
{
if (field.IsStatic) continue;
@@ -291,12 +291,12 @@ internal static partial class HlslKnownTypes
// types and their dependencies, and iteratively remove items from the map when they have no
// dependencies left. When one type is processed and removed, it is also removed from the list
// of dependencies of all other remaining types in the map, until there is none left.
foreach (var type in types)
foreach (INamedTypeSymbol type in types)
{
HashSet<INamedTypeSymbol> dependencies = new(SymbolEqualityComparer.Default);
// Only add other custom types as dependencies, and ignore HLSL types
foreach (var field in type.GetMembers().OfType<IFieldSymbol>())
foreach (IFieldSymbol field in type.GetMembers().OfType<IFieldSymbol>())
{
if (field.IsStatic) continue;
@@ -314,13 +314,13 @@ internal static partial class HlslKnownTypes
while (queue.Count > 0)
{
var entry = queue.Dequeue();
(INamedTypeSymbol Type, HashSet<INamedTypeSymbol> Fields) entry = queue.Dequeue();
// No dependencies left, we can declare this type
if (entry.Fields.Count == 0)
{
// Remove the current type from dependencies of others
foreach (var pair in queue)
foreach ((INamedTypeSymbol Type, HashSet<INamedTypeSymbol> Fields) pair in queue)
{
_ = pair.Fields.Remove(entry.Type);
}
@@ -11,7 +11,7 @@ partial class HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitAnonymousObjectCreationExpression(AnonymousObjectCreationExpressionSyntax node)
{
var updatedNode = (AnonymousObjectCreationExpressionSyntax)base.VisitAnonymousObjectCreationExpression(node)!;
AnonymousObjectCreationExpressionSyntax updatedNode = (AnonymousObjectCreationExpressionSyntax)base.VisitAnonymousObjectCreationExpression(node)!;
Diagnostics.Add(AnonymousObjectCreationExpression, node);
+13 -13
ファイルの表示
@@ -68,7 +68,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode VisitCastExpression(CastExpressionSyntax node)
{
var updatedNode = (CastExpressionSyntax)base.VisitCastExpression(node)!;
CastExpressionSyntax updatedNode = (CastExpressionSyntax)base.VisitCastExpression(node)!;
return updatedNode.ReplaceAndTrackType(updatedNode.Type, node.Type, SemanticModel.For(node), DiscoveredTypes);
}
@@ -76,7 +76,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitVariableDeclaration(VariableDeclarationSyntax node)
{
var updatedNode = (VariableDeclarationSyntax)base.VisitVariableDeclaration(node)!;
VariableDeclarationSyntax updatedNode = (VariableDeclarationSyntax)base.VisitVariableDeclaration(node)!;
if (SemanticModel.For(node).GetTypeInfo(node.Type).Type is ITypeSymbol { IsUnmanagedType: false } type)
{
@@ -95,7 +95,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node)
{
var updatedNode = (ObjectCreationExpressionSyntax)base.VisitObjectCreationExpression(node)!;
ObjectCreationExpressionSyntax updatedNode = (ObjectCreationExpressionSyntax)base.VisitObjectCreationExpression(node)!;
if (SemanticModel.For(node).GetTypeInfo(node).Type is ITypeSymbol { IsUnmanagedType: false } type)
{
@@ -131,7 +131,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode VisitImplicitObjectCreationExpression(ImplicitObjectCreationExpressionSyntax node)
{
var updatedNode = (ImplicitObjectCreationExpressionSyntax)base.VisitImplicitObjectCreationExpression(node)!;
ImplicitObjectCreationExpressionSyntax updatedNode = (ImplicitObjectCreationExpressionSyntax)base.VisitImplicitObjectCreationExpression(node)!;
if (SemanticModel.For(node).GetTypeInfo(node).Type is ITypeSymbol { IsUnmanagedType: false } type)
{
@@ -167,7 +167,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode VisitDefaultExpression(DefaultExpressionSyntax node)
{
var updatedNode = (DefaultExpressionSyntax)base.VisitDefaultExpression(node)!;
DefaultExpressionSyntax updatedNode = (DefaultExpressionSyntax)base.VisitDefaultExpression(node)!;
updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.Type, node.Type, SemanticModel.For(node), DiscoveredTypes);
@@ -178,7 +178,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitLiteralExpression(LiteralExpressionSyntax node)
{
var updatedNode = (LiteralExpressionSyntax)base.VisitLiteralExpression(node)!;
LiteralExpressionSyntax updatedNode = (LiteralExpressionSyntax)base.VisitLiteralExpression(node)!;
if (updatedNode.IsKind(SyntaxKind.DefaultLiteralExpression))
{
@@ -236,7 +236,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitElementAccessExpression(ElementAccessExpressionSyntax node)
{
var updatedNode = (ElementAccessExpressionSyntax)base.VisitElementAccessExpression(node)!;
ElementAccessExpressionSyntax updatedNode = (ElementAccessExpressionSyntax)base.VisitElementAccessExpression(node)!;
if (SemanticModel.For(node).GetOperation(node) is IPropertyReferenceOperation operation)
{
@@ -246,7 +246,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
// For instance: texture[ThreadIds.X, ThreadIds.Y] will be rewritten as texture[int2(ThreadIds.X, ThreadIds.Y)].
if (HlslKnownProperties.TryGetMappedResourceIndexerTypeName(propertyName, out string? mapping))
{
var index = InvocationExpression(IdentifierName(mapping!), ArgumentList(updatedNode.ArgumentList.Arguments));
InvocationExpressionSyntax index = InvocationExpression(IdentifierName(mapping!), ArgumentList(updatedNode.ArgumentList.Arguments));
return updatedNode.WithArgumentList(BracketedArgumentList(SingletonSeparatedList(Argument(index))));
}
@@ -294,7 +294,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitAssignmentExpression(AssignmentExpressionSyntax node)
{
var updatedNode = (AssignmentExpressionSyntax)base.VisitAssignmentExpression(node)!;
AssignmentExpressionSyntax updatedNode = (AssignmentExpressionSyntax)base.VisitAssignmentExpression(node)!;
if (SemanticModel.For(node).GetOperation(node) is ICompoundAssignmentOperation { OperatorMethod: { ContainingType.ContainingNamespace.Name: "ComputeSharp" } method })
{
@@ -321,7 +321,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitBinaryExpression(BinaryExpressionSyntax node)
{
var updatedNode = (BinaryExpressionSyntax)base.VisitBinaryExpression(node)!;
BinaryExpressionSyntax updatedNode = (BinaryExpressionSyntax)base.VisitBinaryExpression(node)!;
// Process binary operations to see if the target operator method is an intrinsic
if (SemanticModel.For(node).GetOperation(node) is IBinaryOperation { OperatorMethod: { ContainingType.ContainingNamespace.Name: "ComputeSharp" } method })
@@ -346,7 +346,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitIdentifierName(IdentifierNameSyntax node)
{
var updatedNode = (IdentifierNameSyntax)base.VisitIdentifierName(node)!;
IdentifierNameSyntax updatedNode = (IdentifierNameSyntax)base.VisitIdentifierName(node)!;
if (SemanticModel.For(node).GetOperation(node) is IFieldReferenceOperation operation &&
operation.Field.IsConst &&
@@ -354,8 +354,8 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
{
ConstantDefinitions[operation.Field] = ((IFormattable)operation.Field.ConstantValue!).ToString(null, CultureInfo.InvariantCulture);
var ownerTypeName = ((INamedTypeSymbol)operation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
var constantName = $"__{ownerTypeName}__{operation.Field.Name}";
string ownerTypeName = ((INamedTypeSymbol)operation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
string constantName = $"__{ownerTypeName}__{operation.Field.Name}";
return IdentifierName(constantName);
}
+17 -17
ファイルの表示
@@ -129,7 +129,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
this.currentMethodIdentifier = node.Identifier;
var updatedNode = (MethodDeclarationSyntax?)base.Visit(node)!;
MethodDeclarationSyntax? updatedNode = (MethodDeclarationSyntax?)base.Visit(node)!;
updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.ReturnType, node!.ReturnType, SemanticModel.For(node), DiscoveredTypes);
@@ -145,7 +145,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
if (updatedNode is not null)
{
var implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
BlockSyntax implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
// Add the tracked implicit declarations (at the start of the body)
updatedNode = updatedNode.WithBody(implicitBlock).AddBodyStatements(updatedNode.Body!.Statements.ToArray());
@@ -164,7 +164,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
this.currentMethodIdentifier = node.Identifier;
var updatedNode = (LocalFunctionStatementSyntax?)base.Visit(node)!;
LocalFunctionStatementSyntax? updatedNode = (LocalFunctionStatementSyntax?)base.Visit(node)!;
updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.ReturnType, node!.ReturnType, SemanticModel.For(node), DiscoveredTypes);
@@ -180,7 +180,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
if (updatedNode is not null)
{
var implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
BlockSyntax implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
updatedNode = updatedNode.WithBody(implicitBlock).AddBodyStatements(updatedNode.Body!.Statements.ToArray());
}
@@ -191,7 +191,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode VisitParameter(ParameterSyntax node)
{
var updatedNode = (ParameterSyntax)base.VisitParameter(node)!;
ParameterSyntax updatedNode = (ParameterSyntax)base.VisitParameter(node)!;
// Convert the C# parameter modifiers to the HLSL equivalent
SyntaxToken modifier =
@@ -214,7 +214,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode VisitLocalDeclarationStatement(LocalDeclarationStatementSyntax node)
{
var updatedNode = ((LocalDeclarationStatementSyntax)base.VisitLocalDeclarationStatement(node)!);
LocalDeclarationStatementSyntax updatedNode = ((LocalDeclarationStatementSyntax)base.VisitLocalDeclarationStatement(node)!);
if (SemanticModel.For(node).GetOperation(node) is IOperation { Kind: OperationKind.UsingDeclaration })
{
@@ -227,7 +227,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitDeclarationExpression(DeclarationExpressionSyntax node)
{
var updatedNode = (DeclarationExpressionSyntax)base.VisitDeclarationExpression(node)!;
DeclarationExpressionSyntax updatedNode = (DeclarationExpressionSyntax)base.VisitDeclarationExpression(node)!;
updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.Type, node.Type, SemanticModel.For(node), DiscoveredTypes);
@@ -255,7 +255,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
// being parsed. That is, this was a blobal method that was annotated in source.
if (node.Identifier == this.currentMethodIdentifier)
{
var updatedNode =
LocalFunctionStatementSyntax updatedNode =
((LocalFunctionStatementSyntax)base.VisitLocalFunctionStatement(node)!)
.WithBlockBody()
.WithAttributeLists(List<AttributeListSyntax>());
@@ -278,7 +278,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
{
this.localFunctionDepth++;
var updatedNode =
LocalFunctionStatementSyntax updatedNode =
((LocalFunctionStatementSyntax)base.VisitLocalFunctionStatement(node)!)
.WithBlockBody()
.WithAttributeLists(List<AttributeListSyntax>())
@@ -311,7 +311,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node)
{
var updatedNode = (MemberAccessExpressionSyntax)base.VisitMemberAccessExpression(node)!;
MemberAccessExpressionSyntax updatedNode = (MemberAccessExpressionSyntax)base.VisitMemberAccessExpression(node)!;
if (node.IsKind(SyntaxKind.SimpleMemberAccessExpression) &&
SemanticModel.For(node).GetOperation(node) is IMemberReferenceOperation operation)
@@ -329,8 +329,8 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
ConstantDefinitions[fieldOperation.Field] = ((IFormattable)fieldOperation.Field.ConstantValue!).ToString(null, CultureInfo.InvariantCulture);
var ownerTypeName = ((INamedTypeSymbol)fieldOperation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
var constantName = $"__{ownerTypeName}__{fieldOperation.Field.Name}";
string ownerTypeName = ((INamedTypeSymbol)fieldOperation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
string constantName = $"__{ownerTypeName}__{fieldOperation.Field.Name}";
return IdentifierName(constantName);
}
@@ -419,7 +419,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitInvocationExpression(InvocationExpressionSyntax node)
{
var updatedNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node)!;
InvocationExpressionSyntax updatedNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node)!;
if (SemanticModel.For(node).GetOperation(node) is IInvocationOperation { TargetMethod: IMethodSymbol method } operation)
{
@@ -447,7 +447,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
// updated name is detailed in the override handling the local function statement.
if (method.MethodKind == MethodKind.LocalFunction)
{
var functionIdentifier = $"__{this.currentMethodIdentifier.Text}__{method.Name}";
string functionIdentifier = $"__{this.currentMethodIdentifier.Text}__{method.Name}";
return updatedNode.WithExpression(IdentifierName(functionIdentifier));
}
@@ -458,7 +458,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
// type as well, as they will be processed by the generator in a different path.
if (!SymbolEqualityComparer.Default.Equals(this.shaderType, method.ContainingType))
{
var methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName();
string methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName();
if (!this.staticMethods.ContainsKey(method))
{
@@ -503,7 +503,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
{
DiscoveredTypes.Add(structTypeSymbol);
var methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName();
string methodIdentifier = method.GetFullMetadataName().ToHlslIdentifierName();
// Same as for static methods, ensure the method is available in source, and process it if so
if (!this.instanceMethods.ContainsKey(method))
@@ -540,7 +540,7 @@ internal sealed partial class ShaderSourceRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitArgument(ArgumentSyntax node)
{
var updatedNode = (ArgumentSyntax)base.VisitArgument(node)!;
ArgumentSyntax updatedNode = (ArgumentSyntax)base.VisitArgument(node)!;
// Strip the ref keywords from arguments
updatedNode = updatedNode.WithRefKindKeyword(Token(SyntaxKind.None));
+5 -5
ファイルの表示
@@ -49,7 +49,7 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node)
{
var updatedNode = (MemberAccessExpressionSyntax)base.VisitMemberAccessExpression(node)!;
MemberAccessExpressionSyntax updatedNode = (MemberAccessExpressionSyntax)base.VisitMemberAccessExpression(node)!;
if (node.IsKind(SyntaxKind.SimpleMemberAccessExpression) &&
SemanticModel.For(node).GetOperation(node) is IMemberReferenceOperation operation)
@@ -66,8 +66,8 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter
ConstantDefinitions[fieldOperation.Field] = ((IFormattable)fieldOperation.Field.ConstantValue!).ToString(null, CultureInfo.InvariantCulture);
var ownerTypeName = ((INamedTypeSymbol)fieldOperation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
var constantName = $"__{ownerTypeName}__{fieldOperation.Field.Name}";
string ownerTypeName = ((INamedTypeSymbol)fieldOperation.Field.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
string constantName = $"__{ownerTypeName}__{fieldOperation.Field.Name}";
return IdentifierName(constantName);
}
@@ -92,7 +92,7 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitInvocationExpression(InvocationExpressionSyntax node)
{
var updatedNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node)!;
InvocationExpressionSyntax updatedNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node)!;
if (SemanticModel.For(node).GetOperation(node) is IInvocationOperation operation &&
operation.TargetMethod is IMethodSymbol method &&
@@ -116,7 +116,7 @@ internal sealed partial class StaticFieldRewriter : HlslSourceRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitArgument(ArgumentSyntax node)
{
var updatedNode = (ArgumentSyntax)base.VisitArgument(node)!;
ArgumentSyntax updatedNode = (ArgumentSyntax)base.VisitArgument(node)!;
updatedNode = updatedNode.WithRefKindKeyword(Token(SyntaxKind.None));
@@ -154,7 +154,7 @@ partial class IShaderGenerator
prologueStatements++;
// <NAME>.Add("<ITEM>");
foreach (var item in items)
foreach (string item in items)
{
statements.Add(
ExpressionStatement(
+34 -34
ファイルの表示
@@ -58,20 +58,20 @@ partial class IShaderGenerator
}
// Explore the syntax tree and extract the processed info
var semanticModelProvider = new SemanticModelProvider(compilation);
var pixelShaderSymbol = structDeclarationSymbol.AllInterfaces.FirstOrDefault(static interfaceSymbol => interfaceSymbol is { IsGenericType: true, Name: nameof(IPixelShader<byte>) });
var isComputeShader = pixelShaderSymbol is null;
var implicitTextureType = isComputeShader ? null : HlslKnownTypes.GetMappedNameForPixelShaderType(pixelShaderSymbol!);
var (resourceFields, valueFields) = GetInstanceFields(diagnostics, structDeclarationSymbol, discoveredTypes, isComputeShader);
var delegateInstanceFields = GetDispatchId.GetInfo(structDeclarationSymbol);
var sharedBuffers = GetSharedBuffers(diagnostics, structDeclarationSymbol, discoveredTypes);
var (entryPoint, processedMethods, isSamplerUsed) = GetProcessedMethods(diagnostics, structDeclaration, structDeclarationSymbol, semanticModelProvider, discoveredTypes, staticMethods, instanceMethods, constantDefinitions, isComputeShader);
var implicitSamplerField = isSamplerUsed ? ("SamplerState", "__sampler") : default((string, string)?);
var staticFields = GetStaticFields(diagnostics, semanticModelProvider, structDeclaration, structDeclarationSymbol, discoveredTypes, constantDefinitions);
SemanticModelProvider semanticModelProvider = new SemanticModelProvider(compilation);
INamedTypeSymbol? pixelShaderSymbol = structDeclarationSymbol.AllInterfaces.FirstOrDefault(static interfaceSymbol => interfaceSymbol is { IsGenericType: true, Name: nameof(IPixelShader<byte>) });
bool isComputeShader = pixelShaderSymbol is null;
string? implicitTextureType = isComputeShader ? null : HlslKnownTypes.GetMappedNameForPixelShaderType(pixelShaderSymbol!);
(ImmutableArray<(string MetadataName, string Name, string HlslType)> resourceFields, ImmutableArray<(string Name, string HlslType)> valueFields) = GetInstanceFields(diagnostics, structDeclarationSymbol, discoveredTypes, isComputeShader);
ImmutableArray<string> delegateInstanceFields = GetDispatchId.GetInfo(structDeclarationSymbol);
ImmutableArray<(string Name, string Type, int? Count)> sharedBuffers = GetSharedBuffers(diagnostics, structDeclarationSymbol, discoveredTypes);
(string entryPoint, ImmutableArray<(string Signature, string Definition)> processedMethods, bool isSamplerUsed) = GetProcessedMethods(diagnostics, structDeclaration, structDeclarationSymbol, semanticModelProvider, discoveredTypes, staticMethods, instanceMethods, constantDefinitions, isComputeShader);
(string, string)? implicitSamplerField = isSamplerUsed ? ("SamplerState", "__sampler") : default((string, string)?);
ImmutableArray<(string Name, string TypeDeclaration, string? Assignment)> staticFields = GetStaticFields(diagnostics, semanticModelProvider, structDeclaration, structDeclarationSymbol, discoveredTypes, constantDefinitions);
// Process the discovered types and constants
var declaredTypes = GetDeclaredTypes(diagnostics, structDeclarationSymbol, discoveredTypes, instanceMethods);
var definedConstants = GetDefinedConstants(constantDefinitions);
ImmutableArray<(string Name, string Definition)> declaredTypes = GetDeclaredTypes(diagnostics, structDeclarationSymbol, discoveredTypes, instanceMethods);
ImmutableArray<(string Name, string Value)> definedConstants = GetDefinedConstants(constantDefinitions);
// Get the HLSL source data with the intermediate info
return GetHlslSourceInfo(
@@ -111,7 +111,7 @@ partial class IShaderGenerator
bool hlslResourceFound = false;
foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
foreach (IFieldSymbol fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
{
if (fieldSymbol.IsStatic)
{
@@ -202,9 +202,9 @@ partial class IShaderGenerator
{
using ImmutableArrayBuilder<(string, string, string?)> builder = ImmutableArrayBuilder<(string, string, string?)>.Rent();
foreach (var fieldDeclaration in structDeclaration.Members.OfType<FieldDeclarationSyntax>())
foreach (FieldDeclarationSyntax fieldDeclaration in structDeclaration.Members.OfType<FieldDeclarationSyntax>())
{
foreach (var variableDeclarator in fieldDeclaration.Declaration.Variables)
foreach (VariableDeclaratorSyntax variableDeclarator in fieldDeclaration.Declaration.Variables)
{
IFieldSymbol fieldSymbol = (IFieldSymbol)semanticModel.For(variableDeclarator).GetDeclaredSymbol(variableDeclarator)!;
@@ -266,7 +266,7 @@ partial class IShaderGenerator
{
using ImmutableArrayBuilder<(string, string, int?)> builder = ImmutableArrayBuilder<(string, string, int?)>.Rent();
foreach (var fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
foreach (IFieldSymbol fieldSymbol in structDeclarationSymbol.GetMembers().OfType<IFieldSymbol>())
{
if (!fieldSymbol.IsStatic)
{
@@ -382,7 +382,7 @@ partial class IShaderGenerator
isSamplerUsed = isSamplerUsed || shaderSourceRewriter.IsSamplerUsed;
// Emit the extracted local functions first
foreach (var localFunction in shaderSourceRewriter.LocalFunctions)
foreach (KeyValuePair<string, LocalFunctionStatementSyntax> localFunction in shaderSourceRewriter.LocalFunctions)
{
methods.Add((
localFunction.Value.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString(),
@@ -428,10 +428,10 @@ partial class IShaderGenerator
{
using ImmutableArrayBuilder<(string, string)> builder = ImmutableArrayBuilder<(string, string)>.Rent();
foreach (var constant in constantDefinitions)
foreach (KeyValuePair<IFieldSymbol, string> constant in constantDefinitions)
{
var ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
var constantName = $"__{ownerTypeName}__{constant.Key.Name}";
string ownerTypeName = ((INamedTypeSymbol)constant.Key.ContainingSymbol).ToDisplayString().ToHlslIdentifierName();
string constantName = $"__{ownerTypeName}__{constant.Key.Name}";
builder.Add((constantName, constant.Value));
}
@@ -458,13 +458,13 @@ partial class IShaderGenerator
IReadOnlyCollection<INamedTypeSymbol> invalidTypes;
// Process the discovered types
foreach (var type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes))
foreach (INamedTypeSymbol type in HlslKnownTypes.GetCustomTypes(types, out invalidTypes))
{
var structType = type.GetFullMetadataName().ToHlslIdentifierName();
var structDeclaration = StructDeclaration(structType);
string structType = type.GetFullMetadataName().ToHlslIdentifierName();
StructDeclarationSyntax structDeclaration = StructDeclaration(structType);
// Declare the fields of the current type
foreach (var field in type.GetMembers().OfType<IFieldSymbol>())
foreach (IFieldSymbol field in type.GetMembers().OfType<IFieldSymbol>())
{
if (field.IsStatic) continue;
@@ -489,7 +489,7 @@ partial class IShaderGenerator
}
// Declare the methods of the current type
foreach (var method in instanceMethods.Where(pair => SymbolEqualityComparer.Default.Equals(pair.Key.ContainingType, type)))
foreach (KeyValuePair<IMethodSymbol, MethodDeclarationSyntax> method in instanceMethods.Where(pair => SymbolEqualityComparer.Default.Equals(pair.Key.ContainingType, type)))
{
structDeclaration = structDeclaration.AddMembers(method.Value);
}
@@ -519,7 +519,7 @@ partial class IShaderGenerator
/// <param name="structDeclarationSymbol">The input <see cref="INamedTypeSymbol"/> instance to process.</param>
private static void DetectAndReportInvalidPropertyDeclarations(ImmutableArrayBuilder<DiagnosticInfo> diagnostics, INamedTypeSymbol structDeclarationSymbol)
{
foreach (var memberSymbol in structDeclarationSymbol.GetMembers())
foreach (ISymbol memberSymbol in structDeclarationSymbol.GetMembers())
{
// Detect properties that are not explicit interface implementations
if (memberSymbol is IPropertySymbol { ExplicitInterfaceImplementations.IsEmpty: true })
@@ -625,7 +625,7 @@ partial class IShaderGenerator
AppendLF();
// Define declarations
foreach (var (name, value) in definedConstants)
foreach ((string name, string value) in definedConstants)
{
AppendLineAndLF($"#define {name} {value}");
}
@@ -637,7 +637,7 @@ partial class IShaderGenerator
{
AppendLF();
foreach (var field in staticFields)
foreach ((string Name, string TypeDeclaration, string? Assignment) field in staticFields)
{
if (field.Assignment is string assignment)
{
@@ -651,7 +651,7 @@ partial class IShaderGenerator
}
// Declared types
foreach (var (_, typeDefinition) in declaredTypes)
foreach ((string _, string typeDefinition) in declaredTypes)
{
AppendLF();
AppendLineAndLF(typeDefinition);
@@ -672,7 +672,7 @@ partial class IShaderGenerator
}
// User-defined values
foreach (var (fieldName, fieldType) in valueFields)
foreach ((string fieldName, string fieldType) in valueFields)
{
AppendLineAndLF($" {fieldType} {fieldName};");
}
@@ -698,7 +698,7 @@ partial class IShaderGenerator
}
// Resources
foreach (var (metadataName, fieldName, fieldType) in resourceFields)
foreach ((string metadataName, string fieldName, string fieldType) in resourceFields)
{
if (HlslKnownTypes.IsConstantBufferType(metadataName))
{
@@ -721,7 +721,7 @@ partial class IShaderGenerator
}
// Shared buffers
foreach (var (bufferName, bufferType, bufferCount) in sharedBuffers)
foreach ((string bufferName, string bufferType, int? bufferCount) in sharedBuffers)
{
object count = (object?)bufferCount ?? "__GroupSize__get_X * __GroupSize__get_Y * __GroupSize__get_Z";
@@ -730,7 +730,7 @@ partial class IShaderGenerator
}
// Forward declarations
foreach (var (forwardDeclaration, _) in processedMethods)
foreach ((string forwardDeclaration, string _) in processedMethods)
{
AppendLF();
AppendLineAndLF(forwardDeclaration);
@@ -739,7 +739,7 @@ partial class IShaderGenerator
string capturedFieldsAndResourcesAndForwardDeclarations = FlushText();
// Captured methods
foreach (var (_, method) in processedMethods)
foreach ((string _, string method) in processedMethods)
{
AppendLF();
AppendLineAndLF(method);
+2 -2
ファイルの表示
@@ -81,7 +81,7 @@ partial class IShaderGenerator
else if (fieldSymbol.Type.IsUnmanagedType)
{
// Custom struct type defined by the user
foreach (var fieldInfo in GetCapturedFieldInfos(fieldSymbol.Type, fieldPath.Add(fieldName), resourceOffset, rawDataOffset))
foreach (FieldInfo fieldInfo in GetCapturedFieldInfos(fieldSymbol.Type, fieldPath.Add(fieldName), resourceOffset, rawDataOffset))
{
yield return fieldInfo;
}
@@ -142,7 +142,7 @@ partial class IShaderGenerator
{
// For scalar, vector and linear matrix types, serialize the value normally.
// Only the initial alignment needs to be considered, while data is packed.
var (fieldSize, fieldPack) = HlslKnownSizes.GetTypeInfo(typeName);
(int fieldSize, int fieldPack) = HlslKnownSizes.GetTypeInfo(typeName);
// Check if the current type is a matrix type with more than one row. In this
// case, each row is aligned as if it was a separate array, so the start of
+4 -4
ファイルの表示
@@ -72,7 +72,7 @@ partial class HlslKnownProperties
PropertyInfo groupindexProperty = typeof(GroupIds).GetProperty(nameof(GroupIds.Index), BindingFlags.Static | BindingFlags.Public);
// Programmatically load mappings for the dispatch types
foreach (var item in
foreach ((Type Type, PropertyInfo Property) item in
from type in HlslKnownTypes.HlslDispatchTypes
from property in type.GetProperties(BindingFlags.Static | BindingFlags.Public)
select (Type: type, Property: property))
@@ -90,7 +90,7 @@ partial class HlslKnownProperties
}
// Programmatically load mappings for the normalized thread ids
foreach (var property in typeof(ThreadIds.Normalized).GetProperties(BindingFlags.Static | BindingFlags.Public))
foreach (PropertyInfo? property in typeof(ThreadIds.Normalized).GetProperties(BindingFlags.Static | BindingFlags.Public))
{
string key = $"{typeof(ThreadIds).FullName}{Type.Delimiter}{typeof(ThreadIds.Normalized).Name}{Type.Delimiter}{property.Name}";
@@ -127,7 +127,7 @@ partial class HlslKnownProperties
}
// Programmatically load mappings for the group size
foreach (var property in typeof(GroupSize).GetProperties(BindingFlags.Static | BindingFlags.Public))
foreach (PropertyInfo? property in typeof(GroupSize).GetProperties(BindingFlags.Static | BindingFlags.Public))
{
string key = $"{typeof(GroupSize).FullName}{Type.Delimiter}{property.Name}";
@@ -149,7 +149,7 @@ partial class HlslKnownProperties
}
// Programmatically load mappings for the dispatch size
foreach (var property in typeof(DispatchSize).GetProperties(BindingFlags.Static | BindingFlags.Public))
foreach (PropertyInfo? property in typeof(DispatchSize).GetProperties(BindingFlags.Static | BindingFlags.Public))
{
string key = $"{typeof(DispatchSize).FullName}{Type.Delimiter}{property.Name}";
+6 -6
ファイルの表示
@@ -87,10 +87,10 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator
Dictionary<IMethodSymbol, MethodDeclarationSyntax> instanceMethods = new(SymbolEqualityComparer.Default); // Unused in this generator
// Explore the syntax tree and extract the processed info
var semanticModel = new SemanticModelProvider(compilation);
var (entryPoint, dependentMethods) = GetProcessedMethods(builder, methodDeclaration, semanticModel, discoveredTypes, constantDefinitions);
var definedTypes = IShaderGenerator.BuildHlslSource.GetDeclaredTypes(builder, methodSymbol, discoveredTypes, instanceMethods);
var definedConstants = IShaderGenerator.BuildHlslSource.GetDefinedConstants(constantDefinitions);
SemanticModelProvider semanticModel = new SemanticModelProvider(compilation);
(string entryPoint, ImmutableArray<(string Signature, string Definition)> dependentMethods) = GetProcessedMethods(builder, methodDeclaration, semanticModel, discoveredTypes, constantDefinitions);
ImmutableArray<(string Name, string Definition)> definedTypes = IShaderGenerator.BuildHlslSource.GetDeclaredTypes(builder, methodSymbol, discoveredTypes, instanceMethods);
ImmutableArray<(string Name, string Value)> definedConstants = IShaderGenerator.BuildHlslSource.GetDefinedConstants(constantDefinitions);
diagnostics = builder.ToImmutable();
@@ -140,7 +140,7 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator
using ImmutableArrayBuilder<(string, string)> methods = ImmutableArrayBuilder<(string, string)>.Rent();
// Emit the extracted local functions
foreach (var localFunction in shaderSourceRewriter.LocalFunctions)
foreach (KeyValuePair<string, LocalFunctionStatementSyntax> localFunction in shaderSourceRewriter.LocalFunctions)
{
methods.Add((
localFunction.Value.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString(),
@@ -148,7 +148,7 @@ public sealed partial class ShaderMethodSourceGenerator : IIncrementalGenerator
}
// Emit the discovered static methods
foreach (var staticMethod in staticMethods.Values)
foreach (MethodDeclarationSyntax staticMethod in staticMethods.Values)
{
methods.Add((
staticMethod.AsDefinition().NormalizeWhitespace(eol: "\n").ToFullString(),
+4 -4
ファイルの表示
@@ -35,7 +35,7 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitParameterList(ParameterListSyntax node)
{
var updatedNode = (ParameterListSyntax)base.VisitParameterList(node)!;
ParameterListSyntax updatedNode = (ParameterListSyntax)base.VisitParameterList(node)!;
updatedNode = updatedNode.AddParameters(Parameter(Identifier($"uint3 {nameof(ThreadIds)} : SV_DispatchThreadID")));
@@ -74,7 +74,7 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitMethodDeclaration(MethodDeclarationSyntax node)
{
var updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList());
MethodDeclarationSyntax updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList());
// When we're rewriting the main compute shader method, we need to insert a range
// check to ensure that invocation outside of the requested range are discarded.
@@ -129,7 +129,7 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitReturnStatement(ReturnStatementSyntax node)
{
var updatedNode = (ReturnStatementSyntax)base.VisitReturnStatement(node)!;
ReturnStatementSyntax updatedNode = (ReturnStatementSyntax)base.VisitReturnStatement(node)!;
// {
// __outputTexture[ThreadIds.xy] = <RETURN_EXPRESSION>;
@@ -154,7 +154,7 @@ internal abstract class ExecuteMethodRewriter : CSharpSyntaxRewriter
/// <inheritdoc/>
public override SyntaxNode? VisitMethodDeclaration(MethodDeclarationSyntax node)
{
var updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList());
MethodDeclarationSyntax updatedNode = ((MethodDeclarationSyntax)base.VisitMethodDeclaration(node)!).WithModifiers(TokenList());
// Change the return type to void
updatedNode = updatedNode.WithReturnType(PredefinedType(Token(SyntaxKind.VoidKeyword)));
+8 -8
ファイルの表示
@@ -72,7 +72,7 @@ partial class AnimatedComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnShaderRunnerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (AnimatedComputeShaderPanel)d;
AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d;
if (@this.IsLoaded &&
!@this.IsPaused &&
@@ -109,8 +109,8 @@ partial class AnimatedComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnResolutionScalePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (AnimatedComputeShaderPanel)d;
var resolutionScale = (double)e.NewValue;
AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d;
double resolutionScale = (double)e.NewValue;
@this.swapChainManager.QueueResolutionScaleChange(resolutionScale);
}
@@ -138,8 +138,8 @@ partial class AnimatedComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnIsDynamicResolutionEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (AnimatedComputeShaderPanel)d;
var isDynamicResolutionEnabled = (bool)e.NewValue;
AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d;
bool isDynamicResolutionEnabled = (bool)e.NewValue;
@this.swapChainManager.QueueDynamicResolutionModeChange(isDynamicResolutionEnabled);
}
@@ -166,8 +166,8 @@ partial class AnimatedComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnIsVerticalSyncEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (AnimatedComputeShaderPanel)d;
var isVerticalSyncEnabled = (bool)e.NewValue;
AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d;
bool isVerticalSyncEnabled = (bool)e.NewValue;
@this.swapChainManager.QueueVerticalSyncModeChange(isVerticalSyncEnabled);
}
@@ -193,7 +193,7 @@ partial class AnimatedComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnIsPausedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (AnimatedComputeShaderPanel)d;
AnimatedComputeShaderPanel @this = (AnimatedComputeShaderPanel)d;
if (@this.IsLoaded &&
(bool)e.NewValue is false &&
+8 -8
ファイルの表示
@@ -72,7 +72,7 @@ partial class ComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnFrameRequestQueueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (ComputeShaderPanel)d;
ComputeShaderPanel @this = (ComputeShaderPanel)d;
if (@this.IsLoaded &&
e.NewValue is IFrameRequestQueue frameRequestQueue &&
@@ -107,7 +107,7 @@ partial class ComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnShaderRunnerPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (ComputeShaderPanel)d;
ComputeShaderPanel @this = (ComputeShaderPanel)d;
if (@this.IsLoaded &&
@this.FrameRequestQueue is IFrameRequestQueue frameRequestQueue &&
@@ -144,8 +144,8 @@ partial class ComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnResolutionScalePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (ComputeShaderPanel)d;
var resolutionScale = (double)e.NewValue;
ComputeShaderPanel @this = (ComputeShaderPanel)d;
double resolutionScale = (double)e.NewValue;
@this.swapChainManager.QueueResolutionScaleChange(resolutionScale);
}
@@ -173,8 +173,8 @@ partial class ComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnIsDynamicResolutionEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (ComputeShaderPanel)d;
var isDynamicResolutionEnabled = (bool)e.NewValue;
ComputeShaderPanel @this = (ComputeShaderPanel)d;
bool isDynamicResolutionEnabled = (bool)e.NewValue;
@this.swapChainManager.QueueDynamicResolutionModeChange(isDynamicResolutionEnabled);
}
@@ -201,8 +201,8 @@ partial class ComputeShaderPanel
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnIsVerticalSyncEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (ComputeShaderPanel)d;
var isVerticalSyncEnabled = (bool)e.NewValue;
ComputeShaderPanel @this = (ComputeShaderPanel)d;
bool isVerticalSyncEnabled = (bool)e.NewValue;
@this.swapChainManager.QueueVerticalSyncModeChange(isVerticalSyncEnabled);
}
+5 -5
ファイルの表示
@@ -34,7 +34,7 @@ partial class SwapChainManager<TOwner>
// Here and in the calls below, only get a reference tracking lease when starting a render thread.
// This avoids crashes when the panel has been disposed but some code (eg. event handlers) still
// ends up calling into any of the APIs in this file, which is not intended but should not crash.
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
this.renderCancellationTokenSource?.Cancel();
@@ -79,7 +79,7 @@ partial class SwapChainManager<TOwner>
// If there is a render thread currently running, stop it and restart it
if (this.renderCancellationTokenSource?.IsCancellationRequested == false)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
this.renderCancellationTokenSource?.Cancel();
@@ -114,7 +114,7 @@ partial class SwapChainManager<TOwner>
if (this.renderCancellationTokenSource?.IsCancellationRequested == false &&
this.isDynamicResolutionEnabled)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
this.renderCancellationTokenSource?.Cancel();
@@ -187,13 +187,13 @@ partial class SwapChainManager<TOwner>
this.dynamicResolutionScale = this.resolutionScale;
// These two leases are needed to ensure the manager isn't disposed while rendering is running
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
RenderLoopWithDynamicResolution();
}
else
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
RenderLoop();
}
+1 -1
ファイルの表示
@@ -150,7 +150,7 @@ public static partial class GraphicsDeviceExtensions
{
Guard.IsNotNull(device);
using var _0 = device.GetReferenceTrackingLease();
using Interop.NativeObject.Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
+2 -2
ファイルの表示
@@ -183,7 +183,7 @@ public static class Texture1DExtensions
{
Guard.IsNotNull(source);
var (offsetX, width) = x.GetOffsetAndLength(source.Width);
(int offsetX, int width) = x.GetOffsetAndLength(source.Width);
source.CopyTo(destination, offsetX, width);
}
@@ -420,7 +420,7 @@ public static class Texture1DExtensions
{
Guard.IsNotNull(destination);
var (offsetX, width) = x.GetOffsetAndLength(destination.Width);
(int offsetX, int width) = x.GetOffsetAndLength(destination.Width);
destination.CopyFrom(source, offsetX, width);
}
+4 -4
ファイルの表示
@@ -213,8 +213,8 @@ public static class Texture2DExtensions
{
Guard.IsNotNull(source);
var (offsetX, width) = x.GetOffsetAndLength(source.Width);
var (offsetY, height) = y.GetOffsetAndLength(source.Height);
(int offsetX, int width) = x.GetOffsetAndLength(source.Width);
(int offsetY, int height) = y.GetOffsetAndLength(source.Height);
source.CopyTo(destination, offsetX, offsetY, width, height);
}
@@ -487,8 +487,8 @@ public static class Texture2DExtensions
{
Guard.IsNotNull(destination);
var (offsetX, width) = x.GetOffsetAndLength(destination.Width);
var (offsetY, height) = y.GetOffsetAndLength(destination.Height);
(int offsetX, int width) = x.GetOffsetAndLength(destination.Width);
(int offsetY, int height) = y.GetOffsetAndLength(destination.Height);
destination.CopyFrom(source, offsetX, offsetY, width, height);
}
+6 -6
ファイルの表示
@@ -173,9 +173,9 @@ public static class Texture3DExtensions
{
Guard.IsNotNull(source);
var (offsetX, width) = x.GetOffsetAndLength(source.Width);
var (offsetY, height) = y.GetOffsetAndLength(source.Height);
var (offsetZ, depth) = z.GetOffsetAndLength(source.Depth);
(int offsetX, int width) = x.GetOffsetAndLength(source.Width);
(int offsetY, int height) = y.GetOffsetAndLength(source.Height);
(int offsetZ, int depth) = z.GetOffsetAndLength(source.Depth);
source.CopyTo(destination, offsetX, offsetY, offsetZ, width, height, depth);
}
@@ -472,9 +472,9 @@ public static class Texture3DExtensions
{
Guard.IsNotNull(destination);
var (offsetX, width) = x.GetOffsetAndLength(destination.Width);
var (offsetY, height) = y.GetOffsetAndLength(destination.Height);
var (offsetZ, depth) = z.GetOffsetAndLength(destination.Depth);
(int offsetX, int width) = x.GetOffsetAndLength(destination.Width);
(int offsetY, int height) = y.GetOffsetAndLength(destination.Height);
(int offsetZ, int depth) = z.GetOffsetAndLength(destination.Depth);
destination.CopyFrom(source, offsetX, offsetY, offsetZ, width, height, depth);
}
+1 -1
ファイルの表示
@@ -48,7 +48,7 @@ unsafe partial class GraphicsDevice
/// </summary>
private void QueueRaiseDeviceLostEventIfNeeded()
{
using var _0 = TryGetReferenceTrackingLease(out bool leaseTaken);
using Lease _0 = TryGetReferenceTrackingLease(out bool leaseTaken);
if (!leaseTaken)
{
+10 -10
ファイルの表示
@@ -164,12 +164,12 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
SharedMemorySize = dxgiDescription1->SharedSystemMemory;
IsHardwareAccelerated = (dxgiDescription1->Flags & (uint)DXGI_ADAPTER_FLAG_SOFTWARE) == 0;
var d3D12Options1Data = d3D12Device->CheckFeatureSupport<D3D12_FEATURE_DATA_D3D12_OPTIONS1>(D3D12_FEATURE_D3D12_OPTIONS1);
D3D12_FEATURE_DATA_D3D12_OPTIONS1 d3D12Options1Data = d3D12Device->CheckFeatureSupport<D3D12_FEATURE_DATA_D3D12_OPTIONS1>(D3D12_FEATURE_D3D12_OPTIONS1);
ComputeUnits = d3D12Options1Data.TotalLaneCount;
WavefrontSize = d3D12Options1Data.WaveLaneCountMin;
var d3D12Architecture1Data = d3D12Device->CheckFeatureSupport<D3D12_FEATURE_DATA_ARCHITECTURE1>(D3D12_FEATURE_ARCHITECTURE1);
D3D12_FEATURE_DATA_ARCHITECTURE1 d3D12Architecture1Data = d3D12Device->CheckFeatureSupport<D3D12_FEATURE_DATA_ARCHITECTURE1>(D3D12_FEATURE_ARCHITECTURE1);
IsCacheCoherentUMA = d3D12Architecture1Data.CacheCoherentUMA != 0;
@@ -252,11 +252,11 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
/// <returns>Whether the current device supports double precision floating point operations in shaders.</returns>
public bool IsDoublePrecisionSupportAvailable()
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceLost();
var d3D12OptionsData = this.d3D12Device.Get()->CheckFeatureSupport<D3D12_FEATURE_DATA_D3D12_OPTIONS>(D3D12_FEATURE_D3D12_OPTIONS);
D3D12_FEATURE_DATA_D3D12_OPTIONS d3D12OptionsData = this.d3D12Device.Get()->CheckFeatureSupport<D3D12_FEATURE_DATA_D3D12_OPTIONS>(D3D12_FEATURE_D3D12_OPTIONS);
return d3D12OptionsData.DoublePrecisionFloatShaderOps;
}
@@ -270,7 +270,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
public bool IsReadOnlyTexture1DSupportedForType<T>()
where T : unmanaged
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceLost();
@@ -286,7 +286,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
public bool IsReadWriteTexture1DSupportedForType<T>()
where T : unmanaged
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceLost();
@@ -304,7 +304,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
public bool IsReadOnlyTexture2DSupportedForType<T>()
where T : unmanaged
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceLost();
@@ -320,7 +320,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
public bool IsReadWriteTexture2DSupportedForType<T>()
where T : unmanaged
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceLost();
@@ -338,7 +338,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
public bool IsReadOnlyTexture3DSupportedForType<T>()
where T : unmanaged
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceLost();
@@ -354,7 +354,7 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
public bool IsReadWriteTexture3DSupportedForType<T>()
where T : unmanaged
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceLost();
+2 -1
ファイルの表示
@@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
@@ -36,7 +37,7 @@ partial class DeviceHelper
{
StringBuilder builder = infoQueueMessageBuilder ??= new(1024);
foreach (var pair in D3D12InfoQueueMap)
foreach (KeyValuePair<Luid, ComPtr<ID3D12InfoQueue>> pair in D3D12InfoQueueMap)
{
GraphicsDevice device = DevicesCache[pair.Key];
ID3D12InfoQueue* queue = pair.Value.Get();
+7 -7
ファイルの表示
@@ -67,7 +67,7 @@ public static class GraphicsResourceHelper
{
Guard.IsNotNull(buffer);
using var _0 = buffer.GetReferenceTrackingLease();
using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease();
buffer.ThrowIfDeviceMismatch(device);
@@ -89,7 +89,7 @@ public static class GraphicsResourceHelper
{
Guard.IsNotNull(texture);
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.ThrowIfDeviceMismatch(device);
@@ -111,7 +111,7 @@ public static class GraphicsResourceHelper
{
Guard.IsNotNull(texture);
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.ThrowIfDeviceMismatch(device);
@@ -202,7 +202,7 @@ public static class GraphicsResourceHelper
{
Guard.IsNotNull(texture);
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.ThrowIfDeviceMismatch(device);
@@ -224,7 +224,7 @@ public static class GraphicsResourceHelper
{
Guard.IsNotNull(texture);
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.ThrowIfDeviceMismatch(device);
@@ -315,7 +315,7 @@ public static class GraphicsResourceHelper
{
Guard.IsNotNull(texture);
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.ThrowIfDeviceMismatch(device);
@@ -337,7 +337,7 @@ public static class GraphicsResourceHelper
{
Guard.IsNotNull(texture);
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.ThrowIfDeviceMismatch(device);
+16 -16
ファイルの表示
@@ -34,7 +34,7 @@ public static unsafe class InteropServices
/// <exception cref="Win32Exception">Thrown if the <c>IUnknown::QueryInterface</c> call doesn't return <c>S_OK</c>.</exception>
public static void GetID3D12Device(GraphicsDevice device, Guid* riid, void** ppvObject)
{
using var _0 = device.GetReferenceTrackingLease();
using NativeObject.Lease _0 = device.GetReferenceTrackingLease();
device.D3D12Device->QueryInterface(riid, ppvObject).Assert();
}
@@ -52,7 +52,7 @@ public static unsafe class InteropServices
public static void GetID3D12Resource<T>(Buffer<T> buffer, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = buffer.GetReferenceTrackingLease();
using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease();
buffer.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
}
@@ -70,7 +70,7 @@ public static unsafe class InteropServices
public static void GetID3D12Resource<T>(Texture1D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
}
@@ -88,7 +88,7 @@ public static unsafe class InteropServices
public static void GetID3D12Resource<T>(Texture2D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
}
@@ -106,7 +106,7 @@ public static unsafe class InteropServices
public static void GetID3D12Resource<T>(Texture3D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
}
@@ -124,7 +124,7 @@ public static unsafe class InteropServices
public static void GetID3D12Resource<T>(TransferBuffer<T> buffer, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = buffer.GetReferenceTrackingLease();
using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease();
buffer.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
}
@@ -142,7 +142,7 @@ public static unsafe class InteropServices
public static void GetID3D12Resource<T>(TransferTexture2D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
}
@@ -160,7 +160,7 @@ public static unsafe class InteropServices
public static void GetID3D12Resource<T>(TransferTexture3D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
texture.D3D12Resource->QueryInterface(riid, ppvObject).Assert();
}
@@ -179,7 +179,7 @@ public static unsafe class InteropServices
/// <exception cref="ObjectDisposedException">The <paramref name="device"/> instance has been disposed.</exception>
public static int TryGetID3D12Device(GraphicsDevice device, Guid* riid, void** ppvObject)
{
using var _0 = device.GetReferenceTrackingLease();
using NativeObject.Lease _0 = device.GetReferenceTrackingLease();
return device.D3D12Device->QueryInterface(riid, ppvObject);
}
@@ -200,7 +200,7 @@ public static unsafe class InteropServices
public static int TryGetID3D12Resource<T>(Buffer<T> buffer, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = buffer.GetReferenceTrackingLease();
using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease();
return buffer.D3D12Resource->QueryInterface(riid, ppvObject);
}
@@ -221,7 +221,7 @@ public static unsafe class InteropServices
public static int TryGetID3D12Resource<T>(Texture1D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
}
@@ -242,7 +242,7 @@ public static unsafe class InteropServices
public static int TryGetID3D12Resource<T>(Texture2D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
}
@@ -263,7 +263,7 @@ public static unsafe class InteropServices
public static int TryGetID3D12Resource<T>(Texture3D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
}
@@ -284,7 +284,7 @@ public static unsafe class InteropServices
public static int TryGetID3D12Resource<T>(TransferBuffer<T> buffer, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = buffer.GetReferenceTrackingLease();
using NativeObject.Lease _0 = buffer.GetReferenceTrackingLease();
return buffer.D3D12Resource->QueryInterface(riid, ppvObject);
}
@@ -305,7 +305,7 @@ public static unsafe class InteropServices
public static int TryGetID3D12Resource<T>(TransferTexture2D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
}
@@ -326,7 +326,7 @@ public static unsafe class InteropServices
public static int TryGetID3D12Resource<T>(TransferTexture3D<T> texture, Guid* riid, void** ppvObject)
where T : unmanaged
{
using var _0 = texture.GetReferenceTrackingLease();
using NativeObject.Lease _0 = texture.GetReferenceTrackingLease();
return texture.D3D12Resource->QueryInterface(riid, ppvObject);
}
+2 -2
ファイルの表示
@@ -76,7 +76,7 @@ public unsafe abstract class Buffer<T> : NativeObject, IGraphicsResource
Guard.IsBetweenOrEqualTo(length, 1, (uint.MaxValue / elementSizeInBytes) & ~255);
}
using var _0 = device.GetReferenceTrackingLease();
using Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -234,7 +234,7 @@ public unsafe abstract class Buffer<T> : NativeObject, IGraphicsResource
/// <inheritdoc cref="__Internals.GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice, out bool)"/>
internal (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceMismatch(device);
+13 -13
ファイルの表示
@@ -38,8 +38,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
Guard.IsInRange(sourceOffset, 0, Length);
Guard.IsLessThanOrEqualTo(sourceOffset + count, Length, nameof(sourceOffset));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -113,9 +113,9 @@ public abstract class StructuredBuffer<T> : Buffer<T>
Guard.IsInRange(destinationOffset, 0, destination.Length);
Guard.IsLessThanOrEqualTo(destinationOffset + count, destination.Length, nameof(destinationOffset));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -158,9 +158,9 @@ public abstract class StructuredBuffer<T> : Buffer<T>
Guard.IsInRange(destinationOffset, 0, destination.Length);
Guard.IsLessThanOrEqualTo(destinationOffset + count, destination.Length, nameof(destinationOffset));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -199,8 +199,8 @@ public abstract class StructuredBuffer<T> : Buffer<T>
Guard.IsInRange(offset, 0, Length);
Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -278,9 +278,9 @@ public abstract class StructuredBuffer<T> : Buffer<T>
Guard.IsInRange(destinationOffset, 0, Length);
Guard.IsLessThanOrEqualTo(destinationOffset + count, Length, nameof(destinationOffset));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = source.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = source.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
+16 -16
ファイルの表示
@@ -73,7 +73,7 @@ public unsafe abstract class Texture1D<T> : NativeObject, IGraphicsResource, Gra
{
Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE1D_U_DIMENSION);
using var _0 = device.GetReferenceTrackingLease();
using Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -163,8 +163,8 @@ public unsafe abstract class Texture1D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX));
Guard.IsGreaterThanOrEqualTo(size, width);
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -247,9 +247,9 @@ public unsafe abstract class Texture1D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX));
Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -307,9 +307,9 @@ public unsafe abstract class Texture1D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX));
Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -361,8 +361,8 @@ public unsafe abstract class Texture1D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX));
Guard.IsGreaterThanOrEqualTo(size, width);
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -443,9 +443,9 @@ public unsafe abstract class Texture1D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(sourceOffsetX + width, source.Width, nameof(sourceOffsetX));
Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = source.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = source.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -532,7 +532,7 @@ public unsafe abstract class Texture1D<T> : NativeObject, IGraphicsResource, Gra
/// <inheritdoc cref="GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice, out bool)"/>
internal (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice device, out bool isNormalized)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceMismatch(device);
@@ -571,7 +571,7 @@ public unsafe abstract class Texture1D<T> : NativeObject, IGraphicsResource, Gra
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceMismatch(device);
+16 -16
ファイルの表示
@@ -75,7 +75,7 @@ public unsafe abstract class Texture2D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION);
Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION);
using var _0 = device.GetReferenceTrackingLease();
using Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -178,8 +178,8 @@ public unsafe abstract class Texture2D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY));
Guard.IsGreaterThanOrEqualTo(size, (nint)width * height);
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -273,9 +273,9 @@ public unsafe abstract class Texture2D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX));
Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -342,9 +342,9 @@ public unsafe abstract class Texture2D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX));
Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -401,8 +401,8 @@ public unsafe abstract class Texture2D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY));
Guard.IsGreaterThanOrEqualTo(size, (nint)width * height);
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -494,9 +494,9 @@ public unsafe abstract class Texture2D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX));
Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = source.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = source.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -583,7 +583,7 @@ public unsafe abstract class Texture2D<T> : NativeObject, IGraphicsResource, Gra
/// <inheritdoc cref="GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice, out bool)"/>
internal (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice device, out bool isNormalized)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceMismatch(device);
@@ -622,7 +622,7 @@ public unsafe abstract class Texture2D<T> : NativeObject, IGraphicsResource, Gra
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceMismatch(device);
+16 -16
ファイルの表示
@@ -77,7 +77,7 @@ public unsafe abstract class Texture3D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION);
Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION);
using var _0 = device.GetReferenceTrackingLease();
using Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -193,8 +193,8 @@ public unsafe abstract class Texture3D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(sourceOffsetZ + depth, Depth, nameof(sourceOffsetZ));
Guard.IsGreaterThanOrEqualTo(size, (nint)width * height * depth);
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -300,9 +300,9 @@ public unsafe abstract class Texture3D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY));
Guard.IsLessThanOrEqualTo(sourceOffsetZ + depth, Depth, nameof(sourceOffsetZ));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -378,9 +378,9 @@ public unsafe abstract class Texture3D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY));
Guard.IsLessThanOrEqualTo(sourceOffsetZ + depth, Depth, nameof(sourceOffsetZ));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -442,8 +442,8 @@ public unsafe abstract class Texture3D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(destinationOffsetZ + depth, Depth, nameof(destinationOffsetZ));
Guard.IsGreaterThanOrEqualTo(size, (nint)width * height * depth);
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -547,9 +547,9 @@ public unsafe abstract class Texture3D<T> : NativeObject, IGraphicsResource, Gra
Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY));
Guard.IsLessThanOrEqualTo(destinationOffsetZ + depth, Depth, nameof(destinationOffsetZ));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = source.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = source.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -636,7 +636,7 @@ public unsafe abstract class Texture3D<T> : NativeObject, IGraphicsResource, Gra
/// <inheritdoc cref="GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice, out bool)"/>
internal (D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) ValidateAndGetGpuAndCpuDescriptorHandlesForClear(GraphicsDevice device, out bool isNormalized)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceMismatch(device);
@@ -675,7 +675,7 @@ public unsafe abstract class Texture3D<T> : NativeObject, IGraphicsResource, Gra
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
ThrowIfDeviceMismatch(device);
+4 -4
ファイルの表示
@@ -51,7 +51,7 @@ public abstract unsafe class TransferBuffer<T> : NativeObject, IGraphicsResource
// The maximum length is set such that the aligned buffer size can't exceed uint.MaxValue
Guard.IsBetweenOrEqualTo(length, 1, (uint.MaxValue / (uint)sizeof(T)) & ~255);
using var _0 = device.GetReferenceTrackingLease();
using Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -104,7 +104,7 @@ public abstract unsafe class TransferBuffer<T> : NativeObject, IGraphicsResource
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
return new MemoryManager(this).Memory;
}
@@ -116,7 +116,7 @@ public abstract unsafe class TransferBuffer<T> : NativeObject, IGraphicsResource
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
return new(this.mappedData, Length);
}
@@ -184,7 +184,7 @@ public abstract unsafe class TransferBuffer<T> : NativeObject, IGraphicsResource
{
Guard.IsEqualTo(elementIndex, 0);
using var _0 = this.buffer.GetReferenceTrackingLease();
using Lease _0 = this.buffer.GetReferenceTrackingLease();
return new(this.buffer.mappedData);
}
+4 -4
ファイルの表示
@@ -53,7 +53,7 @@ public unsafe abstract class TransferTexture1D<T> : NativeObject, IGraphicsResou
{
Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE1D_U_DIMENSION);
using var _0 = device.GetReferenceTrackingLease();
using Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -109,7 +109,7 @@ public unsafe abstract class TransferTexture1D<T> : NativeObject, IGraphicsResou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
return new MemoryManager(this).Memory;
}
@@ -121,7 +121,7 @@ public unsafe abstract class TransferTexture1D<T> : NativeObject, IGraphicsResou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
using var _0 = GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
return new(this.mappedData, Width);
}
@@ -190,7 +190,7 @@ public unsafe abstract class TransferTexture1D<T> : NativeObject, IGraphicsResou
{
Guard.IsEqualTo(elementIndex, 0);
using var _0 = this.buffer.GetReferenceTrackingLease();
using Lease _0 = this.buffer.GetReferenceTrackingLease();
return new(this.buffer.mappedData);
}
+2 -2
ファイルの表示
@@ -53,7 +53,7 @@ public unsafe abstract class TransferTexture2D<T> : NativeObject, IGraphicsResou
Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION);
Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION);
using var _0 = device.GetReferenceTrackingLease();
using Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -115,7 +115,7 @@ public unsafe abstract class TransferTexture2D<T> : NativeObject, IGraphicsResou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
using var _0 = this.GetReferenceTrackingLease();
using Lease _0 = this.GetReferenceTrackingLease();
return new(this.mappedData, Width, Height, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
}
+2 -2
ファイルの表示
@@ -55,7 +55,7 @@ public unsafe abstract class TransferTexture3D<T> : NativeObject, IGraphicsResou
Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION);
Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION);
using var _0 = device.GetReferenceTrackingLease();
using Lease _0 = device.GetReferenceTrackingLease();
device.ThrowIfDeviceLost();
@@ -123,7 +123,7 @@ public unsafe abstract class TransferTexture3D<T> : NativeObject, IGraphicsResou
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
using var _0 = this.GetReferenceTrackingLease();
using Lease _0 = this.GetReferenceTrackingLease();
return new(this.mappedData, Width, Height, Depth, (int)this.d3D12PlacedSubresourceFootprint.Footprint.RowPitch);
}
+7 -7
ファイルの表示
@@ -63,8 +63,8 @@ public sealed class ConstantBuffer<T> : Buffer<T>
Guard.IsInRange(offset, 0, Length);
Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -93,9 +93,9 @@ public sealed class ConstantBuffer<T> : Buffer<T>
Guard.IsInRange(destinationOffset, 0, destination.Length);
Guard.IsLessThanOrEqualTo(destinationOffset + length, destination.Length, nameof(destinationOffset));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using var _2 = destination.GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
using Lease _2 = destination.GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -125,8 +125,8 @@ public sealed class ConstantBuffer<T> : Buffer<T>
Guard.IsInRange(offset, 0, Length);
Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset));
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
+5 -5
ファイルの表示
@@ -24,8 +24,8 @@ partial class ReadWriteTexture1D<T, TPixel>
/// <inheritdoc cref="ReadWriteTexture1DExtensions.AsReadOnly{T, TPixel}(ReadWriteTexture1D{T, TPixel})"/>
internal IReadOnlyNormalizedTexture1D<TPixel> AsReadOnly()
{
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -100,8 +100,8 @@ partial class ReadWriteTexture1D<T, TPixel>
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
@@ -119,7 +119,7 @@ partial class ReadWriteTexture1D<T, TPixel>
{
lease = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
+5 -5
ファイルの表示
@@ -24,8 +24,8 @@ partial class ReadWriteTexture1D<T>
/// <inheritdoc cref="ReadWriteTexture1DExtensions.AsReadOnly(ReadWriteTexture1D{float})"/>
public IReadOnlyTexture1D<T> AsReadOnly()
{
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -100,8 +100,8 @@ partial class ReadWriteTexture1D<T>
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
@@ -119,7 +119,7 @@ partial class ReadWriteTexture1D<T>
{
lease = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
+5 -5
ファイルの表示
@@ -24,8 +24,8 @@ partial class ReadWriteTexture2D<T, TPixel>
/// <inheritdoc cref="ReadWriteTexture2DExtensions.AsReadOnly{T, TPixel}(ReadWriteTexture2D{T, TPixel})"/>
internal IReadOnlyNormalizedTexture2D<TPixel> AsReadOnly()
{
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -112,8 +112,8 @@ partial class ReadWriteTexture2D<T, TPixel>
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
@@ -131,7 +131,7 @@ partial class ReadWriteTexture2D<T, TPixel>
{
lease = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
+5 -5
ファイルの表示
@@ -24,8 +24,8 @@ partial class ReadWriteTexture2D<T>
/// <inheritdoc cref="ReadWriteTexture2DExtensions.AsReadOnly(ReadWriteTexture2D{float})"/>
public IReadOnlyTexture2D<T> AsReadOnly()
{
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -112,8 +112,8 @@ partial class ReadWriteTexture2D<T>
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
@@ -131,7 +131,7 @@ partial class ReadWriteTexture2D<T>
{
lease = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
+5 -5
ファイルの表示
@@ -24,8 +24,8 @@ partial class ReadWriteTexture3D<T, TPixel>
/// <inheritdoc cref="ReadWriteTexture3DExtensions.AsReadOnly{T, TPixel}(ReadWriteTexture3D{T, TPixel})"/>
public IReadOnlyNormalizedTexture3D<TPixel> AsReadOnly()
{
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -112,8 +112,8 @@ partial class ReadWriteTexture3D<T, TPixel>
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
@@ -131,7 +131,7 @@ partial class ReadWriteTexture3D<T, TPixel>
{
lease = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
+5 -5
ファイルの表示
@@ -24,8 +24,8 @@ partial class ReadWriteTexture3D<T>
/// <inheritdoc cref="ReadWriteTexture3DExtensions.AsReadOnly(ReadWriteTexture3D{float})"/>
public IReadOnlyTexture3D<T> AsReadOnly()
{
using var _0 = GraphicsDevice.GetReferenceTrackingLease();
using var _1 = GetReferenceTrackingLease();
using Lease _0 = GraphicsDevice.GetReferenceTrackingLease();
using Lease _1 = GetReferenceTrackingLease();
GraphicsDevice.ThrowIfDeviceLost();
@@ -112,8 +112,8 @@ partial class ReadWriteTexture3D<T>
/// <inheritdoc/>
D3D12_GPU_DESCRIPTOR_HANDLE GraphicsResourceHelper.IGraphicsResource.ValidateAndGetGpuDescriptorHandle(GraphicsDevice device)
{
using var _0 = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _0 = GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
@@ -131,7 +131,7 @@ partial class ReadWriteTexture3D<T>
{
lease = GetReferenceTrackingLease();
using var _1 = this.owner.GetReferenceTrackingLease();
using Lease _1 = this.owner.GetReferenceTrackingLease();
this.owner.ThrowIfDeviceMismatch(device);
+31 -31
ファイルの表示
@@ -191,7 +191,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(buffer);
var handles = buffer.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = buffer.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice);
context.Clear(buffer.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized: false);
}
@@ -207,7 +207,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized);
}
@@ -223,7 +223,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized);
}
@@ -239,7 +239,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized);
}
@@ -257,7 +257,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, true);
}
@@ -275,7 +275,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, true);
}
@@ -293,7 +293,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, true);
}
@@ -309,7 +309,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
using NativeObject.Lease lease = default;
@@ -327,7 +327,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
using NativeObject.Lease lease = default;
@@ -345,7 +345,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
using NativeObject.Lease lease = default;
@@ -366,7 +366,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
context.Fill(texture.D3D12Resource, handles.Gpu, handles.Cpu, DXGIFormatHelper.ExtendToNormalizedValue(value.ToPixel()));
}
@@ -385,7 +385,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
context.Fill(texture.D3D12Resource, handles.Gpu, handles.Cpu, DXGIFormatHelper.ExtendToNormalizedValue(value.ToPixel()));
}
@@ -404,7 +404,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
context.Fill(texture.D3D12Resource, handles.Gpu, handles.Cpu, DXGIFormatHelper.ExtendToNormalizedValue(value.ToPixel()));
}
@@ -421,7 +421,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
using NativeObject.Lease lease = default;
@@ -444,7 +444,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
using NativeObject.Lease lease = default;
@@ -467,7 +467,7 @@ public static class ComputeContextExtensions
{
Guard.IsNotNull(texture);
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
using NativeObject.Lease lease = default;
@@ -583,7 +583,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -600,7 +600,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -617,7 +617,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -634,7 +634,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -655,7 +655,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -672,7 +672,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -689,7 +689,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -706,7 +706,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -723,7 +723,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -744,7 +744,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -761,7 +761,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -778,7 +778,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -795,7 +795,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -812,7 +812,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}
@@ -833,7 +833,7 @@ public static class ComputeContextExtensions
using NativeObject.Lease lease = default;
var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
(D3D12_RESOURCE_STATES Before, D3D12_RESOURCE_STATES After) states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource, out Unsafe.AsRef(in lease));
context.Transition(d3D12Resource, states.Before, states.After);
}