Use collection expressions for array initializations

このコミットが含まれているのは:
Sergio Pedri committed 2023-11-20 23:06:22 +01:00
1 親 8dc70916ac
コミット 6d560f08e2
14ファイル変更
+145 -155

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

+1 -1
ファイルの表示
@@ -46,7 +46,7 @@
This is used eg. to replace Unsafe.SizeOf<T>() calls with just sizeof(T). The warning is not necessary
since in order to use these APIs the caller already has to be in an unsafe context.
-->
<NoWarn>$(NoWarn);CS8500;IDE0300;IDE0301;IDE0302</NoWarn>
<NoWarn>$(NoWarn);CS8500;IDE0301;IDE0302</NoWarn>
</PropertyGroup>
<!-- Centralized location for all generated artifacts -->
+56 -62
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -58,7 +57,61 @@ public sealed partial class HlslBokehBlurProcessor
/// <summary>
/// The mapping of initialized complex kernels and parameters, to speed up the initialization of new <see cref="HlslBokehBlurProcessor"/> instances.
/// </summary>
private static readonly ConcurrentDictionary<(int Radius, int ComponentsCount), (Vector4[] Parameters, float Scale, Complex64[][] Kernels)> Cache = new();
private static readonly ConcurrentDictionary<(int Radius, int ComponentsCount), (Vector4[] Parameters, float Scale, Complex64[][] Kernels)> Cache = [];
/// <summary>
/// The kernel scales to adjust the component values in each kernel.
/// </summary>
private static readonly float[] KernelScales = [1.4f, 1.2f, 1.2f, 1.2f, 1.2f, 1.2f];
/// <summary>
/// The available bokeh blur kernel parameters.
/// </summary>
private static readonly Vector4[][] KernelComponents =
[
// 1 component
[new Vector4(0.862325f, 1.624835f, 0.767583f, 1.862321f)],
// 2 components
[
new Vector4(0.886528f, 5.268909f, 0.411259f, -0.548794f),
new Vector4(1.960518f, 1.558213f, 0.513282f, 4.56111f)
],
// 3 components
[
new Vector4(2.17649f, 5.043495f, 1.621035f, -2.105439f),
new Vector4(1.019306f, 9.027613f, -0.28086f, -0.162882f),
new Vector4(2.81511f, 1.597273f, -0.366471f, 10.300301f)
],
// 4 components
[
new Vector4(4.338459f, 1.553635f, -5.767909f, 46.164397f),
new Vector4(3.839993f, 4.693183f, 9.795391f, -15.227561f),
new Vector4(2.791880f, 8.178137f, -3.048324f, 0.302959f),
new Vector4(1.342190f, 12.328289f, 0.010001f, 0.244650f)
],
// 5 components
[
new Vector4(4.892608f, 1.685979f, -22.356787f, 85.91246f),
new Vector4(4.71187f, 4.998496f, 35.918936f, -28.875618f),
new Vector4(4.052795f, 8.244168f, -13.212253f, -1.578428f),
new Vector4(2.929212f, 11.900859f, 0.507991f, 1.816328f),
new Vector4(1.512961f, 16.116382f, 0.138051f, -0.01f)
],
// 6 components
[
new Vector4(5.143778f, 2.079813f, -82.326596f, 111.231024f),
new Vector4(5.612426f, 6.153387f, 113.878661f, 58.004879f),
new Vector4(5.982921f, 9.802895f, 39.479083f, -162.028887f),
new Vector4(6.505167f, 11.059237f, -71.286026f, 95.027069f),
new Vector4(3.869579f, 14.81052f, 1.405746f, -3.704914f),
new Vector4(2.201904f, 19.032909f, -0.152784f, -0.107988f)
]
];
/// <summary>
/// Initializes a new instance of the <see cref="Implementation"/> class.
@@ -97,72 +150,13 @@ public sealed partial class HlslBokehBlurProcessor
}
}
/// <summary>
/// Gets the kernel scales to adjust the component values in each kernel.
/// </summary>
private static IReadOnlyList<float> KernelScales { get; } = new[] { 1.4f, 1.2f, 1.2f, 1.2f, 1.2f, 1.2f };
/// <summary>
/// Gets the available bokeh blur kernel parameters.
/// </summary>
private static IReadOnlyList<Vector4[]> KernelComponents { get; } = new[]
{
// 1 component
new[] { new Vector4(0.862325f, 1.624835f, 0.767583f, 1.862321f) },
// 2 components
new[]
{
new Vector4(0.886528f, 5.268909f, 0.411259f, -0.548794f),
new Vector4(1.960518f, 1.558213f, 0.513282f, 4.56111f)
},
// 3 components
new[]
{
new Vector4(2.17649f, 5.043495f, 1.621035f, -2.105439f),
new Vector4(1.019306f, 9.027613f, -0.28086f, -0.162882f),
new Vector4(2.81511f, 1.597273f, -0.366471f, 10.300301f)
},
// 4 components
new[]
{
new Vector4(4.338459f, 1.553635f, -5.767909f, 46.164397f),
new Vector4(3.839993f, 4.693183f, 9.795391f, -15.227561f),
new Vector4(2.791880f, 8.178137f, -3.048324f, 0.302959f),
new Vector4(1.342190f, 12.328289f, 0.010001f, 0.244650f)
},
// 5 components
new[]
{
new Vector4(4.892608f, 1.685979f, -22.356787f, 85.91246f),
new Vector4(4.71187f, 4.998496f, 35.918936f, -28.875618f),
new Vector4(4.052795f, 8.244168f, -13.212253f, -1.578428f),
new Vector4(2.929212f, 11.900859f, 0.507991f, 1.816328f),
new Vector4(1.512961f, 16.116382f, 0.138051f, -0.01f)
},
// 6 components
new[]
{
new Vector4(5.143778f, 2.079813f, -82.326596f, 111.231024f),
new Vector4(5.612426f, 6.153387f, 113.878661f, 58.004879f),
new Vector4(5.982921f, 9.802895f, 39.479083f, -162.028887f),
new Vector4(6.505167f, 11.059237f, -71.286026f, 95.027069f),
new Vector4(3.869579f, 14.81052f, 1.405746f, -3.704914f),
new Vector4(2.201904f, 19.032909f, -0.152784f, -0.107988f)
}
};
/// <summary>
/// Gets the kernel parameters and scaling factor for the current count value in the current instance.
/// </summary>
private (Vector4[] Parameters, float Scale) GetParameters()
{
// Prepare the kernel components
int index = Math.Max(0, Math.Min(this.componentsCount - 1, KernelComponents.Count));
int index = Math.Max(0, Math.Min(this.componentsCount - 1, KernelComponents.Length));
return (KernelComponents[index], KernelScales[index]);
}
+3 -3
ファイルの表示
@@ -16,11 +16,11 @@ public sealed class MissingComputeShaderDescriptorOnComputeShaderCodeFixer : Mis
/// <summary>
/// The set of type names for all attributes that can be over shader types.
/// </summary>
private static readonly string[] D2DAttributeTypeNames = new[]
{
private static readonly string[] D2DAttributeTypeNames =
[
"ComputeSharp.EmbeddedBytecodeAttribute",
"ComputeSharp.GroupSharedAttribute"
};
];
/// <summary>
/// Creates a new <see cref="MissingAttributeCodeFixer"/> instance with the specified parameters.
+1 -1
ファイルの表示
@@ -9,7 +9,7 @@ using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
#pragma warning disable CS0618
#pragma warning disable CS0618, IDE0300
namespace ComputeSharp.Core.SourceGenerators;
+3 -3
ファイルの表示
@@ -16,8 +16,8 @@ public sealed class MissingPixelShaderDescriptorOnPixelShaderCodeFixer : Missing
/// <summary>
/// The set of type names for all D2D attributes that can be over shader types.
/// </summary>
private static readonly string[] D2DAttributeTypeNames = new[]
{
private static readonly string[] D2DAttributeTypeNames =
[
"ComputeSharp.D2D1.D2DCompileOptionsAttribute",
"ComputeSharp.D2D1.D2DEffectAuthorAttribute",
"ComputeSharp.D2D1.D2DEffectCategoryAttribute",
@@ -32,7 +32,7 @@ public sealed class MissingPixelShaderDescriptorOnPixelShaderCodeFixer : Missing
"ComputeSharp.D2D1.D2DPixelOptionsAttribute",
"ComputeSharp.D2D1.D2DRequiresScenePositionAttribute",
"ComputeSharp.D2D1.D2DShaderProfileAttribute"
};
];
/// <summary>
/// Creates a new <see cref="MissingAttributeCodeFixer"/> instance with the specified parameters.
@@ -216,14 +216,14 @@ partial class D2DPixelShaderDescriptorGenerator
diagnostic = DiagnosticInfo.Create(
EmbeddedBytecodeFailedWithWin32Exception,
structDeclarationSymbol,
new object[] { structDeclarationSymbol, win32Error.HResult, win32Error.Message });
[structDeclarationSymbol, win32Error.HResult, win32Error.Message]);
}
else if (info is HlslBytecodeInfo.CompilerError fxcError)
{
diagnostic = DiagnosticInfo.Create(
EmbeddedBytecodeFailedWithFxcCompilationException,
structDeclarationSymbol,
new object[] { structDeclarationSymbol, fxcError.Message });
[structDeclarationSymbol, fxcError.Message]);
}
if (diagnostic is not null)
+2 -2
ファイルの表示
@@ -140,14 +140,14 @@ partial class D2DPixelShaderSourceGenerator
diagnostic = DiagnosticInfo.Create(
D2DPixelShaderSourceCompilationFailedWithWin32Exception,
methodSymbol,
new object[] { methodSymbol, methodSymbol.ContainingType, win32Error.HResult, win32Error.Message });
[methodSymbol, methodSymbol.ContainingType, win32Error.HResult, win32Error.Message]);
}
else if (info is HlslBytecodeInfo.CompilerError fxcError)
{
diagnostic = DiagnosticInfo.Create(
D2DPixelShaderSourceCompilationFailedWithFxcCompilationException,
methodSymbol,
new object[] { methodSymbol, methodSymbol.ContainingType, fxcError.Message });
[methodSymbol, methodSymbol.ContainingType, fxcError.Message]);
}
if (diagnostic is not null)
@@ -118,7 +118,7 @@ internal unsafe struct ICanvasEffectFactoryNative
private delegate* unmanaged[Stdcall]<IntPtr, ICanvasDevice*, ID2D1Effect*, float, IInspectable**, int> CreateWrapper;
/// <inheritdoc cref="Interface.CreateWrapper"/>
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })]
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])]
[return: NativeTypeName("HRESULT")]
private static int CreateWrapperFromAbi(IntPtr thisPtr, ICanvasDevice* device, ID2D1Effect* resource, float dpi, IInspectable** wrapper)
{
+2 -2
ファイルの表示
@@ -142,7 +142,7 @@ internal unsafe struct ICanvasImageInterop
private delegate* unmanaged[Stdcall]<IntPtr, ICanvasDevice*, ID2D1DeviceContext*, WIN2D_GET_D2D_IMAGE_FLAGS, float, float*, ID2D1Image**, int> GetD2DImage;
/// <inheritdoc cref="Interface.GetDevice"/>
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })]
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])]
[return: NativeTypeName("HRESULT")]
private static int GetDeviceFromAbi(IntPtr thisPtr, ICanvasDevice** device, WIN2D_GET_DEVICE_ASSOCIATION_TYPE* type)
{
@@ -159,7 +159,7 @@ internal unsafe struct ICanvasImageInterop
}
/// <inheritdoc cref="Interface.GetDevice"/>
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })]
[UnmanagedCallersOnly(CallConvs = [typeof(CallConvStdcall)])]
[return: NativeTypeName("HRESULT")]
private static int GetD2DImageFromAbi(
IntPtr thisPtr,
+4 -2
ファイルの表示
@@ -1,5 +1,7 @@
using System;
#pragma warning disable IDE0055
namespace ComputeSharp.SourceGeneration.Helpers;
/// <summary>
@@ -11,7 +13,7 @@ internal static class SyntaxFormattingHelper
/// A mapping of precomputed literals for all <see cref="byte"/> values.
/// </summary>
private static readonly string[] FormattedBytes =
{
[
"0x00", "0x01", "0x02", "0x03", "0x04", "0x05", "0x06", "0x07", "0x08", "0x09", "0x0A", "0x0B", "0x0C", "0x0D", "0x0E", "0x0F",
"0x10", "0x11", "0x12", "0x13", "0x14", "0x15", "0x16", "0x17", "0x18", "0x19", "0x1A", "0x1B", "0x1C", "0x1D", "0x1E", "0x1F",
"0x20", "0x21", "0x22", "0x23", "0x24", "0x25", "0x26", "0x27", "0x28", "0x29", "0x2A", "0x2B", "0x2C", "0x2D", "0x2E", "0x2F",
@@ -28,7 +30,7 @@ internal static class SyntaxFormattingHelper
"0xD0", "0xD1", "0xD2", "0xD3", "0xD4", "0xD5", "0xD6", "0xD7", "0xD8", "0xD9", "0xDA", "0xDB", "0xDC", "0xDD", "0xDE", "0xDF",
"0xE0", "0xE1", "0xE2", "0xE3", "0xE4", "0xE5", "0xE6", "0xE7", "0xE8", "0xE9", "0xEA", "0xEB", "0xEC", "0xED", "0xEE", "0xEF",
"0xF0", "0xF1", "0xF2", "0xF3", "0xF4", "0xF5", "0xF6", "0xF7", "0xF8", "0xF9", "0xFA", "0xFB", "0xFC", "0xFD", "0xFE", "0xFF"
};
];
/// <summary>
/// Gets an expression representing a single byte.
+1 -1
ファイルの表示
@@ -24,7 +24,7 @@ internal abstract partial class HlslSourceRewriter : CSharpSyntaxRewriter
/// <summary>
/// An array with the <c>'.'</c> and <c>'E'</c> characters.
/// </summary>
private static readonly char[] FloatLiteralSpecialCharacters = { '.', 'E' };
private static readonly char[] FloatLiteralSpecialCharacters = ['.', 'E'];
/// <summary>
/// Creates a new <see cref="HlslSourceRewriter"/> instance with the specified parameters.
+2 -2
ファイルの表示
@@ -90,14 +90,14 @@ partial class ComputeShaderDescriptorGenerator
diagnostic = DiagnosticInfo.Create(
EmbeddedBytecodeFailedWithWin32Exception,
structDeclarationSymbol,
new object[] { structDeclarationSymbol, win32Error.HResult, win32Error.Message });
[structDeclarationSymbol, win32Error.HResult, win32Error.Message]);
}
else if (info is HlslBytecodeInfo.CompilerError dxcError)
{
diagnostic = DiagnosticInfo.Create(
EmbeddedBytecodeFailedWithDxcCompilationException,
structDeclarationSymbol,
new object[] { structDeclarationSymbol, dxcError.Message });
[structDeclarationSymbol, dxcError.Message]);
}
if (diagnostic is not null)
+56 -62
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Numerics;
using System.Runtime.CompilerServices;
@@ -22,7 +21,61 @@ public sealed partial class BokehBlurEffect
/// <summary>
/// The mapping of initialized complex kernels and parameters, to speed up the initialization of new <see cref="BokehBlurEffect"/> instances.
/// </summary>
private static readonly ConcurrentDictionary<(int Radius, int ComponentsCount), (Vector4[] Parameters, float Scale, (float[] Real, float[] Imaginary)[] Kernels)> Cache = new();
private static readonly ConcurrentDictionary<(int Radius, int ComponentsCount), (Vector4[] Parameters, float Scale, (float[] Real, float[] Imaginary)[] Kernels)> Cache = [];
/// <summary>
/// The kernel scales to adjust the component values in each kernel.
/// </summary>
private static readonly float[] KernelScales = [1.4f, 1.2f, 1.2f, 1.2f, 1.2f, 1.2f];
/// <summary>
/// The available bokeh blur kernel parameters.
/// </summary>
private static readonly Vector4[][] KernelComponents =
[
// 1 component
[new Vector4(0.862325f, 1.624835f, 0.767583f, 1.862321f)],
// 2 components
[
new Vector4(0.886528f, 5.268909f, 0.411259f, -0.548794f),
new Vector4(1.960518f, 1.558213f, 0.513282f, 4.56111f)
],
// 3 components
[
new Vector4(2.17649f, 5.043495f, 1.621035f, -2.105439f),
new Vector4(1.019306f, 9.027613f, -0.28086f, -0.162882f),
new Vector4(2.81511f, 1.597273f, -0.366471f, 10.300301f)
],
// 4 components
[
new Vector4(4.338459f, 1.553635f, -5.767909f, 46.164397f),
new Vector4(3.839993f, 4.693183f, 9.795391f, -15.227561f),
new Vector4(2.791880f, 8.178137f, -3.048324f, 0.302959f),
new Vector4(1.342190f, 12.328289f, 0.010001f, 0.244650f)
],
// 5 components
[
new Vector4(4.892608f, 1.685979f, -22.356787f, 85.91246f),
new Vector4(4.71187f, 4.998496f, 35.918936f, -28.875618f),
new Vector4(4.052795f, 8.244168f, -13.212253f, -1.578428f),
new Vector4(2.929212f, 11.900859f, 0.507991f, 1.816328f),
new Vector4(1.512961f, 16.116382f, 0.138051f, -0.01f)
],
// 6 components
[
new Vector4(5.143778f, 2.079813f, -82.326596f, 111.231024f),
new Vector4(5.612426f, 6.153387f, 113.878661f, 58.004879f),
new Vector4(5.982921f, 9.802895f, 39.479083f, -162.028887f),
new Vector4(6.505167f, 11.059237f, -71.286026f, 95.027069f),
new Vector4(3.869579f, 14.81052f, 1.405746f, -3.704914f),
new Vector4(2.201904f, 19.032909f, -0.152784f, -0.107988f)
]
];
/// <summary>
/// The kernel radius.
@@ -90,72 +143,13 @@ public sealed partial class BokehBlurEffect
}
}
/// <summary>
/// Gets the kernel scales to adjust the component values in each kernel.
/// </summary>
private static IReadOnlyList<float> KernelScales { get; } = new[] { 1.4f, 1.2f, 1.2f, 1.2f, 1.2f, 1.2f };
/// <summary>
/// Gets the available bokeh blur kernel parameters.
/// </summary>
private static IReadOnlyList<Vector4[]> KernelComponents { get; } = new[]
{
// 1 component
new[] { new Vector4(0.862325f, 1.624835f, 0.767583f, 1.862321f) },
// 2 components
new[]
{
new Vector4(0.886528f, 5.268909f, 0.411259f, -0.548794f),
new Vector4(1.960518f, 1.558213f, 0.513282f, 4.56111f)
},
// 3 components
new[]
{
new Vector4(2.17649f, 5.043495f, 1.621035f, -2.105439f),
new Vector4(1.019306f, 9.027613f, -0.28086f, -0.162882f),
new Vector4(2.81511f, 1.597273f, -0.366471f, 10.300301f)
},
// 4 components
new[]
{
new Vector4(4.338459f, 1.553635f, -5.767909f, 46.164397f),
new Vector4(3.839993f, 4.693183f, 9.795391f, -15.227561f),
new Vector4(2.791880f, 8.178137f, -3.048324f, 0.302959f),
new Vector4(1.342190f, 12.328289f, 0.010001f, 0.244650f)
},
// 5 components
new[]
{
new Vector4(4.892608f, 1.685979f, -22.356787f, 85.91246f),
new Vector4(4.71187f, 4.998496f, 35.918936f, -28.875618f),
new Vector4(4.052795f, 8.244168f, -13.212253f, -1.578428f),
new Vector4(2.929212f, 11.900859f, 0.507991f, 1.816328f),
new Vector4(1.512961f, 16.116382f, 0.138051f, -0.01f)
},
// 6 components
new[]
{
new Vector4(5.143778f, 2.079813f, -82.326596f, 111.231024f),
new Vector4(5.612426f, 6.153387f, 113.878661f, 58.004879f),
new Vector4(5.982921f, 9.802895f, 39.479083f, -162.028887f),
new Vector4(6.505167f, 11.059237f, -71.286026f, 95.027069f),
new Vector4(3.869579f, 14.81052f, 1.405746f, -3.704914f),
new Vector4(2.201904f, 19.032909f, -0.152784f, -0.107988f)
}
};
/// <summary>
/// Gets the kernel parameters and scaling factor for the current count value in the current instance.
/// </summary>
private (Vector4[] Parameters, float Scale) GetParameters()
{
// Prepare the kernel components
int index = Math.Max(0, Math.Min(this.componentsCount - 1, KernelComponents.Count));
int index = Math.Max(0, Math.Min(this.componentsCount - 1, KernelComponents.Length));
return (KernelComponents[index], KernelScales[index]);
}
+11 -11
ファイルの表示
@@ -95,7 +95,7 @@ public partial class ShaderRewriterTests
[AllDevices]
public void CustomHlslOperators(Device device)
{
float[] data = { 1, 6, 7, 3, 5, 2, 8, 4 };
float[] data = [1, 6, 7, 3, 5, 2, 8, 4];
using ReadWriteBuffer<float> buffer = device.Get().AllocateReadWriteBuffer(data);
@@ -143,7 +143,7 @@ public partial class ShaderRewriterTests
[AllDevices]
public void BitwiseHlslOperators(Device device)
{
int[] data = { 186456131, 215486738, unchecked((int)416439712738), unchecked((int)1437124371243), 0, 0, 0, 0, 0, 0, 0, 0 };
int[] data = [186456131, 215486738, unchecked((int)416439712738), unchecked((int)1437124371243), 0, 0, 0, 0, 0, 0, 0, 0];
using ReadWriteBuffer<int> buffer = device.Get().AllocateReadWriteBuffer(data);
@@ -217,7 +217,7 @@ public partial class ShaderRewriterTests
[AllDevices]
public void BooleanHlslOperators(Device device)
{
int[] data = { 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int[] data = [1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
using ReadWriteBuffer<int> buffer = device.Get().AllocateReadWriteBuffer(data);
@@ -265,8 +265,8 @@ public partial class ShaderRewriterTests
[AllDevices]
public void ToBooleanConversionHlslIntrinsics(Device device)
{
float[] data1 = new[] { 3.14f, 0, 1.44f, 0, 0, 0.4445f };
int[] data2 = new[] { 3, 0, 1, 0, 0, 156 };
float[] data1 = [3.14f, 0, 1.44f, 0, 0, 0.4445f];
int[] data2 = [3, 0, 1, 0, 0, 156];
using ReadOnlyBuffer<float> buffer1 = device.Get().AllocateReadOnlyBuffer(data1);
using ReadOnlyBuffer<int> buffer2 = device.Get().AllocateReadOnlyBuffer(data2);
@@ -340,7 +340,7 @@ public partial class ShaderRewriterTests
[AllDevices]
public void FromBooleanConversionHlslIntrinsics(Device device)
{
int[] data = new[] { 1, 0, 1, 0, 0, 1 };
int[] data = [1, 0, 1, 0, 0, 1];
using ReadOnlyBuffer<int> buffer1 = device.Get().AllocateReadOnlyBuffer(data);
using ReadWriteBuffer<float> buffer2 = device.Get().AllocateReadWriteBuffer<float>(6, AllocationMode.Clear);
@@ -616,8 +616,8 @@ public partial class ShaderRewriterTests
[AllDevices]
public void GlslStyleMulOperators(Device device)
{
float[] data1 = { 0.727829933f, 0.6413954f, 0.9373726f, 0.7044427f, 0.46349f, 0.8098116f, 0.604649544f, 0.309247822f, 0.470999569f, 0.7374923f, 0.6993038f, 0.518516064f, 0.44598946f };
int[] data2 = { 287, 295, 953, 465, 1011, 308, 982, 186, 323, 325, 156, 454, 580 };
float[] data1 = [0.727829933f, 0.6413954f, 0.9373726f, 0.7044427f, 0.46349f, 0.8098116f, 0.604649544f, 0.309247822f, 0.470999569f, 0.7374923f, 0.6993038f, 0.518516064f, 0.44598946f];
int[] data2 = [287, 295, 953, 465, 1011, 308, 982, 186, 323, 325, 156, 454, 580];
using ReadOnlyBuffer<float> buffer1 = device.Get().AllocateReadOnlyBuffer(data1);
using ReadOnlyBuffer<int> buffer2 = device.Get().AllocateReadOnlyBuffer(data2);
@@ -798,8 +798,8 @@ public partial class ShaderRewriterTests
[AllDevices]
public void MiscHlslIntrinsics(Device device)
{
float[] data1 = { 1, 2, 0.4f, 3.14f, 2.4f, 0.8f, 0, 0 };
int[] data2 = { 111, 222, 333, 2, 4, 8, 63, 42, 77, 0, 0, 0 };
float[] data1 = [1, 2, 0.4f, 3.14f, 2.4f, 0.8f, 0, 0];
int[] data2 = [111, 222, 333, 2, 4, 8, 63, 42, 77, 0, 0, 0];
using ReadWriteBuffer<float> buffer1 = device.Get().AllocateReadWriteBuffer(data1);
using ReadWriteBuffer<int> buffer2 = device.Get().AllocateReadWriteBuffer(data2);
@@ -852,7 +852,7 @@ public partial class ShaderRewriterTests
[AllDevices]
public void ReadonlyModifierInMethods(Device device)
{
int[] data = { 0 };
int[] data = [0];
using ReadWriteBuffer<int> buffer = device.Get().AllocateReadWriteBuffer(data);