Daily update on 20250618-051714 by Nitload Youmu. Additional Message : Brief support to collection operation in EXPRESS. A collection type added in core lib and compilestack.

Signed-off-by: Nitload <YoumuLiu_NSI@whv0t.onmicrosoft.com>
This commit is contained in:
Nitload
2025-06-18 05:17:14 +08:00
parent 74c01effe4
commit c624a8ca38
300 changed files with 12227 additions and 4303 deletions
-1
View File
@@ -144,7 +144,6 @@ namespace StgSharp
REPEAT a := 1 TO 10;
b := 10;
END_REPEAT
""";
public static void ExpLinearExpressionTest()
+11 -6
View File
@@ -1,7 +1,7 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Program.cs"
// Project: StgSharp
// Project: World
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
@@ -35,6 +35,7 @@ using StgSharp.Geometries;
using StgSharp.Graphics;
using StgSharp.Math;
using StgSharp.Model.Step;
using StgSharp.MVVM;
using StgSharp.MVVM.ViewModel;
using StgSharp.Script;
@@ -56,9 +57,13 @@ namespace StgSharp
internal static unsafe void Main( string[] args )
{
StgSharp.Init();
StepEntityLabel l1 = new StepEntityLabel( 1 );
StepEntityLabel l2 = new StepEntityLabel( 1 );
Console.WriteLine( l1 == l2 );
World.Init();
TestStepRead();
StgSharp.Terminate( 0 );
World.Terminate( 0 );
return;
try { }
@@ -66,16 +71,16 @@ namespace StgSharp
{
Console.WriteLine( ex );
/*
StgSharp.WriteLog($"{ex}", LogType.Error);
World.WriteLog($"{ex}", LogType.Error);
if( true ) { }
Dialogue.PostError( ex );
/**/
StgSharp.Terminate( -1 );
World.Terminate( -1 );
/**/
}
finally
{
StgSharp.Terminate( 0 );
World.Terminate( 0 );
}
}
+45 -75
View File
@@ -73,17 +73,9 @@ namespace StgSharp
public override bool IsContextSharable => true;
public Rectangle ButtonBounding
{
get;
private set;
}
public Rectangle ButtonBounding { get; private set; }
public TextureProvider ButtonTextureProvider
{
get;
private set;
}
public TextureProvider ButtonTextureProvider { get; private set; }
//render a controlling item
public void ButtonMain( IEnumerable<PlainGeometryMesh> items )
@@ -96,7 +88,8 @@ namespace StgSharp
f_vao.Bind( 0 ); //GL.Assert(true);
foreach( PlainGeometryMesh mesh in items ) {
foreach( PlainGeometryMesh mesh in items )
{
//autoT.SelectTextureAndBind(mesh.TextureImage);
f_t.LoadTexture( 0, mesh.TextureImage );
@@ -104,8 +97,7 @@ namespace StgSharp
frameMainShader.Use(); //GL.Assert(true);
GL.DrawElements(
GeometryType.TRIANGLES, 6, TypeCode.UInt32, IntPtr.Zero );
GL.DrawElements( GeometryType.TRIANGLES, 6, TypeCode.UInt32, IntPtr.Zero );
}
//GL.ClearError();
@@ -133,15 +125,15 @@ namespace StgSharp
/**/
GL.TextureImage2d<byte>(
Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel,
( uint )Width, ( uint )Height, ImageChannel.WithAlphaChannel,
PixelChannelLayout.Byte, null );
Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, ( uint )Width,
( uint )Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null );
/**/
//GL.Assert(false);
//Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.All));
GL.ClearColor( ( 0.6f + TimePassed ) % 1.0f, 0.1f, 0.3f, 1 );
//GL.Assert( false );
//Console.WriteLine(GL.CheckFrameBufferStatus(FrameBufferTarget.All));
@@ -151,16 +143,15 @@ namespace StgSharp
//GL.Assert(false);
vbo.Bind( 1 );
vbo.WriteVectorData<Vec4>(
1, buffer.CoordAndRotationSpan, BufferUsage.StreamDraw );
vbo.WriteVectorData<Vec4>( 1, buffer.CoordAndRotationSpan, BufferUsage.StreamDraw );
s.Use();
NativeCamera.SetAllUniforms();
GL.SetUniformValue( time, TimePassed );
GL.DrawElementsInstanced(
GeometryType.TRIANGLES, 6, TypeCode.UInt32, IntPtr.Zero, 100 );
GL.DrawElementsInstanced( GeometryType.TRIANGLES, 6, TypeCode.UInt32, IntPtr.Zero,
100 );
//Console.WriteLine(TimePassed);
//GL.Assert(true);
@@ -205,16 +196,14 @@ namespace StgSharp
}
public void RenderButton(
ButtonStatus status,
float statusBegin,
in TextureProvider provider )
ButtonStatus status,
float statusBegin,
in TextureProvider provider )
{
provider.UpdateFromImage( i );
}
internal static Vec3 DefaultRotation(
TimeSpanProvider provider,
out float rotation )
internal static Vec3 DefaultRotation( TimeSpanProvider provider, out float rotation )
{
rotation = provider.SpanLengthLowPrecession;
float angle = provider.CurrentSecond * 2;
@@ -230,15 +219,16 @@ namespace StgSharp
//GL.Assert(true);
buffer = new PlainInstancingBuffer<ParticleOnPlain>();
for( int i = 0; i < 10; i++ ) {
for( int i = 0; i < 10; i++ )
{
float ai = Scaler.Abs( i - 5.0f );
for( int t = 0; t < 10; t++ ) {
for( int t = 0; t < 10; t++ )
{
float at = Scaler.Abs( t - 5.0f );
ParticleOnPlain p = new ParticleOnPlain( buffer );
( ( IInstancing )p ).Coord = new Vec3(
( ( ( -5 ) + i ) * 0.2f ) + 0.1f,
( ( ( -5 ) + t ) * 0.2f ) + 0.1f, 0 );
( ( ( -5 ) + i ) * 0.2f ) + 0.1f, ( ( ( -5 ) + t ) * 0.2f ) + 0.1f, 0 );
( ( IInstancing )p ).Scale =
Scaler.MinOf( i, t ) * 0.15f;
( ( IInstancing )p ).Motion = new GeometryMotion(
@@ -287,24 +277,18 @@ namespace StgSharp
vao.Bind( 0 );
vbo.WriteVectorData( 0, rec.VertexStream, BufferUsage.StaticDraw );
ebo.SetValue( 0, rec.VertexIndices, BufferUsage.StaticDraw );
vao.SetVertexAttribute(
0, 3, TypeCode.Single, false, 4 * sizeof( float ), 0 );
vao.SetVertexAttribute( 0, 3, TypeCode.Single, false, 4 * sizeof( float ), 0 );
vbo.WriteVectorData<Vec4>(
1, buffer.CoordAndRotationSpan, BufferUsage.StreamDraw );
vbo.WriteVectorData<Vec4>( 1, buffer.CoordAndRotationSpan, BufferUsage.StreamDraw );
vao.SetVertexAttribute( 1, 3, TypeCode.Single, false, 4 * sizeof( float ), 0 );
vao.SetVertexAttribute(
1, 3, TypeCode.Single, false, 4 * sizeof( float ), 0 );
vao.SetVertexAttribute(
2, 1, TypeCode.Single, false, 4 * sizeof( float ),
3 * sizeof( float ) );
2, 1, TypeCode.Single, false, 4 * sizeof( float ), 3 * sizeof( float ) );
GL.VertexAttributeDivisor( 1, 1 );
GL.VertexAttributeDivisor( 2, 1 );
vbo.WriteScalerData<float>(
2, buffer.ScalingSpan, BufferUsage.StaticDraw );
vao.SetVertexAttribute(
3, 1, TypeCode.Single, false, sizeof( float ), 0 );
vbo.WriteScalerData<float>( 2, buffer.ScalingSpan, BufferUsage.StaticDraw );
vao.SetVertexAttribute( 3, 1, TypeCode.Single, false, sizeof( float ), 0 );
GL.VertexAttributeDivisor( 3, 1 );
@@ -326,33 +310,27 @@ namespace StgSharp
t = CreateTexture( 1 );
t.Bind2D( 0 );
GL.TextureImage2d<byte>(
Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel,
( uint )Width, ( uint )Height, ImageChannel.WithAlphaChannel,
PixelChannelLayout.Byte, null! );
Texture2DTarget.Texture2D, 0, ImageChannel.WithAlphaChannel, ( uint )Width,
( uint )Height, ImageChannel.WithAlphaChannel, PixelChannelLayout.Byte, null! );
t.Set2dWrapProperty( 0, TextureWrap.Repeat, TextureWrap.Repeat );
t.Set2dFilterProperty(
0, TextureFilter.Linear, TextureFilter.Linear );
t.Set2dFilterProperty( 0, TextureFilter.Linear, TextureFilter.Linear );
//GL.Assert(true);
GL.FrameBufferTexture2d(
FrameBufferTarget.All, glAttachment.Color( 0 ),
Texture2DTarget.Texture2D, t[ 0 ], 0 );
FrameBufferTarget.All, glAttachment.Color( 0 ), Texture2DTarget.Texture2D, t[ 0 ],
0 );
GL.SetRenderBufferStorage(
RenderBufferInternalFormat.Depth24_Stencil8, this.Size );
GL.CombineFrameBufferRenderBuffer(
FrameBufferAttachment.DepthAndStencil, rbo[ 0 ] );
GL.SetRenderBufferStorage( RenderBufferInternalFormat.Depth24_Stencil8, this.Size );
GL.CombineFrameBufferRenderBuffer( FrameBufferAttachment.DepthAndStencil, rbo[ 0 ] );
Console.WriteLine(
GL.CheckFrameBufferStatus( FrameBufferTarget.All ) );
Console.WriteLine( GL.CheckFrameBufferStatus( FrameBufferTarget.All ) );
FrameBuffer.BindNull();
//GL.Assert(true);
int streamLength = this.Width * this.Height * 4;
byte[] imageStream = new byte[streamLength];
i = Image.FromMemory(
this.Size, ImageChannel.WithAlphaChannel, imageStream );
i = Image.FromMemory( this.Size, ImageChannel.WithAlphaChannel, imageStream );
time = s.GetUniform<float>( "time" );
@@ -363,12 +341,10 @@ namespace StgSharp
(1f, 0f),
(0f, 0f)
};
ButtonBounding = new Rectangle(
-0.9f, 0.9f, 0.9f, 0.9f, 0.9f, -0.9f, -0.9f, -0.9f );
ButtonBounding = new Rectangle( -0.9f, 0.9f, 0.9f, 0.9f, 0.9f, -0.9f, -0.9f, -0.9f );
//GL.Assert(true);
ButtonTextureProvider = new TextureProvider(
i, buttonTextureCoordArray );
ButtonTextureProvider = new TextureProvider( i, buttonTextureCoordArray );
f_vao = CreateVertexArray( 1 );
f_vbo = CreateVertexBuffer( 2 );
@@ -378,35 +354,29 @@ namespace StgSharp
f_vao.Bind( 0 );
f_ebo.Bind( 0 );
f_ebo.SetValue(
0, ButtonBounding.VertexIndices, BufferUsage.StaticDraw );
f_ebo.SetValue( 0, ButtonBounding.VertexIndices, BufferUsage.StaticDraw );
//GL.Assert(true);
f_vbo.Bind( 0 );
f_vbo.WriteVectorData(
0, ButtonBounding.VertexStream, BufferUsage.StaticDraw );
f_vao.SetVertexAttribute(
0, 3, TypeCode.Single, false, 4 * sizeof( float ), 0 );
f_vbo.WriteVectorData( 0, ButtonBounding.VertexStream, BufferUsage.StaticDraw );
f_vao.SetVertexAttribute( 0, 3, TypeCode.Single, false, 4 * sizeof( float ), 0 );
//GL.Assert(true);
f_vbo.Bind( 1 );
f_vbo.WriteVectorData(
1, buttonTextureCoordArray, BufferUsage.StaticDraw );
f_vao.SetVertexAttribute(
1, 3, TypeCode.Single, false, 4 * sizeof( float ), 0 );
f_vbo.WriteVectorData( 1, buttonTextureCoordArray, BufferUsage.StaticDraw );
f_vao.SetVertexAttribute( 1, 3, TypeCode.Single, false, 4 * sizeof( float ), 0 );
//GL.Assert(true);
autoT = CreateAutoTexture( 4 );
autoT.DefaultTextureProperty = new TextureProperty(
TextureFilter.Nearest, TextureFilter.Nearest,
TextureWrap.Repeat, TextureWrap.Repeat );
TextureFilter.Nearest, TextureFilter.Nearest, TextureWrap.Repeat,
TextureWrap.Repeat );
f_t = CreateTexture( 1 );
f_t.Bind2D( 0 );
f_t.Set2dWrapProperty( 0, TextureWrap.Repeat, TextureWrap.Repeat );
f_t.Set2dFilterProperty(
0, TextureFilter.Nearest, TextureFilter.Nearest );
f_t.Set2dFilterProperty( 0, TextureFilter.Nearest, TextureFilter.Nearest );
//GL.Assert(true);
f_t.ActivateAs( TextureUnit.Unit1 );
+15
View File
@@ -0,0 +1,15 @@
using StgSharp.Math;
namespace StgSharp
{
public static class SimdDemo
{
public static void TestMethod()
{
Matrix44 m1 = new Matrix44();
Matrix44 m2 = new Matrix44();
var m3 = m1 * m2;
Console.WriteLine(m3[0,0]);
}
}
}
+16 -1
View File
@@ -29,6 +29,7 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Model.Step;
using StgSharp.PipeLine;
using StgSharp.Script.Express;
using System;
@@ -50,9 +51,23 @@ namespace StgSharp
private static void TestStepRead()
{
ExpressCompile.InitCompile();
if( StepReader.FromFile( stepFile[ 0 ], out StepReader reader ) )
if( StepReader.FromFile( stepFile[ 1 ], out StepReader reader ) )
{
StepModel model = reader.ReadToModelSingleThread();
PipeLineRunner.SetMaxTaskCount( 1 );
string[] info = model.ShowStructure( int.MaxValue );
FileStream fs = File.Open( "D:\\struct.txt", FileMode.Create,
FileAccess.ReadWrite );
StreamWriter sw = new StreamWriter( fs );
foreach( string line in info )
{
sw.WriteLine( line );
Console.WriteLine( line );
}
sw.Dispose();
fs.Dispose();
//model.InitEntity();
reader.Dispose();
}
}
+1 -2
View File
@@ -48,8 +48,7 @@ namespace StgSharp
ExpSchemaSource schemaSource = new ExpSchemaSource();
schemaSource.ReadSchema( reader );
ExpSchema schema = schemaSource.Compile(
ExpressCompileOption.Translate );
ExpSchema schema = schemaSource.Compile( ExpressCompileOption.Translate );
}
}
+3 -3
View File
@@ -45,8 +45,8 @@ namespace StgSharp
public static void TestRender()
{
StgSharp.InitGL( 4, 6 );
StgSharp.GlobalSetting.VSyncActivated = false;
World.InitGL( 4, 6 );
World.GlobalSetting.VSyncActivated = false;
ViewPort vp = new ViewPort( 800, 600, "Hello StgSharp!", IntPtr.Zero );
@@ -57,7 +57,7 @@ namespace StgSharp
mainModel.UseViewModel( "MainView" );
StgSharp.Terminate( 0 );
World.Terminate( 0 );
}
}
+2 -2
View File
@@ -29,7 +29,7 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Controlling.UsrActivity;
using StgSharp.MVVM.View;
using StgSharp.MVVM;
using System;
using System.Collections.Generic;
@@ -48,7 +48,7 @@ namespace StgSharp
public Control( ViewMain view ) : base( view ) { }
public override void CustomizedInitialize(
Func<IClickTrigger, string, Action> keyRegister ) { }
Func<IClickTrigger, string, Action> keyRegister ) { }
public override bool ValidateInitializing()
{
+3 -12
View File
@@ -48,17 +48,9 @@ namespace StgSharp
public partial class ViewMain
{
internal DemoButtonGroup Group
{
get;
set;
}
internal DemoButtonGroup Group { get; set; }
internal TriggerButton OnlyButton
{
get;
set;
}
internal TriggerButton OnlyButton { get; set; }
internal class Design : ViewDesigner<ViewMain>
{
@@ -74,8 +66,7 @@ namespace StgSharp
new KeyTrigger( KeyboardKey.Down, KeyStatus.PRESS ),
new KeyTrigger( KeyboardKey.Enter, KeyStatus.PRESS ) );
Binding.OnlyButton = CreateKeyboardButton(
Binding.Stream.ButtonBounding,
Binding.Stream.ButtonTextureProvider, true );
Binding.Stream.ButtonBounding, Binding.Stream.ButtonTextureProvider, true );
Binding.OnlyButton.RenderButtonTexture += Binding.Stream.RenderButton;
}
+1 -5
View File
@@ -44,11 +44,7 @@ namespace StgSharp
public partial class ViewMain
{
public ParticleRenderStream Stream
{
get;
set;
}
public ParticleRenderStream Stream { get; set; }
private class NewRender : ViewRender<ViewMain>
{
+6 -8
View File
@@ -30,7 +30,6 @@
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.MVVM;
using StgSharp.MVVM.View;
using StgSharp.MVVM.ViewModel;
using System;
@@ -53,8 +52,7 @@ namespace StgSharp
_databindingIndexMap = new Dictionary<string, DataBindingEntry>();
}
public override void CustomizedInitialize(
[NotNull]ViewModelBase viewModelBinding )
public override void CustomizedInitialize( [NotNull]ViewModelBase viewModelBinding )
{
Designer = new Design( this );
Responder = new Control( this );
@@ -65,21 +63,21 @@ namespace StgSharp
Responder.Initialize( viewModelBinding.MethodLookup );
}
public override bool TryGetObjectReference(
string name,
out DataBindingEntry entry )
public override bool TryGetObjectReference( string name, out DataBindingEntry entry )
{
if( _databindingIndexMap.TryGetValue( name, out entry ) ) {
return true;
}
try {
try
{
entry = name switch
{
_ => default( DataBindingEntry ),
};
return !entry.ExactEqual( default( DataBindingEntry ) );
}
catch( Exception ) {
catch( Exception )
{
entry = default( DataBindingEntry );
return false;
}
+2 -5
View File
@@ -49,15 +49,12 @@ namespace StgSharp
public ViewModelMain( ViewPort vp )
: base( vp, 60 )
{
dataBindingEntryIndexMap = new Dictionary<string, DataBindingEntry>(
);
dataBindingEntryIndexMap = new Dictionary<string, DataBindingEntry>();
}
public override void CustomizeInitialize() { }
public override bool TryGetObjectReference(
string name,
out DataBindingEntry entry )
public override bool TryGetObjectReference( string name, out DataBindingEntry entry )
{
if( dataBindingEntryIndexMap.TryGetValue( name, out entry ) ) {
return true;
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a6411e2f25010961d278c5bcb4a929e21b176bba")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+74c01effe4cabbc9d0e2e87b0d295bb29d7c62ba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/a6411e2f25010961d278c5bcb4a929e21b176bba/*"}}
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/74c01effe4cabbc9d0e2e87b0d295bb29d7c62ba/*"}}
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+74c01effe4cabbc9d0e2e87b0d295bb29d7c62ba")]
[assembly: System.Reflection.AssemblyProductAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpDebug")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。
@@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;