コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
171000d271
|
||
|
|
1c1d206b86
|
||
|
|
9228917700
|
||
|
|
9604213016
|
||
|
|
9808924782
|
||
|
|
261bcf45f1
|
||
|
|
8461aab4cd
|
||
|
|
a91acb6a93
|
||
|
|
a5cd6aa08f
|
||
|
|
854bf21860
|
||
|
|
4f8489057a
|
||
|
|
3f1e63f27b
|
||
|
|
971b0c4151
|
||
|
|
31520cbf4b
|
検索条件に一致するファイルはありません
+77
@@ -0,0 +1,77 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
end_of_line = crlf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{json,yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[*.{csproj,props,targets,vcxproj,filters,slnx,resx,xml}]
|
||||
charset = unset
|
||||
indent_style = unset
|
||||
indent_size = unset
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.cs]
|
||||
dotnet_separate_import_directive_groups = false
|
||||
dotnet_sort_system_directives_first = true
|
||||
|
||||
dotnet_style_qualification_for_field = false:error
|
||||
dotnet_style_qualification_for_property = false:error
|
||||
dotnet_style_qualification_for_method = false:error
|
||||
dotnet_style_qualification_for_event = false:error
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:error
|
||||
dotnet_style_predefined_type_for_member_access = true:error
|
||||
dotnet_style_readonly_field = true:warning
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_code_quality_unused_parameters = all:warning
|
||||
|
||||
csharp_style_namespace_declarations = file_scoped:error
|
||||
csharp_using_directive_placement = outside_namespace:error
|
||||
csharp_prefer_braces = when_multiline:silent
|
||||
csharp_style_var_for_built_in_types = true:silent
|
||||
csharp_style_var_when_type_is_apparent = true:silent
|
||||
csharp_style_var_elsewhere = true:silent
|
||||
csharp_style_expression_bodied_methods = when_on_single_line:silent
|
||||
csharp_style_expression_bodied_properties = true:silent
|
||||
csharp_style_expression_bodied_accessors = true:silent
|
||||
csharp_style_prefer_pattern_matching = true:suggestion
|
||||
csharp_style_prefer_not_pattern = true:suggestion
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
csharp_style_prefer_readonly_struct = true:warning
|
||||
csharp_style_prefer_readonly_struct_member = true:warning
|
||||
csharp_prefer_static_local_function = true:warning
|
||||
csharp_style_prefer_primary_constructors = true:silent
|
||||
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_finally = true
|
||||
|
||||
dotnet_diagnostic.IDE0005.severity = warning
|
||||
dotnet_diagnostic.IDE0055.severity = warning
|
||||
dotnet_diagnostic.IDE0161.severity = error
|
||||
|
||||
[{YMM4-GitHubUpdateNotifier,YMM4-Telemetry,YukkuriMovieMaker.Generator}/**]
|
||||
dotnet_diagnostic.IDE0005.severity = none
|
||||
dotnet_diagnostic.IDE0055.severity = none
|
||||
dotnet_diagnostic.IDE0161.severity = none
|
||||
|
||||
[*.{g.cs,designer.cs}]
|
||||
generated_code = true
|
||||
dotnet_diagnostic.IDE0005.severity = none
|
||||
dotnet_diagnostic.IDE0055.severity = none
|
||||
dotnet_diagnostic.IDE0161.severity = none
|
||||
@@ -1,5 +1,5 @@
|
||||
========================================
|
||||
ローポリ化 for YMM4 v2.0.0
|
||||
ローポリ化 for YMM4 v2.0.2
|
||||
========================================
|
||||
YukkuriMovieMaker4上で動作する、素材を三角形の面で塗り分けて
|
||||
ローポリ画として描画する映像エフェクトプラグインです。
|
||||
|
||||
@@ -298,7 +298,7 @@ static int Structure(HarnessImage image)
|
||||
Console.WriteLine($" {variants[index].Name,-11} min={sorted[0],7:F2} median={median,7:F2} max={sorted[^1],7:F2}");
|
||||
}
|
||||
|
||||
if (pipeline.TryGetVisibleBounds(image.Width, image.Height, in parameters, out var rect))
|
||||
if (pipeline.TryGetVisibleBounds(image.Width, image.Height, out var rect))
|
||||
{
|
||||
using var rectOutput = device.AllocateReadWriteTexture2D<Bgra32, Float4>(rect.Width, rect.Height);
|
||||
pipeline.RenderVisible(rectOutput, image.Width, image.Height, rect, in parameters);
|
||||
@@ -307,7 +307,7 @@ static int Structure(HarnessImage image)
|
||||
for (var frame = 0; frame < RectFrames; frame++)
|
||||
{
|
||||
pipeline.Simulate(sourceTexture, image.Width, image.Height, 0, 0, image.Width, image.Height, in parameters);
|
||||
pipeline.TryGetVisibleBounds(image.Width, image.Height, in parameters, out rect);
|
||||
pipeline.TryGetVisibleBounds(image.Width, image.Height, out rect);
|
||||
pipeline.RenderVisible(rectOutput, image.Width, image.Height, rect, in parameters);
|
||||
}
|
||||
pipeline.WaitForCompletion();
|
||||
|
||||
@@ -419,6 +419,30 @@ public sealed class LowPolyAbstractionEffectProcessorTests
|
||||
Assert.True(IsRedrawn(after, source));
|
||||
}
|
||||
|
||||
[Fact(Timeout = 60000)]
|
||||
public async Task AProcessorDrawsLikeAFreshOneAfterTheDeviceReclaimsIdleMemory()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
using var devices = new GraphicsDevices();
|
||||
using var context = devices.CreateContext();
|
||||
RequireInterop(context);
|
||||
using var source = new SourceImage(context, Size, Size, (x, y) => x is >= 16 and < 48 && y is >= 16 and < 48 ? Bgra.Opaque(80, 200, 255) : Bgra.Transparent);
|
||||
var effect = new LowPolyAbstractionEffect();
|
||||
using var processor = effect.CreateVideoEffect(context);
|
||||
processor.SetInput(source.Bitmap);
|
||||
RenderFrame(context, processor, 0);
|
||||
GraphicsDevice.GetDefault().TrimMemory();
|
||||
|
||||
var reclaimed = RenderFrame(context, processor, 0);
|
||||
using var fresh = effect.CreateVideoEffect(context);
|
||||
fresh.SetInput(source.Bitmap);
|
||||
var expected = RenderFrame(context, fresh, 0);
|
||||
|
||||
Assert.True(reclaimed.SamePixelsAs(expected));
|
||||
}, TestContext.Current.CancellationToken);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AFailureWhileUpdatingIsNotSwallowed()
|
||||
{
|
||||
|
||||
@@ -121,7 +121,7 @@ public sealed class LowPolyAbstractionInteropTests
|
||||
{
|
||||
interop.Draw(source.Bitmap);
|
||||
interop.Pipeline.Simulate(interop.Resources.GetSourceComputeBinding(), 96, 96, 0, 0, 96, 96, in parameters);
|
||||
Assert.True(interop.Pipeline.TryGetVisibleBounds(96, 96, in parameters, out var visible));
|
||||
Assert.True(interop.Pipeline.TryGetVisibleBounds(96, 96, out var visible));
|
||||
var (width, height) = outputSize(visible);
|
||||
Assert.True(interop.Resources.TryEnsureOutput(width, height, out _));
|
||||
interop.Pipeline.RenderVisible(interop.Resources.GetOutputComputeBinding(), 96, 96, visible, in parameters);
|
||||
@@ -154,7 +154,7 @@ public sealed class LowPolyAbstractionInteropTests
|
||||
Assert.True(interop.Resources.TryEnsureSource(size, size, out var sourceChanged));
|
||||
interop.Draw(source.Bitmap);
|
||||
Assert.True(interop.Pipeline.Simulate(interop.Resources.GetSourceComputeBinding(), size, size, 0, 0, size, size, in parameters));
|
||||
Assert.True(interop.Pipeline.TryGetVisibleBounds(size, size, in parameters, out var visible));
|
||||
Assert.True(interop.Pipeline.TryGetVisibleBounds(size, size, out var visible));
|
||||
Assert.True(interop.Resources.TryEnsureOutput(visible.Width, visible.Height, out _));
|
||||
interop.Pipeline.RenderVisible(interop.Resources.GetOutputComputeBinding(), size, size, visible, in parameters);
|
||||
var output = interop.CaptureOutput(context, out var width, out var height);
|
||||
|
||||
@@ -498,6 +498,41 @@ public sealed class LowPolyAbstractionPipelineTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void APipelineWhoseGridWasReclaimedDrawsLikeAFreshOne()
|
||||
{
|
||||
using var pipeline = CreatePipeline();
|
||||
using var fresh = CreatePipeline();
|
||||
var source = TwoTone(64, 64, 16, 16, 32, 32);
|
||||
var parameters = Parameters();
|
||||
Render(pipeline, source, 64, 64, parameters);
|
||||
GraphicsDevice.GetDefault().TrimMemory();
|
||||
|
||||
var reused = Render(pipeline, source, 64, 64, parameters);
|
||||
var expected = Render(fresh, source, 64, 64, parameters);
|
||||
|
||||
Assert.Equal(expected, reused);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AReclaimedGridIsSimulatedAgain()
|
||||
{
|
||||
using var pipeline = CreatePipeline();
|
||||
var parameters = Parameters();
|
||||
var device = GraphicsDevice.GetDefault();
|
||||
using var texture = device.AllocateReadWriteTexture2D<Bgra32, Float4>(64, 64);
|
||||
Upload(texture, TwoTone(64, 64, 16, 16, 32, 32));
|
||||
|
||||
var first = pipeline.Simulate(texture, 64, 64, 0, 0, 64, 64, in parameters);
|
||||
var repeated = pipeline.Simulate(texture, 64, 64, 0, 0, 64, 64, in parameters);
|
||||
device.TrimMemory();
|
||||
var reclaimed = pipeline.Simulate(texture, 64, 64, 0, 0, 64, 64, in parameters);
|
||||
|
||||
Assert.True(first);
|
||||
Assert.False(repeated);
|
||||
Assert.True(reclaimed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AWarmPipelineAllocatesNoManagedMemory()
|
||||
{
|
||||
@@ -580,7 +615,7 @@ public sealed class LowPolyAbstractionPipelineTests
|
||||
Upload(sourceTexture, source);
|
||||
|
||||
pipeline.Simulate(sourceTexture, 192, 192, 0, 0, 192, 192, in parameters);
|
||||
Assert.True(pipeline.TryGetVisibleBounds(192, 192, in parameters, out var rect));
|
||||
Assert.True(pipeline.TryGetVisibleBounds(192, 192, out var rect));
|
||||
using var outputTexture = device.AllocateReadWriteTexture2D<Bgra32, Float4>(rect.Width, rect.Height);
|
||||
pipeline.RenderVisible(outputTexture, 192, 192, rect, in parameters);
|
||||
var visible = new Bgra32[rect.Width * rect.Height];
|
||||
@@ -617,7 +652,7 @@ public sealed class LowPolyAbstractionPipelineTests
|
||||
|
||||
pipeline.Simulate(source, canvas, canvas, 0, 0, canvas, canvas, in parameters);
|
||||
|
||||
Assert.True(pipeline.TryGetVisibleBounds(canvas, canvas, in parameters, out var rect));
|
||||
Assert.True(pipeline.TryGetVisibleBounds(canvas, canvas, out var rect));
|
||||
Assert.Equal((0, 0), (rect.X % 4, rect.Y % 4));
|
||||
Assert.True(rect.Width % 4 == 0 || rect.X + rect.Width == canvas, $"{rect}");
|
||||
Assert.True(rect.Height % 4 == 0 || rect.Y + rect.Height == canvas, $"{rect}");
|
||||
@@ -634,12 +669,12 @@ public sealed class LowPolyAbstractionPipelineTests
|
||||
var parameters = Parameters();
|
||||
using var source = UploadedSquare();
|
||||
pipeline.Simulate(source, 128, 128, 0, 0, 128, 128, in parameters);
|
||||
Assert.True(pipeline.TryGetVisibleBounds(128, 128, in parameters, out _));
|
||||
Assert.True(pipeline.TryGetVisibleBounds(128, 128, out _));
|
||||
|
||||
Upload(source, new int[128 * 128]);
|
||||
pipeline.Simulate(source, 128, 128, 0, 0, 128, 128, in parameters);
|
||||
|
||||
Assert.False(pipeline.TryGetVisibleBounds(128, 128, in parameters, out var rect));
|
||||
Assert.False(pipeline.TryGetVisibleBounds(128, 128, out var rect));
|
||||
Assert.Equal(default, rect);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<Platform Name="x64" />
|
||||
</Configurations>
|
||||
<Folder Name="/Solution Items/">
|
||||
<File Path=".editorconfig" />
|
||||
<File Path=".gitattributes" />
|
||||
<File Path=".gitignore" />
|
||||
<File Path=".gitmodules" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>2.0.0</Version>
|
||||
<Version>2.0.2</Version>
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
|
||||
@@ -142,7 +142,7 @@ internal sealed class LowPolyAbstractionEffectProcessor : VideoEffectProcessorBa
|
||||
itemHeight,
|
||||
in pipelineParameters);
|
||||
|
||||
if (!_pipeline.TryGetVisibleBounds(canvasWidth, canvasHeight, in pipelineParameters, out var rect))
|
||||
if (!_pipeline.TryGetVisibleBounds(canvasWidth, canvasHeight, out var rect))
|
||||
{
|
||||
_effect.Amount = 0f;
|
||||
_parameters = parameters;
|
||||
|
||||
@@ -200,7 +200,7 @@ internal readonly partial struct EdgeDistanceSeedShader(
|
||||
}
|
||||
}
|
||||
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.XY)]
|
||||
[ThreadGroupSize(LowPolyAbstractionSettings.JumpFloodGroupWidth, 1, 1)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
internal readonly partial struct JumpFloodPixelPassShader(
|
||||
ReadWriteBuffer<int> input,
|
||||
@@ -642,7 +642,7 @@ internal readonly partial struct VoronoiScatterShader(
|
||||
}
|
||||
}
|
||||
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.XY)]
|
||||
[ThreadGroupSize(LowPolyAbstractionSettings.JumpFloodGroupWidth, 1, 1)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
internal readonly partial struct JumpFloodSitePassShader(
|
||||
ReadWriteBuffer<int> input,
|
||||
@@ -678,7 +678,7 @@ internal readonly partial struct JumpFloodSitePassShader(
|
||||
if (sx < 0 || sx >= workingWidth || sy < 0 || sy >= workingHeight)
|
||||
continue;
|
||||
var candidate = input[sy * workingWidth + sx];
|
||||
if (candidate < 0)
|
||||
if (candidate < 0 || candidate == best)
|
||||
continue;
|
||||
var delta = position - sitePositions[candidate];
|
||||
var distance = delta.X * delta.X + delta.Y * delta.Y;
|
||||
@@ -693,7 +693,7 @@ internal readonly partial struct JumpFloodSitePassShader(
|
||||
}
|
||||
}
|
||||
|
||||
[ThreadGroupSize(DefaultThreadGroupSizes.XY)]
|
||||
[ThreadGroupSize(LowPolyAbstractionSettings.AccumulateGroupDim, LowPolyAbstractionSettings.AccumulateGroupDim, 1)]
|
||||
[GeneratedComputeShaderDescriptor]
|
||||
internal readonly partial struct CentroidAccumulateShader(
|
||||
ReadWriteBuffer<int> assignment,
|
||||
@@ -708,6 +708,18 @@ internal readonly partial struct CentroidAccumulateShader(
|
||||
private readonly int workingWidth = workingWidth;
|
||||
private readonly int workingHeight = workingHeight;
|
||||
|
||||
[GroupShared(LowPolyAbstractionSettings.AccumulateGroupSize)]
|
||||
private static readonly int[] groupSite = null!;
|
||||
|
||||
[GroupShared(LowPolyAbstractionSettings.AccumulateGroupSize)]
|
||||
private static readonly int[] groupWeight = null!;
|
||||
|
||||
[GroupShared(LowPolyAbstractionSettings.AccumulateGroupSize)]
|
||||
private static readonly int[] groupWeightedX = null!;
|
||||
|
||||
[GroupShared(LowPolyAbstractionSettings.AccumulateGroupSize)]
|
||||
private static readonly int[] groupWeightedY = null!;
|
||||
|
||||
private void AddCarry(int index, int value)
|
||||
{
|
||||
int previous;
|
||||
@@ -720,23 +732,51 @@ internal readonly partial struct CentroidAccumulateShader(
|
||||
{
|
||||
var x = ThreadIds.X;
|
||||
var y = ThreadIds.Y;
|
||||
if (x >= workingWidth || y >= workingHeight)
|
||||
return;
|
||||
var slot = GroupIds.Index;
|
||||
var site = -1;
|
||||
var wq = 0;
|
||||
var weightedX = 0;
|
||||
var weightedY = 0;
|
||||
if (x < workingWidth && y < workingHeight)
|
||||
{
|
||||
var index = y * workingWidth + x;
|
||||
var assigned = assignment[index];
|
||||
if (assigned >= 0)
|
||||
{
|
||||
wq = Hlsl.Max((int)(weight[index] * LowPolyAbstractionSettings.WeightScale + 0.5f), 0);
|
||||
if (wq != 0)
|
||||
{
|
||||
site = assigned;
|
||||
weightedX = wq * (x * LowPolyAbstractionSettings.PositionSubScale + LowPolyAbstractionSettings.PositionSubScale / 2);
|
||||
weightedY = wq * (y * LowPolyAbstractionSettings.PositionSubScale + LowPolyAbstractionSettings.PositionSubScale / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
groupSite[slot] = site;
|
||||
groupWeight[slot] = wq;
|
||||
groupWeightedX[slot] = weightedX;
|
||||
groupWeightedY[slot] = weightedY;
|
||||
Hlsl.GroupMemoryBarrierWithGroupSync();
|
||||
|
||||
var index = y * workingWidth + x;
|
||||
var site = assignment[index];
|
||||
if (site < 0)
|
||||
return;
|
||||
var w = weight[index];
|
||||
var wq = Hlsl.Max((int)(w * LowPolyAbstractionSettings.WeightScale + 0.5f), 0);
|
||||
if (wq == 0)
|
||||
return;
|
||||
var xq = x * LowPolyAbstractionSettings.PositionSubScale + LowPolyAbstractionSettings.PositionSubScale / 2;
|
||||
var yq = y * LowPolyAbstractionSettings.PositionSubScale + LowPolyAbstractionSettings.PositionSubScale / 2;
|
||||
for (var other = 0; other < slot; other++)
|
||||
{
|
||||
if (groupSite[other] == site)
|
||||
return;
|
||||
}
|
||||
for (var other = slot + 1; other < LowPolyAbstractionSettings.AccumulateGroupSize; other++)
|
||||
{
|
||||
if (groupSite[other] != site)
|
||||
continue;
|
||||
wq += groupWeight[other];
|
||||
weightedX += groupWeightedX[other];
|
||||
weightedY += groupWeightedY[other];
|
||||
}
|
||||
var baseIndex = site * 6;
|
||||
AddCarry(baseIndex, wq);
|
||||
AddCarry(baseIndex + 2, wq * xq);
|
||||
AddCarry(baseIndex + 4, wq * yq);
|
||||
AddCarry(baseIndex + 2, weightedX);
|
||||
AddCarry(baseIndex + 4, weightedY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1017,13 +1057,14 @@ internal readonly partial struct TriangleMapShader(
|
||||
for (var slot = 0; slot < listed; slot++)
|
||||
{
|
||||
var triangle = incidence[site * LowPolyAbstractionSettings.MaxIncidence + slot];
|
||||
if (best >= 0 && triangle >= best)
|
||||
continue;
|
||||
var a = sitePositions[triangleVertices[triangle * 3]];
|
||||
var b = sitePositions[triangleVertices[triangle * 3 + 1]];
|
||||
var c = sitePositions[triangleVertices[triangle * 3 + 2]];
|
||||
if (LowPolyAbstractionShaderMath.ContainsPoint(a, b, c, px, py))
|
||||
{
|
||||
best = triangle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
triangleMap[index] = best;
|
||||
}
|
||||
@@ -1403,19 +1444,16 @@ internal readonly partial struct RenderShader(
|
||||
private int FindTriangle(float px, float py, int site)
|
||||
{
|
||||
var listed = Hlsl.Min(incidenceCounts[site], LowPolyAbstractionSettings.MaxIncidence);
|
||||
var best = -1;
|
||||
for (var slot = 0; slot < listed; slot++)
|
||||
{
|
||||
var triangle = incidence[site * LowPolyAbstractionSettings.MaxIncidence + slot];
|
||||
if (best >= 0 && triangle >= best)
|
||||
continue;
|
||||
var a = sitePositions[triangleVertices[triangle * 3]];
|
||||
var b = sitePositions[triangleVertices[triangle * 3 + 1]];
|
||||
var c = sitePositions[triangleVertices[triangle * 3 + 2]];
|
||||
if (LowPolyAbstractionShaderMath.ContainsPoint(a, b, c, px, py))
|
||||
best = triangle;
|
||||
return triangle;
|
||||
}
|
||||
return best;
|
||||
return -1;
|
||||
}
|
||||
|
||||
private float SourceAlpha(float x, float y)
|
||||
|
||||
@@ -168,7 +168,7 @@ internal sealed class LowPolyAbstractionPipeline : IDisposable
|
||||
return true;
|
||||
}
|
||||
|
||||
internal bool TryGetVisibleBounds(int canvasWidth, int canvasHeight, in Parameters parameters, out PixelRect rect)
|
||||
internal bool TryGetVisibleBounds(int canvasWidth, int canvasHeight, out PixelRect rect)
|
||||
{
|
||||
rect = default;
|
||||
if (!_hasStructure || _cachedMinX > _cachedMaxX || _cachedMinY > _cachedMaxY)
|
||||
@@ -266,14 +266,16 @@ internal sealed class LowPolyAbstractionPipeline : IDisposable
|
||||
|
||||
private void EnsureGrid(int workingWidth, int workingHeight, int siteCapacity)
|
||||
{
|
||||
if (_workingWidth == workingWidth && _workingHeight == workingHeight && _siteCapacity == siteCapacity)
|
||||
return;
|
||||
var resized = _workingWidth != workingWidth || _workingHeight != workingHeight || _siteCapacity != siteCapacity;
|
||||
if (resized)
|
||||
{
|
||||
_structureKey = null;
|
||||
_hasStructure = false;
|
||||
_workingWidth = 0;
|
||||
_workingHeight = 0;
|
||||
_siteCapacity = 0;
|
||||
}
|
||||
|
||||
_structureKey = null;
|
||||
_hasStructure = false;
|
||||
_workingWidth = 0;
|
||||
_workingHeight = 0;
|
||||
_siteCapacity = 0;
|
||||
var pixelCount = workingWidth * workingHeight;
|
||||
var triangleCapacity = LowPolyAbstractionSettings.GetTriangleCapacity(siteCapacity);
|
||||
var scanLength = Math.Max((workingWidth + 1) * (workingHeight + 1), triangleCapacity);
|
||||
@@ -301,8 +303,14 @@ internal sealed class LowPolyAbstractionPipeline : IDisposable
|
||||
triangleErrorsLength: triangleCapacity,
|
||||
triangleVerticesLength: triangleCapacity * 3,
|
||||
weightLength: pixelCount),
|
||||
out _))
|
||||
out var changed))
|
||||
throw new InvalidOperationException();
|
||||
|
||||
if (changed)
|
||||
{
|
||||
_structureKey = null;
|
||||
_hasStructure = false;
|
||||
}
|
||||
_workingWidth = workingWidth;
|
||||
_workingHeight = workingHeight;
|
||||
_siteCapacity = siteCapacity;
|
||||
|
||||
@@ -317,8 +317,11 @@ internal sealed partial class LowPolyAbstractionPipelineHost
|
||||
RecordVoronoi(in context, grid, scratch, siteCapacity, in derived);
|
||||
context.For(accumulatorLength, new FillIntShader(grid.SiteAccumulators, accumulatorLength, 0));
|
||||
context.Barrier(grid.SiteAccumulators);
|
||||
context.For(derived.WorkingWidth, derived.WorkingHeight, new CentroidAccumulateShader(
|
||||
GetAssignment(grid, in derived), grid.Weight, grid.SiteAccumulators, derived.WorkingWidth, derived.WorkingHeight));
|
||||
context.For(
|
||||
ThreadGroupAlignment.AlignX<CentroidAccumulateShader>(derived.WorkingWidth),
|
||||
ThreadGroupAlignment.AlignY<CentroidAccumulateShader>(derived.WorkingHeight),
|
||||
new CentroidAccumulateShader(
|
||||
GetAssignment(grid, in derived), grid.Weight, grid.SiteAccumulators, derived.WorkingWidth, derived.WorkingHeight));
|
||||
context.Barrier(grid.SiteAccumulators);
|
||||
context.For(siteCapacity, new UpdateSitesShader(
|
||||
grid.SitePositions, grid.SiteKinds, grid.SiteAccumulators, scratch,
|
||||
|
||||
@@ -18,6 +18,9 @@ internal static class LowPolyAbstractionSettings
|
||||
public const int ScratchAlphaCount = 9;
|
||||
public const int ScratchPendingCount = 10;
|
||||
public const int ScanBlockSize = 1024;
|
||||
public const int JumpFloodGroupWidth = 64;
|
||||
public const int AccumulateGroupDim = 8;
|
||||
public const int AccumulateGroupSize = AccumulateGroupDim * AccumulateGroupDim;
|
||||
public const float AlphaThreshold = 0.05f;
|
||||
public const float EdgeThreshold = 0.06f;
|
||||
public const float EdgeSampleSpacingFactor = 0.02f;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using YukkuriMovieMaker.Generator;
|
||||
|
||||
namespace LowPolyAbstraction
|
||||
{
|
||||
[AutoGenLocalizer]
|
||||
partial class Texts
|
||||
{
|
||||
namespace LowPolyAbstraction;
|
||||
|
||||
}
|
||||
[AutoGenLocalizer]
|
||||
partial class Texts
|
||||
{
|
||||
}
|
||||
バイナリファイルは表示されません。
|
変更前 幅: | 高さ: | サイズ: 839 KiB 変更後 幅: | 高さ: | サイズ: 837 KiB |
新しいイシューから参照
ユーザーをブロックする