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
@@ -30,6 +30,7 @@
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using StgSharp.Graphics.OpenGL;
using StgSharp.Internal.OpenGL;
using StgSharp.Math;
using System;
@@ -47,9 +47,9 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning restore CA1008
{
Read = GLconst.READ_FRAMEBUFFER,
All = GLconst.FRAMEBUFFER,
Draw = GLconst.DRAW_FRAMEBUFFER,
Read = glConst.READ_FRAMEBUFFER,
All = glConst.FRAMEBUFFER,
Draw = glConst.DRAW_FRAMEBUFFER,
}
@@ -63,10 +63,10 @@ namespace StgSharp.Graphics.OpenGL
}
/// <summary>
/// Bind the frame buffer object with name frame buffer to the frame buffer target specified
/// Bind the frame buffer object with _name frame buffer to the frame buffer target specified
/// by target. <see langword="FrameBufferTarget.All" /> will be set as default target.
/// </summary>
/// <param name="index"> Index of object to be binded in handle set </param>
/// <param _name="index"> Index of object to be binded in handle set </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public override unsafe void Bind( int index )
{
@@ -74,11 +74,11 @@ namespace StgSharp.Graphics.OpenGL
}
/// <summary>
/// Bind the frame buffer object with name frame buffer to the frame buffer target specified
/// Bind the frame buffer object with _name frame buffer to the frame buffer target specified
/// by target. Target of this frame buffer should be set manually.
/// </summary>
/// <param name="target"> The frame buffer target of the binding operation. </param>
/// <param name="index"> Index of object to be binded in handle set </param>
/// <param _name="target"> The frame buffer target of the binding operation. </param>
/// <param _name="index"> Index of object to be binded in handle set </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe void Bind( FrameBufferTarget target, int index )
{
@@ -28,7 +28,8 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Data.Intrinsic;
using StgSharp.Internal.Intrinsic;
using StgSharp.Internal.OpenGL;
using StgSharp.Math;
using System;
@@ -85,14 +86,14 @@ namespace StgSharp.Graphics.OpenGL
public void Bind2D( int index )
{
currentEditingTextureIndex = index;
_gl.BindTexture( GLconst.TEXTURE_2D, _textureHandle[ index ] );
_gl.BindTexture( glConst.TEXTURE_2D, _textureHandle[ index ] );
}
/// <summary>
/// Load an <see cref="Image" /> to certain texture.
/// </summary>
/// <param name="index"> </param>
/// <param name="i"> </param>
/// <param _name="index"> </param>
/// <param _name="i"> </param>
public unsafe void LoadTexture( int index, Image i )
{
byte[] handle = i.PixelBuffer;
@@ -117,10 +118,10 @@ namespace StgSharp.Graphics.OpenGL
}
#endif
_gl.TextureParameter(
GLconst.TEXTURE_2D, GLconst.TEXTURE_MIN_FILTER,
glConst.TEXTURE_2D, glConst.TEXTURE_MIN_FILTER,
( int )onMinify );
_gl.TextureParameter(
GLconst.TEXTURE_2D, GLconst.TEXTURE_MAG_FILTER,
glConst.TEXTURE_2D, glConst.TEXTURE_MAG_FILTER,
( int )onMagnify );
}
@@ -137,10 +138,10 @@ namespace StgSharp.Graphics.OpenGL
}
#endif
_gl.TextureParameter(
GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_S,
glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_S,
( int )onHorizontial );
_gl.TextureParameter(
GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_T, ( int )onVertical );
glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_T, ( int )onVertical );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -252,12 +253,12 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning restore CA1008
{
Nearest = GLconst.NEAREST,
Linear = GLconst.LINEAR,
NearestLinearMipmap = GLconst.NEAREST_MIPMAP_LINEAR,
LinearLinearMipmap = GLconst.LINEAR_MIPMAP_LINEAR,
NearestNearestMipmap = GLconst.NEAREST_MIPMAP_NEAREST,
LinearNearestMipmap = GLconst.LINEAR_MIPMAP_NEAREST,
Nearest = glConst.NEAREST,
Linear = glConst.LINEAR,
NearestLinearMipmap = glConst.NEAREST_MIPMAP_LINEAR,
LinearLinearMipmap = glConst.LINEAR_MIPMAP_LINEAR,
NearestNearestMipmap = glConst.NEAREST_MIPMAP_NEAREST,
LinearNearestMipmap = glConst.LINEAR_MIPMAP_NEAREST,
}
@@ -266,22 +267,22 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning restore CA1008
{
Unit0 = GLconst.TEXTURE0,
Unit1 = GLconst.TEXTURE1,
Unit2 = GLconst.TEXTURE2,
Unit3 = GLconst.TEXTURE3,
Unit4 = GLconst.TEXTURE4,
Unit5 = GLconst.TEXTURE5,
Unit6 = GLconst.TEXTURE6,
Unit7 = GLconst.TEXTURE7,
Unit8 = GLconst.TEXTURE8,
Unit9 = GLconst.TEXTURE9,
Unit10 = GLconst.TEXTURE10,
Unit11 = GLconst.TEXTURE11,
Unit12 = GLconst.TEXTURE12,
Unit13 = GLconst.TEXTURE13,
Unit14 = GLconst.TEXTURE14,
Unit15 = GLconst.TEXTURE15,
Unit0 = glConst.TEXTURE0,
Unit1 = glConst.TEXTURE1,
Unit2 = glConst.TEXTURE2,
Unit3 = glConst.TEXTURE3,
Unit4 = glConst.TEXTURE4,
Unit5 = glConst.TEXTURE5,
Unit6 = glConst.TEXTURE6,
Unit7 = glConst.TEXTURE7,
Unit8 = glConst.TEXTURE8,
Unit9 = glConst.TEXTURE9,
Unit10 = glConst.TEXTURE10,
Unit11 = glConst.TEXTURE11,
Unit12 = glConst.TEXTURE12,
Unit13 = glConst.TEXTURE13,
Unit14 = glConst.TEXTURE14,
Unit15 = glConst.TEXTURE15,
}
@@ -290,10 +291,10 @@ namespace StgSharp.Graphics.OpenGL
#pragma warning restore CA1008
{
Repeat = GLconst.REPEAT,
MirroredRepeat = GLconst.MIRRORED_REPEAT,
ClampToEdge = GLconst.CLAMP_TO_EDGE,
ClampToBorder = GLconst.CLAMP_TO_BORDER,
Repeat = glConst.REPEAT,
MirroredRepeat = glConst.MIRRORED_REPEAT,
ClampToEdge = glConst.CLAMP_TO_EDGE,
ClampToBorder = glConst.CLAMP_TO_BORDER,
}
}
@@ -66,10 +66,10 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Set _data to current vertex buffer object
/// </summary>
/// <typeparam name="T"> Type of bufferData </typeparam>
/// <param name="index"> Index to find certain VBO in this instance </param>
/// <param name="bufferData"> Data to write in </param>
/// <param name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
/// <typeparam _name="T"> Type of bufferData </typeparam>
/// <param _name="index"> Index to find certain VBO in this instance </param>
/// <param _name="bufferData"> Data to write in </param>
/// <param _name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
public void WriteMatrixData<T>(
int index,
T bufferData,
@@ -83,10 +83,10 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Set _data to current vertex buffer object
/// </summary>
/// <typeparam name="T"> Type of bufferData </typeparam>
/// <param name="index"> Index to find certain VBO in this instance </param>
/// <param name="bufferArray"> Data to write in </param>
/// <param name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
/// <typeparam _name="T"> Type of bufferData </typeparam>
/// <param _name="index"> Index to find certain VBO in this instance </param>
/// <param _name="bufferArray"> Data to write in </param>
/// <param _name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
public void WriteScalerData<T>(
int index,
T[] bufferArray,
@@ -105,10 +105,10 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Set _data to current vertex buffer object
/// </summary>
/// <typeparam name="T"> Type of bufferData </typeparam>
/// <param name="index"> Index to find certain VBO in this instance </param>
/// <param name="scalerSpan"> A <see cref="Span{T}" /> of _data to write in </param>
/// <param name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
/// <typeparam _name="T"> Type of bufferData </typeparam>
/// <param _name="index"> Index to find certain VBO in this instance </param>
/// <param _name="scalerSpan"> A <see cref="Span{T}" /> of _data to write in </param>
/// <param _name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
public void WriteScalerData<T>(
int index,
ReadOnlySpan<T> scalerSpan,
@@ -127,10 +127,10 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Set _data to current vertex buffer object
/// </summary>
/// <typeparam name="T"> Type of bufferData </typeparam>
/// <param name="index"> Index to find certain VBO in this instance </param>
/// <param name="vectorSpan"> A <see cref="Span{T}" /> of _data to write in </param>
/// <param name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
/// <typeparam _name="T"> Type of bufferData </typeparam>
/// <param _name="index"> Index to find certain VBO in this instance </param>
/// <param _name="vectorSpan"> A <see cref="Span{T}" /> of _data to write in </param>
/// <param _name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
public void WriteVectorData<T>(
int index,
ReadOnlySpan<T> vectorSpan,
@@ -144,10 +144,10 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Set _data to current vertex buffer object
/// </summary>
/// <typeparam name="T"> Type of bufferData </typeparam>
/// <param name="index"> Index to find certain VBO in this instance </param>
/// <param name="vectorArray"> A array of _data to write in </param>
/// <param name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
/// <typeparam _name="T"> Type of bufferData </typeparam>
/// <param _name="index"> Index to find certain VBO in this instance </param>
/// <param _name="vectorArray"> A array of _data to write in </param>
/// <param _name="usage"> How OpenGL use these _data, defined by <see cref="BufferUsage" /></param>
public void WriteVectorData<T>(
int index,
T[] vectorArray,
@@ -29,7 +29,7 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp;
using StgSharp.Data;
using StgSharp.Internal;
using System;
using System.Collections.Generic;
@@ -86,8 +86,8 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Attach one shader code to a shader program.
/// </summary>
/// <param name="target"> Shader program to attach </param>
/// <param name="index"> Index of shader code in current shader code set. </param>
/// <param _name="target"> Shader program to attach </param>
/// <param _name="index"> Index of shader code in current shader code set. </param>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void AttachTo( int index, ShaderProgram target )
{
@@ -160,7 +160,7 @@ namespace StgSharp.Graphics.OpenGL
public enum ShaderStatus : int
{
CompileStatus = GLconst.COMPILE_STATUS,
CompileStatus = glConst.COMPILE_STATUS,
}
@@ -182,7 +182,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param name="name"> ContextName of the Uniform in shader code </param>
/// <param _name="name"> ContextName of the Uniform in shader code </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public unsafe Uniform<T> GetUniform<T>( string name ) where T: struct
@@ -193,7 +193,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param name="name"> ContextName of the Uniform in shader code </param>
/// <param _name="name"> ContextName of the Uniform in shader code </param>
/// <returns></returns>
public unsafe Uniform<T, U> GetUniform<T, U>( string name )
where T: struct
@@ -206,7 +206,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param name="name"> ContextName of the Uniform in shader code </param>
/// <param _name="name"> ContextName of the Uniform in shader code </param>
/// <returns></returns>
public unsafe Uniform<T, U, V> GetUniform<T, U, V>( string name )
where T: struct
@@ -220,7 +220,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param name="name"> ContextName of the Uniform in shader code </param>
/// <param _name="name"> ContextName of the Uniform in shader code </param>
/// <returns></returns>
public unsafe Uniform<T, U, V, W> GetUniform<T, U, V, W>( string name )
where T: struct
@@ -33,6 +33,7 @@ using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
@@ -129,7 +130,7 @@ namespace StgSharp.Graphics.OpenGL
{
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue( Uniform<Matrix44> uniform, Matrix44 mat )
public void SetUniformValue( [NotNull] Uniform<Matrix44> uniform, Matrix44 mat )
{
Matrix44 temp = mat;
Context.glUniformMatrix4fv(
@@ -138,35 +139,35 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue(
Uniform<float, float, float, float> uniform,
[NotNull]Uniform<float, float, float, float> uniform,
Vec4 vec )
{
Vec4 temp = vec;
Context.glUniform1fv( uniform.id.SignedValue, 4, &temp );
Context.glUniform1fv( uniform.id.SignedValue, 4, &temp.reg );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue( Uniform<Vec4> uniform, Vec4 vec )
public void SetUniformValue( [NotNull]Uniform<Vec4> uniform, Vec4 vec )
{
Vec4 temp = vec;
Context.glUniform1fv( uniform.id.SignedValue, 4, &temp );
Context.glUniform1fv( uniform.id.SignedValue, 4, &temp.reg );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue( Uniform<float> uniform, float v0 )
public void SetUniformValue( [NotNull]Uniform<float> uniform, float v0 )
{
Context.glUniform1f( uniform.id.SignedValue, v0 );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue( Uniform<int> uniform, int i0 )
public void SetUniformValue( [NotNull]Uniform<int> uniform, int i0 )
{
Context.glUniform1i( uniform.id.SignedValue, i0 );
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue(
Uniform<float, float> uniform,
[NotNull] Uniform<float, float> uniform,
float v0,
float v1 )
{
@@ -175,7 +176,7 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue(
Uniform<float, float, float> uniform,
[NotNull] Uniform<float, float, float> uniform,
float v0,
float v1,
float v2 )
@@ -185,7 +186,7 @@ namespace StgSharp.Graphics.OpenGL
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetUniformValue(
Uniform<float, float, float, float> uniform,
[NotNull] Uniform<float, float, float, float> uniform,
float v0,
float v1,
float v2,
@@ -59,9 +59,9 @@ namespace StgSharp.Graphics.OpenGL
//--------------------------------------------------------------------------------
/// <summary>
/// Get the function pointer of given OpenGL api name
/// Get the function pointer of given OpenGL api _name
/// </summary>
/// <param name="name"> ContextName of the OpenGL api </param>
/// <param _name="name"> ContextName of the OpenGL api </param>
/// <returns> The funtion pointer of the api in stream of <see cref="IntPtr" /></returns>
public static IntPtr LoadGLfunc( string name )
{
@@ -77,7 +77,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Load all supported OpenGL APIs and bind them to given <see cref="ViewPort" />.
/// </summary>
/// <param name="contextHandle"> The handle to current OpenGL viewPortDisplay </param>
/// <param _name="contextHandle"> The handle to current OpenGL viewPortDisplay </param>
public static unsafe void LoadOpenGLApiTo( IntPtr contextHandle )
{
OpenglContext* context = ( OpenglContext* )contextHandle;
@@ -151,7 +151,7 @@ namespace StgSharp.Graphics.OpenGL
}
int extensionCount;
context->glGetIntegerv( GLconst.NUM_EXTENSIONS, &extensionCount );
context->glGetIntegerv( glConst.NUM_EXTENSIONS, &extensionCount );
if( extensionCount == 0 ) {
InternalIO.InternalWriteLog(
"No supported OpenGL extensions are found.", LogType.Info );
@@ -161,7 +161,7 @@ namespace StgSharp.Graphics.OpenGL
List<string> extensions = new List<string>();
for( uint i = 0; i < extensionCount; i++ ) {
byte* strPtr = context->glGetStringi( GLconst.EXTENSIONS, i );
byte* strPtr = context->glGetStringi( glConst.EXTENSIONS, i );
extensions.Add( Marshal.PtrToStringAnsi( ( IntPtr )strPtr ) );
}
@@ -3219,7 +3219,7 @@ namespace StgSharp.Graphics.OpenGL
"glStencilOpSeparate" );
contextPtr->glUniform1f = ( delegate*<int, float, void> )load(
"glUniform1f" );
contextPtr->glUniform1fv = ( delegate*<int, uint, Vec4*, void> )load(
contextPtr->glUniform1fv = ( delegate*<int, uint, M128*, void> )load(
"glUniform1fv" );
contextPtr->glUniform1i = ( delegate*<int, int, void> )load(
"glUniform1i" );
@@ -54,7 +54,7 @@ namespace StgSharp.Graphics.OpenGL
internal void ReturnAvailableUnit( IEnumerable<TextureUnit> source )
{
int v = GLconst.TEXTURE0 + TextureUnitCount;
int v = glConst.TEXTURE0 + TextureUnitCount;
foreach( TextureUnit unit in source ) {
if( ( int )unit > v ) {
throw new InvalidOperationException(
@@ -83,7 +83,7 @@ namespace StgSharp.Graphics.OpenGL
ConcurrentQueue<TextureUnit> result = new ConcurrentQueue<TextureUnit>(
);
for( int index = 0; index < TextureUnitCount; index++ ) {
result.Enqueue( ( TextureUnit )( GLconst.TEXTURE0 + index ) );
result.Enqueue( ( TextureUnit )( glConst.TEXTURE0 + index ) );
}
return result;
}
@@ -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 );
}
@@ -50,7 +50,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Create a set of <see cref="ElementBuffer" />.
/// </summary>
/// <param name="count"> Amount of EBO to be created. </param>
/// <param _name="count"> Amount of EBO to be created. </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
protected ElementBuffer CreateElementBuffer( int count )
@@ -73,7 +73,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Create a sets of <see cref="TextureGL" />
/// </summary>
/// <param name="count"> Amount of textures to be created. </param>
/// <param _name="count"> Amount of textures to be created. </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
protected TextureGL CreateTexture( int count )
@@ -84,7 +84,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Create a set of <see cref="VertexArray" />.
/// </summary>
/// <param name="count"> Amount of VAO to be created. </param>
/// <param _name="count"> Amount of VAO to be created. </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
protected VertexArray CreateVertexArray( int count )
@@ -95,7 +95,7 @@ namespace StgSharp.Graphics.OpenGL
/// <summary>
/// Create a set of <see cref="VertexBuffer" />.
/// </summary>
/// <param name="count"> Amount of Object to be created. </param>
/// <param _name="count"> Amount of Object to be created. </param>
/// <returns></returns>
[MethodImpl( MethodImplOptions.AggressiveInlining )]
protected VertexBuffer CreateVertexBuffer( int count )