many thing

This commit is contained in:
Nitload
2026-02-28 00:54:32 +08:00
parent a798ab07f1
commit 55cf3934bb
90 changed files with 288 additions and 321 deletions
+5 -4
View File
@@ -96,6 +96,11 @@
<PropertyGroup Condition="'$(IsLinux)'=='true'">
<DefineConstants>LINUX</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Graphics\**" />
<EmbeddedResource Remove="Graphics\**" />
<None Remove="Graphics\**" />
</ItemGroup>
<ItemGroup>
<None Remove=".nuspec" />
<None Remove="StgSharp.Common.deps.json" />
@@ -115,10 +120,6 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Graphics\" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
</Target>
@@ -1,27 +1,30 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Image"
// file="Image.cs"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
@@ -44,9 +47,7 @@ namespace StgSharp.Graphics
_rawInfo = new ImageInfo();
}
internal Image(
ImageInfo information
)
internal Image(ImageInfo information)
{
_rawInfo = information;
_data = [];
@@ -106,18 +107,11 @@ namespace StgSharp.Graphics
private set => _rawInfo.pixelLayout = value;
}
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.PixelImage;
internal ref byte[] Data => ref _data;
public void FromBytes(
byte[] stream
) { }
public void FromBytes(byte[] stream) { }
public static unsafe Image FromFile(
string route,
ImageLoader loader
)
public static unsafe Image FromFile(string route, ImageLoader loader)
{
Image ret = new Image();
fixed (ImageInfo* iptr = &ret._rawInfo) {
@@ -126,11 +120,7 @@ namespace StgSharp.Graphics
return ret;
}
public static Image FromMemory(
(int width, int height) size,
ImageChannel channel,
byte[] stream
)
public static Image FromMemory((int width, int height) size, ImageChannel channel, byte[] stream)
{
ImageInfo _info = new ImageInfo
{
@@ -149,8 +139,7 @@ namespace StgSharp.Graphics
(int width, int height) size,
ImageChannel channel,
PixelChannelLayout layout,
byte[] stream
)
byte[] stream)
{
ImageInfo _info = new ImageInfo
{
@@ -184,11 +173,7 @@ namespace StgSharp.Graphics
return this;
}
internal static Image FromMemory(
ImageInfo info,
byte[] data,
int operationCount
)
internal static Image FromMemory(ImageInfo info, byte[] data, int operationCount)
{
return new Image
{
@@ -198,10 +183,5 @@ namespace StgSharp.Graphics
};
}
byte[] ISSDSerializable.GetBytes()
{
throw new NotImplementedException();
}
}
}
+96
View File
@@ -0,0 +1,96 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="gl.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL;
using StgSharp.Internal;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics
{
internal static partial class GraphicFramework
{
internal static uint[] GLtype = new uint[16];
static GraphicFramework()
{
GLtype[(int)TypeCode.Single] = glConst.FLOAT;
GLtype[(int)TypeCode.Int32] = glConst.INT;
GLtype[(int)TypeCode.UInt32] = glConst.UNSIGNED_INT;
GLtype[(int)TypeCode.Int16] = glConst.SHORT;
GLtype[(int)TypeCode.UInt16] = glConst.UNSIGNED_SHORT;
GLtype[(int)TypeCode.SByte] = glConst.BYTE;
GLtype[(int)TypeCode.Byte] = glConst.UNSIGNED_BYTE;
}
[LibraryImport(Native.LibName, EntryPoint = "glCheckShaderStat")]
[UnmanagedCallConv(CallConvs = [ typeof(CallConvCdecl) ])]
#pragma warning disable CA5392
internal static partial int glCheckShaderStatus(
ref OpenglContext context,
uint shaderHandle,
int key,
ref IntPtr logPtr);
#pragma warning restore CA5392
#region ssgc api define
[LibraryImport(Native.LibName, EntryPoint = "initGL")]
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
internal static partial void InternalInitGL(int majorVersion, int minorVersion);
[LibraryImport(Native.LibName, EntryPoint = "loadGlfuncDefault", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
internal static partial IntPtr InternalLoadGlFuncDefault(string name);
[LibraryImport(Native.LibName, EntryPoint = "linkShaderProgram")]
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
internal static unsafe partial uint InternalLinkShaderProgram(OpenglContext* context, uint shaderProgram);
[LibraryImport(Native.LibName, EntryPoint = "readLog")]
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
internal static unsafe partial IntPtr InternalReadSSCLog();
[LibraryImport(Native.LibName, EntryPoint = "loadImageData", StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
internal static unsafe partial void InternalLoadImage(string fileName, ImageInfo* output, ImageLoader loader);
[LibraryImport(Native.LibName, EntryPoint = "unloadImageData")]
[UnmanagedCallConv(CallConvs =[ typeof(CallConvCdecl) ])]
internal static unsafe partial void InternalUnloadImage(ImageInfo* output);
#endregion ssgc api define
}
}
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="IGeometry"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -43,9 +43,8 @@ namespace StgSharp.Geometries
public Point this[int index] { get; set; }
#pragma warning disable CA1819
public Vec4[] VertexStream
public Vec4[] VertexStream { get; }
#pragma warning restore CA1819
{ get; }
public CoordinationBase Coordination { get; }
+1 -1
View File
@@ -34,7 +34,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.Mathematics", "Stg
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.RegularAnalysis", "StgSharp.RegularAnalysis\StgSharp.RegularAnalysis.csproj", "{46339874-C6B8-4361-997E-2E30387E51F9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgsSharp.Graphics", "StgsSharp.Graphics\StgsSharp.Graphics.csproj", "{80CD3DDE-0642-451D-82DF-0DE422FC6E34}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StgSharp.Graphics", "StgSharp.Graphics\StgSharp.Graphics.csproj", "{80CD3DDE-0642-451D-82DF-0DE422FC6E34}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
-114
View File
@@ -1,114 +0,0 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="gl"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Internal
{
internal static partial class GraphicFramework
{
internal static uint[] GLtype = new uint[16];
static GraphicFramework()
{
GLtype[(int)TypeCode.Single] = glConst.FLOAT;
GLtype[(int)TypeCode.Int32] = glConst.INT;
GLtype[(int)TypeCode.UInt32] = glConst.UNSIGNED_INT;
GLtype[(int)TypeCode.Int16] = glConst.SHORT;
GLtype[(int)TypeCode.UInt16] = glConst.UNSIGNED_SHORT;
GLtype[(int)TypeCode.SByte] = glConst.BYTE;
GLtype[(int)TypeCode.Byte] = glConst.UNSIGNED_BYTE;
}
[LibraryImport(Native.LibName, EntryPoint = "glCheckShaderStat")]
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
#pragma warning disable CA5392
internal static partial int glCheckShaderStatus(
ref OpenglContext context,
uint shaderHandle,
int key,
ref IntPtr logPtr
);
#pragma warning restore CA5392
#region ssgc api define
[LibraryImport(Native.LibName, EntryPoint = "initGL")]
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
internal static partial void InternalInitGL(
int majorVersion,
int minorVersion
);
[LibraryImport(
Native.LibName,
EntryPoint = "loadGlfuncDefault",
StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
internal static partial IntPtr InternalLoadGlFuncDefault(
string name
);
[LibraryImport(Native.LibName, EntryPoint = "linkShaderProgram")]
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
internal static unsafe partial uint InternalLinkShaderProgram(
OpenglContext* context,
uint shaderProgram
);
[LibraryImport(Native.LibName, EntryPoint = "readLog")]
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
internal static unsafe partial IntPtr InternalReadSSCLog();
[LibraryImport(
Native.LibName,
EntryPoint = "loadImageData",
StringMarshalling = StringMarshalling.Utf8)]
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
internal static unsafe partial void InternalLoadImage(
string fileName,
ImageInfo* output,
ImageLoader loader
);
[LibraryImport(Native.LibName, EntryPoint = "unloadImageData")]
[UnmanagedCallConv(CallConvs =[typeof(CallConvCdecl)])]
internal static unsafe partial void InternalUnloadImage(
ImageInfo* output
);
#endregion ssgc api define
}
}
+5
View File
@@ -0,0 +1,5 @@
1. native 核函数标识关键字宏和展开宏
2. 核函数参数表重整
3. C#侧核函数调度器重整适配
4. 正则表达式源生成
5. imgae及pixel存储优化