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
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする