daily update on 2024.03.18 by itload youmu

This commit is contained in:
YoumuLiu
2024-03-19 02:41:04 +08:00
parent 15bf989285
commit 0c50c6282e
200 changed files with 7663 additions and 3455 deletions
@@ -1,28 +1,49 @@
using StgSharp.Logic;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="GLonUpdateInternal.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.Math;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.Graphics
{
internal unsafe partial class GLonUpdate : IglFunc
{
private IntPtr ActiveTexturePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalActiveTexture;
private IntPtr AttachShaderPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalAttachShader;
private IntPtr BindBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindBuffer;
private IntPtr BindTexturePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindTexture;
private IntPtr BindVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalBindVertexArray;
private IntPtr BufferDataPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalSetBufferData;
private IntPtr CanUpdatePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalFrameCanUpdate;
private IntPtr ClearColorPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClearColor;
private IntPtr ClearGraphicErrorPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClearGraphicError;
private IntPtr ClearPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalClear;
@@ -35,7 +56,6 @@ namespace StgSharp.Graphics
private IntPtr DrawElementsPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalDrawElements;
private IntPtr GenBufferPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenBuffers;
private IntPtr GenTexturesPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenTextures;
private IntPtr GenVertexArraysPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGenVertexArrays;
private IntPtr GetUniformLocationPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalGetUniformLocation;
private IntPtr SetVertexArrayPtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalSetVertexAttribute;
private IntPtr ShaderSourcePtr = (IntPtr)(delegate*<FrameOperationBuffer, GLcontext*, void>)&InternalShaderSource;
@@ -147,7 +167,7 @@ namespace StgSharp.Graphics
activatedContext->glDeleteBuffers(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
for (int i = 0; i < m.Read<uint>(2); i++)
{
*((uint*)m.Read<ulong>(0) + i) = 0;
*(((uint*)m.Read<ulong>(0)) + i) = 0;
}
}
@@ -167,13 +187,6 @@ namespace StgSharp.Graphics
activatedContext->glDrawElements(mode, count, type, (void*)ptr);
}
private static void InternalFrameCanUpdate(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr ptr;
frameBuffer.TryDequeue(out ptr);
Interlocked.Add(ref *(int*)ptr, -1);
}
private static void InternalGenBuffers(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
@@ -188,13 +201,6 @@ namespace StgSharp.Graphics
activatedContext->glGenTextures(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
}
private static void InternalGenVertexArrays(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
M128 m = default;
frameBuffer.TryDequeue(out m);
activatedContext->glGenVertexArrays(m.Read<uint>(2), (uint*)m.Read<ulong>(0));
}
private static void InternalGetUniformLocation(FrameOperationBuffer frameBuffer, GLcontext* activatedContext)
{
IntPtr programHandle = default, nameHandle = default, targetHandle = default;
@@ -265,14 +271,5 @@ namespace StgSharp.Graphics
activatedContext->glViewport(m.Read<int>(0), m.Read<int>(1), m.Read<uint>(2), m.Read<uint>(3));
}
private void InternalMakeContexCurrent(Form form)
{
throw new NotImplementedException();
}
private void InternalSwitchContext()
{
throw new NotImplementedException();
}
}
}