Use blocks for all if statements
このコミットが含まれているのは:
1 親
7a7f6be038
コミット
d910922ef5
28ファイル変更
+239
-59
検索条件に一致するファイルはありません
+4
-1
@@ -400,7 +400,10 @@ partial class ID2D1ShaderGenerator
|
||||
// Declare the fields of the current type
|
||||
foreach (IFieldSymbol field in type.GetMembers().OfType<IFieldSymbol>())
|
||||
{
|
||||
if (field.IsStatic) continue;
|
||||
if (field.IsStatic)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type;
|
||||
|
||||
|
||||
@@ -22,7 +22,10 @@ unsafe partial class ShaderCompiler
|
||||
// This happens when doing eg. "dotnet bin\Debug\net5.0\MyApp.dll", which would crash at runtime.
|
||||
Windows.ResolveLibrary += static (libraryName, assembly, searchPath) =>
|
||||
{
|
||||
if (libraryName is not "dxcompiler") return IntPtr.Zero;
|
||||
if (libraryName is not "dxcompiler")
|
||||
{
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
string rid = RuntimeInformation.ProcessArchitecture switch
|
||||
{
|
||||
|
||||
@@ -227,7 +227,10 @@ internal static partial class HlslKnownTypes
|
||||
return;
|
||||
}
|
||||
|
||||
if (KnownHlslTypes.ContainsKey(type.GetFullMetadataName())) return;
|
||||
if (KnownHlslTypes.ContainsKey(type.GetFullMetadataName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the type is unsupported
|
||||
if (!type.IsUnmanagedType ||
|
||||
@@ -241,11 +244,17 @@ internal static partial class HlslKnownTypes
|
||||
return;
|
||||
}
|
||||
|
||||
if (!customTypes.Add(type)) return;
|
||||
if (!customTypes.Add(type))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (IFieldSymbol field in type.GetMembers().OfType<IFieldSymbol>())
|
||||
{
|
||||
if (field.IsStatic) continue;
|
||||
if (field.IsStatic)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ExploreTypes((INamedTypeSymbol)field.Type, customTypes, invalidTypes);
|
||||
}
|
||||
@@ -298,7 +307,10 @@ internal static partial class HlslKnownTypes
|
||||
// Only add other custom types as dependencies, and ignore HLSL types
|
||||
foreach (IFieldSymbol field in type.GetMembers().OfType<IFieldSymbol>())
|
||||
{
|
||||
if (field.IsStatic) continue;
|
||||
if (field.IsStatic)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type;
|
||||
|
||||
@@ -327,7 +339,10 @@ internal static partial class HlslKnownTypes
|
||||
|
||||
yield return entry.Type;
|
||||
}
|
||||
else queue.Enqueue(entry);
|
||||
else
|
||||
{
|
||||
queue.Enqueue(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,7 +466,10 @@ partial class IShaderGenerator
|
||||
// Declare the fields of the current type
|
||||
foreach (IFieldSymbol field in type.GetMembers().OfType<IFieldSymbol>())
|
||||
{
|
||||
if (field.IsStatic) continue;
|
||||
if (field.IsStatic)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type;
|
||||
|
||||
|
||||
@@ -136,7 +136,10 @@ partial class HlslKnownTypes
|
||||
{
|
||||
// Delegate types just return an empty string, as they're not actually
|
||||
// used in the generated shaders, but just mapped to a function at runtime.
|
||||
if (typeSymbol.TypeKind == TypeKind.Delegate) return "";
|
||||
if (typeSymbol.TypeKind == TypeKind.Delegate)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
string typeName = typeSymbol.GetFullMetadataName();
|
||||
|
||||
|
||||
@@ -55,9 +55,18 @@ partial class ShaderSourceRewriter
|
||||
{
|
||||
string typeName = operation.Member.ContainingType.GetFullMetadataName();
|
||||
|
||||
if (mappedName == $"__{nameof(GroupIds)}__get_Index") IsGroupIdsIndexUsed = true;
|
||||
else if (typeName == typeof(GroupIds).FullName) IsGroupIdsUsed = true;
|
||||
else if (typeName == typeof(GridIds).FullName) IsGridIdsUsed = true;
|
||||
if (mappedName == $"__{nameof(GroupIds)}__get_Index")
|
||||
{
|
||||
IsGroupIdsIndexUsed = true;
|
||||
}
|
||||
else if (typeName == typeof(GroupIds).FullName)
|
||||
{
|
||||
IsGroupIdsUsed = true;
|
||||
}
|
||||
else if (typeName == typeof(GridIds).FullName)
|
||||
{
|
||||
IsGridIdsUsed = true;
|
||||
}
|
||||
|
||||
// Check that the dispatch info types are only used from the main shader body
|
||||
if (!this.isEntryPoint || this.localFunctionDepth > 0)
|
||||
|
||||
@@ -240,6 +240,7 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
|
||||
// Extract the ISwapChainPanelNative reference from the current panel, then query the
|
||||
// IDXGISwapChain reference just created and set that as the swap chain panel to use.
|
||||
fixed (ISwapChainPanelNative** swapChainPanelNative = this.swapChainPanelNative)
|
||||
{
|
||||
using (ComPtr<IUnknown> swapChainPanel = default)
|
||||
{
|
||||
#if WINDOWS_UWP
|
||||
@@ -254,6 +255,7 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
|
||||
(void**)swapChainPanelNative).Assert();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Get the underlying ID3D12Device in use
|
||||
fixed (ID3D12Device** d3D12Device = this.d3D12Device)
|
||||
|
||||
@@ -111,7 +111,10 @@ partial class DeviceHelper
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isCompleted) return false;
|
||||
if (this.isCompleted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
@@ -25,9 +25,15 @@ internal static class TypeInfo<T>
|
||||
[RequiresUnreferencedCode("This method reads type info of all fields of the input type (recursively).")]
|
||||
private static bool ChecksIsDoubleOrContainsDoubles(Type type)
|
||||
{
|
||||
if (type == typeof(double)) return true;
|
||||
if (type == typeof(double))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type.IsPrimitive) return false;
|
||||
if (type.IsPrimitive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
|
||||
{
|
||||
|
||||
@@ -139,7 +139,10 @@ public abstract class StructuredBuffer<T> : Buffer<T>
|
||||
|
||||
copyCommandList.ExecuteAndWaitForCompletion();
|
||||
}
|
||||
else CopyToWithCpuBuffer(destination, sourceOffset, destinationOffset, count);
|
||||
else
|
||||
{
|
||||
CopyToWithCpuBuffer(destination, sourceOffset, destinationOffset, count);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -389,6 +389,7 @@ public abstract unsafe class Texture1D<T> : NativeObject, IGraphicsResource, Gra
|
||||
#endif
|
||||
|
||||
using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map())
|
||||
{
|
||||
fixed (void* sourcePointer = &source)
|
||||
{
|
||||
Buffer.MemoryCopy(
|
||||
@@ -397,6 +398,7 @@ public abstract unsafe class Texture1D<T> : NativeObject, IGraphicsResource, Gra
|
||||
destinationSizeInBytes: rowSizeInBytes,
|
||||
sourceBytesToCopy: rowSizeInBytes);
|
||||
}
|
||||
}
|
||||
|
||||
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
|
||||
|
||||
|
||||
@@ -430,6 +430,7 @@ public abstract unsafe class Texture2D<T> : NativeObject, IGraphicsResource, Gra
|
||||
#endif
|
||||
|
||||
using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map())
|
||||
{
|
||||
fixed (void* sourcePointer = &source)
|
||||
{
|
||||
MemoryHelper.Copy(
|
||||
@@ -439,6 +440,7 @@ public abstract unsafe class Texture2D<T> : NativeObject, IGraphicsResource, Gra
|
||||
rowSizeInBytes,
|
||||
d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch);
|
||||
}
|
||||
}
|
||||
|
||||
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
|
||||
|
||||
|
||||
@@ -472,6 +472,7 @@ public abstract unsafe class Texture3D<T> : NativeObject, IGraphicsResource, Gra
|
||||
#endif
|
||||
|
||||
using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map())
|
||||
{
|
||||
fixed (void* sourcePointer = &source)
|
||||
{
|
||||
MemoryHelper.Copy(
|
||||
@@ -483,6 +484,7 @@ public abstract unsafe class Texture3D<T> : NativeObject, IGraphicsResource, Gra
|
||||
d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch,
|
||||
d3D12PlacedSubresourceFootprintSource.Footprint.RowPitch * (uint)height);
|
||||
}
|
||||
}
|
||||
|
||||
using CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType);
|
||||
|
||||
|
||||
@@ -115,7 +115,10 @@ public sealed class ConstantBuffer<T> : Buffer<T>
|
||||
destinationElementPitchInBytes: (uint)GetPaddedSize(),
|
||||
count: (uint)length);
|
||||
}
|
||||
else CopyToWithCpuBuffer(destination, sourceOffset, destinationOffset, length);
|
||||
else
|
||||
{
|
||||
CopyToWithCpuBuffer(destination, sourceOffset, destinationOffset, length);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする