Removed multiline variable declarations

このコミットが含まれているのは:
Sergio Pedri committed 2021-11-06 23:05:49 +01:00
1 親 6fa7464f84
コミット ee0d3a7b68
31ファイル変更
+182 -194

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

+4 -6
ファイルの表示
@@ -29,9 +29,8 @@ public partial class ShaderHashCodeTests
Shader1 shader1 = new() { A = value, B = buffer };
int
hash1 = ((IShader)shader1).GetDispatchId(),
hash2 = ((IShader)shader1).GetDispatchId();
int hash1 = ((IShader)shader1).GetDispatchId();
int hash2 = ((IShader)shader1).GetDispatchId();
Assert.IsTrue(hash1 == hash2);
@@ -63,9 +62,8 @@ public partial class ShaderHashCodeTests
Shader2 shader1 = new() { A = 1, B = buffer, F = f };
int
hash1 = ((IShader)shader1).GetDispatchId(),
hash2 = ((IShader)shader1).GetDispatchId();
int hash1 = ((IShader)shader1).GetDispatchId();
int hash2 = ((IShader)shader1).GetDispatchId();
Assert.IsTrue(hash1 == hash2);
+2 -3
ファイルの表示
@@ -95,9 +95,8 @@ public class AutoConstructorGeneratorTests
string outputBody = outputCompilation.SyntaxTrees.Skip(index + 1).First().ToString();
string[]
outputLines = outputBody.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries),
expectedLines = expectedBody.Replace("\r", "").Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
string[] outputLines = outputBody.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
string[] expectedLines = expectedBody.Replace("\r", "").Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
Assert.AreEqual(expectedLines.Length, outputLines.Length);
+4 -6
ファイルの表示
@@ -31,9 +31,8 @@ public class ImageProcessingTests
using var cpu = original.Clone(c => c.BokehBlur(40, 2, 3));
using var gpu = original.Clone(c => c.ApplyProcessor(new HlslBokehBlurProcessor(device.Get(), 40, 2)));
string
expectedPath = Path.Combine(path, "city_bokeh_cpu.jpg"),
actualPath = Path.Combine(path, "city_bokeh_gpu.jpg");
string expectedPath = Path.Combine(path, "city_bokeh_cpu.jpg");
string actualPath = Path.Combine(path, "city_bokeh_gpu.jpg");
cpu.Save(expectedPath);
gpu.Save(actualPath);
@@ -56,9 +55,8 @@ public class ImageProcessingTests
using var cpu = original.Clone(c => c.GaussianBlur(30f));
using var gpu = original.Clone(c => c.ApplyProcessor(new HlslGaussianBlurProcessor(device.Get(), 90)));
string
expectedPath = Path.Combine(path, "city_gaussian_cpu.jpg"),
actualPath = Path.Combine(path, "city_gaussian_gpu.jpg");
string expectedPath = Path.Combine(path, "city_gaussian_cpu.jpg");
string actualPath = Path.Combine(path, "city_gaussian_gpu.jpg");
cpu.Save(expectedPath);
gpu.Save(actualPath);
+10 -13
ファイルの表示
@@ -96,10 +96,9 @@ public class ImagingTests
[AllDevices]
public void SaveRgba32AsJpeg(Device device)
{
string
path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"),
expectedPath = Path.Combine(path, "city.jpg"),
actualPath = Path.Combine(path, "city_rgba32_saved.jpg");
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging");
string expectedPath = Path.Combine(path, "city.jpg");
string actualPath = Path.Combine(path, "city_rgba32_saved.jpg");
using ReadOnlyTexture2D<Rgba32, float4> texture = device.Get().LoadReadOnlyTexture2D<Rgba32, float4>(expectedPath);
@@ -112,10 +111,9 @@ public class ImagingTests
[AllDevices]
public void SaveBgra32AsJpeg(Device device)
{
string
path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"),
expectedPath = Path.Combine(path, "city.jpg"),
actualPath = Path.Combine(path, "city_bgra32_saved.jpg");
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging");
string expectedPath = Path.Combine(path, "city.jpg");
string actualPath = Path.Combine(path, "city_bgra32_saved.jpg");
using ReadOnlyTexture2D<Bgra32, float4> texture = device.Get().LoadReadOnlyTexture2D<Bgra32, float4>(expectedPath);
@@ -128,11 +126,10 @@ public class ImagingTests
[AllDevices]
public void SaveR8AsJpeg(Device device)
{
string
path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging"),
sourcePath = Path.Combine(path, "city.jpg"),
expectedPath = Path.Combine(path, "city_r8_reference.jpg"),
actualPath = Path.Combine(path, "city_r8_saved.jpg");
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Imaging");
string sourcePath = Path.Combine(path, "city.jpg");
string expectedPath = Path.Combine(path, "city_r8_reference.jpg");
string actualPath = Path.Combine(path, "city_r8_saved.jpg");
using ReadOnlyTexture2D<R8, float> texture = device.Get().LoadReadOnlyTexture2D<R8, float>(sourcePath);
+13 -8
ファイルの表示
@@ -31,7 +31,8 @@ internal readonly partial struct ExtrudedTruchetPattern : IComputeShader
// Standard 2D rotation formula.
private static float2x2 Rotate2x2(float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, -s, s, c);
}
@@ -153,12 +154,14 @@ internal readonly partial struct ExtrudedTruchetPattern : IComputeShader
// Anyway, I like this one. I'm assuHlsl.Ming it's based on IQ's original.
private float CalculateAO(in float3 p, in float3 n)
{
float sca = 2.0f, occ = 0.0f;
float sca = 2.0f;
float occ = 0.0f;
for (int i = (int)Hlsl.Min(time, 0f); i < 5; i++)
{
float hr = (i + 1f) * 0.15f / 5.0f;
float d = M(p + n * hr);
occ += (hr - d) * sca;
sca *= 0.7f;
@@ -184,16 +187,17 @@ internal readonly partial struct ExtrudedTruchetPattern : IComputeShader
{
int2 coords = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y);
float2 u = (coords - (float2)DispatchSize.XY * 0.5f) / DispatchSize.Y;
float3
r = Hlsl.Normalize(new float3(u, 1)),
o = new(0, time / 2.0f, -3),
l = o + new float3(0.25f, 0.25f, 2.0f);
float3 r = Hlsl.Normalize(new float3(u, 1));
float3 o = new(0, time / 2.0f, -3);
float3 l = o + new float3(0.25f, 0.25f, 2.0f);
r.YZ = Hlsl.Mul(Rotate2x2(0.15f), r.YZ);
r.XZ = Hlsl.Mul(Rotate2x2(-Hlsl.Cos(time * 3.14159f / 32.0f) / 8.0f), r.XZ);
r.XY = Hlsl.Mul(Rotate2x2(Hlsl.Sin(time * 3.14159f / 32.0f) / 8.0f), r.XY);
float d, t = Hash21(r.XY * 57.0f + Hlsl.Frac(time)) * 0.5f, glow = 0;
float d;
float t = Hash21(r.XY * 57.0f + Hlsl.Frac(time)) * 0.5f;
float glow = 0;
for (int i = 0; i < 96; i++)
{
@@ -206,7 +210,8 @@ internal readonly partial struct ExtrudedTruchetPattern : IComputeShader
}
int gObjID = objID;
float3 p = o + r * t, n = Normal(p);
float3 p = o + r * t;
float3 n = Normal(p);
float2 uv = p.XY;
float sc = 0.5f;
float2 iuv = Hlsl.Floor(uv / sc) + 0.5f;
+2 -1
ファイルの表示
@@ -20,7 +20,8 @@ internal readonly partial struct Octagrams : IComputeShader
private static float2x2 Rotate(float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, s, -s, c);
}
+2 -1
ファイルの表示
@@ -23,7 +23,8 @@ internal readonly partial struct ProteanClouds : IComputeShader
private static float2x2 Rotate(in float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, s, -s, c);
}
+4 -4
ファイルの表示
@@ -22,7 +22,8 @@ internal readonly partial struct PyramidPattern : IComputeShader
// Standard 2D rotation formula.
private static float2x2 Rotate2x2(in float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, -s, s, c);
}
@@ -146,9 +147,8 @@ internal readonly partial struct PyramidPattern : IComputeShader
float2 oP = p;
float m = BMap(p);
float3 n = new(0, 0, -1);
float
edge = 0.0f,
bumpFactor = 0.25f;
float edge = 0.0f;
float bumpFactor = 0.25f;
n = DoBumpMap(p, n, bumpFactor, ref edge);
+14 -15
ファイルの表示
@@ -21,7 +21,8 @@ internal readonly partial struct TriangleGridContouring : IComputeShader
// Standard 2D rotation formula.
private static float2x2 Rotate2x2(in float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, -s, s, c);
}
@@ -162,12 +163,11 @@ internal readonly partial struct TriangleGridContouring : IComputeShader
p -= s - (s.X + s.Y) * 0.211324865f;
float i = p.X < p.Y ? 1.0f : 0.0f;
float2
ioffs = new(1.0f - i, i),
ip0 = 0,
ip1 = ioffs - 0.2113248654f,
ip2 = 0.577350269f,
ctr = (ip0 + ip1 + ip2) / 3.0f;
float2 ioffs = new(1.0f - i, i);
float2 ip0 = 0;
float2 ip1 = ioffs - 0.2113248654f;
float2 ip2 = 0.577350269f;
float2 ctr = (ip0 + ip1 + ip2) / 3.0f;
ip0 -= ctr;
ip1 -= ctr;
@@ -180,15 +180,14 @@ internal readonly partial struct TriangleGridContouring : IComputeShader
n3.Y = IsoFunction(s + ioffs);
n3.Z = IsoFunction(s + 1.0f);
float
d = 1e5f,
d2 = 1e5f,
d3 = 1e5f,
d4 = 1e5f,
d5 = 1e5f;
float d = 1e5f;
float d2 = 1e5f;
float d3 = 1e5f;
float d4 = 1e5f;
float d5 = 1e5f;
float isovalue = 0;
float2 p0 = default, p1 = default;
float2 p0 = default;
float2 p1 = default;
int iTh = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1);
d = Hlsl.Min(d, distEdge(p - p0, p - p1));
+2 -3
ファイルの表示
@@ -135,9 +135,8 @@ public partial class Texture2DTests
texture.CopyTo(result, x, y, width, height);
Span2D<float>
expected = new Span2D<float>(array, 64, 64).Slice(y, x, height, width),
data = new(result, height, width);
Span2D<float> expected = new Span2D<float>(array, 64, 64).Slice(y, x, height, width);
Span2D<float> data = new(result, height, width);
CollectionAssert.AreEqual(expected.ToArray(), data.ToArray());
}
+4 -3
ファイルの表示
@@ -150,7 +150,9 @@ public partial class Texture3DTests
int[,,] array = new int[3, 64, 64];
foreach (var item in array.AsSpan().Enumerate())
{
item.Value = item.Index;
}
using Texture3D<int> texture = device.Get().AllocateTexture3D(textureType, array);
@@ -160,9 +162,8 @@ public partial class Texture3DTests
for (int k = 0; k < depth; k++)
{
Span2D<int>
source = array.AsSpan2D(z + k).Slice(y, x, height, width),
destination = result.AsSpan2D(k);
Span2D<int> source = array.AsSpan2D(z + k).Slice(y, x, height, width);
Span2D<int> destination = result.AsSpan2D(k);
CollectionAssert.AreEqual(source.ToArray(), destination.ToArray());
}