GPU処理にforce引数を追加しきい値を無視可能に

このコミットが含まれているのは:
routersys committed 2026-07-05 19:17:06 +09:00
1 親 1f421dd158
コミット e4bdf0df19
5ファイル変更
+16 -16

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

+2 -2
ファイルの表示
@@ -15,13 +15,13 @@ namespace LuaScript.Engine.Processing
private readonly float[] _constants = new float[1024];
private readonly List<ConvolveValidation> _validations = [];
public bool TryConvolve(byte[] target, int width, int height, double[] kernel, int size, double divisor, double offset)
public bool TryConvolve(byte[] target, int width, int height, double[] kernel, int size, double divisor, double offset, bool force = false)
{
if (!IsTextureSupported(target, width, height) || !IsSupported(kernel, size, divisor, offset))
return false;
long work = (long)width * height * size * size;
if (work < ConvolveWorkThreshold || !EnsureValidated(target, width, height, kernel, size, divisor, offset))
if (!force && work < ConvolveWorkThreshold || !EnsureValidated(target, width, height, kernel, size, divisor, offset))
return false;
SetConstants(width, height, kernel, size, divisor, offset);
+3 -3
ファイルの表示
@@ -16,7 +16,7 @@ namespace LuaScript.Engine.Processing
private bool? _fullValidated;
private bool? _partialValidated;
public bool TryFill(byte[] target, int width, int height, double r, double g, double b, double a, int x, int y, int fillWidth, int fillHeight)
public bool TryFill(byte[] target, int width, int height, double r, double g, double b, double a, int x, int y, int fillWidth, int fillHeight, bool force = false)
{
if (!IsTextureSupported(target, width, height) || !AreFinite(r, g, b, a))
return false;
@@ -25,14 +25,14 @@ namespace LuaScript.Engine.Processing
bool full = x == 0 && y == 0 && fillWidth == width && fillHeight == height;
if (full)
{
if (pixels < FillFullThreshold || !EnsureFullValidated())
if (!force && pixels < FillFullThreshold || !EnsureFullValidated())
return false;
SetConstants(r, g, b, a);
return RunFillFull(_constants.AsSpan(0, 4), target, width, height);
}
long area = (long)fillWidth * fillHeight;
if (pixels < FillPartialThreshold || area * 4L < pixels * 3L || !EnsurePartialValidated())
if (!force && (pixels < FillPartialThreshold || area * 4L < pixels * 3L) || !EnsurePartialValidated())
return false;
SetConstants(r, g, b, a);
+6 -6
ファイルの表示
@@ -9,22 +9,22 @@ namespace LuaScript.Engine.Processing
private readonly GpuConvolveOperation _convolve = new(runner);
private readonly GpuResizeOperation _resize = new(runner);
public bool TryFill(byte[] target, int width, int height, double r, double g, double b, double a, int x, int y, int fillWidth, int fillHeight)
public bool TryFill(byte[] target, int width, int height, double r, double g, double b, double a, int x, int y, int fillWidth, int fillHeight, bool force = false)
{
lock (_gate)
return _fill.TryFill(target, width, height, r, g, b, a, x, y, fillWidth, fillHeight);
return _fill.TryFill(target, width, height, r, g, b, a, x, y, fillWidth, fillHeight, force);
}
public bool TryConvolve(byte[] target, int width, int height, double[] kernel, int size, double divisor, double offset)
public bool TryConvolve(byte[] target, int width, int height, double[] kernel, int size, double divisor, double offset, bool force = false)
{
lock (_gate)
return _convolve.TryConvolve(target, width, height, kernel, size, divisor, offset);
return _convolve.TryConvolve(target, width, height, kernel, size, divisor, offset, force);
}
public bool TryResize(byte[] source, int sourceWidth, int sourceHeight, int targetWidth, int targetHeight, bool linear, out byte[]? target)
public bool TryResize(byte[] source, int sourceWidth, int sourceHeight, int targetWidth, int targetHeight, bool linear, out byte[]? target, bool force = false)
{
lock (_gate)
return _resize.TryResize(source, sourceWidth, sourceHeight, targetWidth, targetHeight, linear, out target);
return _resize.TryResize(source, sourceWidth, sourceHeight, targetWidth, targetHeight, linear, out target, force);
}
}
}
+2 -2
ファイルの表示
@@ -16,14 +16,14 @@ namespace LuaScript.Engine.Processing
private bool? _nearestValidated;
private bool? _linearValidated;
public bool TryResize(byte[] source, int sourceWidth, int sourceHeight, int targetWidth, int targetHeight, bool linear, out byte[]? target)
public bool TryResize(byte[] source, int sourceWidth, int sourceHeight, int targetWidth, int targetHeight, bool linear, out byte[]? target, bool force = false)
{
target = null;
if (!IsTextureSupported(source, sourceWidth, sourceHeight) || !IsTextureSizeSupported(targetWidth, targetHeight))
return false;
long pixels = (long)targetWidth * targetHeight;
if (pixels < ResizeThreshold || !(linear ? EnsureLinearValidated(source, sourceWidth, sourceHeight) : EnsureNearestValidated(source, sourceWidth, sourceHeight)))
if (!force && pixels < ResizeThreshold || !(linear ? EnsureLinearValidated(source, sourceWidth, sourceHeight) : EnsureNearestValidated(source, sourceWidth, sourceHeight)))
return false;
return RunShader(source, sourceWidth, sourceHeight, targetWidth, targetHeight, linear, out target);