コミットを比較
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
171000d271
|
||
|
|
1c1d206b86
|
||
|
|
9228917700
|
||
|
|
9604213016
|
||
|
|
9808924782
|
||
|
|
261bcf45f1
|
||
|
|
8461aab4cd
|
||
|
|
a91acb6a93
|
検索条件に一致するファイルはありません
+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.1
|
||||
ローポリ化 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.1</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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using YukkuriMovieMaker.Generator;
|
||||
|
||||
namespace LowPolyAbstraction
|
||||
{
|
||||
[AutoGenLocalizer]
|
||||
partial class Texts
|
||||
{
|
||||
namespace LowPolyAbstraction;
|
||||
|
||||
}
|
||||
[AutoGenLocalizer]
|
||||
partial class Texts
|
||||
{
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする