daily update on 20250122 by nitload youmu, architect rearrange

This commit is contained in:
Nitload
2025-01-22 11:34:49 +08:00
parent 6cfaa42ff3
commit 190d67a034
192 changed files with 25177 additions and 3156 deletions
@@ -29,7 +29,8 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Internal;
using StgSharp.Internal.OpenGL;
using StgSharp.Math;
using System;
@@ -42,25 +43,6 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace StgSharp
{
internal static unsafe partial class InternalIO
{
[DllImport(
SSC_libName,
EntryPoint = "glCheckShaderStat",
CallingConvention = CallingConvention.Cdecl )]
#pragma warning disable CA5392
internal static extern int glCheckShaderStatus(
ref OpenglContext context,
uint shaderHandle,
int key,
ref IntPtr logPtr );
#pragma warning restore CA5392
}
}
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
@@ -77,13 +59,13 @@ namespace StgSharp.Graphics.OpenGL
private OpenGLFunction()
{
textureUnitCountGetter = new Lazy<int>(
() => GetMaskInteger( GLconst.MAX_TEXTURE_IMAGE_UNITS ) );
() => GetMaskInteger( glConst.MAX_TEXTURE_IMAGE_UNITS ) );
unusedTextureImageUintInitilizing = new Lazy<ConcurrentQueue<TextureUnit>>(
InitializeUnusedTextureImageUint );
_attachmentColorRange = new Lazy<int>(
() => {
return GetMaskInteger(
( uint )GLconst.MAX_COLOR_ATTACHMENTS );
( uint )glConst.MAX_COLOR_ATTACHMENTS );
} );
}
@@ -123,7 +105,7 @@ namespace StgSharp.Graphics.OpenGL
public void Assert( bool shouldReportWhenNormal )
{
uint code = Context.glGetError();
if( code != GLconst.NO_ERROR ) {
if( code != glConst.NO_ERROR ) {
throw new GlExecutionException( code );
}
if( shouldReportWhenNormal ) {
@@ -147,8 +129,8 @@ namespace StgSharp.Graphics.OpenGL
/// Bind a frame buffer to a frame buffer target Same function as <see
/// href="https://docs._gl/gl3/glBindFramebuffer">glBindFramebuffer</see>.
/// </summary>
/// <param name="target"> The frame buffer target of the binding operation. </param>
/// <param name="handle"> The handle of the frame buffer object to bind. </param>
/// <param _name="target"> The frame buffer target of the binding operation. </param>
/// <param _name="handle"> The handle of the frame buffer object to bind. </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void BindFrameBuffer( FrameBufferTarget target, GlHandle handle )
{
@@ -158,7 +140,7 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void BindRenderBuffer( GlHandle handle )
{
Context.glBindRenderbuffer( GLconst.RENDERBUFFER, handle.Value );
Context.glBindRenderbuffer( glConst.RENDERBUFFER, handle.Value );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -223,7 +205,7 @@ namespace StgSharp.Graphics.OpenGL
GlHandle rboHandle )
{
Context.glFramebufferRenderbuffer(
GLconst.FRAMEBUFFER, ( uint )attachment, GLconst.RENDERBUFFER,
glConst.FRAMEBUFFER, ( uint )attachment, glConst.RENDERBUFFER,
rboHandle.Value );
}
@@ -297,7 +279,7 @@ namespace StgSharp.Graphics.OpenGL
/// href="https://docs.gl/gl3/glDeleteRenderbuffers">glDeleteRenderbuffers</see>. The only
/// deifference is that this mehtod can only delete one renderbuffer at the same time.
/// </summary>
/// <param name="bufferHandle"> Handle to buffer to delete. </param>
/// <param _name="bufferHandle"> Handle to buffer to delete. </param>
public unsafe void DeleteRenderBuffer( GlHandle bufferHandle )
{
Context.glDeleteRenderbuffers( 1, &bufferHandle.Value );
@@ -324,9 +306,9 @@ namespace StgSharp.Graphics.OpenGL
uint a;
a = type switch
{
TypeCode.UInt32 => GLconst.UNSIGNED_INT,
TypeCode.UInt16 => GLconst.UNSIGNED_SHORT,
TypeCode.Byte => GLconst.UNSIGNED_BYTE,
TypeCode.UInt32 => glConst.UNSIGNED_INT,
TypeCode.UInt16 => glConst.UNSIGNED_SHORT,
TypeCode.Byte => glConst.UNSIGNED_BYTE,
_ => throw new ArgumentException(
$"{$"{$"Parameter error in parameter {nameof(type)} method DrawElements. "}"}{$"{$"Only {typeof(uint).Name},{typeof(ushort).Name},{typeof(byte).Name} types are supported."}"}" )
};
@@ -344,15 +326,15 @@ namespace StgSharp.Graphics.OpenGL
uint a;
switch( type ) {
case TypeCode.UInt32:
a = GLconst.UNSIGNED_INT;
a = glConst.UNSIGNED_INT;
break;
case TypeCode.UInt16:
a = GLconst.UNSIGNED_SHORT;
a = glConst.UNSIGNED_SHORT;
break;
case TypeCode.Byte:
a = GLconst.UNSIGNED_BYTE;
a = glConst.UNSIGNED_BYTE;
break;
default:
@@ -508,7 +490,7 @@ namespace StgSharp.Graphics.OpenGL
fixed( byte* ptr = code ) {
int ret = Context.glGetUniformLocation( program.Value, ptr );
#if DEBUG
if( ( ret == GLconst.INVALID_OPERATION ) || ( ret == GLconst.INVALID_VALUE ) ) {
if( ( ret == glConst.INVALID_OPERATION ) || ( ret == glConst.INVALID_VALUE ) ) {
throw new InvalidOperationException();
}
if( ret == -1 ) {
@@ -707,7 +689,7 @@ namespace StgSharp.Graphics.OpenGL
(int width, int height) size )
{
Context.glRenderbufferStorage(
GLconst.RENDERBUFFER, ( uint )internalFormat, size.width,
glConst.RENDERBUFFER, ( uint )internalFormat, size.width,
size.height );
}
@@ -717,7 +699,7 @@ namespace StgSharp.Graphics.OpenGL
(uint width, uint height) size )
{
Context.glRenderbufferStorage(
GLconst.RENDERBUFFER, ( uint )internalFormat, ( int )size.width,
glConst.RENDERBUFFER, ( uint )internalFormat, ( int )size.width,
( int )size.height );
}