Add .this qualifier to all field accesses
このコミットが含まれているのは:
1 親
f2ed8a2d3b
コミット
b9a133b74c
75ファイル変更
+339
-335
検索条件に一致するファイルはありません
@@ -94,15 +94,15 @@ internal static partial class BlasHelpers
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
int x_offset = (ThreadIds.X * n * p) + (ThreadIds.Y * m);
|
||||
int x_offset = (ThreadIds.X * this.n * this.p) + (ThreadIds.Y * this.m);
|
||||
float result = 0f;
|
||||
|
||||
for (int k = 0; k < m; k++)
|
||||
for (int k = 0; k < this.m; k++)
|
||||
{
|
||||
result += x[x_offset + k] * w[(k * p) + ThreadIds.Z];
|
||||
result += this.x[x_offset + k] * this.w[(k * this.p) + ThreadIds.Z];
|
||||
}
|
||||
|
||||
y[(ThreadIds.X * n * p) + (ThreadIds.Y * p) + ThreadIds.Z] = result + b[ThreadIds.Z];
|
||||
this.y[(ThreadIds.X * this.n * this.p) + (ThreadIds.Y * this.p) + ThreadIds.Z] = result + this.b[ThreadIds.Z];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,30 +70,30 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
public Implementation(HlslBokehBlurProcessor definition, Configuration configuration, Image<ImageSharpRgba32> source, Rectangle sourceRectangle)
|
||||
: base(configuration, source, sourceRectangle)
|
||||
{
|
||||
graphicsDevice = definition.GraphicsDevice;
|
||||
radius = definition.Radius;
|
||||
kernelSize = (radius * 2) + 1;
|
||||
componentsCount = definition.Components;
|
||||
this.graphicsDevice = definition.GraphicsDevice;
|
||||
this.radius = definition.Radius;
|
||||
this.kernelSize = (this.radius * 2) + 1;
|
||||
this.componentsCount = definition.Components;
|
||||
|
||||
// Reuse the initialized values from the cache, if possible
|
||||
(int radius, int componentsCount) parameters = (radius, componentsCount);
|
||||
(int radius, int componentsCount) parameters = (this.radius, this.componentsCount);
|
||||
|
||||
if (Cache.TryGetValue(parameters, out (Vector4[] Parameters, float Scale, Complex64[][] Kernels) info))
|
||||
{
|
||||
kernelParameters = info.Parameters;
|
||||
kernelsScale = info.Scale;
|
||||
kernels = info.Kernels;
|
||||
this.kernelParameters = info.Parameters;
|
||||
this.kernelsScale = info.Scale;
|
||||
this.kernels = info.Kernels;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Initialize the complex kernels and parameters with the current arguments
|
||||
(kernelParameters, kernelsScale) = GetParameters();
|
||||
kernels = CreateComplexKernels();
|
||||
(this.kernelParameters, this.kernelsScale) = GetParameters();
|
||||
this.kernels = CreateComplexKernels();
|
||||
|
||||
NormalizeKernels();
|
||||
|
||||
// Store them in the cache for future use
|
||||
_ = Cache.TryAdd(parameters, (kernelParameters, kernelsScale, kernels));
|
||||
_ = Cache.TryAdd(parameters, (this.kernelParameters, this.kernelsScale, this.kernels));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
private (Vector4[] Parameters, float Scale) GetParameters()
|
||||
{
|
||||
// Prepare the kernel components
|
||||
int index = Math.Max(0, Math.Min(componentsCount - 1, KernelComponents.Count));
|
||||
int index = Math.Max(0, Math.Min(this.componentsCount - 1, KernelComponents.Count));
|
||||
|
||||
return (KernelComponents[index], KernelScales[index]);
|
||||
}
|
||||
@@ -172,10 +172,10 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
/// </summary>
|
||||
private Complex64[][] CreateComplexKernels()
|
||||
{
|
||||
Complex64[][] kernels = new Complex64[kernelParameters.Length][];
|
||||
ref Vector4 baseRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan());
|
||||
Complex64[][] kernels = new Complex64[this.kernelParameters.Length][];
|
||||
ref Vector4 baseRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan());
|
||||
|
||||
for (int i = 0; i < kernelParameters.Length; i++)
|
||||
for (int i = 0; i < this.kernelParameters.Length; i++)
|
||||
{
|
||||
ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i);
|
||||
|
||||
@@ -192,15 +192,15 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
/// <param name="b">The angle component for each complex component.</param>
|
||||
private Complex64[] CreateComplex1DKernel(float a, float b)
|
||||
{
|
||||
Complex64[] kernel = new Complex64[kernelSize];
|
||||
Complex64[] kernel = new Complex64[this.kernelSize];
|
||||
ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan());
|
||||
int r = radius;
|
||||
int r = this.radius;
|
||||
int n = -r;
|
||||
|
||||
for (int i = 0; i < kernelSize; i++, n++)
|
||||
for (int i = 0; i < this.kernelSize; i++, n++)
|
||||
{
|
||||
// Incrementally compute the range values
|
||||
float value = n * kernelsScale * (1f / r);
|
||||
float value = n * this.kernelsScale * (1f / r);
|
||||
|
||||
value *= value;
|
||||
|
||||
@@ -220,11 +220,11 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
{
|
||||
// Calculate the complex weighted sum
|
||||
float total = 0;
|
||||
Span<Complex64[]> kernelsSpan = kernels.AsSpan();
|
||||
Span<Complex64[]> kernelsSpan = this.kernels.AsSpan();
|
||||
ref Complex64[] baseKernelsRef = ref MemoryMarshal.GetReference(kernelsSpan);
|
||||
ref Vector4 baseParamsRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan());
|
||||
ref Vector4 baseParamsRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan());
|
||||
|
||||
for (int i = 0; i < kernelParameters.Length; i++)
|
||||
for (int i = 0; i < this.kernelParameters.Length; i++)
|
||||
{
|
||||
ref Complex64[] kernelRef = ref Unsafe.Add(ref baseKernelsRef, i);
|
||||
int length = kernelRef.Length;
|
||||
@@ -271,23 +271,23 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
|
||||
Span<Rgba32> span = MemoryMarshal.Cast<ImageSharpRgba32, Rgba32>(pixelMemory.Span);
|
||||
|
||||
using ReadWriteTexture2D<Rgba32, float4> texture = graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> temporary = graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height, AllocationMode.Clear);
|
||||
using ReadWriteTexture2D<float4> reals = graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> imaginaries = graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<Complex64> kernel = graphicsDevice.AllocateReadOnlyBuffer<Complex64>(kernelSize);
|
||||
using ReadWriteTexture2D<Rgba32, float4> texture = this.graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> temporary = this.graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height, AllocationMode.Clear);
|
||||
using ReadWriteTexture2D<float4> reals = this.graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> imaginaries = this.graphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<Complex64> kernel = this.graphicsDevice.AllocateReadOnlyBuffer<Complex64>(this.kernelSize);
|
||||
|
||||
// Preliminary gamma highlight pass
|
||||
graphicsDevice.For<GammaHighlightProcessor>(source.Height, new(texture));
|
||||
this.graphicsDevice.For<GammaHighlightProcessor>(source.Height, new(texture));
|
||||
|
||||
// Perform two 1D convolutions for each component in the current instance
|
||||
for (int j = 0; j < kernels.Length; j++)
|
||||
for (int j = 0; j < this.kernels.Length; j++)
|
||||
{
|
||||
Vector4 parameters = kernelParameters[j];
|
||||
Vector4 parameters = this.kernelParameters[j];
|
||||
|
||||
kernel.CopyFrom(kernels[j]);
|
||||
kernel.CopyFrom(this.kernels[j]);
|
||||
|
||||
using ComputeContext context = graphicsDevice.CreateComputeContext();
|
||||
using ComputeContext context = this.graphicsDevice.CreateComputeContext();
|
||||
|
||||
context.For<VerticalConvolutionProcessor>(
|
||||
source.Width,
|
||||
@@ -304,7 +304,7 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
}
|
||||
|
||||
// Apply the inverse gamma exposure pass
|
||||
graphicsDevice.For<InverseGammaHighlightProcessor>(source.Height, new(temporary, texture));
|
||||
this.graphicsDevice.For<InverseGammaHighlightProcessor>(source.Height, new(temporary, texture));
|
||||
|
||||
// Write the final pixel data
|
||||
texture.CopyTo(span);
|
||||
@@ -326,24 +326,24 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
{
|
||||
float4 real = float4.Zero;
|
||||
float4 imaginary = float4.Zero;
|
||||
int maxY = source.Height;
|
||||
int maxX = source.Width;
|
||||
int kernelLength = kernel.Length;
|
||||
int maxY = this.source.Height;
|
||||
int maxX = this.source.Width;
|
||||
int kernelLength = this.kernel.Length;
|
||||
int radiusY = kernelLength >> 1;
|
||||
|
||||
for (int i = 0; i < kernelLength; i++)
|
||||
{
|
||||
int offsetY = Hlsl.Clamp(ThreadIds.Y + i - radiusY, 0, maxY);
|
||||
int offsetX = Hlsl.Clamp(ThreadIds.X, 0, maxX);
|
||||
float4 color = source[offsetX, offsetY];
|
||||
Complex64 factors = kernel[i];
|
||||
float4 color = this.source[offsetX, offsetY];
|
||||
Complex64 factors = this.kernel[i];
|
||||
|
||||
real += factors.Real * color;
|
||||
imaginary += factors.Imaginary * color;
|
||||
}
|
||||
|
||||
reals[ThreadIds.XY] = real;
|
||||
imaginaries[ThreadIds.XY] = imaginary;
|
||||
this.reals[ThreadIds.XY] = real;
|
||||
this.imaginaries[ThreadIds.XY] = imaginary;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -364,9 +364,9 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
int maxY = target.Height;
|
||||
int maxX = target.Width;
|
||||
int kernelLength = kernel.Length;
|
||||
int maxY = this.target.Height;
|
||||
int maxX = this.target.Width;
|
||||
int kernelLength = this.kernel.Length;
|
||||
int radiusX = kernelLength >> 1;
|
||||
int offsetY = Hlsl.Clamp(ThreadIds.Y, 0, maxY);
|
||||
ComplexVector4 result = default;
|
||||
@@ -374,15 +374,15 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
for (int i = 0; i < kernelLength; i++)
|
||||
{
|
||||
int offsetX = Hlsl.Clamp(ThreadIds.X + i - radiusX, 0, maxX);
|
||||
float4 sourceReal = reals[offsetX, offsetY];
|
||||
float4 sourceImaginary = imaginaries[offsetX, offsetY];
|
||||
Complex64 factors = kernel[i];
|
||||
float4 sourceReal = this.reals[offsetX, offsetY];
|
||||
float4 sourceImaginary = this.imaginaries[offsetX, offsetY];
|
||||
Complex64 factors = this.kernel[i];
|
||||
|
||||
result.Real += (Vector4)((factors.Real * sourceReal) - (factors.Imaginary * sourceImaginary));
|
||||
result.Imaginary += (Vector4)((factors.Real * sourceImaginary) + (factors.Imaginary * sourceReal));
|
||||
}
|
||||
|
||||
target[ThreadIds.XY] += (float4)result.WeightedSum(z, w);
|
||||
this.target[ThreadIds.XY] += (float4)result.WeightedSum(this.z, this.w);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,15 +397,15 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
int width = source.Width;
|
||||
int width = this.source.Width;
|
||||
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
float4 v = source[i, ThreadIds.X];
|
||||
float4 v = this.source[i, ThreadIds.X];
|
||||
|
||||
v.XYZ = v.XYZ * v.XYZ * v.XYZ;
|
||||
|
||||
source[i, ThreadIds.X] = v;
|
||||
this.source[i, ThreadIds.X] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -422,16 +422,16 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
int width = source.Width;
|
||||
int width = this.source.Width;
|
||||
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
float4 v = source[i, ThreadIds.X];
|
||||
float4 v = this.source[i, ThreadIds.X];
|
||||
|
||||
v = Hlsl.Clamp(v, 0, float.MaxValue);
|
||||
v.XYZ = Hlsl.Pow(v.XYZ, 1 / 3f);
|
||||
|
||||
target[i, ThreadIds.X] = v;
|
||||
this.target[i, ThreadIds.X] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public sealed partial class HlslGaussianBlurProcessor : IImageProcessor
|
||||
/// <param name="radius">The radius value representing the size of the area to sample (this should be at least twice the sigma value)</param>
|
||||
public HlslGaussianBlurProcessor(GraphicsDevice device, float sigma, int radius)
|
||||
{
|
||||
graphicsDevice = device;
|
||||
this.graphicsDevice = device;
|
||||
|
||||
Sigma = sigma;
|
||||
Radius = radius;
|
||||
|
||||
+18
-18
@@ -38,8 +38,8 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
{
|
||||
int kernelSize = (definition.Radius * 2) + 1;
|
||||
|
||||
graphicsDevice = definition.graphicsDevice;
|
||||
kernel = CreateGaussianBlurKernel(kernelSize, definition.Sigma);
|
||||
this.graphicsDevice = definition.graphicsDevice;
|
||||
this.kernel = CreateGaussianBlurKernel(kernelSize, definition.Sigma);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -100,11 +100,11 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
|
||||
Span<Rgba32> span = MemoryMarshal.Cast<ImageSharpRgba32, Rgba32>(pixelMemory.Span);
|
||||
|
||||
using ReadWriteTexture2D<Rgba32, float4> sourceTexture = graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Rgba32, float4> firstPassTexture = graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<float> kernelBuffer = graphicsDevice.AllocateReadOnlyBuffer(kernel);
|
||||
using ReadWriteTexture2D<Rgba32, float4> sourceTexture = this.graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Rgba32, float4> firstPassTexture = this.graphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<float> kernelBuffer = this.graphicsDevice.AllocateReadOnlyBuffer(this.kernel);
|
||||
|
||||
using (ComputeContext context = graphicsDevice.CreateComputeContext())
|
||||
using (ComputeContext context = this.graphicsDevice.CreateComputeContext())
|
||||
{
|
||||
context.For<VerticalConvolutionProcessor>(source.Width, source.Height, new(sourceTexture, firstPassTexture, kernelBuffer));
|
||||
context.Barrier(firstPassTexture);
|
||||
@@ -128,21 +128,21 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
public void Execute()
|
||||
{
|
||||
float4 result = float4.Zero;
|
||||
int maxY = source.Height - 1;
|
||||
int maxX = source.Width - 1;
|
||||
int kernelLength = kernel.Length;
|
||||
int maxY = this.source.Height - 1;
|
||||
int maxX = this.source.Width - 1;
|
||||
int kernelLength = this.kernel.Length;
|
||||
int radiusY = kernelLength >> 1;
|
||||
|
||||
for (int i = 0; i < kernelLength; i++)
|
||||
{
|
||||
int offsetY = Hlsl.Clamp(ThreadIds.Y + i - radiusY, 0, maxY);
|
||||
int offsetX = Hlsl.Clamp(ThreadIds.X, 0, maxX);
|
||||
float4 color = source[offsetX, offsetY];
|
||||
float4 color = this.source[offsetX, offsetY];
|
||||
|
||||
result += kernel[i] * color;
|
||||
result += this.kernel[i] * color;
|
||||
}
|
||||
|
||||
target[ThreadIds.XY] = result;
|
||||
this.target[ThreadIds.XY] = result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,21 +160,21 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
public void Execute()
|
||||
{
|
||||
float4 result = float4.Zero;
|
||||
int maxY = source.Height - 1;
|
||||
int maxX = source.Width - 1;
|
||||
int kernelLength = kernel.Length;
|
||||
int maxY = this.source.Height - 1;
|
||||
int maxX = this.source.Width - 1;
|
||||
int kernelLength = this.kernel.Length;
|
||||
int radiusX = kernelLength >> 1;
|
||||
int offsetY = Hlsl.Clamp(ThreadIds.Y, 0, maxY);
|
||||
|
||||
for (int i = 0; i < kernelLength; i++)
|
||||
{
|
||||
int offsetX = Hlsl.Clamp(ThreadIds.X + i - radiusX, 0, maxX);
|
||||
float4 color = source[offsetX, offsetY];
|
||||
float4 color = this.source[offsetX, offsetY];
|
||||
|
||||
result += kernel[i] * color;
|
||||
result += this.kernel[i] * color;
|
||||
}
|
||||
|
||||
target[ThreadIds.XY] = result;
|
||||
this.target[ThreadIds.XY] = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ public readonly partial struct MultiplyByTwo : IComputeShader
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] *= 2;
|
||||
this.buffer[ThreadIds.X] *= 2;
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,6 @@ internal readonly partial struct MultiplyByTwo : IComputeShader
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] *= 2;
|
||||
this.buffer[ThreadIds.X] *= 2;
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ internal readonly partial struct ColorfulInfinity : IPixelShader<float4>
|
||||
/// </summary>
|
||||
private float4 Tex(float3 p)
|
||||
{
|
||||
float t = time + 78.0f;
|
||||
float t = this.time + 78.0f;
|
||||
float4 o = new(p.X, p.Y, p.Z, 3.0f * Hlsl.Sin(t * 0.1f));
|
||||
float4 dec =
|
||||
new float4(1.0f, 0.9f, 0.1f, 0.15f) +
|
||||
@@ -51,7 +51,7 @@ internal readonly partial struct ColorfulInfinity : IPixelShader<float4>
|
||||
{
|
||||
float2 uv = (ThreadIds.XY - ((float2)DispatchSize.XY * 0.5f)) / DispatchSize.Y;
|
||||
float3 col = 0;
|
||||
float t = time * 0.3f;
|
||||
float t = this.time * 0.3f;
|
||||
|
||||
for (float i = 0.0f; i <= 1.0f; i += 1.0f / NumberOfLayers)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ internal readonly partial struct ContouredLayers : IPixelShader<float4>
|
||||
|
||||
p = Hlsl.Frac(new float2(262144, 32768) * n);
|
||||
|
||||
return Hlsl.Sin((p * 6.2831853f) + time);
|
||||
return Hlsl.Sin((p * 6.2831853f) + this.time);
|
||||
}
|
||||
|
||||
// float2 to float2 hash.
|
||||
@@ -111,7 +111,7 @@ internal readonly partial struct ContouredLayers : IPixelShader<float4>
|
||||
// Layer color. Based on the shade, layer number and smoothing factor.
|
||||
private float3 GetColor(float2 p, float sh, float fi)
|
||||
{
|
||||
float3 tx = texture.Sample(p + Hash21(new float2(sh, fi))).XYZ;
|
||||
float3 tx = this.texture.Sample(p + Hash21(new float2(sh, fi))).XYZ;
|
||||
|
||||
tx *= tx;
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
float sca = 2.0f;
|
||||
float occ = 0.0f;
|
||||
|
||||
for (int i = (int)Hlsl.Min(time, 0f); i < 5; i++)
|
||||
for (int i = (int)Hlsl.Min(this.time, 0f); i < 5; i++)
|
||||
{
|
||||
float hr = (i + 1f) * 0.15f / 5.0f;
|
||||
float d = M(p + (n * hr));
|
||||
@@ -204,15 +204,15 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
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));
|
||||
float3 o = new(0, time / 2.0f, -3);
|
||||
float3 o = new(0, this.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);
|
||||
r.XZ = Hlsl.Mul(Rotate2x2(-Hlsl.Cos(this.time * 3.14159f / 32.0f) / 8.0f), r.XZ);
|
||||
r.XY = Hlsl.Mul(Rotate2x2(Hlsl.Sin(this.time * 3.14159f / 32.0f) / 8.0f), r.XY);
|
||||
|
||||
float d;
|
||||
float t = Hash21((r.XY * 57.0f) + Hlsl.Frac(time)) * 0.5f;
|
||||
float t = Hash21((r.XY * 57.0f) + Hlsl.Frac(this.time)) * 0.5f;
|
||||
float glow = 0;
|
||||
|
||||
for (int i = 0; i < 96; i++)
|
||||
|
||||
@@ -83,7 +83,7 @@ internal readonly partial struct FourColorGradient : IPixelShader<float4>
|
||||
tuv -= 0.5f;
|
||||
|
||||
// Rotate with noise
|
||||
float degree = Noise(new float2(time * 0.1f, tuv.X * tuv.Y));
|
||||
float degree = Noise(new float2(this.time * 0.1f, tuv.X * tuv.Y));
|
||||
|
||||
tuv.Y *= 1.0f / ratio;
|
||||
tuv.XY = Hlsl.Mul(tuv.XY, Rotate(Hlsl.Radians(((degree - 0.5f) * 720.0f) + 180.0f)));
|
||||
@@ -92,7 +92,7 @@ internal readonly partial struct FourColorGradient : IPixelShader<float4>
|
||||
// Wave warp with sin
|
||||
float frequency = 5.0f;
|
||||
float amplitude = 30.0f;
|
||||
float speed = time * 2.0f;
|
||||
float speed = this.time * 2.0f;
|
||||
|
||||
tuv.X += Hlsl.Sin((tuv.Y * frequency) + speed) / amplitude;
|
||||
tuv.Y += Hlsl.Sin((tuv.X * frequency * 1.5f) + speed) / (amplitude * 0.5f);
|
||||
|
||||
@@ -20,7 +20,7 @@ internal readonly partial struct FractalTiling : IPixelShader<float4>
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
float2 position = (((float2)(256 * ThreadIds.XY)) / DispatchSize.X) + time;
|
||||
float2 position = (((float2)(256 * ThreadIds.XY)) / DispatchSize.X) + this.time;
|
||||
float4 color = 0;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
@@ -28,7 +28,7 @@ internal readonly partial struct FractalTiling : IPixelShader<float4>
|
||||
float2 a = Hlsl.Floor(position);
|
||||
float2 b = Hlsl.Frac(position);
|
||||
float4 w = Hlsl.Frac(
|
||||
(Hlsl.Sin((a.X * 7) + (31.0f * a.Y) + (0.01f * time)) +
|
||||
(Hlsl.Sin((a.X * 7) + (31.0f * a.Y) + (0.01f * this.time)) +
|
||||
new float4(0.035f, 0.01f, 0, 0.7f))
|
||||
* 13.545317f);
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ internal readonly partial struct HelloWorld : IPixelShader<float4>
|
||||
float2 uv = ThreadIds.Normalized.XY;
|
||||
|
||||
// Time varying pixel color
|
||||
float3 col = 0.5f + (0.5f * Hlsl.Cos(time + new float3(uv, uv.X) + new float3(0, 2, 4)));
|
||||
float3 col = 0.5f + (0.5f * Hlsl.Cos(this.time + new float3(uv, uv.X) + new float3(0, 2, 4)));
|
||||
|
||||
// Output to screen
|
||||
return new(col, 1f);
|
||||
|
||||
@@ -77,7 +77,7 @@ internal readonly partial struct MengerJourney : IPixelShader<float4>
|
||||
|
||||
for (int n = 0; n < Iterations; n++)
|
||||
{
|
||||
z.XY = Rotate(z.XY, 4.0f + (2.0f * Hlsl.Cos(time / 8.0f)));
|
||||
z.XY = Rotate(z.XY, 4.0f + (2.0f * Hlsl.Cos(this.time / 8.0f)));
|
||||
z = Hlsl.Abs(z);
|
||||
|
||||
if (z.X < z.Y) { z.XY = z.YX; }
|
||||
@@ -123,7 +123,7 @@ internal readonly partial struct MengerJourney : IPixelShader<float4>
|
||||
return Hlsl.Frac(Hlsl.Cos(Hlsl.Dot(co, new float2(4.898f, 7.23f))) * 23421.631f);
|
||||
}
|
||||
|
||||
float totalDistance = Jitter * Rand(fragCoord.XY + time);
|
||||
float totalDistance = Jitter * Rand(fragCoord.XY + this.time);
|
||||
float3 dir2 = dir;
|
||||
float distance = 0;
|
||||
int steps = 0;
|
||||
@@ -131,7 +131,7 @@ internal readonly partial struct MengerJourney : IPixelShader<float4>
|
||||
|
||||
for (int i = 0; i < MaxSteps; i++)
|
||||
{
|
||||
dir.ZY = Rotate(dir2.ZY, totalDistance * Hlsl.Cos(time / 4.0f) * NonLinearPerspective);
|
||||
dir.ZY = Rotate(dir2.ZY, totalDistance * Hlsl.Cos(this.time / 4.0f) * NonLinearPerspective);
|
||||
pos = from + (totalDistance * dir);
|
||||
distance = DE(pos) * FudgeFactor;
|
||||
totalDistance += distance;
|
||||
@@ -158,8 +158,8 @@ internal readonly partial struct MengerJourney : IPixelShader<float4>
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
float3 camPos = 0.5f * time * new float3(1.0f, 0.0f, 0.0f);
|
||||
float3 target = camPos + new float3(1.0f, 0.0f * Hlsl.Cos(time), 0.0f * Hlsl.Sin(0.4f * time));
|
||||
float3 camPos = 0.5f * this.time * new float3(1.0f, 0.0f, 0.0f);
|
||||
float3 target = camPos + new float3(1.0f, 0.0f * Hlsl.Cos(this.time), 0.0f * Hlsl.Sin(0.4f * this.time));
|
||||
float3 camDir = Hlsl.Normalize(target - camPos);
|
||||
float3 camUp = new(0.0f, 1.0f, 0.0f);
|
||||
|
||||
|
||||
@@ -90,11 +90,11 @@ internal readonly partial struct Octagrams : IPixelShader<float4>
|
||||
public float4 Execute()
|
||||
{
|
||||
float2 p = (((float2)ThreadIds.XY * 2.0f) - DispatchSize.XY) / Hlsl.Min(DispatchSize.X, DispatchSize.Y);
|
||||
float3 ro = new(0.0f, -0.2f, time * 4.0f);
|
||||
float3 ro = new(0.0f, -0.2f, this.time * 4.0f);
|
||||
float3 ray = Hlsl.Normalize(new float3(p, 1.5f));
|
||||
|
||||
ray.XY = Hlsl.Mul(ray.XY, Rotate(Hlsl.Sin(time * 0.03f) * 5.0f));
|
||||
ray.YZ = Hlsl.Mul(ray.YZ, Rotate(Hlsl.Sin(time * 0.05f) * 0.2f));
|
||||
ray.XY = Hlsl.Mul(ray.XY, Rotate(Hlsl.Sin(this.time * 0.03f) * 5.0f));
|
||||
ray.YZ = Hlsl.Mul(ray.YZ, Rotate(Hlsl.Sin(this.time * 0.05f) * 0.2f));
|
||||
|
||||
float t = 0.1f;
|
||||
float ac = 0.0f;
|
||||
@@ -110,7 +110,7 @@ internal readonly partial struct Octagrams : IPixelShader<float4>
|
||||
|
||||
pos = Mod(pos - 2.0f, 4.0f) - 2.0f;
|
||||
|
||||
float gTime = time - (i * 0.01f);
|
||||
float gTime = this.time - (i * 0.01f);
|
||||
float d = BoxSet(pos, gTime);
|
||||
|
||||
d = Hlsl.Max(Hlsl.Abs(d), 0.01f);
|
||||
@@ -118,8 +118,8 @@ internal readonly partial struct Octagrams : IPixelShader<float4>
|
||||
t += d * 0.55f;
|
||||
}
|
||||
|
||||
float3 col = (ac * 0.02f) + new float3(0.0f, 0.2f * Hlsl.Abs(Hlsl.Sin(time)), 0.5f + (Hlsl.Sin(time) * 0.2f));
|
||||
float4 color = new(col, 1.0f - (t * (0.02f + (0.02f * Hlsl.Sin(time)))));
|
||||
float3 col = (ac * 0.02f) + new float3(0.0f, 0.2f * Hlsl.Abs(Hlsl.Sin(this.time)), 0.5f + (Hlsl.Sin(this.time) * 0.2f));
|
||||
float4 color = new(col, 1.0f - (t * (0.02f + (0.02f * Hlsl.Sin(this.time)))));
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ internal readonly partial struct ProteanClouds : IPixelShader<float4>
|
||||
float3 p2 = p;
|
||||
|
||||
p2.XY -= Disp(p.Z).XY;
|
||||
p.XY = Hlsl.Mul(p.XY, Rotate((Hlsl.Sin(p.Z + time) * (0.1f + (prm1 * 0.05f))) + (time * 0.09f)));
|
||||
p.XY = Hlsl.Mul(p.XY, Rotate((Hlsl.Sin(p.Z + this.time) * (0.1f + (prm1 * 0.05f))) + (this.time * 0.09f)));
|
||||
|
||||
float cl = Hlsl.Dot(p2.XY, p2.XY);
|
||||
float d = 0.0f;
|
||||
@@ -55,7 +55,7 @@ internal readonly partial struct ProteanClouds : IPixelShader<float4>
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
p += Hlsl.Sin((p.ZXY * 0.75f * trk) + (time * trk * 0.8f)) * dspAmp;
|
||||
p += Hlsl.Sin((p.ZXY * 0.75f * trk) + (this.time * trk * 0.8f)) * dspAmp;
|
||||
d -= Hlsl.Abs(Hlsl.Dot(Hlsl.Cos(p), Hlsl.Sin(p.YZX)) * z);
|
||||
z *= 0.57f;
|
||||
trk *= 1.4f;
|
||||
@@ -138,10 +138,10 @@ internal readonly partial struct ProteanClouds : IPixelShader<float4>
|
||||
float2 q = (float2)ThreadIds.XY / DispatchSize.XY;
|
||||
float2 p = (ThreadIds.XY - (0.5f * (float2)DispatchSize.XY)) / DispatchSize.Y;
|
||||
float2 bsMo = -0.5f * (float2)DispatchSize.XY / DispatchSize.Y;
|
||||
float scaledTime = time * 3.0f;
|
||||
float scaledTime = this.time * 3.0f;
|
||||
float3 ro = new(0, 0, scaledTime);
|
||||
|
||||
ro += new float3(Hlsl.Sin(time) * 0.5f, Hlsl.Sin(time * 1.0f) * 0.0f, 0);
|
||||
ro += new float3(Hlsl.Sin(this.time) * 0.5f, Hlsl.Sin(this.time * 1.0f) * 0.0f, 0);
|
||||
|
||||
float dspAmp = 0.85f;
|
||||
|
||||
@@ -161,7 +161,7 @@ internal readonly partial struct ProteanClouds : IPixelShader<float4>
|
||||
|
||||
rd.XY = Hlsl.Mul(rd.XY, Rotate((-Disp(scaledTime + 3.5f).X * 0.2f) + bsMo.X));
|
||||
|
||||
float prm1 = Hlsl.SmoothStep(-0.4f, 0.4f, Hlsl.Sin(time * 0.3f));
|
||||
float prm1 = Hlsl.SmoothStep(-0.4f, 0.4f, Hlsl.Sin(this.time * 0.3f));
|
||||
float4 scn = Render(ro, rd, scaledTime, prm1, bsMo);
|
||||
float3 col = scn.RGB;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ internal readonly partial struct PyramidPattern : IPixelShader<float4>
|
||||
|
||||
p -= ip + 0.5f;
|
||||
|
||||
float ang = (-3.14159f * 3.0f / 5.0f) + (FBM((ip / 8.0f) + (time / 3.0f)) * 6.2831f * 2.0f);
|
||||
float ang = (-3.14159f * 3.0f / 5.0f) + (FBM((ip / 8.0f) + (this.time / 3.0f)) * 6.2831f * 2.0f);
|
||||
|
||||
float2 offs = new float2(Hlsl.Cos(ang), Hlsl.Sin(ang)) * 0.35f;
|
||||
|
||||
@@ -154,7 +154,7 @@ internal readonly partial struct PyramidPattern : IPixelShader<float4>
|
||||
float2 uv = (coordinate - ((float2)DispatchSize.XY * 0.5f)) / iRes;
|
||||
float3 rd = Hlsl.Normalize(new float3(uv, 0.5f));
|
||||
const float gSc = 10.0f;
|
||||
float2 p = (uv * gSc) + new float2(0, time / 2.0f);
|
||||
float2 p = (uv * gSc) + new float2(0, this.time / 2.0f);
|
||||
float2 oP = p;
|
||||
float m = BMap(p);
|
||||
float3 n = new(0, 0, -1);
|
||||
@@ -163,7 +163,7 @@ internal readonly partial struct PyramidPattern : IPixelShader<float4>
|
||||
|
||||
n = DoBumpMap(p, n, bumpFactor, ref edge);
|
||||
|
||||
float3 lp = new float3(-0.0f + (Hlsl.Sin(time) * 0.3f), 0.0f + (Hlsl.Cos(time * 1.3f) * 0.3f), -1) - new float3(uv, 0);
|
||||
float3 lp = new float3(-0.0f + (Hlsl.Sin(this.time) * 0.3f), 0.0f + (Hlsl.Cos(this.time * 1.3f) * 0.3f), -1) - new float3(uv, 0);
|
||||
float lDist = Hlsl.Max(Hlsl.Length(lp), 0.001f);
|
||||
float3 ld = lp / lDist;
|
||||
float diff = Hlsl.Max(Hlsl.Dot(n, ld), 0.0f);
|
||||
|
||||
@@ -38,7 +38,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
|
||||
p = Hlsl.Frac(new float2(262144, 32768) * n);
|
||||
|
||||
return Hlsl.Sin((p * 6.2831853f) + time);
|
||||
return Hlsl.Sin((p * 6.2831853f) + this.time);
|
||||
}
|
||||
|
||||
// Based on IQ's gradient noise formula.
|
||||
@@ -297,7 +297,7 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
{
|
||||
int2 coordinate = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y);
|
||||
float2 uv = (coordinate - ((float2)DispatchSize.XY * 0.5f)) / Hlsl.Min(650.0f, DispatchSize.Y);
|
||||
float2 p = Hlsl.Mul(Rotate2x2(3.14159f / 12.0f), uv) + (new float2(0.8660254f, 0.5f) * time / 16.0f);
|
||||
float2 p = Hlsl.Mul(Rotate2x2(3.14159f / 12.0f), uv) + (new float2(0.8660254f, 0.5f) * this.time / 16.0f);
|
||||
float3 col = SimplexContour(p);
|
||||
|
||||
uv = coordinate / (float2)DispatchSize.XY;
|
||||
|
||||
@@ -106,7 +106,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader<float4>
|
||||
ang *= 2.0f;
|
||||
}
|
||||
|
||||
ang = Hlsl.Frac(ang + (time / 4.0f));
|
||||
ang = Hlsl.Frac(ang + (this.time / 4.0f));
|
||||
|
||||
return d;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader<float4>
|
||||
{
|
||||
float2 uv = (ThreadIds.XY - ((float2)DispatchSize.XY * 0.5f)) / DispatchSize.Y;
|
||||
float gSc = 7.0f;
|
||||
float2 p = (uv * gSc) - (new float2(-1, -0.5f) * time / 2.0f);
|
||||
float2 p = (uv * gSc) - (new float2(-1, -0.5f) * this.time / 2.0f);
|
||||
float sf = 2.0f / DispatchSize.Y * gSc;
|
||||
float lSc = 6.0f;
|
||||
float lw = 1.0f / lSc / gSc;
|
||||
@@ -126,7 +126,7 @@ internal readonly partial struct TwoTiledTruchet : IPixelShader<float4>
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float di = d[i] - (lw / 4.0f);
|
||||
float tracks = Hlsl.Clamp(Hlsl.Sin((ang[i] * 6.2831f) + (time * 6.0f)) * 4.0f, 0.0f, 1.0f);
|
||||
float tracks = Hlsl.Clamp(Hlsl.Sin((ang[i] * 6.2831f) + (this.time * 6.0f)) * 4.0f, 0.0f, 1.0f);
|
||||
float gap = 1.0f + lw;
|
||||
|
||||
col = Hlsl.Lerp(col, 0, (1.0f - Hlsl.SmoothStep(0.0f, sf * 6.0f, di)) * 0.35f);
|
||||
|
||||
@@ -31,8 +31,8 @@ public sealed partial class MainView : UserControl
|
||||
{
|
||||
Ioc.Default.GetRequiredService<IAnalyticsService>().Log(Event.OpenShaderSelectionPanel);
|
||||
|
||||
_ = Root.Resources.Remove("ShaderSelectionPanel");
|
||||
Root.Children.Add(ShaderSelectionPanel);
|
||||
_ = this.Root.Resources.Remove("ShaderSelectionPanel");
|
||||
this.Root.Children.Add(this.ShaderSelectionPanel);
|
||||
}
|
||||
|
||||
// Hides the shader selection panel
|
||||
@@ -40,13 +40,13 @@ public sealed partial class MainView : UserControl
|
||||
{
|
||||
Ioc.Default.GetRequiredService<IAnalyticsService>().Log(Event.CloseShaderSelectionPanel);
|
||||
|
||||
_ = Root.Children.Remove(ShaderSelectionPanel);
|
||||
_ = this.Root.Children.Remove(this.ShaderSelectionPanel);
|
||||
}
|
||||
|
||||
// Updates the size of the shaders list panel
|
||||
private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
ShadersListContainerPanel.Height = Math.Round(e.NewSize.Height * 0.35);
|
||||
this.ShadersListContainerPanel.Height = Math.Round(e.NewSize.Height * 0.35);
|
||||
}
|
||||
|
||||
// Logs rendering failed in the main panel
|
||||
@@ -54,7 +54,7 @@ public sealed partial class MainView : UserControl
|
||||
{
|
||||
Ioc.Default.GetRequiredService<IAnalyticsService>().Log(args.Exception, (nameof(Error), Error.RenderingFailedOnMainPanel));
|
||||
|
||||
RenderingErrorInfoBar.IsOpen = true;
|
||||
this.RenderingErrorInfoBar.IsOpen = true;
|
||||
}
|
||||
|
||||
// Logs rendering failed in a secondary panel
|
||||
@@ -62,6 +62,6 @@ public sealed partial class MainView : UserControl
|
||||
{
|
||||
Ioc.Default.GetRequiredService<IAnalyticsService>().Log(args.Exception, (nameof(Error), Error.RenderingFailedOnSelectionPanel));
|
||||
|
||||
RenderingErrorInfoBar.IsOpen = true;
|
||||
this.RenderingErrorInfoBar.IsOpen = true;
|
||||
}
|
||||
}
|
||||
@@ -23,22 +23,22 @@ public sealed partial class MainWindow : Window
|
||||
this.InitializeComponent();
|
||||
this.ExtendsContentIntoTitleBar = true;
|
||||
|
||||
SetTitleBar(TitleBarRectangle);
|
||||
SetTitleBar(this.TitleBarRectangle);
|
||||
|
||||
Root.DataContext = new MainViewModel(new DebugAnalyticsService());
|
||||
this.Root.DataContext = new MainViewModel(new DebugAnalyticsService());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="MainViewModel"/> instance for the current view.
|
||||
/// </summary>
|
||||
public MainViewModel ViewModel => (MainViewModel)Root.DataContext;
|
||||
public MainViewModel ViewModel => (MainViewModel)this.Root.DataContext;
|
||||
|
||||
/// <summary>
|
||||
/// Stops all rendering when the application is closing.
|
||||
/// </summary>
|
||||
public void OnShutdown()
|
||||
{
|
||||
ShaderPanel.ShaderRunner = null;
|
||||
this.ShaderPanel.ShaderRunner = null;
|
||||
|
||||
foreach ((AnimatedComputeShaderPanel panel, object _) in this.shaderPanels)
|
||||
{
|
||||
@@ -49,20 +49,20 @@ public sealed partial class MainWindow : Window
|
||||
// Opens the shader selection panel
|
||||
private void OpenShaderSelectionPanelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_ = Root.Resources.Remove("ShaderSelectionPanel");
|
||||
Root.Children.Add(ShaderSelectionPanel);
|
||||
_ = this.Root.Resources.Remove("ShaderSelectionPanel");
|
||||
this.Root.Children.Add(this.ShaderSelectionPanel);
|
||||
}
|
||||
|
||||
// Hides the shader selection panel
|
||||
private void ShaderSelectionPanel_Tapped(object sender, TappedRoutedEventArgs e)
|
||||
{
|
||||
_ = Root.Children.Remove(ShaderSelectionPanel);
|
||||
_ = this.Root.Children.Remove(this.ShaderSelectionPanel);
|
||||
}
|
||||
|
||||
// Updates the size of the shaders list panel
|
||||
private void UserControl_SizeChanged(object sender, WindowSizeChangedEventArgs e)
|
||||
{
|
||||
ShadersListContainerPanel.Height = Math.Round(e.Size.Height * 0.35);
|
||||
this.ShadersListContainerPanel.Height = Math.Round(e.Size.Height * 0.35);
|
||||
}
|
||||
|
||||
// Tracks the current panel
|
||||
|
||||
@@ -100,7 +100,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
d3D12CommandQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAGS.D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||
d3D12CommandQueueDesc.NodeMask = 0;
|
||||
|
||||
_ = d3D12Device.Get()->CreateCommandQueue(
|
||||
_ = this.d3D12Device.Get()->CreateCommandQueue(
|
||||
&d3D12CommandQueueDesc,
|
||||
Windows.__uuidof<ID3D12CommandQueue>(),
|
||||
(void**)d3D12CommandQueue);
|
||||
@@ -136,7 +136,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
dxgiSwapChainDesc1.SwapEffect = DXGI_SWAP_EFFECT.DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
|
||||
|
||||
_ = dxgiFactory2.Get()->CreateSwapChainForHwnd(
|
||||
(IUnknown*)d3D12CommandQueue.Get(),
|
||||
(IUnknown*)this.d3D12CommandQueue.Get(),
|
||||
hwnd,
|
||||
&dxgiSwapChainDesc1,
|
||||
null,
|
||||
@@ -159,7 +159,7 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
_ = this.d3D12Device.Get()->CreateCommandList(
|
||||
0,
|
||||
D3D12_COMMAND_LIST_TYPE.D3D12_COMMAND_LIST_TYPE_DIRECT,
|
||||
d3D12CommandAllocator,
|
||||
this.d3D12CommandAllocator,
|
||||
null,
|
||||
Windows.__uuidof<ID3D12GraphicsCommandList>(),
|
||||
(void**)d3D12GraphicsCommandList);
|
||||
@@ -206,8 +206,8 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
fixed (ID3D12Resource** d3D12Resource0 = this.d3D12Resource0)
|
||||
fixed (ID3D12Resource** d3D12Resource1 = this.d3D12Resource1)
|
||||
{
|
||||
_ = dxgiSwapChain1.Get()->GetBuffer(0, Windows.__uuidof<ID3D12Resource>(), (void**)d3D12Resource0);
|
||||
_ = dxgiSwapChain1.Get()->GetBuffer(1, Windows.__uuidof<ID3D12Resource>(), (void**)d3D12Resource1);
|
||||
_ = this.dxgiSwapChain1.Get()->GetBuffer(0, Windows.__uuidof<ID3D12Resource>(), (void**)d3D12Resource0);
|
||||
_ = this.dxgiSwapChain1.Get()->GetBuffer(1, Windows.__uuidof<ID3D12Resource>(), (void**)d3D12Resource1);
|
||||
}
|
||||
|
||||
this.texture?.Dispose();
|
||||
@@ -265,10 +265,10 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
};
|
||||
|
||||
// Transition the resources to COPY_DEST and COPY_SOURCE respectively
|
||||
d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers);
|
||||
this.d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers);
|
||||
|
||||
// Copy the generated frame to the target back buffer
|
||||
d3D12GraphicsCommandList.Get()->CopyResource(d3D12ResourceBackBuffer, d3D12Resource.Get());
|
||||
this.d3D12GraphicsCommandList.Get()->CopyResource(d3D12ResourceBackBuffer, d3D12Resource.Get());
|
||||
|
||||
d3D12ResourceBarriers[0] = D3D12_RESOURCE_BARRIER.InitTransition(
|
||||
d3D12Resource.Get(),
|
||||
@@ -281,12 +281,12 @@ internal sealed class SwapChainApplication<T> : Win32Application
|
||||
D3D12_RESOURCE_STATES.D3D12_RESOURCE_STATE_COMMON);
|
||||
|
||||
// Transition the resources back to COMMON and UNORDERED_ACCESS respectively
|
||||
d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers);
|
||||
this.d3D12GraphicsCommandList.Get()->ResourceBarrier(2, d3D12ResourceBarriers);
|
||||
|
||||
_ = d3D12GraphicsCommandList.Get()->Close();
|
||||
_ = this.d3D12GraphicsCommandList.Get()->Close();
|
||||
|
||||
// Execute the command list to perform the copy
|
||||
this.d3D12CommandQueue.Get()->ExecuteCommandLists(1, (ID3D12CommandList**)d3D12GraphicsCommandList.GetAddressOf());
|
||||
this.d3D12CommandQueue.Get()->ExecuteCommandLists(1, (ID3D12CommandList**)this.d3D12GraphicsCommandList.GetAddressOf());
|
||||
_ = this.d3D12CommandQueue.Get()->Signal(this.d3D12Fence.Get(), this.nextD3D12FenceValue);
|
||||
|
||||
// Present the new frame
|
||||
|
||||
@@ -61,10 +61,10 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
{
|
||||
this.format = format;
|
||||
this.formatProvider = formatProvider;
|
||||
characters = initialBuffer;
|
||||
arrayToReturnToPool = null;
|
||||
position = 0;
|
||||
hasCustomFormatter = formatProvider is not null && HasCustomFormatter(formatProvider);
|
||||
this.characters = initialBuffer;
|
||||
this.arrayToReturnToPool = null;
|
||||
this.position = 0;
|
||||
this.hasCustomFormatter = formatProvider is not null && HasCustomFormatter(formatProvider);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -96,11 +96,11 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
public string ToStringAndClear()
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
string result = new(characters.Slice(0, position));
|
||||
string result = new(this.characters.Slice(0, this.position));
|
||||
#else
|
||||
string result = characters.Slice(0, position).ToString();
|
||||
string result = this.characters.Slice(0, this.position).ToString();
|
||||
#endif
|
||||
char[]? toReturn = arrayToReturnToPool;
|
||||
char[]? toReturn = this.arrayToReturnToPool;
|
||||
|
||||
this = default;
|
||||
|
||||
@@ -121,14 +121,14 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
{
|
||||
if (value.Length == 1)
|
||||
{
|
||||
Span<char> chars = characters;
|
||||
int pos = position;
|
||||
Span<char> chars = this.characters;
|
||||
int pos = this.position;
|
||||
|
||||
if ((uint)pos < (uint)chars.Length)
|
||||
{
|
||||
chars[pos] = value[0];
|
||||
|
||||
position = pos + 1;
|
||||
this.position = pos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,8 +140,8 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
|
||||
if (value.Length == 2)
|
||||
{
|
||||
Span<char> chars = characters;
|
||||
int pos = position;
|
||||
Span<char> chars = this.characters;
|
||||
int pos = this.position;
|
||||
|
||||
if ((uint)pos < chars.Length - 1)
|
||||
{
|
||||
@@ -153,7 +153,7 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
Unsafe.ReadUnaligned<int>(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value.AsSpan()))));
|
||||
#endif
|
||||
|
||||
position = pos + 2;
|
||||
this.position = pos + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -173,12 +173,12 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
private void AppendStringDirect(string value)
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
if (value.TryCopyTo(characters.Slice(position)))
|
||||
if (value.TryCopyTo(this.characters.Slice(this.position)))
|
||||
#else
|
||||
if (value.AsSpan().TryCopyTo(characters.Slice(position)))
|
||||
if (value.AsSpan().TryCopyTo(this.characters.Slice(this.position)))
|
||||
#endif
|
||||
{
|
||||
position += value.Length;
|
||||
this.position += value.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -206,23 +206,23 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
where T : IFormattable
|
||||
#endif
|
||||
{
|
||||
if (hasCustomFormatter)
|
||||
if (this.hasCustomFormatter)
|
||||
{
|
||||
AppendCustomFormatter(value, format);
|
||||
AppendCustomFormatter(value, this.format);
|
||||
return;
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
int charsWritten;
|
||||
|
||||
while (!value.TryFormat(characters.Slice(position), out charsWritten, format, formatProvider))
|
||||
while (!value.TryFormat(this.characters.Slice(this.position), out charsWritten, this.format, this.formatProvider))
|
||||
{
|
||||
Grow();
|
||||
}
|
||||
|
||||
position += charsWritten;
|
||||
this.position += charsWritten;
|
||||
#else
|
||||
AppendStringDirect(value.ToString(format, formatProvider));
|
||||
AppendStringDirect(value.ToString(this.format, this.formatProvider));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -245,9 +245,9 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void AppendCustomFormatter<T>(T value, string? format)
|
||||
{
|
||||
ICustomFormatter? formatter = (ICustomFormatter?)formatProvider?.GetFormat(typeof(ICustomFormatter));
|
||||
ICustomFormatter? formatter = (ICustomFormatter?)this.formatProvider?.GetFormat(typeof(ICustomFormatter));
|
||||
|
||||
if (formatter is not null && formatter.Format(format, value, formatProvider) is string customFormatted)
|
||||
if (formatter is not null && formatter.Format(format, value, this.formatProvider) is string customFormatted)
|
||||
{
|
||||
AppendStringDirect(customFormatted);
|
||||
}
|
||||
@@ -263,12 +263,12 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
Grow(value.Length);
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
value.CopyTo(characters.Slice(position));
|
||||
value.CopyTo(this.characters.Slice(this.position));
|
||||
#else
|
||||
value.AsSpan().CopyTo(characters.Slice(position));
|
||||
value.AsSpan().CopyTo(this.characters.Slice(this.position));
|
||||
#endif
|
||||
|
||||
position += value.Length;
|
||||
this.position += value.Length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -277,7 +277,7 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void Grow(int additionalChars)
|
||||
{
|
||||
GrowCore((uint)position + (uint)additionalChars);
|
||||
GrowCore((uint)this.position + (uint)additionalChars);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
@@ -287,7 +287,7 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void Grow()
|
||||
{
|
||||
GrowCore((uint)characters.Length + 1);
|
||||
GrowCore((uint)this.characters.Length + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -297,7 +297,7 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void GrowCore(uint requiredMinCapacity)
|
||||
{
|
||||
uint newCapacity = Math.Max(requiredMinCapacity, Math.Min((uint)characters.Length * 2, 0x3FFFFFDF));
|
||||
uint newCapacity = Math.Max(requiredMinCapacity, Math.Min((uint)this.characters.Length * 2, 0x3FFFFFDF));
|
||||
#if NET6_0_OR_GREATER
|
||||
int arraySize = (int)Math.Clamp(newCapacity, MinimumArrayPoolLength, int.MaxValue);
|
||||
#else
|
||||
@@ -305,11 +305,11 @@ internal ref struct FormatInterpolatedStringHandler
|
||||
#endif
|
||||
char[] newArray = ArrayPool<char>.Shared.Rent(arraySize);
|
||||
|
||||
characters.Slice(0, position).CopyTo(newArray);
|
||||
this.characters.Slice(0, this.position).CopyTo(newArray);
|
||||
|
||||
char[]? toReturn = arrayToReturnToPool;
|
||||
char[]? toReturn = this.arrayToReturnToPool;
|
||||
|
||||
characters = arrayToReturnToPool = newArray;
|
||||
this.characters = this.arrayToReturnToPool = newArray;
|
||||
|
||||
if (toReturn is not null)
|
||||
{
|
||||
|
||||
@@ -62,9 +62,9 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
this.format = format;
|
||||
this.formatAsString = null;
|
||||
this.formatProvider = formatProvider;
|
||||
position = 0;
|
||||
success = shouldAppend = destination.Length >= literalLength;
|
||||
hasCustomFormatter = formatProvider is not null && FormatInterpolatedStringHandler.HasCustomFormatter(formatProvider);
|
||||
this.position = 0;
|
||||
this.success = shouldAppend = destination.Length >= literalLength;
|
||||
this.hasCustomFormatter = formatProvider is not null && FormatInterpolatedStringHandler.HasCustomFormatter(formatProvider);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -106,13 +106,13 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
if (value.Length == 1)
|
||||
{
|
||||
Span<char> destination = this.destination;
|
||||
int pos = position;
|
||||
int pos = this.position;
|
||||
|
||||
if ((uint)pos < (uint)destination.Length)
|
||||
{
|
||||
destination[pos] = value[0];
|
||||
|
||||
position = pos + 1;
|
||||
this.position = pos + 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
if (value.Length == 2)
|
||||
{
|
||||
Span<char> destination = this.destination;
|
||||
int pos = position;
|
||||
int pos = this.position;
|
||||
|
||||
if ((uint)pos < destination.Length - 1)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
Unsafe.ReadUnaligned<int>(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value.AsSpan()))));
|
||||
#endif
|
||||
|
||||
position = pos + 2;
|
||||
this.position = pos + 2;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -154,12 +154,12 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
private bool AppendStringDirect(string value)
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
if (value.TryCopyTo(destination.Slice(position)))
|
||||
if (value.TryCopyTo(this.destination.Slice(this.position)))
|
||||
#else
|
||||
if (value.AsSpan().TryCopyTo(destination.Slice(position)))
|
||||
if (value.AsSpan().TryCopyTo(this.destination.Slice(this.position)))
|
||||
#endif
|
||||
{
|
||||
position += value.Length;
|
||||
this.position += value.Length;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -177,22 +177,22 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
where T : IFormattable
|
||||
#endif
|
||||
{
|
||||
if (hasCustomFormatter)
|
||||
if (this.hasCustomFormatter)
|
||||
{
|
||||
return AppendCustomFormatter(value, formatAsString ??= format.ToString());
|
||||
return AppendCustomFormatter(value, this.formatAsString ??= this.format.ToString());
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
if (value.TryFormat(destination.Slice(position), out int charsWritten, format, formatProvider))
|
||||
if (value.TryFormat(this.destination.Slice(this.position), out int charsWritten, this.format, this.formatProvider))
|
||||
{
|
||||
position += charsWritten;
|
||||
this.position += charsWritten;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return Fail();
|
||||
#else
|
||||
return AppendStringDirect(value.ToString(formatAsString ??= format.ToString(), formatProvider));
|
||||
return AppendStringDirect(value.ToString(this.formatAsString ??= this.format.ToString(), this.formatProvider));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
/// <param name="value">The value to write.</param>
|
||||
public bool AppendFormatted(string? value)
|
||||
{
|
||||
if (hasCustomFormatter)
|
||||
if (this.hasCustomFormatter)
|
||||
{
|
||||
return AppendCustomFormatter(value, format: null);
|
||||
}
|
||||
@@ -213,12 +213,12 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
if (value.TryCopyTo(destination.Slice(position)))
|
||||
if (value.TryCopyTo(this.destination.Slice(this.position)))
|
||||
#else
|
||||
if (value.AsSpan().TryCopyTo(destination.Slice(position)))
|
||||
if (value.AsSpan().TryCopyTo(this.destination.Slice(this.position)))
|
||||
#endif
|
||||
{
|
||||
position += value.Length;
|
||||
this.position += value.Length;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -234,9 +234,9 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private bool AppendCustomFormatter<T>(T value, string? format)
|
||||
{
|
||||
ICustomFormatter? formatter = (ICustomFormatter?)formatProvider?.GetFormat(typeof(ICustomFormatter));
|
||||
ICustomFormatter? formatter = (ICustomFormatter?)this.formatProvider?.GetFormat(typeof(ICustomFormatter));
|
||||
|
||||
if (formatter is not null && formatter.Format(format, value, formatProvider) is string customFormatted)
|
||||
if (formatter is not null && formatter.Format(format, value, this.formatProvider) is string customFormatted)
|
||||
{
|
||||
return AppendStringDirect(customFormatted);
|
||||
}
|
||||
@@ -249,7 +249,7 @@ internal ref struct TryWriteFormatInterpolatedStringHandler
|
||||
/// </summary>
|
||||
private bool Fail()
|
||||
{
|
||||
success = false;
|
||||
this.success = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ public readonly struct Bool
|
||||
/// <inheritdoc/>
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is Bool x && value == x.value;
|
||||
return obj is Bool x && this.value == x.value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return value.GetHashCode();
|
||||
return this.value.GetHashCode();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -69,9 +69,9 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
/// </summary>
|
||||
~ShaderCompiler()
|
||||
{
|
||||
dxcCompiler.Dispose();
|
||||
dxcLibrary.Dispose();
|
||||
dxcIncludeHandler.Dispose();
|
||||
this.dxcCompiler.Dispose();
|
||||
this.dxcLibrary.Dispose();
|
||||
this.dxcIncludeHandler.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -93,7 +93,7 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
// Get the encoded blob from the source code
|
||||
fixed (char* p = source)
|
||||
{
|
||||
dxcLibrary.Get()->CreateBlobWithEncodingOnHeapCopy(
|
||||
this.dxcLibrary.Get()->CreateBlobWithEncodingOnHeapCopy(
|
||||
p,
|
||||
(uint)source.Length * 2,
|
||||
1200,
|
||||
@@ -110,7 +110,7 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
{
|
||||
char** arguments = stackalloc char*[3] { optimization, rowMajor, warningsAsErrors };
|
||||
|
||||
dxcCompiler.Get()->Compile(
|
||||
this.dxcCompiler.Get()->Compile(
|
||||
(IDxcBlob*)dxcBlobEncoding.Get(),
|
||||
(ushort*)shaderName,
|
||||
(ushort*)entryPoint,
|
||||
@@ -119,7 +119,7 @@ internal sealed unsafe partial class ShaderCompiler
|
||||
3,
|
||||
null,
|
||||
0,
|
||||
dxcIncludeHandler.Get(),
|
||||
this.dxcIncludeHandler.Get(),
|
||||
dxcOperationResult.GetAddressOf()).Assert();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ using Microsoft.CodeAnalysis.Operations;
|
||||
using static ComputeSharp.SourceGeneration.Diagnostics.DiagnosticDescriptors;
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
#pragma warning disable IDE0052
|
||||
|
||||
namespace ComputeSharp.SourceGeneration.SyntaxRewriters;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -114,10 +114,10 @@ internal unsafe ref struct DynamicResolutionManager
|
||||
// This formula is adapted from https://software.intel.com/content/www/us/en/develop/articles/dynamic-resolution-rendering-article.html.
|
||||
long averageFrameTimeInTicks = this.slidingFrameTimeWindowSum / SlidingFrameTimeWindowLength;
|
||||
|
||||
if (averageFrameTimeInTicks < lowerFrameTimeThresholdInTicks ||
|
||||
averageFrameTimeInTicks > upperFrameTimeThresholdInTicks)
|
||||
if (averageFrameTimeInTicks < this.lowerFrameTimeThresholdInTicks ||
|
||||
averageFrameTimeInTicks > this.upperFrameTimeThresholdInTicks)
|
||||
{
|
||||
float frameTimeDelta = (targetFrameTimeInTicks - averageFrameTimeInTicks) / (float)averageFrameTimeInTicks;
|
||||
float frameTimeDelta = (this.targetFrameTimeInTicks - averageFrameTimeInTicks) / (float)averageFrameTimeInTicks;
|
||||
float scaleFactorDelta = scaleFactor * frameTimeDelta * ScaleFactorDeltaK;
|
||||
float updatedScaleFactor = Math.Clamp(scaleFactor + scaleFactorDelta, 0.10f, 1.0f);
|
||||
|
||||
|
||||
@@ -422,7 +422,7 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
|
||||
/// <inheritdoc/>
|
||||
private unsafe partial void OnWaitForPresent()
|
||||
{
|
||||
_ = Win32.WaitForSingleObjectEx(frameLatencyWaitableObject, Win32.INFINITE, true);
|
||||
_ = Win32.WaitForSingleObjectEx(this.frameLatencyWaitableObject, Win32.INFINITE, true);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -141,8 +141,8 @@ internal readonly unsafe struct ID3D12CommandListPool : IDisposable
|
||||
/// <param name="d3D12CommandAllocator">The <see cref="ID3D12CommandAllocator"/> value to wrap.</param>
|
||||
public D3D12CommandListBundle(ID3D12GraphicsCommandList* d3D12CommandList, ID3D12CommandAllocator* d3D12CommandAllocator)
|
||||
{
|
||||
D3D12CommandList = d3D12CommandList;
|
||||
D3D12CommandAllocator = d3D12CommandAllocator;
|
||||
this.D3D12CommandList = d3D12CommandList;
|
||||
this.D3D12CommandAllocator = d3D12CommandAllocator;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,8 +33,8 @@ internal readonly struct ID3D12ResourceDescriptorHandles
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandleNonShaderVisible)
|
||||
{
|
||||
D3D12CpuDescriptorHandle = d3D12CpuDescriptorHandle;
|
||||
D3D12GpuDescriptorHandle = d3D12GpuDescriptorHandle;
|
||||
D3D12CpuDescriptorHandleNonShaderVisible = d3D12CpuDescriptorHandleNonShaderVisible;
|
||||
this.D3D12CpuDescriptorHandle = d3D12CpuDescriptorHandle;
|
||||
this.D3D12GpuDescriptorHandle = d3D12GpuDescriptorHandle;
|
||||
this.D3D12CpuDescriptorHandleNonShaderVisible = d3D12CpuDescriptorHandleNonShaderVisible;
|
||||
}
|
||||
}
|
||||
@@ -60,14 +60,14 @@ internal static unsafe class AllocatorExtensions
|
||||
(D3D12_HEAP_TYPE d3D12HeapType,
|
||||
D3D12_RESOURCE_FLAGS d3D12ResourceFlags,
|
||||
D3D12_RESOURCE_STATES d3D12ResourceStates) = resourceType switch
|
||||
{
|
||||
{
|
||||
ResourceType.Constant => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ),
|
||||
ResourceType.ReadOnly => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON),
|
||||
ResourceType.ReadWrite => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COMMON),
|
||||
ResourceType.ReadBack => (D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST),
|
||||
ResourceType.Upload => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ),
|
||||
_ => ThrowHelper.ThrowArgumentException<(D3D12_HEAP_TYPE, D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
|
||||
};
|
||||
};
|
||||
|
||||
using ComPtr<D3D12MA_Allocation> allocation = default;
|
||||
|
||||
|
||||
@@ -267,19 +267,19 @@ unsafe partial class IWICStreamExtensions
|
||||
/// <inheritdoc/>
|
||||
public HRESULT QueryInterface(Guid* riid, void** ppvObject)
|
||||
{
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, Guid*, void**, HRESULT>)lpVtbl[0])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, Guid*, void**, HRESULT>)this.lpVtbl[0])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, uint>)lpVtbl[1])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this));
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, uint>)this.lpVtbl[1])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, uint>)lpVtbl[2])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this));
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, uint>)this.lpVtbl[2])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -270,19 +270,19 @@ internal static unsafe partial class IWICStreamExtensions
|
||||
/// <inheritdoc/>
|
||||
public HRESULT QueryInterface(Guid* riid, void** ppvObject)
|
||||
{
|
||||
return ((delegate* unmanaged<IStreamWrapper*, Guid*, void**, HRESULT>)lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
return ((delegate* unmanaged<IStreamWrapper*, Guid*, void**, HRESULT>)this.lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged<IStreamWrapper*, uint>)lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this));
|
||||
return ((delegate* unmanaged<IStreamWrapper*, uint>)this.lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged<IStreamWrapper*, uint>)lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this));
|
||||
return ((delegate* unmanaged<IStreamWrapper*, uint>)this.lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -97,12 +97,12 @@ public sealed unsafe partial class GraphicsDevice : NativeObject
|
||||
/// <summary>
|
||||
/// The event for the device removed callback.
|
||||
/// </summary>
|
||||
private HANDLE deviceRemovedEvent;
|
||||
private readonly HANDLE deviceRemovedEvent;
|
||||
|
||||
/// <summary>
|
||||
/// The wait handle for the device removed callback.
|
||||
/// </summary>
|
||||
private HANDLE deviceRemovedWaitHandle;
|
||||
private readonly HANDLE deviceRemovedWaitHandle;
|
||||
|
||||
/// <summary>
|
||||
/// The reason the device was removed, if any.
|
||||
|
||||
@@ -89,7 +89,7 @@ public abstract unsafe class Buffer<T> : NativeObject, IGraphicsResource
|
||||
nint usableSizeInBytes = checked((nint)(length * elementSizeInBytes));
|
||||
nint effectiveSizeInBytes = resourceType == ResourceType.Constant ? AlignmentHelper.Pad(usableSizeInBytes, D3D12.D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT) : usableSizeInBytes;
|
||||
|
||||
SizeInBytes = usableSizeInBytes;
|
||||
this.SizeInBytes = usableSizeInBytes;
|
||||
GraphicsDevice = device;
|
||||
Length = length;
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract unsafe class Buffer<T> : NativeObject, IGraphicsResource
|
||||
internal bool IsPaddingPresent
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => SizeInBytes > (nint)Length * sizeof(T);
|
||||
get => this.SizeInBytes > (nint)Length * sizeof(T);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -30,7 +30,7 @@ internal readonly unsafe ref struct ID3D12ResourceMap
|
||||
{
|
||||
this.d3D12Resource = d3D12Resource;
|
||||
|
||||
Pointer = pointer;
|
||||
this.Pointer = pointer;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IDisposable.Dispose"/>
|
||||
|
||||
@@ -130,7 +130,7 @@ public ref struct ArrayPoolStringBuilder
|
||||
|
||||
Array.Copy(this.array, 0, newArray, 0, itemsToCopy);
|
||||
|
||||
ArrayPool<char>.Shared.Return(array);
|
||||
ArrayPool<char>.Shared.Return(this.array);
|
||||
|
||||
this.array = newArray;
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ internal readonly struct ShaderKey : IEquatable<ShaderKey>
|
||||
public bool Equals(ShaderKey other)
|
||||
{
|
||||
return
|
||||
id == other.id &&
|
||||
threadsX == other.threadsX &&
|
||||
threadsY == other.threadsY &&
|
||||
threadsZ == other.threadsZ;
|
||||
this.id == other.id &&
|
||||
this.threadsX == other.threadsX &&
|
||||
this.threadsY == other.threadsY &&
|
||||
this.threadsZ == other.threadsZ;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -65,6 +65,6 @@ internal readonly struct ShaderKey : IEquatable<ShaderKey>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(id, threadsX, threadsY, threadsZ);
|
||||
return HashCode.Combine(this.id, this.threadsX, this.threadsY, this.threadsZ);
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public partial class D2D1EffectRegistrationDataTests
|
||||
|
||||
public float4 Execute()
|
||||
{
|
||||
return a;
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public partial class D2D1PixelShaderEffectTests
|
||||
|
||||
public float4 Execute()
|
||||
{
|
||||
return dummy;
|
||||
return this.dummy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public partial class D2D1PixelShaderEffectTests
|
||||
|
||||
public float4 Execute()
|
||||
{
|
||||
return a + b + c.X + d + e;
|
||||
return this.a + this.b + this.c.X + this.d + this.e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,14 +232,14 @@ public partial class D2D1PixelShaderTests
|
||||
|
||||
public Float4 Execute()
|
||||
{
|
||||
float4 pixel1 = myTexture1[0];
|
||||
float4 pixel2 = myTexture1.Sample(0.4f);
|
||||
float4 pixel3 = myTexture2[0, 1];
|
||||
float4 pixel4 = myTexture2.Sample(0.4f, 0.3f);
|
||||
float4 pixel5 = myTexture3[0, 1, 2];
|
||||
float4 pixel6 = myTexture3.Sample(0.4f, 0.5f, 0.6f);
|
||||
float number1 = myTexture4[0, 2];
|
||||
float number2 = myTexture4.Sample(0.4f, 0.6f);
|
||||
float4 pixel1 = this.myTexture1[0];
|
||||
float4 pixel2 = this.myTexture1.Sample(0.4f);
|
||||
float4 pixel3 = this.myTexture2[0, 1];
|
||||
float4 pixel4 = this.myTexture2.Sample(0.4f, 0.3f);
|
||||
float4 pixel5 = this.myTexture3[0, 1, 2];
|
||||
float4 pixel6 = this.myTexture3.Sample(0.4f, 0.5f, 0.6f);
|
||||
float number1 = this.myTexture4[0, 2];
|
||||
float number2 = this.myTexture4.Sample(0.4f, 0.6f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -547,8 +547,8 @@ public partial class D2D1ResourceTextureManagerTests
|
||||
int2 xy = (int2)D2D.GetScenePosition().XY;
|
||||
|
||||
int x = xy.X;
|
||||
int y = (int)((uint)xy.Y % (uint)height);
|
||||
int z = (int)((uint)xy.Y / (uint)height);
|
||||
int y = (int)((uint)xy.Y % (uint)this.height);
|
||||
int z = (int)((uint)xy.Y / (uint)this.height);
|
||||
|
||||
return this.source[x, y, z];
|
||||
}
|
||||
@@ -876,7 +876,7 @@ public partial class D2D1ResourceTextureManagerTests
|
||||
|
||||
public float4 Execute()
|
||||
{
|
||||
return source[0, 0];
|
||||
return this.source[0, 0];
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -16,7 +16,7 @@ internal sealed partial class D2D1ResourceTextureUninitializedFieldDiagnosticSup
|
||||
|
||||
public float4 Execute()
|
||||
{
|
||||
return texture[0];
|
||||
return this.texture[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public sealed partial class BokehBlurEffect
|
||||
private (Vector4[] Parameters, float Scale) GetParameters()
|
||||
{
|
||||
// Prepare the kernel components
|
||||
int index = Math.Max(0, Math.Min(componentsCount - 1, KernelComponents.Count));
|
||||
int index = Math.Max(0, Math.Min(this.componentsCount - 1, KernelComponents.Count));
|
||||
|
||||
return (KernelComponents[index], KernelScales[index]);
|
||||
}
|
||||
@@ -177,10 +177,10 @@ public sealed partial class BokehBlurEffect
|
||||
/// </summary>
|
||||
private Complex64[][] CreateComplexKernels()
|
||||
{
|
||||
Complex64[][] kernels = new Complex64[kernelParameters.Length][];
|
||||
ref Vector4 baseRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan());
|
||||
Complex64[][] kernels = new Complex64[this.kernelParameters.Length][];
|
||||
ref Vector4 baseRef = ref MemoryMarshal.GetReference(this.kernelParameters.AsSpan());
|
||||
|
||||
for (int i = 0; i < kernelParameters.Length; i++)
|
||||
for (int i = 0; i < this.kernelParameters.Length; i++)
|
||||
{
|
||||
ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i);
|
||||
|
||||
@@ -197,15 +197,15 @@ public sealed partial class BokehBlurEffect
|
||||
/// <param name="b">The angle component for each complex component.</param>
|
||||
private Complex64[] CreateComplex1DKernel(float a, float b)
|
||||
{
|
||||
Complex64[] kernel = new Complex64[kernelSize];
|
||||
Complex64[] kernel = new Complex64[this.kernelSize];
|
||||
ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan());
|
||||
int r = radius;
|
||||
int r = this.radius;
|
||||
int n = -r;
|
||||
|
||||
for (int i = 0; i < kernelSize; i++, n++)
|
||||
for (int i = 0; i < this.kernelSize; i++, n++)
|
||||
{
|
||||
// Incrementally compute the range values
|
||||
float value = n * kernelsScale * (1f / r);
|
||||
float value = n * this.kernelsScale * (1f / r);
|
||||
|
||||
value *= value;
|
||||
|
||||
@@ -321,7 +321,7 @@ public sealed partial class BokehBlurEffect
|
||||
D2D1PixelShaderEffect.RegisterForD2D1Factory1<GammaHighlight>(d2D1Factory2.Get(), out _);
|
||||
D2D1PixelShaderEffect.RegisterForD2D1Factory1<InverseGammaHighlight>(d2D1Factory2.Get(), out _);
|
||||
|
||||
int numberOfComponents = kernelParameters.Length;
|
||||
int numberOfComponents = this.kernelParameters.Length;
|
||||
|
||||
using ComPtr<ID2D1Effect> gammaExposureEffect = default;
|
||||
using ComPtr<ID2D1Effect> inverseGammaExposureEffect = default;
|
||||
@@ -422,7 +422,7 @@ public sealed partial class BokehBlurEffect
|
||||
{
|
||||
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new VerticalConvolution.Shader((int)kernelSize), verticalConvolutionEffectsForReals[i].Get());
|
||||
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new VerticalConvolution.Shader((int)kernelSize), verticalConvolutionEffectsForImaginaries[i].Get());
|
||||
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new HorizontalConvolutionAndAccumulatePartials.Shader((int)kernelSize, kernelParameters[i].Z, kernelParameters[i].W), horizontalConvolutionEffects[i].Get());
|
||||
D2D1PixelShaderEffect.SetConstantBufferForD2D1Effect(new HorizontalConvolutionAndAccumulatePartials.Shader((int)kernelSize, this.kernelParameters[i].Z, this.kernelParameters[i].W), horizontalConvolutionEffects[i].Get());
|
||||
}
|
||||
|
||||
// Build the effect graph:
|
||||
@@ -579,14 +579,14 @@ public sealed partial class BokehBlurEffect
|
||||
{
|
||||
float4 sourceReal = D2D.SampleInputAtOffset(0, new float2(i - radiusX, 0));
|
||||
float4 sourceImaginary = D2D.SampleInputAtOffset(1, new float2(i - radiusX, 0));
|
||||
float realFactor = kernelReals[i];
|
||||
float imaginaryFactor = kernelImaginaries[i];
|
||||
float realFactor = this.kernelReals[i];
|
||||
float imaginaryFactor = this.kernelImaginaries[i];
|
||||
|
||||
result.Real += (Vector4)((realFactor * sourceReal) - (imaginaryFactor * sourceImaginary));
|
||||
result.Imaginary += (Vector4)((realFactor * sourceImaginary) + (imaginaryFactor * sourceReal));
|
||||
}
|
||||
|
||||
return result.WeightedSum(z, w);
|
||||
return result.WeightedSum(this.z, this.w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ public partial struct CheckerboardClipEffect : ID2D1PixelShader
|
||||
uint x = (uint)Hlsl.Floor(position.X);
|
||||
uint y = (uint)Hlsl.Floor(position.Y);
|
||||
|
||||
uint cellX = (uint)(int)Hlsl.Floor(x / cellSize);
|
||||
uint cellY = (uint)(int)Hlsl.Floor(y / cellSize);
|
||||
uint cellX = (uint)(int)Hlsl.Floor(x / this.cellSize);
|
||||
uint cellY = (uint)(int)Hlsl.Floor(y / this.cellSize);
|
||||
|
||||
if ((cellX % 2 == 0 && cellY % 2 == 0) ||
|
||||
(cellX % 2 == 1 && cellY % 2 == 1))
|
||||
|
||||
@@ -139,7 +139,7 @@ public partial class DeviceDisposalTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = ThreadIds.X;
|
||||
this.buffer[ThreadIds.X] = ThreadIds.X;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ namespace TerraFX.Interop.DirectX
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID3D12Device5*, uint>)lpVtbl[2])((ID3D12Device5*)Unsafe.AsPointer(ref this));
|
||||
return ((delegate* unmanaged[Stdcall]<ID3D12Device5*, uint>)this.lpVtbl[2])((ID3D12Device5*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RemoveDevice()
|
||||
{
|
||||
((delegate* unmanaged[Stdcall]<ID3D12Device5*, void>)lpVtbl[58])((ID3D12Device5*)Unsafe.AsPointer(ref this));
|
||||
((delegate* unmanaged[Stdcall]<ID3D12Device5*, void>)this.lpVtbl[58])((ID3D12Device5*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public partial class DispatchTests
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] *= factor;
|
||||
this.buffer[ThreadIds.X] *= this.factor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public partial class DispatchTests
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
return new(ThreadIds.Normalized.X, ThreadIds.Normalized.Y, b, a);
|
||||
return new(ThreadIds.Normalized.X, ThreadIds.Normalized.Y, this.b, this.a);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ public partial class ShaderHashCodeTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
B[0] = A;
|
||||
this.B[0] = this.A;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public partial class ShaderHashCodeTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
B[0] = F(A);
|
||||
this.B[0] = this.F(this.A);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ public partial class BufferTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.X] = source[ThreadIds.X];
|
||||
this.destination[ThreadIds.X] = this.source[ThreadIds.X];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public partial class BufferTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.X] = source[ThreadIds.X];
|
||||
this.destination[ThreadIds.X] = this.source[ThreadIds.X];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ public partial class BufferTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.X] = source[ThreadIds.X];
|
||||
this.destination[ThreadIds.X] = this.source[ThreadIds.X];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public partial class BufferTests
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = (buffer[ThreadIds.X] * factor) + 3.14;
|
||||
this.buffer[ThreadIds.X] = (this.buffer[ThreadIds.X] * this.factor) + 3.14;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1302,7 +1302,7 @@ public partial class ComputeContextTests
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
buffer[offset + ThreadIds.X] *= 2;
|
||||
this.buffer[this.offset + ThreadIds.X] *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1324,7 +1324,7 @@ public partial class ComputeContextTests
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
return color;
|
||||
return this.color;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1336,7 +1336,7 @@ public partial class ComputeContextTests
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
return source.Sample(ThreadIds.Normalized.XY);
|
||||
return this.source.Sample(ThreadIds.Normalized.XY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1354,7 +1354,7 @@ public partial class ComputeContextTests
|
||||
// The source has a depth of 3, but the destination has a depth of 2
|
||||
xyz.Z = Hlsl.Lerp(0, 0.5f, xyz.Z);
|
||||
|
||||
destination[ThreadIds.XYZ] = source.Sample(xyz);
|
||||
this.destination[ThreadIds.XYZ] = this.source.Sample(xyz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ public partial class ComputeContextTests
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
return source.Sample(ThreadIds.Normalized.XY);
|
||||
return this.source.Sample(ThreadIds.Normalized.XY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1378,7 +1378,7 @@ public partial class ComputeContextTests
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
return source[ThreadIds.XY];
|
||||
return this.source[ThreadIds.XY];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1390,7 +1390,7 @@ public partial class ComputeContextTests
|
||||
/// <inheritdoc/>
|
||||
public float4 Execute()
|
||||
{
|
||||
return new(1.0f - source[ThreadIds.XY].XYZ, source[ThreadIds.XY].W);
|
||||
return new(1.0f - this.source[ThreadIds.XY].XYZ, this.source[ThreadIds.XY].W);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1408,7 +1408,7 @@ public partial class ComputeContextTests
|
||||
// See comment in LinearSampling3DComputeShader
|
||||
xyz.Z = Hlsl.Lerp(0, 0.5f, xyz.Z);
|
||||
|
||||
destination[ThreadIds.XYZ] = source.Sample(xyz);
|
||||
this.destination[ThreadIds.XYZ] = this.source.Sample(xyz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1430,11 +1430,11 @@ public partial class ComputeContextTests
|
||||
(ThreadIds.Normalized.X > 0.5f &&
|
||||
ThreadIds.Normalized.Y > 0.5))
|
||||
{
|
||||
source[ThreadIds.XY] = float4.UnitW;
|
||||
this.source[ThreadIds.XY] = float4.UnitW;
|
||||
}
|
||||
else
|
||||
{
|
||||
source[ThreadIds.XY] = float4.Zero;
|
||||
this.source[ThreadIds.XY] = float4.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1458,11 +1458,11 @@ public partial class ComputeContextTests
|
||||
(ThreadIds.Normalized.X > 0.5f &&
|
||||
ThreadIds.Normalized.Y > 0.5))
|
||||
{
|
||||
source[ThreadIds.XYZ] = float4.UnitW;
|
||||
this.source[ThreadIds.XYZ] = float4.UnitW;
|
||||
}
|
||||
else
|
||||
{
|
||||
source[ThreadIds.XYZ] = float4.Zero;
|
||||
this.source[ThreadIds.XYZ] = float4.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1477,7 +1477,7 @@ public partial class ComputeContextTests
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XY] = source[ThreadIds.XY];
|
||||
this.destination[ThreadIds.XY] = this.source[ThreadIds.XY];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public partial class DispatchTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.XYZ].XYZ = ThreadIds.XYZ;
|
||||
this.buffer[ThreadIds.XYZ].XYZ = ThreadIds.XYZ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,9 +117,9 @@ public partial class DispatchTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.XYZ].XYZ = ThreadIds.Normalized.XYZ;
|
||||
buffer[ThreadIds.XYZ].XY = ThreadIds.Normalized.XY;
|
||||
buffer[ThreadIds.XYZ].W = ThreadIds.Normalized.X;
|
||||
this.buffer[ThreadIds.XYZ].XYZ = ThreadIds.Normalized.XYZ;
|
||||
this.buffer[ThreadIds.XYZ].XY = ThreadIds.Normalized.XY;
|
||||
this.buffer[ThreadIds.XYZ].W = ThreadIds.Normalized.X;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,8 +178,8 @@ public partial class DispatchTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.XYZ].XYZ = GroupIds.XYZ;
|
||||
buffer[ThreadIds.XYZ].W = GroupIds.Index;
|
||||
this.buffer[ThreadIds.XYZ].XYZ = GroupIds.XYZ;
|
||||
this.buffer[ThreadIds.XYZ].W = GroupIds.Index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,12 +208,12 @@ public partial class DispatchTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[0] = GroupSize.X;
|
||||
buffer[1] = GroupSize.Y;
|
||||
buffer[2] = GroupSize.Z;
|
||||
buffer[3] = GroupSize.Count;
|
||||
buffer[4] = (int)Hlsl.Dot(GroupSize.XY, float2.One);
|
||||
buffer[5] = (int)Hlsl.Dot(GroupSize.XYZ, float3.One);
|
||||
this.buffer[0] = GroupSize.X;
|
||||
this.buffer[1] = GroupSize.Y;
|
||||
this.buffer[2] = GroupSize.Z;
|
||||
this.buffer[3] = GroupSize.Count;
|
||||
this.buffer[4] = (int)Hlsl.Dot(GroupSize.XY, float2.One);
|
||||
this.buffer[5] = (int)Hlsl.Dot(GroupSize.XYZ, float3.One);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ public partial class DispatchTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = GridIds.X;
|
||||
this.buffer[ThreadIds.X] = GridIds.X;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,12 +271,12 @@ public partial class DispatchTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[0] = DispatchSize.Count;
|
||||
buffer[1] = DispatchSize.X;
|
||||
buffer[2] = DispatchSize.Y;
|
||||
buffer[3] = DispatchSize.Z;
|
||||
buffer[4] = (int)Hlsl.Dot(DispatchSize.XY, float2.One);
|
||||
buffer[5] = (int)Hlsl.Dot(DispatchSize.XYZ, float3.One);
|
||||
this.buffer[0] = DispatchSize.Count;
|
||||
this.buffer[1] = DispatchSize.X;
|
||||
this.buffer[2] = DispatchSize.Y;
|
||||
this.buffer[3] = DispatchSize.Z;
|
||||
this.buffer[4] = (int)Hlsl.Dot(DispatchSize.XY, float2.One);
|
||||
this.buffer[5] = (int)Hlsl.Dot(DispatchSize.XYZ, float3.One);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ public partial class DispatchTests
|
||||
|
||||
if (!isWritingToGroupShared)
|
||||
{
|
||||
buffer[index] = cache[index];
|
||||
this.buffer[index] = cache[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -397,7 +397,7 @@ public partial class DispatchTests
|
||||
|
||||
if (!isWritingToGroupShared)
|
||||
{
|
||||
buffer[index] = cache[index];
|
||||
this.buffer[index] = cache[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ internal static class TolerantImageComparer
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[delta({RedDifference},{GreenDifference},{BlueDifference},{AlphaDifference}) @ ({Position.X},{Position.Y})]";
|
||||
return $"[delta({this.RedDifference},{this.GreenDifference},{this.BlueDifference},{this.AlphaDifference}) @ ({this.Position.X},{this.Position.Y})]";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public partial class InitializationTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = ThreadIds.X;
|
||||
this.buffer[ThreadIds.X] = ThreadIds.X;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public partial class MetaprogrammingTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = activation(ThreadIds.X);
|
||||
this.buffer[ThreadIds.X] = this.activation(ThreadIds.X);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public partial class MetaprogrammingTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = f2(f1(ThreadIds.X));
|
||||
this.buffer[ThreadIds.X] = this.f2(this.f1(ThreadIds.X));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public partial class MetaprogrammingTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = MagicNumber + activation(ThreadIds.X);
|
||||
this.buffer[ThreadIds.X] = MagicNumber + this.activation(ThreadIds.X);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public partial class MetaprogrammingTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = activation(ThreadIds.X);
|
||||
this.buffer[ThreadIds.X] = this.activation(ThreadIds.X);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ public partial class MetaprogrammingTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
buffer[ThreadIds.X] = Activations.AddOne(ThreadIds.X) + activation(ThreadIds.X);
|
||||
this.buffer[ThreadIds.X] = Activations.AddOne(ThreadIds.X) + this.activation(ThreadIds.X);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using ComputeSharp.Interop;
|
||||
using ComputeSharp.Tests.Misc;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
#pragma warning disable IDE0008, IDE0022
|
||||
#pragma warning disable IDE0008, IDE0022, IDE0009
|
||||
|
||||
namespace ComputeSharp.Tests
|
||||
{
|
||||
|
||||
@@ -3,6 +3,8 @@ using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
#pragma warning disable IDE0009
|
||||
|
||||
namespace ComputeSharp.Tests;
|
||||
|
||||
[TestClass]
|
||||
|
||||
@@ -4,7 +4,7 @@ using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
#pragma warning disable IDE0008
|
||||
#pragma warning disable IDE0007, IDE0008, IDE0009
|
||||
|
||||
namespace ComputeSharp.Tests;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048
|
||||
#pragma warning disable IDE0048, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048, IDE0011
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048
|
||||
#pragma warning disable IDE0048, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048
|
||||
#pragma warning disable IDE0048, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048
|
||||
#pragma warning disable IDE0048, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048
|
||||
#pragma warning disable IDE0048, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047
|
||||
#pragma warning disable IDE0048, IDE0011, IDE0047, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma warning disable IDE0048
|
||||
#pragma warning disable IDE0048, IDE0009
|
||||
|
||||
namespace ComputeSharp.SwapChain.Shaders.Compute;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ partial class Texture1DTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.X] = source.Sample(ThreadIds.Normalized.X);
|
||||
this.destination[ThreadIds.X] = this.source.Sample(ThreadIds.Normalized.X);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -370,7 +370,7 @@ public partial class Texture1DTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.X] = source[ThreadIds.X];
|
||||
this.destination[ThreadIds.X] = this.source[ThreadIds.X];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ public partial class Texture1DTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.X] = source[ThreadIds.X];
|
||||
this.destination[ThreadIds.X] = this.source[ThreadIds.X];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ partial class Texture2DTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XY] = source.Sample(ThreadIds.Normalized.XY);
|
||||
this.destination[ThreadIds.XY] = this.source.Sample(ThreadIds.Normalized.XY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ partial class Texture2DTests
|
||||
|
||||
public float4 Execute()
|
||||
{
|
||||
return texture.Sample(ThreadIds.Normalized.XY);
|
||||
return this.texture.Sample(ThreadIds.Normalized.XY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ public partial class Texture2DTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[(ThreadIds.Y * 32) + ThreadIds.X] = source[ThreadIds.XY];
|
||||
this.destination[(ThreadIds.Y * 32) + ThreadIds.X] = this.source[ThreadIds.XY];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ public partial class Texture2DTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XY] = source[ThreadIds.XY];
|
||||
this.destination[ThreadIds.XY] = this.source[ThreadIds.XY];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -540,7 +540,7 @@ public partial class Texture3DTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[(ThreadIds.Z * 32 * 32) + (ThreadIds.Y * 32) + ThreadIds.X] = source[ThreadIds.XYZ];
|
||||
this.destination[(ThreadIds.Z * 32 * 32) + (ThreadIds.Y * 32) + ThreadIds.X] = this.source[ThreadIds.XYZ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +570,7 @@ public partial class Texture3DTests
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XYZ] = source[ThreadIds.XYZ];
|
||||
this.destination[ThreadIds.XYZ] = this.source[ThreadIds.XYZ];
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする