From 3ce248306237ef5822c55dbccc30597de94bd8fb Mon Sep 17 00:00:00 2001 From: routersys Date: Sat, 4 Jul 2026 11:49:12 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=8D=E3=82=A4=E3=83=86=E3=82=A3=E3=83=96?= =?UTF-8?q?=E6=89=8B=E9=A0=86=E3=81=B8=E3=82=B7=E3=82=A7=E3=83=BC=E3=83=80?= =?UTF-8?q?=E3=83=BC=E4=BA=A4=E6=8F=9B=E9=A0=98=E5=9F=9F=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript.Runtime/Engine/NativeProtocol.cs | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/LuaScript.Runtime/Engine/NativeProtocol.cs b/LuaScript.Runtime/Engine/NativeProtocol.cs index 86d5163..18f3a56 100644 --- a/LuaScript.Runtime/Engine/NativeProtocol.cs +++ b/LuaScript.Runtime/Engine/NativeProtocol.cs @@ -61,6 +61,8 @@ namespace LuaScript.Engine public const int CbKindFlushDraws = 10; public const int CbKindSceneGet = 11; public const int CbKindSceneSet = 12; + public const int CbKindPixelShaderStage = 13; + public const int CbKindPixelShaderRun = 14; public const int DrawRingCapacity = 4096; public const int DrawEntryDoubles = 24; @@ -153,7 +155,38 @@ namespace LuaScript.Engine public const int MaxPixelBufferSize = 3840 * 2160 * 4; + public const int ShaderMetaDoubles = 20; + public const int ShaderConstantsMax = 1024; + public const int ShaderResourcesMax = 8; + + public const int ShaderMetaResourceCount = 0; + public const int ShaderMetaBlendMode = 1; + public const int ShaderMetaCompositeBlend = 2; + public const int ShaderMetaSampler = 3; + public const int ShaderMetaConstantCount = 4; + public const int ShaderMetaImageWidth = 5; + public const int ShaderMetaImageHeight = 6; + public const int ShaderMetaImageKind = 7; + public const int ShaderMetaStatus = 8; + public const int ShaderMetaResourceKinds = 9; + + public const int ShaderResourceStaged = 0; + public const int ShaderResourceRandom = 1; + public const int ShaderResourceTransparent = 2; + public const int ShaderResourceObject = 3; + + public const int ShaderTargetExchange = 0; + public const int ShaderTargetObject = 1; + + public const long ShaderRegionBytes = ShaderMetaDoubles * 8 + ShaderConstantsMax * 4 + MaxPixelBufferSize; + + public static long ShaderMetaOffset(long bufferSize) => bufferSize - ShaderRegionBytes; + + public static long ShaderConstantsOffset(long bufferSize) => ShaderMetaOffset(bufferSize) + ShaderMetaDoubles * 8; + + public static long ShaderImageOffset(long bufferSize) => ShaderConstantsOffset(bufferSize) + ShaderConstantsMax * 4; + public static long BufferSize(int width, int height, int stringCapacity) => - PixelOffset(stringCapacity) + Math.Max((long)width * height * 4, MaxPixelBufferSize); + PixelOffset(stringCapacity) + Math.Max((long)width * height * 4, MaxPixelBufferSize) + ShaderRegionBytes; } }