画像処理のGPU委譲契約を追加

このコミットが含まれているのは:
routersys committed 2026-07-05 10:11:26 +09:00
1 親 31d26c0a70
コミット a291d66567
2ファイル変更
+31

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

+20
ファイルの表示
@@ -169,6 +169,8 @@ namespace LuaScript
internal IPixelShaderRunner? ShaderRunner { get; set; }
internal IPixelBufferProcessor? PixelProcessor { get; set; }
internal AviUtlPixelShaderLibrary PixelShaders { get; set; } = AviUtlPixelShaderLibrary.Empty;
internal bool TryGetShaderResource(string id, out byte[] data, out int width, out int height) =>
@@ -524,6 +526,12 @@ namespace LuaScript
if (x1 <= x0 || y1 <= y0)
return;
if (PixelProcessor?.TryFill(_pixelBuffer, cw, ch, r, g, b, a, x0, y0, x1 - x0, y1 - y0) == true)
{
_isPixelsDirty = true;
return;
}
_isPixelsDirty = true;
double aK = Math.Clamp(a, 0d, 255d) / 255d;
byte pb = (byte)Math.Clamp(b * aK, 0d, 255d);
@@ -641,6 +649,12 @@ namespace LuaScript
int cw = ImageWidth;
int ch = ImageHeight;
if (PixelProcessor?.TryConvolve(_pixelBuffer, cw, ch, kernel, size, divisor, offset) == true)
{
_isPixelsDirty = true;
return;
}
int count = cw * ch * 4;
if (_convolveSource is null || _convolveSource.Length < count)
_convolveSource = new double[count];
@@ -720,6 +734,12 @@ namespace LuaScript
int cw = ImageWidth;
int ch = ImageHeight;
if (PixelProcessor?.TryResize(_pixelBuffer, cw, ch, newWidth, newHeight, linear, out var processed) == true && processed is not null)
{
ReplaceBuffer(processed, newWidth, newHeight);
return;
}
int srcCount = cw * ch * 4;
if (_resizeSource is null || _resizeSource.Length < srcCount)
_resizeSource = new byte[srcCount];
+11
ファイルの表示
@@ -0,0 +1,11 @@
namespace LuaScript
{
internal interface IPixelBufferProcessor
{
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 TryConvolve(byte[] target, int width, int height, double[] kernel, int size, double divisor, double offset);
bool TryResize(byte[] source, int sourceWidth, int sourceHeight, int targetWidth, int targetHeight, bool linear, out byte[]? target);
}
}