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
@@ -0,0 +1,40 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="IImageProvider"
// 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 System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphics
{
public interface IImageProvider
{
Image ProvideImage();
}
}
@@ -0,0 +1,83 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ImageHelper"
// 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 System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace StgSharp.Graphics
{
public static class ImageHelper
{
public static void Resize(Image i, int width, int height, ImageMovement move)
{
if (i == null) {
throw new ArgumentNullException(nameof(i));
}
if (i.Size == (width, height)) {
return;
}
if (!Enum.IsDefined(typeof(ImageMovement), move)) {
throw new InvalidEnumArgumentException(nameof(move));
}
byte[] oldData = i.Data;
i.Data = new byte[width * height * i.PixelSize];
i.Height = height;
i.Width = width;
i.PixelUpdateCount++;
switch (move)
{
case ImageMovement.Discard:
break;
case ImageMovement.Top:
break;
default:
throw new NotImplementedException();
}
}
}
[Flags]
public enum ImageMovement
{
#pragma warning disable CA1008
Discard = 0,
#pragma warning restore CA1008
Top = 1,
Bottom = 2,
Left = 4,
Right = 8,
TopLeft = Top | Left,
BottomLeft = Bottom | Left,
TopRight = Top | Right,
BottomRight = Bottom | Right,
}
}
+306
View File
@@ -0,0 +1,306 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Camera"
// 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.OpenGL;
using StgSharp.Graphics.ShaderEdit;
using System;
namespace StgSharp.Mathematics.Graphics
{
public sealed class Camera : IglConvertable
{
private bool _isLookAtAvailable;
internal Matrix44 _lookAt;
internal Matrix44 _projection;
internal Matrix44 cameraAtt;
internal Matrix44 rotation;
internal Matrix44 rotationAtt;
internal Radius _pitch;
internal Radius _row;
internal Radius _yaw;
internal Uniform<Matrix44> convertedUniform;
internal Vec3 _target, up;
public Camera()
{
cameraAtt = Matrix44.Unit;
_target = Vec3.Zero;
up = Vec3.Zero;
_isLookAtAvailable = false;
_lookAt = Matrix44.Unit;
rotationAtt = Matrix44.Unit;
_projection = new Matrix44();
}
public Camera(Vec3 position, Vec3 target, Vec3 up)
: this()
{
rotationAtt = Matrix44.Unit;
cameraAtt = new Matrix44();
SetViewDirection(position, target, up);
_pitch = Radius.Zero;
_row = Radius.Zero;
_yaw = Radius.Zero;
}
public Matrix44 Projection => _projection;
public Matrix44 View
{
get
{
if (_isLookAtAvailable) {
return _lookAt;
}
Matrix44 move = Matrix44.Unit;
move.column[3].vec -= cameraAtt.column[3].vec;
_lookAt = rotationAtt.Transpose * move;
_isLookAtAvailable = true;
return _lookAt;
}
}
public Matrix44 CameraMatrix()
{
return Projection * View;
}
public void DisplayGLtypeDefinition()
{
Console.WriteLine("uniform matrix4x4 cameraName;");
}
/// <summary>
/// Get all uniform related to this <see cref="Camera" />.
/// </summary>
/// <param _label="source">
/// Shader program requires this camera.
/// </param>
/// <param _label="uniformName">
/// ContextName of all related uniforms. If you fallow form from <see
/// cref="IglConvertable.DisplayGLtypeDefinition" />
/// </param>
/// <exception cref="ArgumentException">
///
/// </exception>
public unsafe void GainAllUniforms(ShaderProgram source, params string[] uniformName)
{
if (uniformName is null || uniformName.Length != 1) {
throw new ArgumentException(
"Camera needs exactly one uniform.", nameof(uniformName));
}
convertedUniform = source.GetUniform<Matrix44>(uniformName[0]);
}
public void MoveNear(float distance)
{
cameraAtt.column[3].Z -= distance;
_isLookAtAvailable = false;
}
public void MoveRight(float distance)
{
cameraAtt.column[3].X -= distance;
_isLookAtAvailable = false;
}
public void MoveUp(float distance)
{
cameraAtt.column[3].Y -= distance;
_isLookAtAvailable = false;
}
public unsafe void SetAllUniforms()
{
// Console.WriteLine(Projection * ViewBase);
OpenGLFunction.CurrentGL.SetUniformValue(convertedUniform, Projection * View);
}
public void SetViewDirection(Vec3 position, Vec3 target, Vec3 up)
{
Vec3 direction = position - target;
if ((position.reg == cameraAtt.column[3].reg) &&
(this.up == up) &&
(cameraAtt.column[3].reg == direction.reg)) {
return;
}
if (direction.GetLength() == 0)
{
// deadlock
throw new ArgumentException("Direction bust is not zero.");
}
if (Vec3.IsParallel(direction, up)) {
throw new ArgumentException("Direction and UP is on on same way");
}
_target = direction;
this.up = up;
_isLookAtAvailable = false;
direction.Orthogonalize(ref up);
Vec3 right = Linear.Orthogonalize(Linear.Cross(up, direction));
cameraAtt.column[0].reg = right.reg;
cameraAtt.column[1].reg = up.reg;
cameraAtt.column[2].reg = direction.reg;
cameraAtt.column[3].reg = position.reg;
InternalPitch();
InternalRow();
InternalYaw();
}
public void SetViewRange(
Radius fovRadius,
Vec2 size,
Vec2 offset,
(float front, float back) depthRange)
{
float
distance = _target.GetLength(),
near = distance - depthRange.front,
far = distance + depthRange.back,
offsetX = offset.X,
offsetY = offset.Y,
width = Scalar.Abs(GeometryScaler.Tan(fovRadius / 2) * near * 2),
height = width * size.Y / size.X;
_projection.column[0].X = 2 * near / width;
_projection.column[1].Y = 2 * near / height;
_projection.column[2].X = 2 * offsetX / width;
_projection.column[2].Y = 2 * offsetY / height;
_projection.column[2].Z = (far + near) / (near - far);
_projection.column[2].W = -1;
_projection.column[3].Z = 2 * near * far / (near - far);
}
public void Test(params Vec4[] vec)
{
Console.WriteLine(View);
Console.WriteLine(Projection);
Console.WriteLine(Projection * View);
Console.WriteLine(View);
foreach (Vec4 item in vec) {
Console.Write($"{Projection * View * item};");
}
}
ShaderStruct IglConvertable.GetConvertedGLtype()
{
throw new NotImplementedException();
}
~Camera() { }
#region rotation
public void Yaw(Radius r)
{
_yaw -= r;
// Console.WriteLine(_yaw._radius);
// Console.WriteLine(rotationAtt);
InternalYaw();
}
public void Pitch(Radius r)
{
_pitch -= r;
// Console.WriteLine(_pitch._radius);
// Console.WriteLine(rotationAtt);
InternalPitch();
}
public void Row(Radius r)
{
_row -= r;
// Console.WriteLine(_row._radius);
// Console.WriteLine(rotationAtt);
InternalRow();
}
internal void InternalPitch()
{
/*
_isLookAtAvailable = false;
Matrix32 partialCoord = new Matrix32(cameraAtt.colum1.vec, cameraAtt.colum2.vec);
float angle = _pitch._radius;
Matrix22 rotation = new Matrix22(
Scaler.Cos(angle), -Scaler.Sin(angle), Scaler.Sin(angle), Scaler.Cos(angle));
partialCoord *= rotation;
rotationAtt.colum1.reg = partialCoord.colum0.reg;
rotationAtt.colum2.reg = partialCoord.colum1.reg;
rotationAtt.isTransposed = false;
/**/
}
internal void InternalRow()
{
/*
_isLookAtAvailable = false;
Matrix32 partialCoord = new Matrix32(cameraAtt.colum0.vec, cameraAtt.colum1.vec);
float angle = _row._radius;
Matrix22 rotation = new Matrix22(
Scaler.Cos(angle), -Scaler.Sin(angle), Scaler.Sin(angle), Scaler.Cos(angle));
partialCoord *= rotation;
rotationAtt.colum0.reg = partialCoord.colum0.reg;
rotationAtt.colum1.reg = partialCoord.colum1.reg;
rotationAtt.isTransposed = false;
*/
}
internal void InternalYaw()
{
/*
_isLookAtAvailable = false;
Matrix32 partialCoord = new Matrix32(cameraAtt.colum0.vec, cameraAtt.colum2.vec);
float angle = _yaw._radius;
Matrix22 rotation = new Matrix22(
Scaler.Cos(angle), -Scaler.Sin(angle), Scaler.Sin(angle), Scaler.Cos(angle));
partialCoord *= rotation;
rotationAtt.colum0.reg = partialCoord.colum0.reg;
rotationAtt.colum2.reg = partialCoord.colum1.reg;
rotationAtt.isTransposed = false;
*/
}
#endregion
}
}
@@ -0,0 +1,86 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="BufferObjectBase"
// 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.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics
{
/// <summary>
/// Interface of all kinds OpenGL BufferHandle objects
/// </summary>
public abstract class BufferObjectBase : IDisposable
{
protected GlHandle[] _bufferHandle;
protected RenderStream binding;
/// <summary>
/// Get the only handle to one of the Object instance
/// </summary>
/// <param _label="index">
///
/// </param>
/// <returns>
///
/// </returns>
public GlHandle this[int index] => _bufferHandle[index];
/// <summary>
/// Bind a BufferHandle instance to OpenGL
/// </summary>
/// <param _label="index">
/// Index of handle of the object in this instance to be bind
/// </param>
public abstract void Bind(int index);
public void Dispose()
{
Dispose(disposing:true);
GC.SuppressFinalize(this);
}
/// <inheritdoc />
public override string ToString()
{
return $"This is a {GetType().FullName}, containing {_bufferHandle.Length} buffer handles: {_bufferHandle.ToString()}.";
}
protected abstract void Dispose(bool disposing);
~BufferObjectBase()
{
Dispose(disposing:false);
}
}
}
+336
View File
@@ -0,0 +1,336 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="FrameworkConstant"
// 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics
{
public static class FrameworkConstant
{
#region glfw
public const int VERSION_MAJOR = 3;
public const int VERSION_MINOR = 3;
public const int VERSION_REVISION = 8;
public const int TRUE = 1;
public const int FALSE = 0;
public const int RELEASE = 0;
public const int PRESS = 1;
public const int REPEAT = 2;
public const int HAT_CENTERED = 0;
public const int HAT_UP = 1;
public const int HAT_RIGHT = 2;
public const int HAT_DOWN = 4;
public const int HAT_LEFT = 8;
public const int HAT_RIGHT_UP = HAT_RIGHT | HAT_UP;
public const int HAT_RIGHT_DOWN = HAT_RIGHT | HAT_DOWN;
public const int HAT_LEFT_UP = HAT_LEFT | HAT_UP;
public const int HAT_LEFT_DOWN = HAT_LEFT | HAT_DOWN;
public const int KEY_UNKNOWN = -1;
public const int KEY_SPACE = 32;
public const int KEY_APOSTROPHE = 39;
public const int KEY_COMMA = 44;
public const int KEY_MINUS = 45;
public const int KEY_PERIOD = 46;
public const int KEY_SLASH = 47;
public const int KEY_0 = 48;
public const int KEY_1 = 49;
public const int KEY_2 = 50;
public const int KEY_3 = 51;
public const int KEY_4 = 52;
public const int KEY_5 = 53;
public const int KEY_6 = 54;
public const int KEY_7 = 55;
public const int KEY_8 = 56;
public const int KEY_9 = 57;
public const int KEY_SEMICOLON = 59;
public const int KEY_EQUAL = 61;
public const int KEY_A = 65;
public const int KEY_B = 66;
public const int KEY_C = 67;
public const int KEY_D = 68;
public const int KEY_E = 69;
public const int KEY_F = 70;
public const int KEY_G = 71;
public const int KEY_H = 72;
public const int KEY_I = 73;
public const int KEY_J = 74;
public const int KEY_K = 75;
public const int KEY_L = 76;
public const int KEY_M = 77;
public const int KEY_N = 78;
public const int KEY_O = 79;
public const int KEY_P = 80;
public const int KEY_Q = 81;
public const int KEY_R = 82;
public const int KEY_S = 83;
public const int KEY_T = 84;
public const int KEY_U = 85;
public const int KEY_V = 86;
public const int KEY_W = 87;
public const int KEY_X = 88;
public const int KEY_Y = 89;
public const int KEY_Z = 90;
public const int KEY_LEFT_BRACKET = 91;
public const int KEY_BACKSLASH = 92;
public const int KEY_RIGHT_BRACKET = 93;
public const int KEY_GRAVE_ACCENT = 96;
public const int KEY_WORLD_1 = 161;
public const int KEY_WORLD_2 = 162;
public const int KEY_ESCAPE = 256;
public const int KEY_ENTER = 257;
public const int KEY_TAB = 258;
public const int KEY_BACKSPACE = 259;
public const int KEY_INSERT = 260;
public const int KEY_DELETE = 261;
public const int KEY_RIGHT = 262;
public const int KEY_LEFT = 263;
public const int KEY_DOWN = 264;
public const int KEY_UP = 265;
public const int KEY_PAGE_UP = 266;
public const int KEY_PAGE_DOWN = 267;
public const int KEY_HOME = 268;
public const int KEY_END = 269;
public const int KEY_CAPS_LOCK = 280;
public const int KEY_SCROLL_LOCK = 281;
public const int KEY_NUM_LOCK = 282;
public const int KEY_PRINT_SCREEN = 283;
public const int KEY_PAUSE = 284;
public const int KEY_F1 = 290;
public const int KEY_F2 = 291;
public const int KEY_F3 = 292;
public const int KEY_F4 = 293;
public const int KEY_F5 = 294;
public const int KEY_F6 = 295;
public const int KEY_F7 = 296;
public const int KEY_F8 = 297;
public const int KEY_F9 = 298;
public const int KEY_F10 = 299;
public const int KEY_F11 = 300;
public const int KEY_F12 = 301;
public const int KEY_F13 = 302;
public const int KEY_F14 = 303;
public const int KEY_F15 = 304;
public const int KEY_F16 = 305;
public const int KEY_F17 = 306;
public const int KEY_F18 = 307;
public const int KEY_F19 = 308;
public const int KEY_F20 = 309;
public const int KEY_F21 = 310;
public const int KEY_F22 = 311;
public const int KEY_F23 = 312;
public const int KEY_F24 = 313;
public const int KEY_F25 = 314;
public const int KEY_KP_0 = 320;
public const int KEY_KP_1 = 321;
public const int KEY_KP_2 = 322;
public const int KEY_KP_3 = 323;
public const int KEY_KP_4 = 324;
public const int KEY_KP_5 = 325;
public const int KEY_KP_6 = 326;
public const int KEY_KP_7 = 327;
public const int KEY_KP_8 = 328;
public const int KEY_KP_9 = 329;
public const int KEY_KP_DECIMAL = 330;
public const int KEY_KP_DIVIDE = 331;
public const int KEY_KP_MULTIPLY = 332;
public const int KEY_KP_SUBTRACT = 333;
public const int KEY_KP_ADD = 334;
public const int KEY_KP_ENTER = 335;
public const int KEY_KP_EQUAL = 336;
public const int KEY_LEFT_SHIFT = 340;
public const int KEY_LEFT_CONTROL = 341;
public const int KEY_LEFT_ALT = 342;
public const int KEY_LEFT_SUPER = 343;
public const int KEY_RIGHT_SHIFT = 344;
public const int KEY_RIGHT_CONTROL = 345;
public const int KEY_RIGHT_ALT = 346;
public const int KEY_RIGHT_SUPER = 347;
public const int KEY_MENU = 348;
public const int KEY_LAST = KEY_MENU;
public const int MOD_SHIFT = 0x0001;
public const int MOD_CONTROL = 0x0002;
public const int MOD_ALT = 0x0004;
public const int MOD_SUPER = 0x0008;
public const int MOD_CAPS_LOCK = 0x0010;
public const int MOD_NUM_LOCK = 0x0020;
public const int MOUSE_BUTTON_1 = 0;
public const int MOUSE_BUTTON_2 = 1;
public const int MOUSE_BUTTON_3 = 2;
public const int MOUSE_BUTTON_4 = 3;
public const int MOUSE_BUTTON_5 = 4;
public const int MOUSE_BUTTON_6 = 5;
public const int MOUSE_BUTTON_7 = 6;
public const int MOUSE_BUTTON_8 = 7;
public const int MOUSE_BUTTON_LAST = MOUSE_BUTTON_8;
public const int MOUSE_BUTTON_LEFT = MOUSE_BUTTON_1;
public const int MOUSE_BUTTON_RIGHT = MOUSE_BUTTON_2;
public const int MOUSE_BUTTON_MIDDLE = MOUSE_BUTTON_3;
public const int JOYSTICK_1 = 0;
public const int JOYSTICK_2 = 1;
public const int JOYSTICK_3 = 2;
public const int JOYSTICK_4 = 3;
public const int JOYSTICK_5 = 4;
public const int JOYSTICK_6 = 5;
public const int JOYSTICK_7 = 6;
public const int JOYSTICK_8 = 7;
public const int JOYSTICK_9 = 8;
public const int JOYSTICK_10 = 9;
public const int JOYSTICK_11 = 10;
public const int JOYSTICK_12 = 11;
public const int JOYSTICK_13 = 12;
public const int JOYSTICK_14 = 13;
public const int JOYSTICK_15 = 14;
public const int JOYSTICK_16 = 15;
public const int JOYSTICK_LAST = JOYSTICK_16;
public const int GAMEPAD_BUTTON_A = 0;
public const int GAMEPAD_BUTTON_B = 1;
public const int GAMEPAD_BUTTON_X = 2;
public const int GAMEPAD_BUTTON_Y = 3;
public const int GAMEPAD_BUTTON_LEFT_BUMPER = 4;
public const int GAMEPAD_BUTTON_RIGHT_BUMPER = 5;
public const int GAMEPAD_BUTTON_BACK = 6;
public const int GAMEPAD_BUTTON_START = 7;
public const int GAMEPAD_BUTTON_GUIDE = 8;
public const int GAMEPAD_BUTTON_LEFT_THUMB = 9;
public const int GAMEPAD_BUTTON_RIGHT_THUMB = 10;
public const int GAMEPAD_BUTTON_DPAD_UP = 11;
public const int GAMEPAD_BUTTON_DPAD_RIGHT = 12;
public const int GAMEPAD_BUTTON_DPAD_DOWN = 13;
public const int GAMEPAD_BUTTON_DPAD_LEFT = 14;
public const int GAMEPAD_BUTTON_LAST = GAMEPAD_BUTTON_DPAD_LEFT;
public const int GAMEPAD_BUTTON_CROSS = GAMEPAD_BUTTON_A;
public const int GAMEPAD_BUTTON_CIRCLE = GAMEPAD_BUTTON_B;
public const int GAMEPAD_BUTTON_SQUARE = GAMEPAD_BUTTON_X;
public const int GAMEPAD_BUTTON_TRIANGLE = GAMEPAD_BUTTON_Y;
public const int GAMEPAD_AXIS_LEFT_X = 0;
public const int GAMEPAD_AXIS_LEFT_Y = 1;
public const int GAMEPAD_AXIS_RIGHT_X = 2;
public const int GAMEPAD_AXIS_RIGHT_Y = 3;
public const int GAMEPAD_AXIS_LEFT_TRIGGER = 4;
public const int GAMEPAD_AXIS_RIGHT_TRIGGER = 5;
public const int GAMEPAD_AXIS_LAST = GAMEPAD_AXIS_RIGHT_TRIGGER;
public const int NO_ERROR = 0;
public const int NOT_INITIALIZED = 0x00010001;
public const int NO_CURRENT_CONTEXT = 0x00010002;
public const int INVALID_ENUM = 0x00010003;
public const int INVALID_VALUE = 0x00010004;
public const int OUT_OF_MEMORY = 0x00010005;
public const int API_UNAVAILABLE = 0x00010006;
public const int VERSION_UNAVAILABLE = 0x00010007;
public const int PLATFORM_ERROR = 0x00010008;
public const int FORMAT_UNAVAILABLE = 0x00010009;
public const int NO_WINDOW_CONTEXT = 0x0001000A;
public const int FOCUSED = 0x00020001;
public const int ICONIFIED = 0x00020002;
public const int RESIZABLE = 0x00020003;
public const int VISIBLE = 0x00020004;
public const int DECORATED = 0x00020005;
public const int AUTO_ICONIFY = 0x00020006;
public const int FLOATING = 0x00020007;
public const int MAXIMIZED = 0x00020008;
public const int CENTER_CURSOR = 0x00020009;
public const int TRANSPARENT_FRAMEBUFFER = 0x0002000A;
public const int HOVERED = 0x0002000B;
public const int FOCUS_ON_SHOW = 0x0002000C;
public const int RED_BITS = 0x00021001;
public const int GREEN_BITS = 0x00021002;
public const int BLUE_BITS = 0x00021003;
public const int ALPHA_BITS = 0x00021004;
public const int DEPTH_BITS = 0x00021005;
public const int STENCIL_BITS = 0x00021006;
public const int ACCUM_RED_BITS = 0x00021007;
public const int ACCUM_GREEN_BITS = 0x00021008;
public const int ACCUM_BLUE_BITS = 0x00021009;
public const int ACCUM_ALPHA_BITS = 0x0002100A;
public const int AUX_BUFFERS = 0x0002100B;
public const int STEREO = 0x0002100C;
public const int SAMPLES = 0x0002100D;
public const int SRGB_CAPABLE = 0x0002100E;
public const int REFRESH_RATE = 0x0002100F;
public const int DOUBLEBUFFER = 0x00021010;
public const int CLIENT_API = 0x00022001;
public const int CONTEXT_VERSION_MAJOR = 0x00022002;
public const int CONTEXT_VERSION_MINOR = 0x00022003;
public const int CONTEXT_REVISION = 0x00022004;
public const int CONTEXT_ROBUSTNESS = 0x00022005;
public const int OPENGL_FORWARD_COMPAT = 0x00022006;
public const int OPENGL_DEBUG_CONTEXT = 0x00022007;
public const int OPENGL_PROFILE = 0x00022008;
public const int CONTEXT_RELEASE_BEHAVIOR = 0x00022009;
public const int CONTEXT_NO_ERROR = 0x0002200A;
public const int CONTEXT_CREATION_API = 0x0002200B;
public const int SCALE_TO_MONITOR = 0x0002200C;
public const int COCOA_RETINA_FRAMEBUFFER = 0x00023001;
public const int COCOA_FRAME_NAME = 0x00023002;
public const int COCOA_GRAPHICS_SWITCHING = 0x00023003;
public const int X11_CLASS_NAME = 0x00024001;
public const int X11_INSTANCE_NAME = 0x00024002;
public const int NO_API = 0;
public const int OPENGL_API = 0x00030001;
public const int OPENGL_ES_API = 0x00030002;
public const int NO_ROBUSTNESS = 0;
public const int NO_RESET_NOTIFICATION = 0x00031001;
public const int LOSE_CONTEXT_ON_RESET = 0x00031002;
public const int OPENGL_ANY_PROFILE = 0;
public const int OPENGL_CORE_PROFILE = 0x00032001;
public const int OPENGL_COMPAT_PROFILE = 0x00032002;
public const int CURSOR = 0x00033001;
public const int STICKY_KEYS = 0x00033002;
public const int STICKY_MOUSE_BUTTONS = 0x00033003;
public const int LOCK_KEY_MODS = 0x00033004;
public const int RAW_MOUSE_MOTION = 0x00033005;
public const int CURSOR_NORMAL = 0x00034001;
public const int CURSOR_HIDDEN = 0x00034002;
public const int CURSOR_DISABLED = 0x00034003;
public const int ANY_RELEASE_BEHAVIOR = 0;
public const int RELEASE_BEHAVIOR_FLUSH = 0x00035001;
public const int RELEASE_BEHAVIOR_NONE = 0x00035002;
public const int NATIVE_CONTEXT_API = 0x00036001;
public const int EGL_CONTEXT_API = 0x00036002;
public const int OSMESA_CONTEXT_API = 0x00036003;
public const int ARROW_CURSOR = 0x00036001;
public const int IBEAM_CURSOR = 0x00036002;
public const int CROSSHAIR_CURSOR = 0x00036003;
public const int HAND_CURSOR = 0x00036004;
public const int HRESIZE_CURSOR = 0x00036005;
public const int VRESIZE_CURSOR = 0x00036006;
public const int CONNECTED = 0x00040001;
public const int DISCONNECTED = 0x00040002;
public const int JOYSTICK_HAT_BUTTONS = 0x00050001;
public const int COCOA_CHDIR_RESOURCES = 0x00051001;
public const int COCOA_MENUBAR = 0x00051002;
public const int DONT_CARE = -1;
#endregion
}
}
+187
View File
@@ -0,0 +1,187 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Image.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.OpenGL;
using System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics
{
public class Image : IImageProvider
{
private byte[] _data;
private ImageInfo _rawInfo;
private int _pixelUpdateCount = 0;
internal unsafe Image()
{
_rawInfo = new ImageInfo();
}
internal Image(ImageInfo information)
{
_rawInfo = information;
_data = [];
// int length = _rawInfo.width * _rawInfo.height * _rawInfo.channel;
}
public (int width, int height) Size
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => (_rawInfo.Width, _rawInfo.Height);
}
public byte[] PixelBuffer
{
get
{
if ((_data.Length == 0) || (_data == null))
{
GetBytes();
return _data!;
}
return _data;
}
}
public ImageChannel Channel => _rawInfo.Channel;
/// <summary>
/// Hash code of time pixels updated last time.
/// </summary>
public int PixelUpdateCount
{
get => _pixelUpdateCount;
internal set => _pixelUpdateCount = value;
}
public int ChannelCount => _rawInfo.ChannelCount;
public int Height
{
get => _rawInfo.Height;
internal set => _rawInfo.Height = value;
}
public int Width
{
get => _rawInfo.Width;
internal set => _rawInfo.Width = value;
}
public int PixelSize => ImageInfo.GetPixelSize(_rawInfo.pixelLayout, _rawInfo.Channel);
public PixelChannelLayout PixelLayout
{
get => _rawInfo.pixelLayout;
private set => _rawInfo.pixelLayout = value;
}
internal ref byte[] Data => ref _data;
public void FromBytes(byte[] stream) { }
public static unsafe Image FromFile(string route, ImageLoader loader)
{
Image ret = new Image();
fixed (ImageInfo* iptr = &ret._rawInfo) {
GraphicFramework.InternalLoadImage(route, iptr, loader);
}
return ret;
}
public static Image FromMemory((int width, int height) size, ImageChannel channel, byte[] stream)
{
ImageInfo _info = new ImageInfo
{
Height = size.height,
Width = size.width,
Channel = channel,
StreamPtr = IntPtr.Zero
};
Image ret = new Image(_info);
ret.PixelLayout = PixelChannelLayout.Byte;
ret._data = stream;
return ret;
}
public static Image FromMemory(
(int width, int height) size,
ImageChannel channel,
PixelChannelLayout layout,
byte[] stream)
{
ImageInfo _info = new ImageInfo
{
Height = size.height,
Width = size.width,
Channel = channel,
StreamPtr = IntPtr.Zero
};
Image ret = new Image(_info);
ret.PixelLayout = layout;
ret._data = stream;
return ret;
}
public unsafe byte[] GetBytes()
{
if (_data.Length == 0)
{
int size = Width * Height * ImageInfo.GetPixelSize(PixelLayout, Channel);
_data = new Span<byte>((byte*)_rawInfo.StreamPtr, size).ToArray();
fixed (ImageInfo* pptr = &_rawInfo) {
GraphicFramework.InternalUnloadImage(pptr);
}
_rawInfo.StreamPtr = IntPtr.Zero;
}
return _data;
}
public Image ProvideImage()
{
return this;
}
internal static Image FromMemory(ImageInfo info, byte[] data, int operationCount)
{
return new Image
{
_rawInfo = info,
_data = data,
_pixelUpdateCount = operationCount
};
}
}
}
+162
View File
@@ -0,0 +1,162 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ImageInfo"
// 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.OpenGL;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public delegate IntPtr ImageLoader(
string name,
ref int width,
ref int height,
ref int definedChannel,
int desiredChannel);
[StructLayout(LayoutKind.Sequential)]
internal struct ImageInfo
{
private ImageChannel channel;
private int height;
private int width;
private IntPtr pixelPtr;
internal PixelChannelLayout pixelLayout;
public ImageChannel Channel
{
get => channel;
set { channel = value; }
}
public int ChannelCount
{
get => GetChannelCount(channel);
}
public int Height
{
get => height;
set => height = value;
}
public int StreamSize
{
get => width * height * GetPixelSize(
pixelLayout, channel);
}
public int Width
{
get => width;
set => width = value;
}
public IntPtr StreamPtr
{
get => pixelPtr;
internal set => pixelPtr = value;
}
public override int GetHashCode()
{
int hash = 17;
hash = (hash * 17) + width;
hash = (hash * 17) + height;
hash = (hash * 17) + (int)channel;
return hash;
}
public override string ToString()
{
return $"{channel}\t{width}\t{height}\t{(ulong)StreamPtr}";
}
internal static int GetChannelCount(ImageChannel channel)
{
return channel switch
{
ImageChannel.SingleColor => 1,
ImageChannel.DoubleColor => 2,
ImageChannel.TripleColor => 3,
ImageChannel.WithAlphaChannel => 4,
_ => throw new InvalidCastException(
"Unknown color channel decoding setting.")
};
}
internal static int GetPixelSize(PixelChannelLayout layout, ImageChannel channel)
{
return layout switch
{
PixelChannelLayout.UByte => sizeof(byte) * GetChannelCount(
channel),
PixelChannelLayout.Byte => sizeof(byte) * GetChannelCount(
channel),
PixelChannelLayout.UShort => sizeof(short) * GetChannelCount(
channel),
PixelChannelLayout.Short => sizeof(short) * GetChannelCount(
channel),
PixelChannelLayout.UInt => sizeof(int) * GetChannelCount(
channel),
PixelChannelLayout.Int => sizeof(int) * GetChannelCount(
channel),
PixelChannelLayout.Float => sizeof(float) * GetChannelCount(
channel),
PixelChannelLayout.UByte332 => sizeof(byte),
PixelChannelLayout.UByte233Rev => sizeof(byte),
PixelChannelLayout.UShort565 => sizeof(short),
PixelChannelLayout.UShort565Rev => sizeof(short),
PixelChannelLayout.UShort4444 => sizeof(short),
PixelChannelLayout.UShort4444Rev => sizeof(short),
PixelChannelLayout.UShort5551 => sizeof(short),
PixelChannelLayout.UShort1555Rev => sizeof(short),
PixelChannelLayout.UInt8888 => sizeof(int),
PixelChannelLayout.UInt8888Rev => sizeof(int),
PixelChannelLayout.UInt1010102 => sizeof(int),
PixelChannelLayout.UInt2101010Rev => sizeof(int),
_ => throw new ArgumentException("Unknown layout type"),
};
}
}
public enum ImageChannel : uint
{
SingleColor = glConst.RED,
DoubleColor = glConst.RG,
TripleColor = glConst.RGB,
WithAlphaChannel = glConst.RGBA,
}
}
@@ -0,0 +1,160 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="AutoTexture"
// 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.Collections;
using StgSharp.Graphics;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.OpenGL
{
/// <summary>
/// A collection of a sets of OpenGL textures. The collection can automatically select one of
/// the texture with minimum costs to upgrade pixels to BufferHandle. Usually <see
/// cref="AutoTextureGL" /> is used for <see cref="IImageProvider" /> loading, but not for
/// target of <see cref="OpenGLFunction.FrameBufferTexture2d(FrameBufferTarget, uint,
/// Texture2DTarget, GlHandle, int)" />.
/// </summary>
public sealed class AutoTextureGL
{
private TextureProperty[] propertyCache;
private BidirectionalDictionary<Image, int> imageIndexMap = new BidirectionalDictionary<Image, int>(
);
private Dictionary<Image, int> imageUpdateIndex = new Dictionary<Image, int>();
private int _size, _currentIndex;
private LinkedList<int> usedTextureIndex;
private Queue<int> unusedTextureUnitIndex;
private TextureGL texturePackage;
private TextureProperty _textureProperty;
private AutoTextureGL(TextureGL texture)
{
texturePackage = texture;
_size = texture.Count;
imageIndexMap = new BidirectionalDictionary<Image, int>();
unusedTextureUnitIndex = new Queue<int>(Enumerable.Range(0, _size));
usedTextureIndex = new LinkedList<int>();
propertyCache = new TextureProperty[_size];
}
public AutoTextureGL(int textureObjectSize, [NotNull]glRender binding)
{
this._size = textureObjectSize;
imageIndexMap = new BidirectionalDictionary<Image, int>();
texturePackage = new TextureGL(textureObjectSize, binding);
unusedTextureUnitIndex = new Queue<int>(Enumerable.Range(0, _size));
usedTextureIndex = new LinkedList<int>();
propertyCache = new TextureProperty[_size];
}
public TextureProperty DefaultTextureProperty
{
get => _textureProperty;
set => _textureProperty = value;
}
private OpenGLFunction GL
{
get => texturePackage.GL;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SelectTextureAndBind(Image i)
{
TextureProperty property = _textureProperty;
SelectTextureAndBind(i, property);
}
public void SelectTextureAndBind([NotNull]Image i, TextureProperty property)
{
// usable texture with image match
if (imageIndexMap.TryGetValue(i, out int index))
{
// prop setting match
if (propertyCache[index] == property)
{
_currentIndex = index; //GL.Assert(true);
texturePackage.Bind2D(index); //GL.Assert(true);
if (i.PixelUpdateCount != imageUpdateIndex[i])
{
texturePackage.LoadTexture(index, i); //GL.Assert(true);
}
} else
{
_currentIndex = index; //GL.Assert(true);
texturePackage.Bind2D(index); //GL.Assert(true);
texturePackage.Set2dProperty(index, property); //GL.Assert(true);
if (i.PixelUpdateCount != imageUpdateIndex[i])
{
texturePackage.LoadTexture(index, i); //GL.Assert(true);
}
}
} else
{
if (unusedTextureUnitIndex.TryDequeue(out int newIndex))
{
// has extra unused texture object
imageIndexMap.Add(i, index);
texturePackage.Bind2D(index);
texturePackage.Set2dProperty(index, property);
texturePackage.LoadTexture(index, i);
usedTextureIndex.AddLast(newIndex);
propertyCache[newIndex] = property;
imageUpdateIndex[i] = i.PixelUpdateCount;
} else
{
// recycle from current
int reusedIndex = usedTextureIndex.First!.Value;
usedTextureIndex.RemoveFirst();
usedTextureIndex.AddLast(reusedIndex);
imageIndexMap[i] = reusedIndex;
propertyCache[newIndex] = property;
imageUpdateIndex[i] = i.PixelUpdateCount;
}
}
}
public static AutoTextureGL ToAuto([NotNull]TextureGL texture)
{
if (texture.IndexOfCurrentTexture != -1) {
throw new InvalidOperationException("Texture to be converted has been editted.");
}
return new AutoTextureGL(texture);
}
}
}
+81
View File
@@ -0,0 +1,81 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="EBO"
// 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 StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics.OpenGL
{
/// <summary>
/// A collection of handle to Element BufferHandle Object in OpenglFunc. Each <see
/// langword="uint" /> value indexed from instance of this class this is the only handle to
/// one Element BufferHandle Object.
/// </summary>
public sealed unsafe class ElementBuffer : GlBufferObjectBase
{
internal ElementBuffer(int n, glRender binding)
: base(binding)
{
_bufferHandle = GL.GenBuffers(n);
}
public sealed override void Bind(int index)
{
GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]);
}
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage) where T: unmanaged, INumber<T>
{
GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]);
GL.SetBufferData<T>(BufferType.ElementArrayBuffer, bufferArray, usage);
}
public void SetValue<T>(int index, ReadOnlySpan<T> bufferSpan, BufferUsage usage) where T: unmanaged, INumber<T>
{
GL.BindBuffer(BufferType.ElementArrayBuffer, _bufferHandle[index]);
GL.SetBufferData<T>(BufferType.ElementArrayBuffer, bufferSpan, usage);
}
protected sealed override void Dispose(bool disposing)
{
if (disposing) {
GL.DeleteBuffers(_bufferHandle);
}
}
}
}
+115
View File
@@ -0,0 +1,115 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="FBO"
// 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 System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.OpenGL
{
#pragma warning disable CA1008
#pragma warning disable CA1028
public enum FrameBufferTarget : uint
#pragma warning restore CA1028
#pragma warning restore CA1008
{
Read = glConst.READ_FRAMEBUFFER,
All = glConst.FRAMEBUFFER,
Draw = glConst.DRAW_FRAMEBUFFER,
}
public sealed class FrameBuffer : GlBufferObjectBase
{
internal unsafe FrameBuffer(
int count,
glRender binding
)
: base(binding)
{
_bufferHandle = new GlHandle[count];
GL.GenFrameBuffers(_bufferHandle);
}
/// <summary>
/// Bind the frame BufferHandle object with _label frame BufferHandle to the frame
/// BufferHandle target specified by target. <see langword="FrameBufferTarget.All" /> will
/// be set as default target.
/// </summary>
/// <param _label="index">
/// Index of object to be binded in handle set
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override unsafe void Bind(
int index
)
{
GL.BindFrameBuffer(FrameBufferTarget.All, _bufferHandle[index]);
}
/// <summary>
/// Bind the frame BufferHandle object with _label frame BufferHandle to the frame
/// BufferHandle target specified by target. Target of this frame BufferHandle should be
/// set manually.
/// </summary>
/// <param _label="target">
/// The frame BufferHandle target of the binding operation.
/// </param>
/// <param _label="index">
/// Index of object to be binded in handle set
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void Bind(
FrameBufferTarget target,
int index
)
{
GL.BindFrameBuffer(target, _bufferHandle[index]);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void BindNull()
{
OpenGLFunction.CurrentGL.BindFrameBuffer(FrameBufferTarget.All, GlHandle.Zero);
}
protected override void Dispose(
bool disposing
)
{
throw new NotImplementedException();
}
}
}
@@ -0,0 +1,50 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="GLBufferObjectBase"
// 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.OpenGL;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphics.OpenGL
{
public abstract class GlBufferObjectBase : BufferObjectBase
{
private readonly glRender _contextBinding;
protected GlBufferObjectBase(glRender contextBinding)
{
binding = contextBinding;
_contextBinding = contextBinding;
}
protected OpenGLFunction GL => _contextBinding.GL;
}
}
+67
View File
@@ -0,0 +1,67 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="RBO"
// 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 System;
using System.Collections.Generic;
using System.Security.Principal;
using System.Text;
namespace StgSharp.Graphics.OpenGL
{
public sealed class RenderBuffer : GlBufferObjectBase
{
public RenderBuffer(int count, glRender binding)
: base(binding)
{
_bufferHandle = GL.GenRenderBuffer(count);
}
public override void Bind(int index)
{
GL.BindRenderBuffer(this[index]);
}
public void Store(RenderBufferInternalFormat format, (int width, int height) size)
{
if ((size.width > binding.Width) || (size.height > binding.Height)) {
World.LogWarning("FrameBuffer is larger than current canvas binding");
}
}
protected override void Dispose(bool disposing)
{
foreach (GlHandle item in _bufferHandle)
{
Console.WriteLine("removing a render buffer");
GL.DeleteRenderBuffer(item);
}
}
}
}
@@ -0,0 +1,311 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="TextureGL"
// 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.HighPerformance;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics.OpenGL
{
public sealed unsafe class TextureGL
{
private int currentEditingTextureIndex;
private OpenGLFunction _gl;
internal GlHandle[] _textureHandle;
internal TextureGL(
int count,
glRender binding
)
{
// sourceList = new Image[count];
this._gl = binding.GL;
_textureHandle = _gl.GenTextures(count);
}
public GlHandle this[
int index
]
{
get => _textureHandle[index];
}
public int Count
{
get => _textureHandle.Length;
}
// internal Image[] sourceList;
public int IndexOfCurrentTexture
{
get => currentEditingTextureIndex;
}
internal OpenGLFunction GL => _gl;
public void ActivateAs(
TextureUnit unit
)
{
_gl.ActiveTextureUnit((uint)unit);
}
public void Bind2D(
int index
)
{
currentEditingTextureIndex = index;
_gl.BindTexture(glConst.TEXTURE_2D, _textureHandle[index]);
}
/// <summary>
/// Load an <see cref="Image" /> to certain texture.
/// </summary>
/// <param _label="index">
///
/// </param>
/// <param _label="i">
///
/// </param>
public unsafe void LoadTexture(
int index,
Image i
)
{
byte[] handle = i.PixelBuffer;
_gl.TextureImage2d(Texture2DTarget.Texture2D, 0, i.Channel, i.Width, i.Height,
i.Channel, i.PixelLayout, pixels:handle);
_gl.GenerateMipmap(Texture2DTarget.Texture2D);
}
#region texture setting
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dFilterProperty(
int index,
TextureFilter onMinify,
TextureFilter onMagnify
)
{
#if DEBUG
if (index != currentEditingTextureIndex)
{
throw new InvalidOperationException(
"Texture to be editted is not the one being activated.");
}
#endif
_gl.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_MIN_FILTER, (int)onMinify);
_gl.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_MAG_FILTER,
(int)onMagnify);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dWrapProperty(
int index,
TextureWrap onHorizontial,
TextureWrap onVertical
)
{
#if DEBUG
if (index != currentEditingTextureIndex)
{
throw new InvalidOperationException(
"Texture to be editted is not the one being activated.");
}
#endif
_gl.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_S,
(int)onHorizontial);
_gl.TextureParameter(glConst.TEXTURE_2D, glConst.TEXTURE_WRAP_T, (int)onVertical);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Set2dProperty(
int index,
TextureProperty property
)
{
Set2dFilterProperty(index, property.FilterOnMinify, property.FilterOnMagnify);
Set2dWrapProperty(index, property.WrapOnHorizontial, property.WrapOnVertical);
}
#endregion texture setting
}
[StructLayout(LayoutKind.Explicit)]
public struct TextureProperty
{
[FieldOffset(0)] private M128 mask;
[FieldOffset(0)] private TextureFilter mag;
[FieldOffset(4)] private TextureFilter min;
[FieldOffset(8)] private TextureWrap hori;
[FieldOffset(12)] private TextureWrap vert;
public TextureProperty(
TextureFilter onMagnify,
TextureFilter onMinify,
TextureWrap onHorizontial,
TextureWrap onVertical
)
{
FilterOnMagnify = onMagnify;
FilterOnMinify = onMinify;
WrapOnHorizontial = onHorizontial;
WrapOnVertical = onVertical;
}
public TextureFilter FilterOnMagnify
{
get => mag;
set => mag = value;
}
public TextureFilter FilterOnMinify
{
get => min;
set => min = value;
}
public TextureWrap WrapOnHorizontial
{
get => hori;
set => hori = value;
}
public TextureWrap WrapOnVertical
{
get => vert;
set => vert = value;
}
public override bool Equals(
[NotNullWhen(true)] object obj
)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return HashCode.Combine(FilterOnMagnify, FilterOnMagnify, WrapOnHorizontial,
WrapOnVertical);
}
public override string ToString()
{
return $"FilterOnMagnify:{FilterOnMagnify}, " + $"FilterOnMagnify:{FilterOnMagnify}, " + $"WrapOnHorizontial:{WrapOnHorizontial}, " + $"WrapOnVertical:{WrapOnVertical}";
}
public static bool operator !=(
TextureProperty left,
TextureProperty right
)
{
return left.mask != right.mask;
}
public static bool operator ==(
TextureProperty left,
TextureProperty right
)
{
return left.mask == right.mask;
}
public static implicit operator TextureProperty(
(
TextureFilter onMagnify, TextureFilter onMinify,
TextureWrap onHorizontial, TextureWrap onVertical
) propertyValueTuple
)
{
return new TextureProperty(propertyValueTuple.onMagnify, propertyValueTuple.onMinify,
propertyValueTuple.onHorizontial,
propertyValueTuple.onVertical);
}
}
#pragma warning disable CA1008
public enum TextureFilter
#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,
}
#pragma warning disable CA1008
public enum TextureUnit
#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,
}
#pragma warning disable CA1008
public enum TextureWrap
#pragma warning restore CA1008
{
Repeat = glConst.REPEAT,
MirroredRepeat = glConst.MIRRORED_REPEAT,
ClampToEdge = glConst.CLAMP_TO_EDGE,
ClampToBorder = glConst.CLAMP_TO_BORDER,
}
}
+86
View File
@@ -0,0 +1,86 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="VAO"
// 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 System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.Graphics.OpenGL
{
public sealed unsafe class VertexArray : GlBufferObjectBase
{
internal VertexArray(
int n,
glRender binding
)
: base(binding)
{
_bufferHandle = GL.GenVertexArrays(n);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public sealed override void Bind(
int index
)
{
GL.BindVertexArray(_bufferHandle[index]);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void BindNull()
{
OpenGLFunction.CurrentGL.BindVertexArray(GlHandle.Zero);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute(
uint attributeIndex,
int vertexLength,
TypeCode dataType,
bool isNomalized,
int stride,
int pointer
)
{
GL.SetVertexAttribute(attributeIndex, vertexLength, dataType, isNomalized, stride,
pointer);
}
protected sealed override void Dispose(
bool disposing
)
{
if (disposing) {
GL.DeleteVertexArrays(_bufferHandle);
}
}
}
}
+181
View File
@@ -0,0 +1,181 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="VBO"
// 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.Mathematics;
using StgSharp.Mathematics.Numeric;
using System;
using System.Collections.Generic;
using System.Net.Security;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics.OpenGL
{
public sealed unsafe class VertexBuffer : GlBufferObjectBase
{
internal VertexBuffer(
int n,
glRender binding
)
: base(binding)
{
_bufferHandle = GL.GenBuffers(n);
}
public sealed override void Bind(
int index
)
{
GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]);
}
/// <summary>
///
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Unbind()
{
GL.BindBuffer(BufferType.ArrayBuffer, GlHandle.Zero);
}
/// <summary>
/// Set _data to current vertex BufferHandle object
/// </summary>
/// <typeparam _label="TItem">
/// Type of bufferData
/// </typeparam>
/// <param _label="index">
/// Index to find certain VBO in this instance
/// </param>
/// <param _label="bufferArray">
/// Data to write in
/// </param>
/// <param _label="usage">
/// How OpenGL use these _data, defined by <see cref="BufferUsage" />
/// </param>
public void WriteScalerData<T>(
int index,
T[] bufferArray,
BufferUsage usage
) where T : unmanaged, INumber<T>
{
GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]);
GL.SetBufferData(BufferType.ArrayBuffer, bufferArray, usage);
}
/// <summary>
/// Set _data to current vertex BufferHandle object
/// </summary>
/// <typeparam _label="TItem">
/// Type of bufferData
/// </typeparam>
/// <param _label="index">
/// Index to find certain VBO in this instance
/// </param>
/// <param _label="scalerSpan">
/// A <see cref="Span{T}" /> of _data to write in
/// </param>
/// <param _label="usage">
/// How OpenGL use these _data, defined by <see cref="BufferUsage" />
/// </param>
public void WriteScalerData<T>(
int index,
ReadOnlySpan<T> scalerSpan,
BufferUsage usage
) where T : unmanaged,INumber<T>
{
GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]);
GL.SetBufferData(BufferType.ArrayBuffer, scalerSpan, usage);
}
/// <summary>
/// Set data to current vertex BufferHandle object
/// </summary>
/// <typeparam _label="TItem">
/// Type of bufferData
/// </typeparam>
/// <param _label="index">
/// Index to find certain VBO in this instance
/// </param>
/// <param _label="vectorSpan">
/// A <see cref="Span{T}" /> of data to write in
/// </param>
/// <param _label="usage">
/// How OpenGL use these data, defined by <see cref="BufferUsage" />
/// </param>
public void WriteVectorData<T>(
int index,
ReadOnlySpan<T> vectorSpan,
BufferUsage usage
) where T : unmanaged, IUnmanagedVector<T>
{
GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]);
GL.SetBufferVectorData(BufferType.ArrayBuffer, vectorSpan, usage);
}
/// <summary>
/// Set _data to current vertex BufferHandle object
/// </summary>
/// <typeparam _label="TItem">
/// Type of bufferData
/// </typeparam>
/// <param _label="index">
/// Index to find certain VBO in this instance
/// </param>
/// <param _label="vectorArray">
/// A array of _data to write in
/// </param>
/// <param _label="usage">
/// How OpenGL use these _data, defined by <see cref="BufferUsage" />
/// </param>
public void WriteVectorData<T>(
int index,
T[] vectorArray,
BufferUsage usage
) where T : unmanaged, IUnmanagedVector<T>
{
GL.BindBuffer(BufferType.ArrayBuffer, _bufferHandle[index]);
GL.SetBufferVectorData(BufferType.ArrayBuffer, vectorArray, usage);
}
protected sealed override void Dispose(
bool disposing
)
{
if (disposing) {
GL.DeleteBuffers(_bufferHandle);
}
}
}
}
@@ -0,0 +1,65 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="IglConvertable"
// 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.OpenGL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.ShaderEdit
{
public interface IglConvertable
{
/// <summary>
///
/// </summary>
public void DisplayGLtypeDefinition();
/// <summary>
///
/// </summary>
public void GainAllUniforms(ShaderProgram source, params string[] uniformName);
/// <summary>
///
/// </summary>
/// <returns>
///
/// </returns>
public ShaderStruct GetConvertedGLtype();
/// <summary>
///
/// </summary>
public void SetAllUniforms();
}
}
@@ -0,0 +1,318 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Shader"
// 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;
using StgSharp.Graphics;
using StgSharp.Internal;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Xml.Linq;
namespace StgSharp.Graphics.OpenGL
{
public abstract partial class glRender : RenderStream
{
/// <summary>
/// Create an instance of <see cref="Shader" /> program
/// </summary>
/// <returns>
/// New instance of <see cref="Shader" /> instance.
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected sealed override ShaderProgram CreateShaderProgram()
{
return new ShaderProgram(this);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected sealed override Shader CreateShaderSegment(
ShaderType type,
int count
)
{
return new Shader(GL.CreateShaderSet(count, type), type, this);
}
}
public class Shader : ISSDSerializable
{
private readonly OpenGLFunction GL;
internal readonly GlHandle[] handle;
public readonly ShaderType type;
internal unsafe Shader(
GlHandle[] handle,
ShaderType usage,
glRender stream
)
{
this.handle = handle;
GL = stream.GL;
type = usage;
}
public SerializableTypeCode SSDTypeCode => SerializableTypeCode.Shader;
/// <summary>
/// Attach one shader code to a shader program.
/// </summary>
/// <param _label="target">
/// Shader program to attach
/// </param>
/// <param _label="index">
/// Index of shader code in current shader code set.
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AttachTo(
int index,
[NotNull]ShaderProgram target
)
{
GL.AttachShader(target.handle, handle[index]);
}
public void CheckStatus(
int index,
ShaderStatus status
)
{
string log = GL.GetShaderStatus(this, index, (int)status);
if (!string.IsNullOrEmpty(log)) {
throw new InvalidOperationException($"{$"Shader Error \t{status}\n"}{log}");
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void Compile(
int index,
ReadOnlySpan<byte> codeU8Stream
)
{
GL.LoadShaderSource(handle[index], codeU8Stream);
GL.CompileShader(handle[index]);
CheckStatus(index, ShaderStatus.CompileStatus);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void Compile(
int index,
byte[] codeStream
)
{
ArgumentNullException.ThrowIfNull(codeStream);
GL.LoadShaderSource(handle[index], codeStream);
GL.CompileShader(handle[index]);
CheckStatus(index, ShaderStatus.CompileStatus);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void Compile(
int index,
string codeStream
)
{
ArgumentNullException.ThrowIfNull(codeStream);
GL.LoadShaderSource(handle[index], codeStream.AsSpan());
GL.CompileShader(handle[index]);
CheckStatus(index, ShaderStatus.CompileStatus);
}
public void FromBytes(
byte[] stream
)
{
throw new NotImplementedException();
}
public static byte[] FromCodeFile(
string fileRoute
)
{
string str = File.ReadAllText(fileRoute);
if (string.IsNullOrEmpty(str)) {
throw new InvalidOperationException($"Cannot load and GLSL code from {fileRoute}");
}
return Encoding.UTF8.GetBytes(str);
}
public byte[] GetBytes()
{
return Array.Empty<byte>();
}
public byte[] GetBytes(
out int length
)
{
throw new NotImplementedException();
}
public override string ToString()
{
return $"This is a {type} shader, its shader handles are {handle.ToString()}.";
}
}
public enum ShaderStatus : int
{
CompileStatus = glConst.COMPILE_STATUS,
}
public class ShaderProgram
{
private readonly OpenGLFunction GL;
internal readonly GlHandle handle;
/// <summary>
/// CustomizeInit a program with no shader attached.
/// </summary>
internal unsafe ShaderProgram(
glRender binding
)
{
GL = binding.GL;
handle = GL.CreateProgram();
}
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param _label="name">
/// ContextName of the Uniform in shader code
/// </param>
/// <returns>
///
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe Uniform<T> GetUniform<T>(
string name
) where T : unmanaged
{
return new Uniform<T>(GL.GetUniformLocation(this.handle, name));
}
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param _label="name">
/// ContextName of the Uniform in shader code
/// </param>
/// <returns>
///
/// </returns>
public unsafe Uniform<T, U> GetUniform<T, U>(
string name
) where T : unmanaged where U : struct
{
return new Uniform<T, U>(GL.GetUniformLocation(this.handle, name));
}
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param _label="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 : unmanaged where U : struct where V : struct
{
return new Uniform<T, U, V>(GL.GetUniformLocation(this.handle, name));
}
/// <summary>
/// Get a uniform form current shader, the value type of the uniform should be provided.
/// </summary>
/// <param _label="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 : unmanaged where U : struct where V : struct where W : struct
{
return new Uniform<T, U, V, W>(GL.GetUniformLocation(this.handle, name));
}
/// <summary>
/// Link the shader to current viewPortDisplay.
/// </summary>
public unsafe void Link()
{
if (GraphicFramework.InternalLinkShaderProgram(
(OpenglContext*)this.GL.ContextHandle, handle.Value) == 0)
{
IntPtr logPtr = GraphicFramework.InternalReadSSCLog();
try
{
byte[] logByte = new byte[512];
Marshal.Copy(logPtr, logByte, 0, 512);
string log = Encoding.UTF8.GetString(logByte);
log = log.Replace("\0", string.Empty);
DefaultLog.InternalWriteLog(log, LogType.Error);
}
catch (Exception ex)
{
DefaultLog.InternalWriteLog(ex.Message, LogType.Error);
}
}
}
/// <summary>
/// Let the current viewPortDisplay use this shader.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void Use()
{
GL.UseProgram(handle);
}
~ShaderProgram()
{
// handle.Dispose();
}
}
}
@@ -0,0 +1,225 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Uniform"
// 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.Mathematics.Graphics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public class Uniform
{
internal GlHandle id;
public GlHandle Handle => id;
}
public sealed class Uniform<T> : Uniform where T : unmanaged
{
internal Uniform() { }
internal unsafe Uniform(
GlHandle id
)
{
this.id = id;
}
internal static Uniform<T> FromHandle(
GlHandle handle
)
{
return new Uniform<T>
{
id = handle
};
}
}
public sealed class Uniform<T, U> : Uniform where T : unmanaged where U : struct
{
internal Uniform() { }
internal unsafe Uniform(
GlHandle id
)
{
this.id = id;
}
internal static Uniform<T, U> FromHandle(
GlHandle handle
)
{
return new Uniform<T, U>
{
id = handle
};
}
}
public sealed class Uniform<T, U, V> : Uniform where T : unmanaged where U : struct
where V : struct
{
internal Uniform() { }
internal unsafe Uniform(
GlHandle id
)
{
this.id = id;
}
internal static Uniform<T, U, V> FromHandle(
GlHandle handle
)
{
return new Uniform<T, U, V>
{
id = handle
};
}
}
public sealed class Uniform<T, U, V, W> : Uniform where T : unmanaged where U : struct
where V : struct
where W : struct
{
internal Uniform() { }
internal unsafe Uniform(
GlHandle id
)
{
this.id = id;
}
internal static Uniform<T, U, V, W> FromHandle(
GlHandle handle
)
{
return new Uniform<T, U, V, W>
{
id = handle
};
}
}
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(
[NotNull] Uniform<Matrix44> uniform,
Matrix44 mat
)
{
Context.glUniformMatrix4fv(uniform.id.SignedValue, 1, (byte)0, (float*)&mat);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(
[NotNull]Uniform<float, float, float, float> uniform,
Vec4 vec
)
{
Context.glUniform1fv(uniform.id.SignedValue, 4, (float*)&vec);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(
[NotNull]Uniform<Vec4> uniform,
Vec4 vec
)
{
Context.glUniform1fv(uniform.id.SignedValue, 4, (float*)&vec);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(
[NotNull]Uniform<float> uniform,
float v0
)
{
Context.glUniform1f(uniform.id.SignedValue, v0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(
[NotNull]Uniform<int> uniform,
int i0
)
{
Context.glUniform1i(uniform.id.SignedValue, i0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(
[NotNull] Uniform<float, float> uniform,
float v0,
float v1
)
{
Context.glUniform2f(uniform.id.SignedValue, v0, v1);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(
[NotNull] Uniform<float, float, float> uniform,
float v0,
float v1,
float v2
)
{
Context.glUniform3f(uniform.id.SignedValue, v0, v1, v2);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetUniformValue(
[NotNull] Uniform<float, float, float, float> uniform,
float v0,
float v1,
float v2,
float v3
)
{
Context.glUniform4f(uniform.id.SignedValue, v0, v1, v2, v3);
}
}
}
@@ -0,0 +1,685 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glApiManagerConst"
// 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 System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphics.OpenGL
{
public static partial class glManager
{
#region coreVersion
private static bool core10 = false;
private static bool core11 = false;
private static bool core12 = false;
private static bool core13 = false;
private static bool core14 = false;
private static bool core15 = false;
private static bool core20 = false;
private static bool core21 = false;
private static bool core30 = false;
private static bool core31 = false;
private static bool core32 = false;
private static bool core33 = false;
private static bool core40 = false;
private static bool core41 = false;
private static bool core42 = false;
private static bool core43 = false;
private static bool core44 = false;
private static bool core45 = false;
private static bool core46 = false;
#endregion
#region extension
private static bool _3DFX_tbuffer;
private static bool _3DFX_texture_compression_FXT1;
private static bool _4DFX_multisample;
private static bool AMD_blend_minmax_factor;
private static bool AMD_conservative_depth;
private static bool AMD_debug_output;
private static bool AMD_depth_clamp_separate;
private static bool AMD_draw_buffers_blend;
private static bool AMD_framebuffer_multisample_advanced;
private static bool AMD_framebuffer_sample_positions;
private static bool AMD_gcn_shader;
private static bool AMD_gpu_shader_half_float;
private static bool AMD_gpu_shader_int16;
private static bool AMD_gpu_shader_int64;
private static bool AMD_interleaved_elements;
private static bool AMD_multi_draw_indirect;
private static bool AMD_name_gen_delete;
private static bool AMD_occlusion_query_event;
private static bool AMD_performance_monitor;
private static bool AMD_pinned_memory;
private static bool AMD_query_buffer_object;
private static bool AMD_sample_positions;
private static bool AMD_seamless_cubemap_per_texture;
private static bool AMD_shader_atomic_counter_ops;
private static bool AMD_shader_ballot;
private static bool AMD_shader_explicit_vertex_parameter;
private static bool AMD_shader_gpu_shader_half_float_fetch;
private static bool AMD_shader_image_load_store_lod;
private static bool AMD_shader_stencil_export;
private static bool AMD_shader_trinary_minmax;
private static bool AMD_sparse_texture;
private static bool AMD_stencil_operation_extended;
private static bool AMD_texture_gather_bias_lod;
private static bool AMD_texture_texture4;
private static bool AMD_transform_feedback3_lines_triangles;
private static bool AMD_transform_feedback4;
private static bool AMD_vertex_shader_layer;
private static bool AMD_vertex_shader_tessellator;
private static bool AMD_vertex_shader_viewport_index;
private static bool APPLE_aux_depth_stencil;
private static bool APPLE_client_storage;
private static bool APPLE_element_array;
private static bool APPLE_fence;
private static bool APPLE_float_pixels;
private static bool APPLE_flush_buffer_range;
private static bool APPLE_object_purgeable;
private static bool APPLE_rgb_422;
private static bool APPLE_row_bytes;
private static bool APPLE_specular_vector;
private static bool APPLE_texture_range;
private static bool APPLE_transform_hint;
private static bool APPLE_vertex_array_object;
private static bool APPLE_vertex_array_range;
private static bool APPLE_vertex_program_evaluators;
private static bool APPLE_ycbcr_422;
private static bool ARB_arrays_of_arrays;
private static bool ARB_base_instance;
private static bool ARB_bindless_texture;
private static bool ARB_blend_func_extended;
private static bool ARB_buffer_storage;
private static bool ARB_cl_event;
private static bool ARB_clear_buffer_object;
private static bool ARB_clear_texture;
private static bool ARB_clip_control;
private static bool ARB_color_buffer_float;
private static bool ARB_compatibility;
private static bool ARB_compressed_texture_pixel_storage;
private static bool ARB_compute_shader;
private static bool ARB_compute_variable_group_size;
private static bool ARB_conditional_render_inverted;
private static bool ARB_conservative_depth;
private static bool ARB_copy_buffer;
private static bool ARB_copy_image;
private static bool ARB_cull_distance;
private static bool ARB_debug_output;
private static bool ARB_depth_buffer_float;
private static bool ARB_depth_clamp;
private static bool ARB_depth_texture;
private static bool ARB_derivative_control;
private static bool ARB_direct_state_access;
private static bool ARB_draw_buffers;
private static bool ARB_draw_buffers_blend;
private static bool ARB_draw_elements_base_vertex;
private static bool ARB_draw_indirect;
private static bool ARB_draw_instanced;
private static bool ARB_enhanced_layouts;
private static bool ARB_ES2_compatibility;
private static bool ARB_ES3_1_compatibility;
private static bool ARB_ES3_2_compatibility;
private static bool ARB_ES3_compatibility;
private static bool ARB_explicit_attrib_location;
private static bool ARB_explicit_uniform_location;
private static bool ARB_fragment_coord_conventions;
private static bool ARB_fragment_layer_viewport;
private static bool ARB_fragment_program;
private static bool ARB_fragment_program_shadow;
private static bool ARB_fragment_shader;
private static bool ARB_fragment_shader_interlock;
private static bool ARB_framebuffer_no_attachments;
private static bool ARB_framebuffer_object;
private static bool ARB_framebuffer_sRGB;
private static bool ARB_geometry_shader4;
private static bool ARB_get_program_binary;
private static bool ARB_get_texture_sub_image;
private static bool ARB_gl_spirv;
private static bool ARB_gpu_shader_fp64;
private static bool ARB_gpu_shader_int64;
private static bool ARB_gpu_shader5;
private static bool ARB_half_float_pixel;
private static bool ARB_half_float_vertex;
private static bool ARB_imaging;
private static bool ARB_indirect_parameters;
private static bool ARB_instanced_arrays;
private static bool ARB_internalformat_query;
private static bool ARB_internalformat_query2;
private static bool ARB_invalidate_subdata;
private static bool ARB_map_buffer_alignment;
private static bool ARB_map_buffer_range;
private static bool ARB_matrix_palette;
private static bool ARB_multi_bind;
private static bool ARB_multi_draw_indirect;
private static bool ARB_multisample;
private static bool ARB_multitexture;
private static bool ARB_occlusion_query;
private static bool ARB_occlusion_query2;
private static bool ARB_parallel_shader_compile;
private static bool ARB_pipeline_statistics_query;
private static bool ARB_pixel_buffer_object;
private static bool ARB_point_parameters;
private static bool ARB_point_sprite;
private static bool ARB_polygon_offset_clamp;
private static bool ARB_post_depth_coverage;
private static bool ARB_program_interface_query;
private static bool ARB_provoking_vertex;
private static bool ARB_query_buffer_object;
private static bool ARB_robust_buffer_access_behavior;
private static bool ARB_robustness;
private static bool ARB_robustness_isolation;
private static bool ARB_sample_locations;
private static bool ARB_sample_shading;
private static bool ARB_sampler_objects;
private static bool ARB_seamless_cube_map;
private static bool ARB_seamless_cubemap_per_texture;
private static bool ARB_separate_shader_objects;
private static bool ARB_shader_atomic_counter_ops;
private static bool ARB_shader_atomic_counters;
private static bool ARB_shader_ballot;
private static bool ARB_shader_bit_encoding;
private static bool ARB_shader_clock;
private static bool ARB_shader_draw_parameters;
private static bool ARB_shader_group_vote;
private static bool ARB_shader_image_load_store;
private static bool ARB_shader_image_size;
private static bool ARB_shader_objects;
private static bool ARB_shader_precision;
private static bool ARB_shader_stencil_export;
private static bool ARB_shader_storage_buffer_object;
private static bool ARB_shader_subroutine;
private static bool ARB_shader_texture_image_samples;
private static bool ARB_shader_texture_lod;
private static bool ARB_shader_viewport_layer_array;
private static bool ARB_shading_language_100;
private static bool ARB_shading_language_420pack;
private static bool ARB_shading_language_include;
private static bool ARB_shading_language_packing;
private static bool ARB_shadow;
private static bool ARB_shadow_ambient;
private static bool ARB_sparse_buffer;
private static bool ARB_sparse_texture;
private static bool ARB_sparse_texture_clamp;
private static bool ARB_sparse_texture2;
private static bool ARB_spirv_extensions;
private static bool ARB_stencil_texturing;
private static bool ARB_sync;
private static bool ARB_tessellation_shader;
private static bool ARB_texture_barrier;
private static bool ARB_texture_border_clamp;
private static bool ARB_texture_buffer_object;
private static bool ARB_texture_buffer_object_rgb32;
private static bool ARB_texture_buffer_range;
private static bool ARB_texture_compression;
private static bool ARB_texture_compression_bptc;
private static bool ARB_texture_compression_rgtc;
private static bool ARB_texture_cube_map;
private static bool ARB_texture_cube_map_array;
private static bool ARB_texture_env_add;
private static bool ARB_texture_env_combine;
private static bool ARB_texture_env_crossbar;
private static bool ARB_texture_env_dot3;
private static bool ARB_texture_filter_anisotropic;
private static bool ARB_texture_filter_minmax;
private static bool ARB_texture_float;
private static bool ARB_texture_gather;
private static bool ARB_texture_mirror_clamp_to_edge;
private static bool ARB_texture_mirrored_repeat;
private static bool ARB_texture_multisample;
private static bool ARB_texture_non_power_of_two;
private static bool ARB_texture_query_levels;
private static bool ARB_texture_query_lod;
private static bool ARB_texture_rectangle;
private static bool ARB_texture_rg;
private static bool ARB_texture_rgb10_a2ui;
private static bool ARB_texture_stencil8;
private static bool ARB_texture_storage;
private static bool ARB_texture_storage_multisample;
private static bool ARB_texture_swizzle;
private static bool ARB_texture_view;
private static bool ARB_timer_query;
private static bool ARB_transform_feedback_instanced;
private static bool ARB_transform_feedback_overflow_query;
private static bool ARB_transform_feedback2;
private static bool ARB_transform_feedback3;
private static bool ARB_transpose_matrix;
private static bool ARB_uniform_buffer_object;
private static bool ARB_vertex_array_bgra;
private static bool ARB_vertex_array_object;
private static bool ARB_vertex_attrib_64bit;
private static bool ARB_vertex_attrib_binding;
private static bool ARB_vertex_blend;
private static bool ARB_vertex_buffer_object;
private static bool ARB_vertex_program;
private static bool ARB_vertex_shader;
private static bool ARB_vertex_type_10f_11f_11f_rev;
private static bool ARB_vertex_type_2_10_10_10_rev;
private static bool ARB_viewport_array;
private static bool ARB_window_pos;
private static bool ATI_draw_buffers;
private static bool ATI_element_array;
private static bool ATI_envmap_bumpmap;
private static bool ATI_fragment_shader;
private static bool ATI_map_object_buffer;
private static bool ATI_meminfo;
private static bool ATI_pixel_format_float;
private static bool ATI_pn_triangles;
private static bool ATI_separate_stencil;
private static bool ATI_text_fragment_shader;
private static bool ATI_texture_env_combine3;
private static bool ATI_texture_float;
private static bool ATI_texture_mirror_once;
private static bool ATI_vertex_array_object;
private static bool ATI_vertex_attrib_array_object;
private static bool ATI_vertex_streams;
private static bool EXT_422_pixels;
private static bool EXT_abgr;
private static bool EXT_bgra;
private static bool EXT_bindable_uniform;
private static bool EXT_blend_color;
private static bool EXT_blend_equation_separate;
private static bool EXT_blend_func_separate;
private static bool EXT_blend_logic_op;
private static bool EXT_blend_minmax;
private static bool EXT_blend_subtract;
private static bool EXT_clip_volume_hint;
private static bool EXT_cmyka;
private static bool EXT_color_subtable;
private static bool EXT_compiled_vertex_array;
private static bool EXT_convolution;
private static bool EXT_coordinate_frame;
private static bool EXT_copy_texture;
private static bool EXT_cull_vertex;
private static bool EXT_debug_label;
private static bool EXT_debug_marker;
private static bool EXT_depth_bounds_test;
private static bool EXT_direct_state_access;
private static bool EXT_draw_buffers2;
private static bool EXT_draw_instanced;
private static bool EXT_draw_range_elements;
private static bool EXT_EGL_image_storage;
private static bool EXT_EGL_sync;
private static bool EXT_external_buffer;
private static bool EXT_fog_coord;
private static bool EXT_framebuffer_blit;
private static bool EXT_framebuffer_blit_layers;
private static bool EXT_framebuffer_multisample;
private static bool EXT_framebuffer_multisample_blit_scaled;
private static bool EXT_framebuffer_object;
private static bool EXT_framebuffer_sRGB;
private static bool EXT_geometry_shader4;
private static bool EXT_gpu_program_parameters;
private static bool EXT_gpu_shader4;
private static bool EXT_histogram;
private static bool EXT_index_array_formats;
private static bool EXT_index_func;
private static bool EXT_index_material;
private static bool EXT_index_texture;
private static bool EXT_light_texture;
private static bool EXT_memory_object;
private static bool EXT_memory_object_fd;
private static bool EXT_memory_object_win32;
private static bool EXT_misc_attribute;
private static bool EXT_multi_draw_arrays;
private static bool EXT_multisample;
private static bool EXT_multiview_tessellation_geometry_shader;
private static bool EXT_multiview_texture_multisample;
private static bool EXT_multiview_timer_query;
private static bool EXT_packed_depth_stencil;
private static bool EXT_packed_float;
private static bool EXT_packed_pixels;
private static bool EXT_paletted_texture;
private static bool EXT_pixel_buffer_object;
private static bool EXT_pixel_transform;
private static bool EXT_pixel_transform_color_table;
private static bool EXT_point_parameters;
private static bool EXT_polygon_offset;
private static bool EXT_polygon_offset_clamp;
private static bool EXT_post_depth_coverage;
private static bool EXT_provoking_vertex;
private static bool EXT_raster_multisample;
private static bool EXT_rescale_normal;
private static bool EXT_secondary_color;
private static bool EXT_semaphore;
private static bool EXT_semaphore_fd;
private static bool EXT_semaphore_win32;
private static bool EXT_separate_shader_objects;
private static bool EXT_separate_specular_color;
private static bool EXT_shader_framebuffer_fetch;
private static bool EXT_shader_framebuffer_fetch_non_coherent;
private static bool EXT_shader_image_load_formatted;
private static bool EXT_shader_image_load_store;
private static bool EXT_shader_integer_mix;
private static bool EXT_shader_samples_identical;
private static bool EXT_shadow_funcs;
private static bool EXT_shared_texture_palette;
private static bool EXT_sparse_texture2;
private static bool EXT_stencil_clear_tag;
private static bool EXT_stencil_two_side;
private static bool EXT_stencil_wrap;
private static bool EXT_subtexture;
private static bool EXT_texture;
private static bool EXT_texture_array;
private static bool EXT_texture_buffer_object;
private static bool EXT_texture_compression_latc;
private static bool EXT_texture_compression_rgtc;
private static bool EXT_texture_compression_s3tc;
private static bool EXT_texture_cube_map;
private static bool EXT_texture_env_add;
private static bool EXT_texture_env_combine;
private static bool EXT_texture_env_dot3;
private static bool EXT_texture_filter_anisotropic;
private static bool EXT_texture_filter_minmax;
private static bool EXT_texture_integer;
private static bool EXT_texture_lod_bias;
private static bool EXT_texture_mirror_clamp;
private static bool EXT_texture_object;
private static bool EXT_texture_perturb_normal;
private static bool EXT_texture_shadow_lod;
private static bool EXT_texture_shared_exponent;
private static bool EXT_texture_snorm;
private static bool EXT_texture_sRGB;
private static bool EXT_texture_sRGB_decode;
private static bool EXT_texture_sRGB_R8;
private static bool EXT_texture_sRGB_RG8;
private static bool EXT_texture_storage;
private static bool EXT_texture_swizzle;
private static bool EXT_texture3D;
private static bool EXT_timer_query;
private static bool EXT_transform_feedback;
private static bool EXT_vertex_array;
private static bool EXT_vertex_array_bgra;
private static bool EXT_vertex_attrib_64bit;
private static bool EXT_vertex_shader;
private static bool EXT_vertex_weighting;
private static bool EXT_win32_keyed_mutex;
private static bool EXT_window_rectangles;
private static bool EXT_x11_sync_object;
private static bool GREMEDY_frame_terminator;
private static bool GREMEDY_string_marker;
private static bool HP_convolution_border_modes;
private static bool HP_image_transform;
private static bool HP_occlusion_test;
private static bool HP_texture_lighting;
private static bool IBM_cull_vertex;
private static bool IBM_multimode_draw_arrays;
private static bool IBM_rasterpos_clip;
private static bool IBM_static_data;
private static bool IBM_texture_mirrored_repeat;
private static bool IBM_vertex_array_lists;
private static bool INGR_blend_func_separate;
private static bool INGR_color_clamp;
private static bool INGR_interlace_read;
private static bool INTEL_blackhole_render;
private static bool INTEL_conservative_rasterization;
private static bool INTEL_fragment_shader_ordering;
private static bool INTEL_framebuffer_CMAA;
private static bool INTEL_map_texture;
private static bool INTEL_parallel_arrays;
private static bool INTEL_performance_query;
private static bool KHR_blend_equation_advanced;
private static bool KHR_blend_equation_advanced_coherent;
private static bool KHR_context_flush_control;
private static bool KHR_debug;
private static bool KHR_no_error;
private static bool KHR_parallel_shader_compile;
private static bool KHR_robust_buffer_access_behavior;
private static bool KHR_robustness;
private static bool KHR_shader_subgroup;
private static bool KHR_texture_compression_astc_hdr;
private static bool KHR_texture_compression_astc_ldr;
private static bool KHR_texture_compression_astc_sliced_3d;
private static bool MESA_framebuffer_flip_x;
private static bool MESA_framebuffer_flip_y;
private static bool MESA_framebuffer_swap_xy;
private static bool MESA_pack_invert;
private static bool MESA_program_binary_formats;
private static bool MESA_resize_buffers;
private static bool MESA_shader_integer_functions;
private static bool MESA_tile_raster_order;
private static bool MESA_window_pos;
private static bool MESA_ycbcr_texture;
private static bool MESAX_texture_stack;
private static bool NV_alpha_to_coverage_dither_control;
private static bool NV_bindless_multi_draw_indirect;
private static bool NV_bindless_multi_draw_indirect_count;
private static bool NV_bindless_texture;
private static bool NV_blend_equation_advanced;
private static bool NV_blend_equation_advanced_coherent;
private static bool NV_blend_minmax_factor;
private static bool NV_blend_square;
private static bool NV_clip_space_w_scaling;
private static bool NV_command_list;
private static bool NV_compute_program5;
private static bool NV_compute_shader_derivatives;
private static bool NV_conditional_render;
private static bool NV_conservative_raster;
private static bool NV_conservative_raster_dilate;
private static bool NV_conservative_raster_pre_snap;
private static bool NV_conservative_raster_pre_snap_triangles;
private static bool NV_conservative_raster_underestimation;
private static bool NV_copy_depth_to_color;
private static bool NV_copy_image;
private static bool NV_deep_texture3D;
private static bool NV_depth_buffer_float;
private static bool NV_depth_clamp;
private static bool NV_draw_texture;
private static bool NV_draw_vulkan_image;
private static bool NV_evaluators;
private static bool NV_explicit_multisample;
private static bool NV_fence;
private static bool NV_fill_rectangle;
private static bool NV_float_buffer;
private static bool NV_fog_distance;
private static bool NV_fragment_coverage_to_color;
private static bool NV_fragment_program;
private static bool NV_fragment_program_option;
private static bool NV_fragment_program2;
private static bool NV_fragment_program4;
private static bool NV_fragment_shader_barycentric;
private static bool NV_fragment_shader_interlock;
private static bool NV_framebuffer_mixed_samples;
private static bool NV_framebuffer_multisample_coverage;
private static bool NV_geometry_program4;
private static bool NV_geometry_shader_passthrough;
private static bool NV_geometry_shader4;
private static bool NV_gpu_multicast;
private static bool NV_gpu_program4;
private static bool NV_gpu_program5;
private static bool NV_gpu_program5_mem_extended;
private static bool NV_gpu_shader5;
private static bool NV_half_float;
private static bool NV_internalformat_sample_query;
private static bool NV_light_max_exponent;
private static bool NV_memory_attachment;
private static bool NV_memory_object_sparse;
private static bool NV_mesh_shader;
private static bool NV_multisample_coverage;
private static bool NV_multisample_filter_hint;
private static bool NV_occlusion_query;
private static bool NV_packed_depth_stencil;
private static bool NV_parameter_buffer_object;
private static bool NV_parameter_buffer_object2;
private static bool NV_path_rendering;
private static bool NV_path_rendering_shared_edge;
private static bool NV_pixel_data_range;
private static bool NV_point_sprite;
private static bool NV_present_video;
private static bool NV_primitive_restart;
private static bool NV_primitive_shading_rate;
private static bool NV_query_resource;
private static bool NV_query_resource_tag;
private static bool NV_register_combiners;
private static bool NV_register_combiners2;
private static bool NV_representative_fragment_test;
private static bool NV_robustness_video_memory_purge;
private static bool NV_sample_locations;
private static bool NV_sample_mask_override_coverage;
private static bool NV_scissor_exclusive;
private static bool NV_shader_atomic_counters;
private static bool NV_shader_atomic_float;
private static bool NV_shader_atomic_float64;
private static bool NV_shader_atomic_fp16_vector;
private static bool NV_shader_atomic_int64;
private static bool NV_shader_buffer_load;
private static bool NV_shader_buffer_store;
private static bool NV_shader_storage_buffer_object;
private static bool NV_shader_subgroup_partitioned;
private static bool NV_shader_texture_footprint;
private static bool NV_shader_thread_group;
private static bool NV_shader_thread_shuffle;
private static bool NV_shading_rate_image;
private static bool NV_stereo_view_rendering;
private static bool NV_tessellation_program5;
private static bool NV_texgen_emboss;
private static bool NV_texgen_reflection;
private static bool NV_texture_barrier;
private static bool NV_texture_compression_vtc;
private static bool NV_texture_env_combine4;
private static bool NV_texture_expand_normal;
private static bool NV_texture_multisample;
private static bool NV_texture_rectangle;
private static bool NV_texture_rectangle_compressed;
private static bool NV_texture_shader;
private static bool NV_texture_shader2;
private static bool NV_texture_shader3;
private static bool NV_timeline_semaphore;
private static bool NV_transform_feedback;
private static bool NV_transform_feedback2;
private static bool NV_uniform_buffer_std430_layout;
private static bool NV_uniform_buffer_unified_memory;
private static bool NV_vdpau_interop;
private static bool NV_vdpau_interop2;
private static bool NV_vertex_array_range;
private static bool NV_vertex_array_range2;
private static bool NV_vertex_attrib_integer_64bit;
private static bool NV_vertex_buffer_unified_memory;
private static bool NV_vertex_program;
private static bool NV_vertex_program1_1;
private static bool NV_vertex_program2;
private static bool NV_vertex_program2_option;
private static bool NV_vertex_program3;
private static bool NV_vertex_program4;
private static bool NV_video_capture;
private static bool NV_viewport_array2;
private static bool NV_viewport_swizzle;
private static bool NVX_blend_equation_advanced_multi_draw_buffers;
private static bool NVX_conditional_render;
private static bool NVX_gpu_memory_info;
private static bool NVX_gpu_multicast2;
private static bool NVX_linked_gpu_multicast;
private static bool NVX_progress_fence;
private static bool OES_byte_coordinates;
private static bool OES_compressed_paletted_texture;
private static bool OES_fixed_point;
private static bool OES_query_matrix;
private static bool OES_read_format;
private static bool OES_single_precision;
private static bool OML_interlace;
private static bool OML_resample;
private static bool OML_subsample;
private static bool OVR_multiview;
private static bool OVR_multiview2;
private static bool PGI_misc_hints;
private static bool PGI_vertex_hints;
private static bool REND_screen_coordinates;
private static bool S3_s3tc;
private static bool SGI_color_matrix;
private static bool SGI_color_table;
private static bool SGI_texture_color_table;
private static bool SGIS_detail_texture;
private static bool SGIS_fog_function;
private static bool SGIS_generate_mipmap;
private static bool SGIS_multisample;
private static bool SGIS_pixel_texture;
private static bool SGIS_point_line_texgen;
private static bool SGIS_point_parameters;
private static bool SGIS_sharpen_texture;
private static bool SGIS_texture_border_clamp;
private static bool SGIS_texture_color_mask;
private static bool SGIS_texture_edge_clamp;
private static bool SGIS_texture_filter4;
private static bool SGIS_texture_lod;
private static bool SGIS_texture_select;
private static bool SGIS_texture4D;
private static bool SGIX_async;
private static bool SGIX_async_histogram;
private static bool SGIX_async_pixel;
private static bool SGIX_blend_alpha_minmax;
private static bool SGIX_calligraphic_fragment;
private static bool SGIX_clipmap;
private static bool SGIX_convolution_accuracy;
private static bool SGIX_depth_pass_instrument;
private static bool SGIX_depth_texture;
private static bool SGIX_flush_raster;
private static bool SGIX_fog_offset;
private static bool SGIX_fragment_lighting;
private static bool SGIX_framezoom;
private static bool SGIX_igloo_interface;
private static bool SGIX_instruments;
private static bool SGIX_interlace;
private static bool SGIX_ir_instrument1;
private static bool SGIX_list_priority;
private static bool SGIX_pixel_texture;
private static bool SGIX_pixel_tiles;
private static bool SGIX_polynomial_ffd;
private static bool SGIX_reference_plane;
private static bool SGIX_resample;
private static bool SGIX_scalebias_hint;
private static bool SGIX_shadow;
private static bool SGIX_shadow_ambient;
private static bool SGIX_sprite;
private static bool SGIX_subsample;
private static bool SGIX_tag_sample_buffer;
private static bool SGIX_texture_add_env;
private static bool SGIX_texture_coordinate_clamp;
private static bool SGIX_texture_lod_bias;
private static bool SGIX_texture_multi_buffer;
private static bool SGIX_texture_scale_bias;
private static bool SGIX_vertex_preclip;
private static bool SGIX_ycrcb;
private static bool SGIX_ycrcb_subsample;
private static bool SGIX_ycrcba;
private static bool SUN_convolution_border_modes;
private static bool SUN_global_alpha;
private static bool SUN_mesh_array;
private static bool SUN_slice_accum;
private static bool SUN_triangle_list;
private static bool SUN_vertex;
private static bool SUNX_constant_data;
private static bool WIN_phong_shading;
private static bool WIN_specular_fog;
#endregion
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+695
View File
@@ -0,0 +1,695 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glContext"
// 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 System;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial struct OpenglContext
{
internal unsafe delegate*<uint, uint, void> glActiveShaderProgram;
internal unsafe delegate*<uint, void> glActiveTexture;
internal unsafe delegate*<uint, uint, void> glAttachShader;
internal unsafe delegate*<uint, uint, void> glBeginConditionalRender;
internal unsafe delegate*<uint, uint, void> glBeginQuery;
internal unsafe delegate*<uint, uint, uint, void> glBeginQueryIndexed;
internal unsafe delegate*<uint, void> glBeginTransformFeedback;
internal unsafe delegate*<uint, uint, byte*, void> glBindAttribLocation;
internal unsafe delegate*<uint, uint, void> glBindBuffer;
internal unsafe delegate*<uint, uint, uint, void> glBindBufferBase;
internal unsafe delegate*<uint, uint, uint, nint, nuint, void> glBindBufferRange;
internal unsafe delegate*<uint, uint, int, uint*, void> glBindBuffersBase;
internal unsafe delegate*<uint, uint, int, uint*, nint*, nuint*, void> glBindBuffersRange;
internal unsafe delegate*<uint, uint, byte*, void> glBindFragDataLocation;
internal unsafe delegate*<uint, uint, uint, byte*, void> glBindFragDataLocationIndexed;
internal unsafe delegate*<uint, uint, void> glBindFramebuffer;
internal unsafe delegate*<uint, uint, int, byte, int, uint, uint, void> glBindImageTexture;
internal unsafe delegate*<uint, int, uint*, void> glBindImageTextures;
internal unsafe delegate*<uint, void> glBindProgramPipeline;
internal unsafe delegate*<uint, uint, void> glBindRenderbuffer;
internal unsafe delegate*<uint, uint, void> glBindSampler;
internal unsafe delegate*<uint, int, uint*, void> glBindSamplers;
internal unsafe delegate*<uint, uint, void> glBindTexture;
internal unsafe delegate*<uint, int, uint*, void> glBindTextures;
internal unsafe delegate*<uint, uint, void> glBindTextureUnit;
internal unsafe delegate*<uint, uint, void> glBindTransformFeedback;
internal unsafe delegate*<uint, void> glBindVertexArray;
internal unsafe delegate*<uint, uint, nint, int, void> glBindVertexBuffer;
internal unsafe delegate*<uint, int, uint*, nint*, int*, void> glBindVertexBuffers;
internal unsafe delegate*<float, float, float, float, void> glBlendColor;
internal unsafe delegate*<uint, void> glBlendEquation;
internal unsafe delegate*<uint, uint, void> glBlendEquationi;
internal unsafe delegate*<uint, uint, void> glBlendEquationSeparate;
internal unsafe delegate*<uint, uint, uint, void> glBlendEquationSeparatei;
internal unsafe delegate*<uint, uint, void> glBlendFunc;
internal unsafe delegate*<uint, uint, uint, void> glBlendFunci;
internal unsafe delegate*<uint, uint, uint, uint, void> glBlendFuncSeparate;
internal unsafe delegate*<uint, uint, uint, uint, uint, void> glBlendFuncSeparatei;
internal unsafe delegate*<int, int, int, int, int, int, int, int, uint, uint, void> glBlitFramebuffer;
internal unsafe delegate*<uint, uint, int, int, int, int, int, int, int, int, uint, uint, void> glBlitNamedFramebuffer;
internal unsafe delegate*<uint, nuint, IntPtr*, uint, void> glBufferData;
internal unsafe delegate*<uint, nuint, IntPtr*, uint, void> glBufferStorage;
internal unsafe delegate*<uint, nint, nuint, IntPtr*, void> glBufferSubData;
internal unsafe delegate*<uint, uint> glCheckFramebufferStatus;
internal unsafe delegate*<uint, uint, uint> glCheckNamedFramebufferStatus;
internal unsafe delegate*<uint, uint, void> glClampColor;
internal unsafe delegate*<uint, void> glClear;
internal unsafe delegate*<uint, uint, uint, uint, IntPtr*, void> glClearBufferData;
internal unsafe delegate*<uint, int, float, int, void> glClearBufferfi;
internal unsafe delegate*<uint, int, float*, void> glClearBufferfv;
internal unsafe delegate*<uint, int, int*, void> glClearBufferiv;
internal unsafe delegate*<uint, uint, nint, nuint, uint, uint, IntPtr*, void> glClearBufferSubData;
internal unsafe delegate*<uint, int, uint*, void> glClearBufferuiv;
internal unsafe delegate*<float, float, float, float, void> glClearColor;
internal unsafe delegate*<double, void> glClearDepth;
internal unsafe delegate*<float, void> glClearDepthf;
internal unsafe delegate*<uint, uint, uint, uint, IntPtr*, void> glClearNamedBufferData;
internal unsafe delegate*<uint, uint, nint, nuint, uint, uint, IntPtr*, void> glClearNamedBufferSubData;
internal unsafe delegate*<uint, uint, int, float, int, void> glClearNamedFramebufferfi;
internal unsafe delegate*<uint, uint, int, float*, void> glClearNamedFramebufferfv;
internal unsafe delegate*<uint, uint, int, int*, void> glClearNamedFramebufferiv;
internal unsafe delegate*<uint, uint, int, uint*, void> glClearNamedFramebufferuiv;
internal unsafe delegate*<int, void> glClearStencil;
internal unsafe delegate*<uint, int, uint, uint, IntPtr*, void> glClearTexImage;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, uint, uint, IntPtr*, void> glClearTexSubImage;
internal unsafe delegate*<glSync, uint, IntPtr, uint> glClientWaitSync;
internal unsafe delegate*<uint, uint, void> glClipControl;
internal unsafe delegate*<byte, byte, byte, byte, void> glColorMask;
internal unsafe delegate*<uint, byte, byte, byte, byte, void> glColorMaski;
internal unsafe delegate*<uint, void> glCompileShader;
internal unsafe delegate*<uint, int, uint, int, int, int, IntPtr*, void> glCompressedTexImage1D;
internal unsafe delegate*<uint, int, uint, int, int, int, int, IntPtr*, void> glCompressedTexImage2D;
internal unsafe delegate*<uint, int, uint, int, int, int, int, int, IntPtr*, void> glCompressedTexImage3D;
internal unsafe delegate*<uint, int, int, int, uint, int, IntPtr*, void> glCompressedTexSubImage1D;
internal unsafe delegate*<uint, int, int, int, int, int, uint, int, IntPtr*, void> glCompressedTexSubImage2D;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, uint, int, IntPtr*, void> glCompressedTexSubImage3D;
internal unsafe delegate*<uint, int, int, int, uint, int, IntPtr*, void> glCompressedTextureSubImage1D;
internal unsafe delegate*<uint, int, int, int, int, int, uint, int, IntPtr*, void> glCompressedTextureSubImage2D;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, uint, int, IntPtr*, void> glCompressedTextureSubImage3D;
internal unsafe delegate*<uint, uint, nint, nint, nuint, void> glCopyBufferSubData;
internal unsafe delegate*<uint, uint, int, int, int, int, uint, uint, int, int, int, int, int, int, int, void> glCopyImageSubData;
internal unsafe delegate*<uint, uint, nint, nint, nuint, void> glCopyNamedBufferSubData;
internal unsafe delegate*<uint, int, uint, int, int, int, int, void> glCopyTexImage1D;
internal unsafe delegate*<uint, int, uint, int, int, int, int, int, void> glCopyTexImage2D;
internal unsafe delegate*<uint, int, int, int, int, int, void> glCopyTexSubImage1D;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, void> glCopyTexSubImage2D;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, int, void> glCopyTexSubImage3D;
internal unsafe delegate*<uint, int, int, int, int, int, void> glCopyTextureSubImage1D;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, void> glCopyTextureSubImage2D;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, int, void> glCopyTextureSubImage3D;
internal unsafe delegate*<int, uint*, void> glCreateBuffers;
internal unsafe delegate*<int, uint*, void> glCreateFramebuffers;
internal unsafe delegate*<uint> glCreateProgram;
internal unsafe delegate*<int, uint*, void> glCreateProgramPipelines;
internal unsafe delegate*<uint, int, uint*, void> glCreateQueries;
internal unsafe delegate*<int, uint*, void> glCreateRenderbuffers;
internal unsafe delegate*<int, uint*, void> glCreateSamplers;
internal unsafe delegate*<uint, uint> glCreateShader;
internal unsafe delegate*<uint, int, byte*, uint> glCreateShaderProgramv;
internal unsafe delegate*<uint, int, uint*, void> glCreateTextures;
internal unsafe delegate*<int, uint*, void> glCreateTransformFeedbacks;
internal unsafe delegate*<int, uint*, void> glCreateVertexArrays;
internal unsafe delegate*<uint, void> glCullFace;
internal unsafe delegate*<IntPtr, IntPtr*, void> glDebugMessageCallback;
internal unsafe delegate*<uint, uint, uint, int, uint*, byte, void> glDebugMessageControl;
internal unsafe delegate*<uint, uint, uint, uint, int, byte*, void> glDebugMessageInsert;
internal unsafe delegate*<int, uint*, void> glDeleteBuffers;
internal unsafe delegate*<int, uint*, void> glDeleteFramebuffers;
internal unsafe delegate*<uint, void> glDeleteProgram;
internal unsafe delegate*<int, uint*, void> glDeleteProgramPipelines;
internal unsafe delegate*<int, uint*, void> glDeleteQueries;
internal unsafe delegate*<int, uint*, void> glDeleteRenderbuffers;
internal unsafe delegate*<int, uint*, void> glDeleteSamplers;
internal unsafe delegate*<uint, void> glDeleteShader;
internal unsafe delegate*<glSync, void> glDeleteSync;
internal unsafe delegate*<int, uint*, void> glDeleteTextures;
internal unsafe delegate*<int, uint*, void> glDeleteTransformFeedbacks;
internal unsafe delegate*<int, uint*, void> glDeleteVertexArrays;
internal unsafe delegate*<uint, void> glDepthFunc;
internal unsafe delegate*<byte, void> glDepthMask;
internal unsafe delegate*<double, double, void> glDepthRange;
internal unsafe delegate*<uint, int, double*, void> glDepthRangeArrayv;
internal unsafe delegate*<float, float, void> glDepthRangef;
internal unsafe delegate*<uint, double, double, void> glDepthRangeIndexed;
internal unsafe delegate*<uint, uint, void> glDetachShader;
internal unsafe delegate*<uint, void> glDisable;
internal unsafe delegate*<uint, uint, void> glDisablei;
internal unsafe delegate*<uint, uint, void> glDisableVertexArrayAttrib;
internal unsafe delegate*<uint, void> glDisableVertexAttribArray;
internal unsafe delegate*<uint, uint, uint, void> glDispatchCompute;
internal unsafe delegate*<nint, void> glDispatchComputeIndirect;
internal unsafe delegate*<uint, int, int, void> glDrawArrays;
internal unsafe delegate*<uint, IntPtr*, void> glDrawArraysIndirect;
internal unsafe delegate*<uint, int, int, int, void> glDrawArraysInstanced;
internal unsafe delegate*<uint, int, int, int, uint, void> glDrawArraysInstancedBaseInstance;
internal unsafe delegate*<uint, void> glDrawBuffer;
internal unsafe delegate*<int, uint*, void> glDrawBuffers;
internal unsafe delegate*<uint, int, uint, IntPtr*, void> glDrawElements;
internal unsafe delegate*<uint, int, uint, IntPtr*, int, void> glDrawElementsBaseVertex;
internal unsafe delegate*<uint, uint, IntPtr*, void> glDrawElementsIndirect;
internal unsafe delegate*<uint, int, uint, IntPtr*, int, void> glDrawElementsInstanced;
internal unsafe delegate*<uint, int, uint, IntPtr*, int, uint, void> glDrawElementsInstancedBaseInstance;
internal unsafe delegate*<uint, int, uint, IntPtr*, int, int, void> glDrawElementsInstancedBaseVertex;
internal unsafe delegate*<uint, int, uint, IntPtr*, int, int, uint, void> glDrawElementsInstancedBaseVertexBaseInstance;
internal unsafe delegate*<uint, uint, uint, int, uint, IntPtr*, void> glDrawRangeElements;
internal unsafe delegate*<uint, uint, uint, int, uint, IntPtr*, int, void> glDrawRangeElementsBaseVertex;
internal unsafe delegate*<uint, uint, void> glDrawTransformFeedback;
internal unsafe delegate*<uint, uint, int, void> glDrawTransformFeedbackInstanced;
internal unsafe delegate*<uint, uint, uint, void> glDrawTransformFeedbackStream;
internal unsafe delegate*<uint, uint, uint, int, void> glDrawTransformFeedbackStreamInstanced;
internal unsafe delegate*<uint, void> glEnable;
internal unsafe delegate*<uint, uint, void> glEnablei;
internal unsafe delegate*<uint, uint, void> glEnableVertexArrayAttrib;
internal unsafe delegate*<uint, void> glEnableVertexAttribArray;
internal unsafe delegate*<void> glEndConditionalRender;
internal unsafe delegate*<uint, void> glEndQuery;
internal unsafe delegate*<uint, uint, void> glEndQueryIndexed;
internal unsafe delegate*<void> glEndTransformFeedback;
internal unsafe delegate*<uint, uint, glSync> glFenceSync;
internal unsafe delegate*<void> glFinish;
internal unsafe delegate*<void> glFlush;
internal unsafe delegate*<uint, nint, nuint, void> glFlushMappedBufferRange;
internal unsafe delegate*<uint, nint, nuint, void> glFlushMappedNamedBufferRange;
internal unsafe delegate*<uint, uint, int, void> glFramebufferParameteri;
internal unsafe delegate*<uint, uint, uint, uint, void> glFramebufferRenderbuffer;
internal unsafe delegate*<uint, uint, uint, int, void> glFramebufferTexture;
internal unsafe delegate*<uint, uint, uint, uint, int, void> glFramebufferTexture1D;
internal unsafe delegate*<uint, uint, uint, uint, int, void> glFramebufferTexture2D;
internal unsafe delegate*<uint, uint, uint, uint, int, int, void> glFramebufferTexture3D;
internal unsafe delegate*<uint, uint, uint, int, int, void> glFramebufferTextureLayer;
internal unsafe delegate*<uint, void> glFrontFace;
internal unsafe delegate*<int, uint*, void> glGenBuffers;
internal unsafe delegate*<uint, void> glGenerateMipmap;
internal unsafe delegate*<uint, void> glGenerateTextureMipmap;
internal unsafe delegate*<int, uint*, void> glGenFramebuffers;
internal unsafe delegate*<int, uint*, void> glGenProgramPipelines;
internal unsafe delegate*<int, uint*, void> glGenQueries;
internal unsafe delegate*<int, uint*, void> glGenRenderbuffers;
internal unsafe delegate*<int, uint*, void> glGenSamplers;
internal unsafe delegate*<int, uint*, void> glGenTextures;
internal unsafe delegate*<int, uint*, void> glGenTransformFeedbacks;
internal unsafe delegate*<int, uint*, void> glGenVertexArrays;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetActiveAtomicCounterBufferiv;
internal unsafe delegate*<uint, uint, int, int*, int*, uint*, byte*, void> glGetActiveAttrib;
internal unsafe delegate*<uint, uint, uint, int, int*, byte*, void> glGetActiveSubroutineName;
internal unsafe delegate*<uint, uint, uint, uint, int*, void> glGetActiveSubroutineUniformiv;
internal unsafe delegate*<uint, uint, uint, int, int*, byte*, void> glGetActiveSubroutineUniformName;
internal unsafe delegate*<uint, uint, int, int*, int*, uint*, byte*, void> glGetActiveUniform;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetActiveUniformBlockiv;
internal unsafe delegate*<uint, uint, int, int*, byte*, void> glGetActiveUniformBlockName;
internal unsafe delegate*<uint, uint, int, int*, byte*, void> glGetActiveUniformName;
internal unsafe delegate*<uint, int, uint*, uint, int*, void> glGetActiveUniformsiv;
internal unsafe delegate*<uint, int, int*, uint*, void> glGetAttachedShaders;
internal unsafe delegate*<uint, byte*, int> glGetAttribLocation;
internal unsafe delegate*<uint, uint, byte*, void> glGetBooleani_v;
internal unsafe delegate*<uint, byte*, void> glGetBooleanv;
internal unsafe delegate*<uint, uint, IntPtr*, void> glGetBufferParameteri64v;
internal unsafe delegate*<uint, uint, int*, void> glGetBufferParameteriv;
internal unsafe delegate*<uint, uint, IntPtr*, void> glGetBufferPointerv;
internal unsafe delegate*<uint, nint, nuint, IntPtr*, void> glGetBufferSubData;
internal unsafe delegate*<uint, int, IntPtr*, void> glGetCompressedTexImage;
internal unsafe delegate*<uint, int, int, IntPtr*, void> glGetCompressedTextureImage;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, int, IntPtr*, void> glGetCompressedTextureSubImage;
internal unsafe delegate*<uint, int, uint*, uint*, uint*, uint*, int*, byte*, uint> glGetDebugMessageLog;
internal unsafe delegate*<uint, uint, double*, void> glGetDoublei_v;
internal unsafe delegate*<uint, double*, void> glGetDoublev;
internal unsafe delegate*<uint> glGetError;
internal unsafe delegate*<uint, uint, float*, void> glGetFloati_v;
internal unsafe delegate*<uint, float*, void> glGetFloatv;
internal unsafe delegate*<uint, byte*, int> glGetFragDataIndex;
internal unsafe delegate*<uint, byte*, int> glGetFragDataLocation;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetFramebufferAttachmentParameteriv;
internal unsafe delegate*<uint, uint, int*, void> glGetFramebufferParameteriv;
internal unsafe delegate*<uint> glGetGraphicsResetStatus;
internal unsafe delegate*<uint, uint, IntPtr*, void> glGetInteger64i_v;
internal unsafe delegate*<uint, IntPtr*, void> glGetInteger64v;
internal unsafe delegate*<uint, uint, int*, void> glGetIntegeri_v;
internal unsafe delegate*<uint, int*, void> glGetIntegerv;
internal unsafe delegate*<uint, uint, uint, int, IntPtr*, void> glGetInternalformati64v;
internal unsafe delegate*<uint, uint, uint, int, int*, void> glGetInternalformativ;
internal unsafe delegate*<uint, uint, float*, void> glGetMultisamplefv;
internal unsafe delegate*<uint, uint, IntPtr*, void> glGetNamedBufferParameteri64v;
internal unsafe delegate*<uint, uint, int*, void> glGetNamedBufferParameteriv;
internal unsafe delegate*<uint, uint, IntPtr*, void> glGetNamedBufferPointerv;
internal unsafe delegate*<uint, nint, nuint, IntPtr*, void> glGetNamedBufferSubData;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetNamedFramebufferAttachmentParameteriv;
internal unsafe delegate*<uint, uint, int*, void> glGetNamedFramebufferParameteriv;
internal unsafe delegate*<uint, uint, int*, void> glGetNamedRenderbufferParameteriv;
internal unsafe delegate*<uint, int, int, IntPtr*, void> glGetnCompressedTexImage;
internal unsafe delegate*<uint, int, uint, uint, int, IntPtr*, void> glGetnTexImage;
internal unsafe delegate*<uint, int, int, double*, void> glGetnUniformdv;
internal unsafe delegate*<uint, int, int, float*, void> glGetnUniformfv;
internal unsafe delegate*<uint, int, int, int*, void> glGetnUniformiv;
internal unsafe delegate*<uint, int, int, uint*, void> glGetnUniformuiv;
internal unsafe delegate*<uint, uint, int, int*, byte*, void> glGetObjectLabel;
internal unsafe delegate*<IntPtr*, int, int*, byte*, void> glGetObjectPtrLabel;
internal unsafe delegate*<uint, IntPtr*, void> glGetPointerv;
internal unsafe delegate*<uint, int, int*, uint*, IntPtr*, void> glGetProgramBinary;
internal unsafe delegate*<uint, int, int*, byte*, void> glGetProgramInfoLog;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetProgramInterfaceiv;
internal unsafe delegate*<uint, uint, int*, void> glGetProgramiv;
internal unsafe delegate*<uint, int, int*, byte*, void> glGetProgramPipelineInfoLog;
internal unsafe delegate*<uint, uint, int*, void> glGetProgramPipelineiv;
internal unsafe delegate*<uint, uint, byte*, uint> glGetProgramResourceIndex;
internal unsafe delegate*<uint, uint, uint, int, uint*, int, int*, int*, void> glGetProgramResourceiv;
internal unsafe delegate*<uint, uint, byte*, int> glGetProgramResourceLocation;
internal unsafe delegate*<uint, uint, byte*, int> glGetProgramResourceLocationIndex;
internal unsafe delegate*<uint, uint, uint, int, int*, byte*, void> glGetProgramResourceName;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetProgramStageiv;
internal unsafe delegate*<uint, uint, uint, nint, void> glGetQueryBufferObjecti64v;
internal unsafe delegate*<uint, uint, uint, nint, void> glGetQueryBufferObjectiv;
internal unsafe delegate*<uint, uint, uint, nint, void> glGetQueryBufferObjectui64v;
internal unsafe delegate*<uint, uint, uint, nint, void> glGetQueryBufferObjectuiv;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetQueryIndexediv;
internal unsafe delegate*<uint, uint, int*, void> glGetQueryiv;
internal unsafe delegate*<uint, uint, IntPtr*, void> glGetQueryObjecti64v;
internal unsafe delegate*<uint, uint, int*, void> glGetQueryObjectiv;
internal unsafe delegate*<uint, uint, IntPtr*, void> glGetQueryObjectui64v;
internal unsafe delegate*<uint, uint, uint*, void> glGetQueryObjectuiv;
internal unsafe delegate*<uint, uint, int*, void> glGetRenderbufferParameteriv;
internal unsafe delegate*<uint, uint, float*, void> glGetSamplerParameterfv;
internal unsafe delegate*<uint, uint, int*, void> glGetSamplerParameterIiv;
internal unsafe delegate*<uint, uint, uint*, void> glGetSamplerParameterIuiv;
internal unsafe delegate*<uint, uint, int*, void> glGetSamplerParameteriv;
internal unsafe delegate*<uint, int, int*, byte*, void> glGetShaderInfoLog;
internal unsafe delegate*<uint, uint, int*, void> glGetShaderiv;
internal unsafe delegate*<uint, uint, int*, int*, void> glGetShaderPrecisionFormat;
internal unsafe delegate*<uint, int, int*, byte*, void> glGetShaderSource;
internal unsafe delegate*<uint, byte*> glGetString;
internal unsafe delegate*<uint, uint, byte*> glGetStringi;
internal unsafe delegate*<uint, uint, byte*, uint> glGetSubroutineIndex;
internal unsafe delegate*<uint, uint, byte*, int> glGetSubroutineUniformLocation;
internal unsafe delegate*<glSync, uint, int, int*, int*, void> glGetSynciv;
internal unsafe delegate*<uint, int, uint, uint, IntPtr*, void> glGetTexImage;
internal unsafe delegate*<uint, int, uint, float*, void> glGetTexLevelParameterfv;
internal unsafe delegate*<uint, int, uint, int*, void> glGetTexLevelParameteriv;
internal unsafe delegate*<uint, uint, float*, void> glGetTexParameterfv;
internal unsafe delegate*<uint, uint, int*, void> glGetTexParameterIiv;
internal unsafe delegate*<uint, uint, uint*, void> glGetTexParameterIuiv;
internal unsafe delegate*<uint, uint, int*, void> glGetTexParameteriv;
internal unsafe delegate*<uint, int, uint, uint, int, IntPtr*, void> glGetTextureImage;
internal unsafe delegate*<uint, int, uint, float*, void> glGetTextureLevelParameterfv;
internal unsafe delegate*<uint, int, uint, int*, void> glGetTextureLevelParameteriv;
internal unsafe delegate*<uint, uint, float*, void> glGetTextureParameterfv;
internal unsafe delegate*<uint, uint, int*, void> glGetTextureParameterIiv;
internal unsafe delegate*<uint, uint, uint*, void> glGetTextureParameterIuiv;
internal unsafe delegate*<uint, uint, int*, void> glGetTextureParameteriv;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, uint, uint, int, IntPtr*, void> glGetTextureSubImage;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetTransformFeedbacki_v;
internal unsafe delegate*<uint, uint, uint, IntPtr*, void> glGetTransformFeedbacki64_v;
internal unsafe delegate*<uint, uint, int*, void> glGetTransformFeedbackiv;
internal unsafe delegate*<uint, uint, int, int*, int*, uint*, byte*, void> glGetTransformFeedbackVarying;
internal unsafe delegate*<uint, byte*, uint> glGetUniformBlockIndex;
internal unsafe delegate*<uint, int, double*, void> glGetUniformdv;
internal unsafe delegate*<uint, int, float*, void> glGetUniformfv;
internal unsafe delegate*<uint, int, byte*, uint*, void> glGetUniformIndices;
internal unsafe delegate*<uint, int, int*, void> glGetUniformiv;
internal unsafe delegate*<uint, byte*, int> glGetUniformLocation;
internal unsafe delegate*<uint, int, uint*, void> glGetUniformSubroutineuiv;
internal unsafe delegate*<uint, int, uint*, void> glGetUniformuiv;
internal unsafe delegate*<uint, uint, uint, IntPtr*, void> glGetVertexArrayIndexed64iv;
internal unsafe delegate*<uint, uint, uint, int*, void> glGetVertexArrayIndexediv;
internal unsafe delegate*<uint, uint, int*, void> glGetVertexArrayiv;
internal unsafe delegate*<uint, uint, double*, void> glGetVertexAttribdv;
internal unsafe delegate*<uint, uint, float*, void> glGetVertexAttribfv;
internal unsafe delegate*<uint, uint, int*, void> glGetVertexAttribIiv;
internal unsafe delegate*<uint, uint, uint*, void> glGetVertexAttribIuiv;
internal unsafe delegate*<uint, uint, int*, void> glGetVertexAttribiv;
internal unsafe delegate*<uint, uint, double*, void> glGetVertexAttribLdv;
internal unsafe delegate*<uint, uint, IntPtr*, void> glGetVertexAttribPointerv;
internal unsafe delegate*<uint, uint, void> glHint;
internal unsafe delegate*<uint, void> glInvalidateBufferData;
internal unsafe delegate*<uint, nint, nuint, void> glInvalidateBufferSubData;
internal unsafe delegate*<uint, int, uint*, void> glInvalidateFramebuffer;
internal unsafe delegate*<uint, int, uint*, void> glInvalidateNamedFramebufferData;
internal unsafe delegate*<uint, int, uint*, int, int, int, int, void> glInvalidateNamedFramebufferSubData;
internal unsafe delegate*<uint, int, uint*, int, int, int, int, void> glInvalidateSubFramebuffer;
internal unsafe delegate*<uint, int, void> glInvalidateTexImage;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, void> glInvalidateTexSubImage;
internal unsafe delegate*<uint, byte> glIsBuffer;
internal unsafe delegate*<uint, byte> glIsEnabled;
internal unsafe delegate*<uint, uint, byte> glIsEnabledi;
internal unsafe delegate*<uint, byte> glIsFramebuffer;
internal unsafe delegate*<uint, byte> glIsProgram;
internal unsafe delegate*<uint, byte> glIsProgramPipeline;
internal unsafe delegate*<uint, byte> glIsQuery;
internal unsafe delegate*<uint, byte> glIsRenderbuffer;
internal unsafe delegate*<uint, byte> glIsSampler;
internal unsafe delegate*<uint, byte> glIsShader;
internal unsafe delegate*<glSync, byte> glIsSync;
internal unsafe delegate*<uint, byte> glIsTexture;
internal unsafe delegate*<uint, byte> glIsTransformFeedback;
internal unsafe delegate*<uint, byte> glIsVertexArray;
internal unsafe delegate*<float, void> glLineWidth;
internal unsafe delegate*<uint, void> glLinkProgram;
internal unsafe delegate*<uint, void> glLogicOp;
internal unsafe delegate*<uint, uint, void*> glMapBuffer;
internal unsafe delegate*<uint, nint, nuint, uint, void*> glMapBufferRange;
internal unsafe delegate*<uint, uint, void*> glMapNamedBuffer;
internal unsafe delegate*<uint, nint, nuint, uint, void*> glMapNamedBufferRange;
internal unsafe delegate*<uint, void> glMemoryBarrier;
internal unsafe delegate*<uint, void> glMemoryBarrierByRegion;
internal unsafe delegate*<float, void> glMinSampleShading;
internal unsafe delegate*<uint, int*, int*, int, void> glMultiDrawArrays;
internal unsafe delegate*<uint, IntPtr*, int, int, void> glMultiDrawArraysIndirect;
internal unsafe delegate*<uint, IntPtr*, nint, int, int, void> glMultiDrawArraysIndirectCount;
internal unsafe delegate*<uint, int*, uint, IntPtr*, int, void> glMultiDrawElements;
internal unsafe delegate*<uint, int*, uint, IntPtr*, int, int*, void> glMultiDrawElementsBaseVertex;
internal unsafe delegate*<uint, uint, IntPtr*, int, int, void> glMultiDrawElementsIndirect;
internal unsafe delegate*<uint, uint, IntPtr*, nint, int, int, void> glMultiDrawElementsIndirectCount;
internal unsafe delegate*<uint, nuint, IntPtr*, uint, void> glNamedBufferData;
internal unsafe delegate*<uint, nuint, IntPtr*, uint, void> glNamedBufferStorage;
internal unsafe delegate*<uint, nint, nuint, IntPtr*, void> glNamedBufferSubData;
internal unsafe delegate*<uint, uint, void> glNamedFramebufferDrawBuffer;
internal unsafe delegate*<uint, int, uint*, void> glNamedFramebufferDrawBuffers;
internal unsafe delegate*<uint, uint, int, void> glNamedFramebufferParameteri;
internal unsafe delegate*<uint, uint, void> glNamedFramebufferReadBuffer;
internal unsafe delegate*<uint, uint, uint, uint, void> glNamedFramebufferRenderbuffer;
internal unsafe delegate*<uint, uint, uint, int, void> glNamedFramebufferTexture;
internal unsafe delegate*<uint, uint, uint, int, int, void> glNamedFramebufferTextureLayer;
internal unsafe delegate*<uint, uint, int, int, void> glNamedRenderbufferStorage;
internal unsafe delegate*<uint, int, uint, int, int, void> glNamedRenderbufferStorageMultisample;
internal unsafe delegate*<uint, uint, int, byte*, void> glObjectLabel;
internal unsafe delegate*<IntPtr*, int, byte*, void> glObjectPtrLabel;
internal unsafe delegate*<uint, float*, void> glPatchParameterfv;
internal unsafe delegate*<uint, int, void> glPatchParameteri;
internal unsafe delegate*<void> glPauseTransformFeedback;
internal unsafe delegate*<uint, float, void> glPixelStoref;
internal unsafe delegate*<uint, int, void> glPixelStorei;
internal unsafe delegate*<uint, float, void> glPointParameterf;
internal unsafe delegate*<uint, float*, void> glPointParameterfv;
internal unsafe delegate*<uint, int, void> glPointParameteri;
internal unsafe delegate*<uint, int*, void> glPointParameteriv;
internal unsafe delegate*<float, void> glPointSize;
internal unsafe delegate*<uint, uint, void> glPolygonMode;
internal unsafe delegate*<float, float, void> glPolygonOffset;
internal unsafe delegate*<float, float, float, void> glPolygonOffsetClamp;
internal unsafe delegate*<void> glPopDebugGroup;
internal unsafe delegate*<uint, void> glPrimitiveRestartIndex;
internal unsafe delegate*<uint, uint, IntPtr*, int, void> glProgramBinary;
internal unsafe delegate*<uint, uint, int, void> glProgramParameteri;
internal unsafe delegate*<uint, int, double, void> glProgramUniform1d;
internal unsafe delegate*<uint, int, int, double*, void> glProgramUniform1dv;
internal unsafe delegate*<uint, int, float, void> glProgramUniform1f;
internal unsafe delegate*<uint, int, int, float*, void> glProgramUniform1fv;
internal unsafe delegate*<uint, int, int, void> glProgramUniform1i;
internal unsafe delegate*<uint, int, int, int*, void> glProgramUniform1iv;
internal unsafe delegate*<uint, int, uint, void> glProgramUniform1ui;
internal unsafe delegate*<uint, int, int, uint*, void> glProgramUniform1uiv;
internal unsafe delegate*<uint, int, double, double, void> glProgramUniform2d;
internal unsafe delegate*<uint, int, int, double*, void> glProgramUniform2dv;
internal unsafe delegate*<uint, int, float, float, void> glProgramUniform2f;
internal unsafe delegate*<uint, int, int, float*, void> glProgramUniform2fv;
internal unsafe delegate*<uint, int, int, int, void> glProgramUniform2i;
internal unsafe delegate*<uint, int, int, int*, void> glProgramUniform2iv;
internal unsafe delegate*<uint, int, uint, uint, void> glProgramUniform2ui;
internal unsafe delegate*<uint, int, int, uint*, void> glProgramUniform2uiv;
internal unsafe delegate*<uint, int, double, double, double, void> glProgramUniform3d;
internal unsafe delegate*<uint, int, int, double*, void> glProgramUniform3dv;
internal unsafe delegate*<uint, int, float, float, float, void> glProgramUniform3f;
internal unsafe delegate*<uint, int, int, float*, void> glProgramUniform3fv;
internal unsafe delegate*<uint, int, int, int, int, void> glProgramUniform3i;
internal unsafe delegate*<uint, int, int, int*, void> glProgramUniform3iv;
internal unsafe delegate*<uint, int, uint, uint, uint, void> glProgramUniform3ui;
internal unsafe delegate*<uint, int, int, uint*, void> glProgramUniform3uiv;
internal unsafe delegate*<uint, int, double, double, double, double, void> glProgramUniform4d;
internal unsafe delegate*<uint, int, int, double*, void> glProgramUniform4dv;
internal unsafe delegate*<uint, int, float, float, float, float, void> glProgramUniform4f;
internal unsafe delegate*<uint, int, int, float*, void> glProgramUniform4fv;
internal unsafe delegate*<uint, int, int, int, int, int, void> glProgramUniform4i;
internal unsafe delegate*<uint, int, int, int*, void> glProgramUniform4iv;
internal unsafe delegate*<uint, int, uint, uint, uint, uint, void> glProgramUniform4ui;
internal unsafe delegate*<uint, int, int, uint*, void> glProgramUniform4uiv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix2dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix2fv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix2x3dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix2x3fv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix2x4dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix2x4fv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix3dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix3fv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix3x2dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix3x2fv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix3x4dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix3x4fv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix4dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix4fv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix4x2dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix4x2fv;
internal unsafe delegate*<uint, int, int, byte, double*, void> glProgramUniformMatrix4x3dv;
internal unsafe delegate*<uint, int, int, byte, float*, void> glProgramUniformMatrix4x3fv;
internal unsafe delegate*<uint, void> glProvokingVertex;
internal unsafe delegate*<uint, uint, int, byte*, void> glPushDebugGroup;
internal unsafe delegate*<uint, uint, void> glQueryCounter;
internal unsafe delegate*<uint, void> glReadBuffer;
internal unsafe delegate*<int, int, int, int, uint, uint, int, IntPtr*, void> glReadnPixels;
internal unsafe delegate*<int, int, int, int, uint, uint, IntPtr*, void> glReadPixels;
internal unsafe delegate*<void> glReleaseShaderCompiler;
internal unsafe delegate*<uint, uint, int, int, void> glRenderbufferStorage;
internal unsafe delegate*<uint, int, uint, int, int, void> glRenderbufferStorageMultisample;
internal unsafe delegate*<void> glResumeTransformFeedback;
internal unsafe delegate*<float, byte, void> glSampleCoverage;
internal unsafe delegate*<uint, uint, void> glSampleMaski;
internal unsafe delegate*<uint, uint, float, void> glSamplerParameterf;
internal unsafe delegate*<uint, uint, float*, void> glSamplerParameterfv;
internal unsafe delegate*<uint, uint, int, void> glSamplerParameteri;
internal unsafe delegate*<uint, uint, int*, void> glSamplerParameterIiv;
internal unsafe delegate*<uint, uint, uint*, void> glSamplerParameterIuiv;
internal unsafe delegate*<uint, uint, int*, void> glSamplerParameteriv;
internal unsafe delegate*<int, int, int, int, void> glScissor;
internal unsafe delegate*<uint, int, int*, void> glScissorArrayv;
internal unsafe delegate*<uint, int, int, int, int, void> glScissorIndexed;
internal unsafe delegate*<uint, int*, void> glScissorIndexedv;
internal unsafe delegate*<int, uint*, uint, IntPtr*, int, void> glShaderBinary;
internal unsafe delegate*<uint, int, byte**, int*, void> glShaderSource;
internal unsafe delegate*<uint, uint, uint, void> glShaderStorageBlockBinding;
internal unsafe delegate*<uint, byte*, uint, uint*, uint*, void> glSpecializeShader;
internal unsafe delegate*<uint, int, uint, void> glStencilFunc;
internal unsafe delegate*<uint, uint, int, uint, void> glStencilFuncSeparate;
internal unsafe delegate*<uint, void> glStencilMask;
internal unsafe delegate*<uint, uint, void> glStencilMaskSeparate;
internal unsafe delegate*<uint, uint, uint, void> glStencilOp;
internal unsafe delegate*<uint, uint, uint, uint, void> glStencilOpSeparate;
internal unsafe delegate*<uint, uint, uint, void> glTexBuffer;
internal unsafe delegate*<uint, uint, uint, nint, nuint, void> glTexBufferRange;
internal unsafe delegate*<uint, int, int, int, int, uint, uint, IntPtr*, void> glTexImage1D;
internal unsafe delegate*<uint, int, int, int, int, int, uint, uint, IntPtr*, void> glTexImage2D;
internal unsafe delegate*<uint, int, uint, int, int, byte, void> glTexImage2DMultisample;
internal unsafe delegate*<uint, int, int, int, int, int, int, uint, uint, IntPtr*, void> glTexImage3D;
internal unsafe delegate*<uint, int, uint, int, int, int, byte, void> glTexImage3DMultisample;
internal unsafe delegate*<uint, uint, float, void> glTexParameterf;
internal unsafe delegate*<uint, uint, float*, void> glTexParameterfv;
internal unsafe delegate*<uint, uint, int, void> glTexParameteri;
internal unsafe delegate*<uint, uint, int*, void> glTexParameterIiv;
internal unsafe delegate*<uint, uint, uint*, void> glTexParameterIuiv;
internal unsafe delegate*<uint, uint, int*, void> glTexParameteriv;
internal unsafe delegate*<uint, int, uint, int, void> glTexStorage1D;
internal unsafe delegate*<uint, int, uint, int, int, void> glTexStorage2D;
internal unsafe delegate*<uint, int, uint, int, int, byte, void> glTexStorage2DMultisample;
internal unsafe delegate*<uint, int, uint, int, int, int, void> glTexStorage3D;
internal unsafe delegate*<uint, int, uint, int, int, int, byte, void> glTexStorage3DMultisample;
internal unsafe delegate*<uint, int, int, int, uint, uint, IntPtr*, void> glTexSubImage1D;
internal unsafe delegate*<uint, int, int, int, int, int, uint, uint, IntPtr*, void> glTexSubImage2D;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, uint, uint, IntPtr*, void> glTexSubImage3D;
internal unsafe delegate*<void> glTextureBarrier;
internal unsafe delegate*<uint, uint, uint, void> glTextureBuffer;
internal unsafe delegate*<uint, uint, uint, nint, nuint, void> glTextureBufferRange;
internal unsafe delegate*<uint, uint, float, void> glTextureParameterf;
internal unsafe delegate*<uint, uint, float*, void> glTextureParameterfv;
internal unsafe delegate*<uint, uint, int, void> glTextureParameteri;
internal unsafe delegate*<uint, uint, int*, void> glTextureParameterIiv;
internal unsafe delegate*<uint, uint, uint*, void> glTextureParameterIuiv;
internal unsafe delegate*<uint, uint, int*, void> glTextureParameteriv;
internal unsafe delegate*<uint, int, uint, int, void> glTextureStorage1D;
internal unsafe delegate*<uint, int, uint, int, int, void> glTextureStorage2D;
internal unsafe delegate*<uint, int, uint, int, int, byte, void> glTextureStorage2DMultisample;
internal unsafe delegate*<uint, int, uint, int, int, int, void> glTextureStorage3D;
internal unsafe delegate*<uint, int, uint, int, int, int, byte, void> glTextureStorage3DMultisample;
internal unsafe delegate*<uint, int, int, int, uint, uint, IntPtr*, void> glTextureSubImage1D;
internal unsafe delegate*<uint, int, int, int, int, int, uint, uint, IntPtr*, void> glTextureSubImage2D;
internal unsafe delegate*<uint, int, int, int, int, int, int, int, uint, uint, IntPtr*, void> glTextureSubImage3D;
internal unsafe delegate*<uint, uint, uint, uint, uint, uint, uint, uint, void> glTextureView;
internal unsafe delegate*<uint, uint, uint, void> glTransformFeedbackBufferBase;
internal unsafe delegate*<uint, uint, uint, nint, nuint, void> glTransformFeedbackBufferRange;
internal unsafe delegate*<uint, int, byte*, uint, void> glTransformFeedbackVaryings;
internal unsafe delegate*<int, double, void> glUniform1d;
internal unsafe delegate*<int, int, double*, void> glUniform1dv;
internal unsafe delegate*<int, float, void> glUniform1f;
internal unsafe delegate*<int, int, float*, void> glUniform1fv;
internal unsafe delegate*<int, int, void> glUniform1i;
internal unsafe delegate*<int, int, int*, void> glUniform1iv;
internal unsafe delegate*<int, uint, void> glUniform1ui;
internal unsafe delegate*<int, int, uint*, void> glUniform1uiv;
internal unsafe delegate*<int, double, double, void> glUniform2d;
internal unsafe delegate*<int, int, double*, void> glUniform2dv;
internal unsafe delegate*<int, float, float, void> glUniform2f;
internal unsafe delegate*<int, int, float*, void> glUniform2fv;
internal unsafe delegate*<int, int, int, void> glUniform2i;
internal unsafe delegate*<int, int, int*, void> glUniform2iv;
internal unsafe delegate*<int, uint, uint, void> glUniform2ui;
internal unsafe delegate*<int, int, uint*, void> glUniform2uiv;
internal unsafe delegate*<int, double, double, double, void> glUniform3d;
internal unsafe delegate*<int, int, double*, void> glUniform3dv;
internal unsafe delegate*<int, float, float, float, void> glUniform3f;
internal unsafe delegate*<int, int, float*, void> glUniform3fv;
internal unsafe delegate*<int, int, int, int, void> glUniform3i;
internal unsafe delegate*<int, int, int*, void> glUniform3iv;
internal unsafe delegate*<int, uint, uint, uint, void> glUniform3ui;
internal unsafe delegate*<int, int, uint*, void> glUniform3uiv;
internal unsafe delegate*<int, double, double, double, double, void> glUniform4d;
internal unsafe delegate*<int, int, double*, void> glUniform4dv;
internal unsafe delegate*<int, float, float, float, float, void> glUniform4f;
internal unsafe delegate*<int, int, float*, void> glUniform4fv;
internal unsafe delegate*<int, int, int, int, int, void> glUniform4i;
internal unsafe delegate*<int, int, int*, void> glUniform4iv;
internal unsafe delegate*<int, uint, uint, uint, uint, void> glUniform4ui;
internal unsafe delegate*<int, int, uint*, void> glUniform4uiv;
internal unsafe delegate*<uint, uint, uint, void> glUniformBlockBinding;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix2dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix2fv;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix2x3dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix2x3fv;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix2x4dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix2x4fv;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix3dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix3fv;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix3x2dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix3x2fv;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix3x4dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix3x4fv;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix4dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix4fv;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix4x2dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix4x2fv;
internal unsafe delegate*<int, int, byte, double*, void> glUniformMatrix4x3dv;
internal unsafe delegate*<int, int, byte, float*, void> glUniformMatrix4x3fv;
internal unsafe delegate*<uint, int, uint*, void> glUniformSubroutinesuiv;
internal unsafe delegate*<uint, byte> glUnmapBuffer;
internal unsafe delegate*<uint, byte> glUnmapNamedBuffer;
internal unsafe delegate*<uint, void> glUseProgram;
internal unsafe delegate*<uint, uint, uint, void> glUseProgramStages;
internal unsafe delegate*<uint, void> glValidateProgram;
internal unsafe delegate*<uint, void> glValidateProgramPipeline;
internal unsafe delegate*<uint, uint, uint, void> glVertexArrayAttribBinding;
internal unsafe delegate*<uint, uint, int, uint, byte, uint, void> glVertexArrayAttribFormat;
internal unsafe delegate*<uint, uint, int, uint, uint, void> glVertexArrayAttribIFormat;
internal unsafe delegate*<uint, uint, int, uint, uint, void> glVertexArrayAttribLFormat;
internal unsafe delegate*<uint, uint, uint, void> glVertexArrayBindingDivisor;
internal unsafe delegate*<uint, uint, void> glVertexArrayElementBuffer;
internal unsafe delegate*<uint, uint, uint, nint, int, void> glVertexArrayVertexBuffer;
internal unsafe delegate*<uint, uint, int, uint*, nint*, int*, void> glVertexArrayVertexBuffers;
internal unsafe delegate*<uint, double, void> glVertexAttrib1d;
internal unsafe delegate*<uint, double*, void> glVertexAttrib1dv;
internal unsafe delegate*<uint, float, void> glVertexAttrib1f;
internal unsafe delegate*<uint, float*, void> glVertexAttrib1fv;
internal unsafe delegate*<uint, short, void> glVertexAttrib1s;
internal unsafe delegate*<uint, short*, void> glVertexAttrib1sv;
internal unsafe delegate*<uint, double, double, void> glVertexAttrib2d;
internal unsafe delegate*<uint, double*, void> glVertexAttrib2dv;
internal unsafe delegate*<uint, float, float, void> glVertexAttrib2f;
internal unsafe delegate*<uint, float*, void> glVertexAttrib2fv;
internal unsafe delegate*<uint, short, short, void> glVertexAttrib2s;
internal unsafe delegate*<uint, short*, void> glVertexAttrib2sv;
internal unsafe delegate*<uint, double, double, double, void> glVertexAttrib3d;
internal unsafe delegate*<uint, double*, void> glVertexAttrib3dv;
internal unsafe delegate*<uint, float, float, float, void> glVertexAttrib3f;
internal unsafe delegate*<uint, float*, void> glVertexAttrib3fv;
internal unsafe delegate*<uint, short, short, short, void> glVertexAttrib3s;
internal unsafe delegate*<uint, short*, void> glVertexAttrib3sv;
internal unsafe delegate*<uint, sbyte*, void> glVertexAttrib4bv;
internal unsafe delegate*<uint, double, double, double, double, void> glVertexAttrib4d;
internal unsafe delegate*<uint, double*, void> glVertexAttrib4dv;
internal unsafe delegate*<uint, float, float, float, float, void> glVertexAttrib4f;
internal unsafe delegate*<uint, float*, void> glVertexAttrib4fv;
internal unsafe delegate*<uint, int*, void> glVertexAttrib4iv;
internal unsafe delegate*<uint, sbyte*, void> glVertexAttrib4Nbv;
internal unsafe delegate*<uint, int*, void> glVertexAttrib4Niv;
internal unsafe delegate*<uint, short*, void> glVertexAttrib4Nsv;
internal unsafe delegate*<uint, byte, byte, byte, byte, void> glVertexAttrib4Nub;
internal unsafe delegate*<uint, byte*, void> glVertexAttrib4Nubv;
internal unsafe delegate*<uint, uint*, void> glVertexAttrib4Nuiv;
internal unsafe delegate*<uint, ushort*, void> glVertexAttrib4Nusv;
internal unsafe delegate*<uint, short, short, short, short, void> glVertexAttrib4s;
internal unsafe delegate*<uint, short*, void> glVertexAttrib4sv;
internal unsafe delegate*<uint, byte*, void> glVertexAttrib4ubv;
internal unsafe delegate*<uint, uint*, void> glVertexAttrib4uiv;
internal unsafe delegate*<uint, ushort*, void> glVertexAttrib4usv;
internal unsafe delegate*<uint, uint, void> glVertexAttribBinding;
internal unsafe delegate*<uint, uint, void> glVertexAttribDivisor;
internal unsafe delegate*<uint, int, uint, byte, uint, void> glVertexAttribFormat;
internal unsafe delegate*<uint, int, void> glVertexAttribI1i;
internal unsafe delegate*<uint, int*, void> glVertexAttribI1iv;
internal unsafe delegate*<uint, uint, void> glVertexAttribI1ui;
internal unsafe delegate*<uint, uint*, void> glVertexAttribI1uiv;
internal unsafe delegate*<uint, int, int, void> glVertexAttribI2i;
internal unsafe delegate*<uint, int*, void> glVertexAttribI2iv;
internal unsafe delegate*<uint, uint, uint, void> glVertexAttribI2ui;
internal unsafe delegate*<uint, uint*, void> glVertexAttribI2uiv;
internal unsafe delegate*<uint, int, int, int, void> glVertexAttribI3i;
internal unsafe delegate*<uint, int*, void> glVertexAttribI3iv;
internal unsafe delegate*<uint, uint, uint, uint, void> glVertexAttribI3ui;
internal unsafe delegate*<uint, uint*, void> glVertexAttribI3uiv;
internal unsafe delegate*<uint, sbyte*, void> glVertexAttribI4bv;
internal unsafe delegate*<uint, int, int, int, int, void> glVertexAttribI4i;
internal unsafe delegate*<uint, int*, void> glVertexAttribI4iv;
internal unsafe delegate*<uint, short*, void> glVertexAttribI4sv;
internal unsafe delegate*<uint, byte*, void> glVertexAttribI4ubv;
internal unsafe delegate*<uint, uint, uint, uint, uint, void> glVertexAttribI4ui;
internal unsafe delegate*<uint, uint*, void> glVertexAttribI4uiv;
internal unsafe delegate*<uint, ushort*, void> glVertexAttribI4usv;
internal unsafe delegate*<uint, int, uint, uint, void> glVertexAttribIFormat;
internal unsafe delegate*<uint, int, uint, int, IntPtr*, void> glVertexAttribIPointer;
internal unsafe delegate*<uint, double, void> glVertexAttribL1d;
internal unsafe delegate*<uint, double*, void> glVertexAttribL1dv;
internal unsafe delegate*<uint, double, double, void> glVertexAttribL2d;
internal unsafe delegate*<uint, double*, void> glVertexAttribL2dv;
internal unsafe delegate*<uint, double, double, double, void> glVertexAttribL3d;
internal unsafe delegate*<uint, double*, void> glVertexAttribL3dv;
internal unsafe delegate*<uint, double, double, double, double, void> glVertexAttribL4d;
internal unsafe delegate*<uint, double*, void> glVertexAttribL4dv;
internal unsafe delegate*<uint, int, uint, uint, void> glVertexAttribLFormat;
internal unsafe delegate*<uint, int, uint, int, IntPtr*, void> glVertexAttribLPointer;
internal unsafe delegate*<uint, uint, byte, uint, void> glVertexAttribP1ui;
internal unsafe delegate*<uint, uint, byte, uint*, void> glVertexAttribP1uiv;
internal unsafe delegate*<uint, uint, byte, uint, void> glVertexAttribP2ui;
internal unsafe delegate*<uint, uint, byte, uint*, void> glVertexAttribP2uiv;
internal unsafe delegate*<uint, uint, byte, uint, void> glVertexAttribP3ui;
internal unsafe delegate*<uint, uint, byte, uint*, void> glVertexAttribP3uiv;
internal unsafe delegate*<uint, uint, byte, uint, void> glVertexAttribP4ui;
internal unsafe delegate*<uint, uint, byte, uint*, void> glVertexAttribP4uiv;
internal unsafe delegate*<uint, int, uint, byte, int, IntPtr*, void> glVertexAttribPointer;
internal unsafe delegate*<uint, uint, void> glVertexBindingDivisor;
internal unsafe delegate*<int, int, int, int, void> glViewport;
internal unsafe delegate*<uint, int, float*, void> glViewportArrayv;
internal unsafe delegate*<uint, float, float, float, float, void> glViewportIndexedf;
internal unsafe delegate*<uint, float*, void> glViewportIndexedfv;
internal unsafe delegate*<glSync, uint, IntPtr, void> glWaitSync;
}
}
+698
View File
@@ -0,0 +1,698 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glContextShadow"
// 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.OpenGL
{
internal struct glContextShadow
{
internal IntPtr glActiveShaderProgram;
internal IntPtr glActiveTexture;
internal IntPtr glAttachShader;
internal IntPtr glBeginConditionalRender;
internal IntPtr glBeginQuery;
internal IntPtr glBeginQueryIndexed;
internal IntPtr glBeginTransformFeedback;
internal IntPtr glBindAttribLocation;
internal IntPtr glBindBuffer;
internal IntPtr glBindBufferBase;
internal IntPtr glBindBufferRange;
internal IntPtr glBindBuffersBase;
internal IntPtr glBindBuffersRange;
internal IntPtr glBindFragDataLocation;
internal IntPtr glBindFragDataLocationIndexed;
internal IntPtr glBindFramebuffer;
internal IntPtr glBindImageTexture;
internal IntPtr glBindImageTextures;
internal IntPtr glBindProgramPipeline;
internal IntPtr glBindRenderbuffer;
internal IntPtr glBindSampler;
internal IntPtr glBindSamplers;
internal IntPtr glBindTexture;
internal IntPtr glBindTextures;
internal IntPtr glBindTextureUnit;
internal IntPtr glBindTransformFeedback;
internal IntPtr glBindVertexArray;
internal IntPtr glBindVertexBuffer;
internal IntPtr glBindVertexBuffers;
internal IntPtr glBlendColor;
internal IntPtr glBlendEquation;
internal IntPtr glBlendEquationi;
internal IntPtr glBlendEquationSeparate;
internal IntPtr glBlendEquationSeparatei;
internal IntPtr glBlendFunc;
internal IntPtr glBlendFunci;
internal IntPtr glBlendFuncSeparate;
internal IntPtr glBlendFuncSeparatei;
internal IntPtr glBlitFramebuffer;
internal IntPtr glBlitNamedFramebuffer;
internal IntPtr glBufferData;
internal IntPtr glBufferStorage;
internal IntPtr glBufferSubData;
internal IntPtr glCheckFramebufferStatus;
internal IntPtr glCheckNamedFramebufferStatus;
internal IntPtr glClampColor;
internal IntPtr glClear;
internal IntPtr glClearBufferData;
internal IntPtr glClearBufferfi;
internal IntPtr glClearBufferfv;
internal IntPtr glClearBufferiv;
internal IntPtr glClearBufferSubData;
internal IntPtr glClearBufferuiv;
internal IntPtr glClearColor;
internal IntPtr glClearDepth;
internal IntPtr glClearDepthf;
internal IntPtr glClearNamedBufferData;
internal IntPtr glClearNamedBufferSubData;
internal IntPtr glClearNamedFramebufferfi;
internal IntPtr glClearNamedFramebufferfv;
internal IntPtr glClearNamedFramebufferiv;
internal IntPtr glClearNamedFramebufferuiv;
internal IntPtr glClearStencil;
internal IntPtr glClearTexImage;
internal IntPtr glClearTexSubImage;
internal IntPtr glClientWaitSync;
internal IntPtr glClipControl;
internal IntPtr glColorMask;
internal IntPtr glColorMaski;
internal IntPtr glCompileShader;
internal IntPtr glCompressedTexImage1D;
internal IntPtr glCompressedTexImage2D;
internal IntPtr glCompressedTexImage3D;
internal IntPtr glCompressedTexSubImage1D;
internal IntPtr glCompressedTexSubImage2D;
internal IntPtr glCompressedTexSubImage3D;
internal IntPtr glCompressedTextureSubImage1D;
internal IntPtr glCompressedTextureSubImage2D;
internal IntPtr glCompressedTextureSubImage3D;
internal IntPtr glCopyBufferSubData;
internal IntPtr glCopyImageSubData;
internal IntPtr glCopyNamedBufferSubData;
internal IntPtr glCopyTexImage1D;
internal IntPtr glCopyTexImage2D;
internal IntPtr glCopyTexSubImage1D;
internal IntPtr glCopyTexSubImage2D;
internal IntPtr glCopyTexSubImage3D;
internal IntPtr glCopyTextureSubImage1D;
internal IntPtr glCopyTextureSubImage2D;
internal IntPtr glCopyTextureSubImage3D;
internal IntPtr glCreateBuffers;
internal IntPtr glCreateFramebuffers;
internal IntPtr glCreateProgram;
internal IntPtr glCreateProgramPipelines;
internal IntPtr glCreateQueries;
internal IntPtr glCreateRenderbuffers;
internal IntPtr glCreateSamplers;
internal IntPtr glCreateShader;
internal IntPtr glCreateShaderProgramv;
internal IntPtr glCreateTextures;
internal IntPtr glCreateTransformFeedbacks;
internal IntPtr glCreateVertexArrays;
internal IntPtr glCullFace;
internal IntPtr glDebugMessageCallback;
internal IntPtr glDebugMessageControl;
internal IntPtr glDebugMessageInsert;
internal IntPtr glDeleteBuffers;
internal IntPtr glDeleteFramebuffers;
internal IntPtr glDeleteProgram;
internal IntPtr glDeleteProgramPipelines;
internal IntPtr glDeleteQueries;
internal IntPtr glDeleteRenderbuffers;
internal IntPtr glDeleteSamplers;
internal IntPtr glDeleteShader;
internal IntPtr glDeleteSync;
internal IntPtr glDeleteTextures;
internal IntPtr glDeleteTransformFeedbacks;
internal IntPtr glDeleteVertexArrays;
internal IntPtr glDepthFunc;
internal IntPtr glDepthMask;
internal IntPtr glDepthRange;
internal IntPtr glDepthRangeArrayv;
internal IntPtr glDepthRangef;
internal IntPtr glDepthRangeIndexed;
internal IntPtr glDetachShader;
internal IntPtr glDisable;
internal IntPtr glDisablei;
internal IntPtr glDisableVertexArrayAttrib;
internal IntPtr glDisableVertexAttribArray;
internal IntPtr glDispatchCompute;
internal IntPtr glDispatchComputeIndirect;
internal IntPtr glDrawArrays;
internal IntPtr glDrawArraysIndirect;
internal IntPtr glDrawArraysInstanced;
internal IntPtr glDrawArraysInstancedBaseInstance;
internal IntPtr glDrawBuffer;
internal IntPtr glDrawBuffers;
internal IntPtr glDrawElements;
internal IntPtr glDrawElementsBaseVertex;
internal IntPtr glDrawElementsIndirect;
internal IntPtr glDrawElementsInstanced;
internal IntPtr glDrawElementsInstancedBaseInstance;
internal IntPtr glDrawElementsInstancedBaseVertex;
internal IntPtr glDrawElementsInstancedBaseVertexBaseInstance;
internal IntPtr glDrawRangeElements;
internal IntPtr glDrawRangeElementsBaseVertex;
internal IntPtr glDrawTransformFeedback;
internal IntPtr glDrawTransformFeedbackInstanced;
internal IntPtr glDrawTransformFeedbackStream;
internal IntPtr glDrawTransformFeedbackStreamInstanced;
internal IntPtr glEnable;
internal IntPtr glEnablei;
internal IntPtr glEnableVertexArrayAttrib;
internal IntPtr glEnableVertexAttribArray;
internal IntPtr glEndConditionalRender;
internal IntPtr glEndQuery;
internal IntPtr glEndQueryIndexed;
internal IntPtr glEndTransformFeedback;
internal IntPtr glFenceSync;
internal IntPtr glFinish;
internal IntPtr glFlush;
internal IntPtr glFlushMappedBufferRange;
internal IntPtr glFlushMappedNamedBufferRange;
internal IntPtr glFramebufferParameteri;
internal IntPtr glFramebufferRenderbuffer;
internal IntPtr glFramebufferTexture;
internal IntPtr glFramebufferTexture1D;
internal IntPtr glFramebufferTexture2D;
internal IntPtr glFramebufferTexture3D;
internal IntPtr glFramebufferTextureLayer;
internal IntPtr glFrontFace;
internal IntPtr glGenBuffers;
internal IntPtr glGenerateMipmap;
internal IntPtr glGenerateTextureMipmap;
internal IntPtr glGenFramebuffers;
internal IntPtr glGenProgramPipelines;
internal IntPtr glGenQueries;
internal IntPtr glGenRenderbuffers;
internal IntPtr glGenSamplers;
internal IntPtr glGenTextures;
internal IntPtr glGenTransformFeedbacks;
internal IntPtr glGenVertexArrays;
internal IntPtr glGetActiveAtomicCounterBufferiv;
internal IntPtr glGetActiveAttrib;
internal IntPtr glGetActiveSubroutineName;
internal IntPtr glGetActiveSubroutineUniformiv;
internal IntPtr glGetActiveSubroutineUniformName;
internal IntPtr glGetActiveUniform;
internal IntPtr glGetActiveUniformBlockiv;
internal IntPtr glGetActiveUniformBlockName;
internal IntPtr glGetActiveUniformName;
internal IntPtr glGetActiveUniformsiv;
internal IntPtr glGetAttachedShaders;
internal IntPtr glGetAttribLocation;
internal IntPtr glGetBooleani_v;
internal IntPtr glGetBooleanv;
internal IntPtr glGetBufferParameteri64v;
internal IntPtr glGetBufferParameteriv;
internal IntPtr glGetBufferPointerv;
internal IntPtr glGetBufferSubData;
internal IntPtr glGetCompressedTexImage;
internal IntPtr glGetCompressedTextureImage;
internal IntPtr glGetCompressedTextureSubImage;
internal IntPtr glGetDebugMessageLog;
internal IntPtr glGetDoublei_v;
internal IntPtr glGetDoublev;
internal IntPtr glGetError;
internal IntPtr glGetFloati_v;
internal IntPtr glGetFloatv;
internal IntPtr glGetFragDataIndex;
internal IntPtr glGetFragDataLocation;
internal IntPtr glGetFramebufferAttachmentParameteriv;
internal IntPtr glGetFramebufferParameteriv;
internal IntPtr glGetGraphicsResetStatus;
internal IntPtr glGetInteger64i_v;
internal IntPtr glGetInteger64v;
internal IntPtr glGetIntegeri_v;
internal IntPtr glGetIntegerv;
internal IntPtr glGetInternalformati64v;
internal IntPtr glGetInternalformativ;
internal IntPtr glGetMultisamplefv;
internal IntPtr glGetNamedBufferParameteri64v;
internal IntPtr glGetNamedBufferParameteriv;
internal IntPtr glGetNamedBufferPointerv;
internal IntPtr glGetNamedBufferSubData;
internal IntPtr glGetNamedFramebufferAttachmentParameteriv;
internal IntPtr glGetNamedFramebufferParameteriv;
internal IntPtr glGetNamedRenderbufferParameteriv;
internal IntPtr glGetnCompressedTexImage;
internal IntPtr glGetnTexImage;
internal IntPtr glGetnUniformdv;
internal IntPtr glGetnUniformfv;
internal IntPtr glGetnUniformiv;
internal IntPtr glGetnUniformuiv;
internal IntPtr glGetObjectLabel;
internal IntPtr glGetObjectPtrLabel;
internal IntPtr glGetPointerv;
internal IntPtr glGetProgramBinary;
internal IntPtr glGetProgramInfoLog;
internal IntPtr glGetProgramInterfaceiv;
internal IntPtr glGetProgramiv;
internal IntPtr glGetProgramPipelineInfoLog;
internal IntPtr glGetProgramPipelineiv;
internal IntPtr glGetProgramResourceIndex;
internal IntPtr glGetProgramResourceiv;
internal IntPtr glGetProgramResourceLocation;
internal IntPtr glGetProgramResourceLocationIndex;
internal IntPtr glGetProgramResourceName;
internal IntPtr glGetProgramStageiv;
internal IntPtr glGetQueryBufferObjecti64v;
internal IntPtr glGetQueryBufferObjectiv;
internal IntPtr glGetQueryBufferObjectui64v;
internal IntPtr glGetQueryBufferObjectuiv;
internal IntPtr glGetQueryIndexediv;
internal IntPtr glGetQueryiv;
internal IntPtr glGetQueryObjecti64v;
internal IntPtr glGetQueryObjectiv;
internal IntPtr glGetQueryObjectui64v;
internal IntPtr glGetQueryObjectuiv;
internal IntPtr glGetRenderbufferParameteriv;
internal IntPtr glGetSamplerParameterfv;
internal IntPtr glGetSamplerParameterIiv;
internal IntPtr glGetSamplerParameterIuiv;
internal IntPtr glGetSamplerParameteriv;
internal IntPtr glGetShaderInfoLog;
internal IntPtr glGetShaderiv;
internal IntPtr glGetShaderPrecisionFormat;
internal IntPtr glGetShaderSource;
internal IntPtr glGetString;
internal IntPtr glGetStringi;
internal IntPtr glGetSubroutineIndex;
internal IntPtr glGetSubroutineUniformLocation;
internal IntPtr glGetSynciv;
internal IntPtr glGetTexImage;
internal IntPtr glGetTexLevelParameterfv;
internal IntPtr glGetTexLevelParameteriv;
internal IntPtr glGetTexParameterfv;
internal IntPtr glGetTexParameterIiv;
internal IntPtr glGetTexParameterIuiv;
internal IntPtr glGetTexParameteriv;
internal IntPtr glGetTextureImage;
internal IntPtr glGetTextureLevelParameterfv;
internal IntPtr glGetTextureLevelParameteriv;
internal IntPtr glGetTextureParameterfv;
internal IntPtr glGetTextureParameterIiv;
internal IntPtr glGetTextureParameterIuiv;
internal IntPtr glGetTextureParameteriv;
internal IntPtr glGetTextureSubImage;
internal IntPtr glGetTransformFeedbacki_v;
internal IntPtr glGetTransformFeedbacki64_v;
internal IntPtr glGetTransformFeedbackiv;
internal IntPtr glGetTransformFeedbackVarying;
internal IntPtr glGetUniformBlockIndex;
internal IntPtr glGetUniformdv;
internal IntPtr glGetUniformfv;
internal IntPtr glGetUniformIndices;
internal IntPtr glGetUniformiv;
internal IntPtr glGetUniformLocation;
internal IntPtr glGetUniformSubroutineuiv;
internal IntPtr glGetUniformuiv;
internal IntPtr glGetVertexArrayIndexed64iv;
internal IntPtr glGetVertexArrayIndexediv;
internal IntPtr glGetVertexArrayiv;
internal IntPtr glGetVertexAttribdv;
internal IntPtr glGetVertexAttribfv;
internal IntPtr glGetVertexAttribIiv;
internal IntPtr glGetVertexAttribIuiv;
internal IntPtr glGetVertexAttribiv;
internal IntPtr glGetVertexAttribLdv;
internal IntPtr glGetVertexAttribPointerv;
internal IntPtr glHint;
internal IntPtr glInvalidateBufferData;
internal IntPtr glInvalidateBufferSubData;
internal IntPtr glInvalidateFramebuffer;
internal IntPtr glInvalidateNamedFramebufferData;
internal IntPtr glInvalidateNamedFramebufferSubData;
internal IntPtr glInvalidateSubFramebuffer;
internal IntPtr glInvalidateTexImage;
internal IntPtr glInvalidateTexSubImage;
internal IntPtr glIsBuffer;
internal IntPtr glIsEnabled;
internal IntPtr glIsEnabledi;
internal IntPtr glIsFramebuffer;
internal IntPtr glIsProgram;
internal IntPtr glIsProgramPipeline;
internal IntPtr glIsQuery;
internal IntPtr glIsRenderbuffer;
internal IntPtr glIsSampler;
internal IntPtr glIsShader;
internal IntPtr glIsSync;
internal IntPtr glIsTexture;
internal IntPtr glIsTransformFeedback;
internal IntPtr glIsVertexArray;
internal IntPtr glLineWidth;
internal IntPtr glLinkProgram;
internal IntPtr glLogicOp;
internal IntPtr glMapBuffer;
internal IntPtr glMapBufferRange;
internal IntPtr glMapNamedBuffer;
internal IntPtr glMapNamedBufferRange;
internal IntPtr glMemoryBarrier;
internal IntPtr glMemoryBarrierByRegion;
internal IntPtr glMinSampleShading;
internal IntPtr glMultiDrawArrays;
internal IntPtr glMultiDrawArraysIndirect;
internal IntPtr glMultiDrawArraysIndirectCount;
internal IntPtr glMultiDrawElements;
internal IntPtr glMultiDrawElementsBaseVertex;
internal IntPtr glMultiDrawElementsIndirect;
internal IntPtr glMultiDrawElementsIndirectCount;
internal IntPtr glNamedBufferData;
internal IntPtr glNamedBufferStorage;
internal IntPtr glNamedBufferSubData;
internal IntPtr glNamedFramebufferDrawBuffer;
internal IntPtr glNamedFramebufferDrawBuffers;
internal IntPtr glNamedFramebufferParameteri;
internal IntPtr glNamedFramebufferReadBuffer;
internal IntPtr glNamedFramebufferRenderbuffer;
internal IntPtr glNamedFramebufferTexture;
internal IntPtr glNamedFramebufferTextureLayer;
internal IntPtr glNamedRenderbufferStorage;
internal IntPtr glNamedRenderbufferStorageMultisample;
internal IntPtr glObjectLabel;
internal IntPtr glObjectPtrLabel;
internal IntPtr glPatchParameterfv;
internal IntPtr glPatchParameteri;
internal IntPtr glPauseTransformFeedback;
internal IntPtr glPixelStoref;
internal IntPtr glPixelStorei;
internal IntPtr glPointParameterf;
internal IntPtr glPointParameterfv;
internal IntPtr glPointParameteri;
internal IntPtr glPointParameteriv;
internal IntPtr glPointSize;
internal IntPtr glPolygonMode;
internal IntPtr glPolygonOffset;
internal IntPtr glPolygonOffsetClamp;
internal IntPtr glPopDebugGroup;
internal IntPtr glPrimitiveRestartIndex;
internal IntPtr glProgramBinary;
internal IntPtr glProgramParameteri;
internal IntPtr glProgramUniform1d;
internal IntPtr glProgramUniform1dv;
internal IntPtr glProgramUniform1f;
internal IntPtr glProgramUniform1fv;
internal IntPtr glProgramUniform1i;
internal IntPtr glProgramUniform1iv;
internal IntPtr glProgramUniform1ui;
internal IntPtr glProgramUniform1uiv;
internal IntPtr glProgramUniform2d;
internal IntPtr glProgramUniform2dv;
internal IntPtr glProgramUniform2f;
internal IntPtr glProgramUniform2fv;
internal IntPtr glProgramUniform2i;
internal IntPtr glProgramUniform2iv;
internal IntPtr glProgramUniform2ui;
internal IntPtr glProgramUniform2uiv;
internal IntPtr glProgramUniform3d;
internal IntPtr glProgramUniform3dv;
internal IntPtr glProgramUniform3f;
internal IntPtr glProgramUniform3fv;
internal IntPtr glProgramUniform3i;
internal IntPtr glProgramUniform3iv;
internal IntPtr glProgramUniform3ui;
internal IntPtr glProgramUniform3uiv;
internal IntPtr glProgramUniform4d;
internal IntPtr glProgramUniform4dv;
internal IntPtr glProgramUniform4f;
internal IntPtr glProgramUniform4fv;
internal IntPtr glProgramUniform4i;
internal IntPtr glProgramUniform4iv;
internal IntPtr glProgramUniform4ui;
internal IntPtr glProgramUniform4uiv;
internal IntPtr glProgramUniformMatrix2dv;
internal IntPtr glProgramUniformMatrix2fv;
internal IntPtr glProgramUniformMatrix2x3dv;
internal IntPtr glProgramUniformMatrix2x3fv;
internal IntPtr glProgramUniformMatrix2x4dv;
internal IntPtr glProgramUniformMatrix2x4fv;
internal IntPtr glProgramUniformMatrix3dv;
internal IntPtr glProgramUniformMatrix3fv;
internal IntPtr glProgramUniformMatrix3x2dv;
internal IntPtr glProgramUniformMatrix3x2fv;
internal IntPtr glProgramUniformMatrix3x4dv;
internal IntPtr glProgramUniformMatrix3x4fv;
internal IntPtr glProgramUniformMatrix4dv;
internal IntPtr glProgramUniformMatrix4fv;
internal IntPtr glProgramUniformMatrix4x2dv;
internal IntPtr glProgramUniformMatrix4x2fv;
internal IntPtr glProgramUniformMatrix4x3dv;
internal IntPtr glProgramUniformMatrix4x3fv;
internal IntPtr glProvokingVertex;
internal IntPtr glPushDebugGroup;
internal IntPtr glQueryCounter;
internal IntPtr glReadBuffer;
internal IntPtr glReadnPixels;
internal IntPtr glReadPixels;
internal IntPtr glReleaseShaderCompiler;
internal IntPtr glRenderbufferStorage;
internal IntPtr glRenderbufferStorageMultisample;
internal IntPtr glResumeTransformFeedback;
internal IntPtr glSampleCoverage;
internal IntPtr glSampleMaski;
internal IntPtr glSamplerParameterf;
internal IntPtr glSamplerParameterfv;
internal IntPtr glSamplerParameteri;
internal IntPtr glSamplerParameterIiv;
internal IntPtr glSamplerParameterIuiv;
internal IntPtr glSamplerParameteriv;
internal IntPtr glScissor;
internal IntPtr glScissorArrayv;
internal IntPtr glScissorIndexed;
internal IntPtr glScissorIndexedv;
internal IntPtr glShaderBinary;
internal IntPtr glShaderSource;
internal IntPtr glShaderStorageBlockBinding;
internal IntPtr glSpecializeShader;
internal IntPtr glStencilFunc;
internal IntPtr glStencilFuncSeparate;
internal IntPtr glStencilMask;
internal IntPtr glStencilMaskSeparate;
internal IntPtr glStencilOp;
internal IntPtr glStencilOpSeparate;
internal IntPtr glTexBuffer;
internal IntPtr glTexBufferRange;
internal IntPtr glTexImage1D;
internal IntPtr glTexImage2D;
internal IntPtr glTexImage2DMultisample;
internal IntPtr glTexImage3D;
internal IntPtr glTexImage3DMultisample;
internal IntPtr glTexParameterf;
internal IntPtr glTexParameterfv;
internal IntPtr glTexParameteri;
internal IntPtr glTexParameterIiv;
internal IntPtr glTexParameterIuiv;
internal IntPtr glTexParameteriv;
internal IntPtr glTexStorage1D;
internal IntPtr glTexStorage2D;
internal IntPtr glTexStorage2DMultisample;
internal IntPtr glTexStorage3D;
internal IntPtr glTexStorage3DMultisample;
internal IntPtr glTexSubImage1D;
internal IntPtr glTexSubImage2D;
internal IntPtr glTexSubImage3D;
internal IntPtr glTextureBarrier;
internal IntPtr glTextureBuffer;
internal IntPtr glTextureBufferRange;
internal IntPtr glTextureParameterf;
internal IntPtr glTextureParameterfv;
internal IntPtr glTextureParameteri;
internal IntPtr glTextureParameterIiv;
internal IntPtr glTextureParameterIuiv;
internal IntPtr glTextureParameteriv;
internal IntPtr glTextureStorage1D;
internal IntPtr glTextureStorage2D;
internal IntPtr glTextureStorage2DMultisample;
internal IntPtr glTextureStorage3D;
internal IntPtr glTextureStorage3DMultisample;
internal IntPtr glTextureSubImage1D;
internal IntPtr glTextureSubImage2D;
internal IntPtr glTextureSubImage3D;
internal IntPtr glTextureView;
internal IntPtr glTransformFeedbackBufferBase;
internal IntPtr glTransformFeedbackBufferRange;
internal IntPtr glTransformFeedbackVaryings;
internal IntPtr glUniform1d;
internal IntPtr glUniform1dv;
internal IntPtr glUniform1f;
internal IntPtr glUniform1fv;
internal IntPtr glUniform1i;
internal IntPtr glUniform1iv;
internal IntPtr glUniform1ui;
internal IntPtr glUniform1uiv;
internal IntPtr glUniform2d;
internal IntPtr glUniform2dv;
internal IntPtr glUniform2f;
internal IntPtr glUniform2fv;
internal IntPtr glUniform2i;
internal IntPtr glUniform2iv;
internal IntPtr glUniform2ui;
internal IntPtr glUniform2uiv;
internal IntPtr glUniform3d;
internal IntPtr glUniform3dv;
internal IntPtr glUniform3f;
internal IntPtr glUniform3fv;
internal IntPtr glUniform3i;
internal IntPtr glUniform3iv;
internal IntPtr glUniform3ui;
internal IntPtr glUniform3uiv;
internal IntPtr glUniform4d;
internal IntPtr glUniform4dv;
internal IntPtr glUniform4f;
internal IntPtr glUniform4fv;
internal IntPtr glUniform4i;
internal IntPtr glUniform4iv;
internal IntPtr glUniform4ui;
internal IntPtr glUniform4uiv;
internal IntPtr glUniformBlockBinding;
internal IntPtr glUniformMatrix2dv;
internal IntPtr glUniformMatrix2fv;
internal IntPtr glUniformMatrix2x3dv;
internal IntPtr glUniformMatrix2x3fv;
internal IntPtr glUniformMatrix2x4dv;
internal IntPtr glUniformMatrix2x4fv;
internal IntPtr glUniformMatrix3dv;
internal IntPtr glUniformMatrix3fv;
internal IntPtr glUniformMatrix3x2dv;
internal IntPtr glUniformMatrix3x2fv;
internal IntPtr glUniformMatrix3x4dv;
internal IntPtr glUniformMatrix3x4fv;
internal IntPtr glUniformMatrix4dv;
internal IntPtr glUniformMatrix4fv;
internal IntPtr glUniformMatrix4x2dv;
internal IntPtr glUniformMatrix4x2fv;
internal IntPtr glUniformMatrix4x3dv;
internal IntPtr glUniformMatrix4x3fv;
internal IntPtr glUniformSubroutinesuiv;
internal IntPtr glUnmapBuffer;
internal IntPtr glUnmapNamedBuffer;
internal IntPtr glUseProgram;
internal IntPtr glUseProgramStages;
internal IntPtr glValidateProgram;
internal IntPtr glValidateProgramPipeline;
internal IntPtr glVertexArrayAttribBinding;
internal IntPtr glVertexArrayAttribFormat;
internal IntPtr glVertexArrayAttribIFormat;
internal IntPtr glVertexArrayAttribLFormat;
internal IntPtr glVertexArrayBindingDivisor;
internal IntPtr glVertexArrayElementBuffer;
internal IntPtr glVertexArrayVertexBuffer;
internal IntPtr glVertexArrayVertexBuffers;
internal IntPtr glVertexAttrib1d;
internal IntPtr glVertexAttrib1dv;
internal IntPtr glVertexAttrib1f;
internal IntPtr glVertexAttrib1fv;
internal IntPtr glVertexAttrib1s;
internal IntPtr glVertexAttrib1sv;
internal IntPtr glVertexAttrib2d;
internal IntPtr glVertexAttrib2dv;
internal IntPtr glVertexAttrib2f;
internal IntPtr glVertexAttrib2fv;
internal IntPtr glVertexAttrib2s;
internal IntPtr glVertexAttrib2sv;
internal IntPtr glVertexAttrib3d;
internal IntPtr glVertexAttrib3dv;
internal IntPtr glVertexAttrib3f;
internal IntPtr glVertexAttrib3fv;
internal IntPtr glVertexAttrib3s;
internal IntPtr glVertexAttrib3sv;
internal IntPtr glVertexAttrib4bv;
internal IntPtr glVertexAttrib4d;
internal IntPtr glVertexAttrib4dv;
internal IntPtr glVertexAttrib4f;
internal IntPtr glVertexAttrib4fv;
internal IntPtr glVertexAttrib4iv;
internal IntPtr glVertexAttrib4Nbv;
internal IntPtr glVertexAttrib4Niv;
internal IntPtr glVertexAttrib4Nsv;
internal IntPtr glVertexAttrib4Nub;
internal IntPtr glVertexAttrib4Nubv;
internal IntPtr glVertexAttrib4Nuiv;
internal IntPtr glVertexAttrib4Nusv;
internal IntPtr glVertexAttrib4s;
internal IntPtr glVertexAttrib4sv;
internal IntPtr glVertexAttrib4ubv;
internal IntPtr glVertexAttrib4uiv;
internal IntPtr glVertexAttrib4usv;
internal IntPtr glVertexAttribBinding;
internal IntPtr glVertexAttribDivisor;
internal IntPtr glVertexAttribFormat;
internal IntPtr glVertexAttribI1i;
internal IntPtr glVertexAttribI1iv;
internal IntPtr glVertexAttribI1ui;
internal IntPtr glVertexAttribI1uiv;
internal IntPtr glVertexAttribI2i;
internal IntPtr glVertexAttribI2iv;
internal IntPtr glVertexAttribI2ui;
internal IntPtr glVertexAttribI2uiv;
internal IntPtr glVertexAttribI3i;
internal IntPtr glVertexAttribI3iv;
internal IntPtr glVertexAttribI3ui;
internal IntPtr glVertexAttribI3uiv;
internal IntPtr glVertexAttribI4bv;
internal IntPtr glVertexAttribI4i;
internal IntPtr glVertexAttribI4iv;
internal IntPtr glVertexAttribI4sv;
internal IntPtr glVertexAttribI4ubv;
internal IntPtr glVertexAttribI4ui;
internal IntPtr glVertexAttribI4uiv;
internal IntPtr glVertexAttribI4usv;
internal IntPtr glVertexAttribIFormat;
internal IntPtr glVertexAttribIPointer;
internal IntPtr glVertexAttribL1d;
internal IntPtr glVertexAttribL1dv;
internal IntPtr glVertexAttribL2d;
internal IntPtr glVertexAttribL2dv;
internal IntPtr glVertexAttribL3d;
internal IntPtr glVertexAttribL3dv;
internal IntPtr glVertexAttribL4d;
internal IntPtr glVertexAttribL4dv;
internal IntPtr glVertexAttribLFormat;
internal IntPtr glVertexAttribLPointer;
internal IntPtr glVertexAttribP1ui;
internal IntPtr glVertexAttribP1uiv;
internal IntPtr glVertexAttribP2ui;
internal IntPtr glVertexAttribP2uiv;
internal IntPtr glVertexAttribP3ui;
internal IntPtr glVertexAttribP3uiv;
internal IntPtr glVertexAttribP4ui;
internal IntPtr glVertexAttribP4uiv;
internal IntPtr glVertexAttribPointer;
internal IntPtr glVertexBindingDivisor;
internal IntPtr glViewport;
internal IntPtr glViewportArrayv;
internal IntPtr glViewportIndexedf;
internal IntPtr glViewportIndexedfv;
internal IntPtr glWaitSync;
}
}
+224
View File
@@ -0,0 +1,224 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glEnum"
// 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 System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public enum PixelChannelLayout
{
UByte = glConst.UNSIGNED_BYTE,
Byte = glConst.BYTE,
UShort = glConst.UNSIGNED_SHORT,
Short = glConst.SHORT,
UInt = glConst.UNSIGNED_INT,
Int = glConst.INT,
Float = glConst.FLOAT,
UByte332 = glConst.UNSIGNED_BYTE_3_3_2,
UByte233Rev = glConst.UNSIGNED_BYTE_2_3_3_REV,
UShort565 = glConst.UNSIGNED_SHORT_5_6_5,
UShort565Rev = glConst.UNSIGNED_SHORT_5_6_5_REV,
UShort4444 = glConst.UNSIGNED_SHORT_4_4_4_4,
UShort4444Rev = glConst.UNSIGNED_SHORT_4_4_4_4_REV,
UShort5551 = glConst.UNSIGNED_SHORT_5_5_5_1,
UShort1555Rev = glConst.UNSIGNED_SHORT_1_5_5_5_REV,
UInt8888 = glConst.UNSIGNED_INT_8_8_8_8,
UInt8888Rev = glConst.UNSIGNED_INT_8_8_8_8_REV,
UInt1010102 = glConst.UNSIGNED_INT_10_10_10_2,
UInt2101010Rev = glConst.UNSIGNED_INT_2_10_10_10_REV
}
public enum FaceMode
{
Point = glConst.POINT,
Line = glConst.LINE,
Fill = glConst.FILL
}
public enum FrameBufferStatus
{
Complete = glConst.FRAMEBUFFER_COMPLETE, // GL_FRAMEBUFFER_COMPLETE
IncompleteAttachment = glConst.FRAMEBUFFER_INCOMPLETE_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
IncompleteMissingAttachment = glConst.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
IncompleteDrawBuffer = glConst.FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, // GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
IncompleteReadBuffer = glConst.FRAMEBUFFER_INCOMPLETE_READ_BUFFER, // GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
Unsupported = glConst.FRAMEBUFFER_UNSUPPORTED, // GL_FRAMEBUFFER_UNSUPPORTED
IncompleteMultiSample = glConst.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, // GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
IncompleteLayerTargets = glConst.FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS // GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
}
public enum FrameBufferChannel
{
STENCIL_INDEX = glConst.STENCIL_INDEX,
DEPTH_COMPONENT = glConst.DEPTH_COMPONENT,
DEPTH_STENCIL = glConst.DEPTH_STENCIL,
RED = glConst.RED,
GREEN = glConst.GREEN,
BLUE = glConst.BLUE,
RGB = glConst.RGB,
BGR = glConst.BGR,
RGBA = glConst.RGBA,
BGRA = glConst.BGRA
}
public enum FrameBufferAttachment
{
Color = glConst.COLOR_ATTACHMENT0,
Depth = glConst.DEPTH_ATTACHMENT,
Stencil = glConst.STENCIL_ATTACHMENT,
DepthAndStencil = glConst.DEPTH_STENCIL_ATTACHMENT,
}
public enum Texture2DTarget
{
Texture2D = glConst.TEXTURE_2D,
ProxyTexture2D = glConst.PROXY_TEXTURE_2D,
Texture1DArray = glConst.TEXTURE_1D_ARRAY,
ProxyTexture1DArray = glConst.PROXY_TEXTURE_1D_ARRAY,
TextureRectangle = glConst.TEXTURE_RECTANGLE,
ProxyTextureRectangle = glConst.PROXY_TEXTURE_RECTANGLE,
TextureCubeMapPositiveX = glConst.TEXTURE_CUBE_MAP_POSITIVE_X,
TextureCubeMapNegativeX = glConst.TEXTURE_CUBE_MAP_NEGATIVE_X,
TextureCubeMapPositiveY = glConst.TEXTURE_CUBE_MAP_POSITIVE_Y,
TextureCubeMapNegativeY = glConst.TEXTURE_CUBE_MAP_NEGATIVE_Y,
TextureCubeMapPositiveZ = glConst.TEXTURE_CUBE_MAP_POSITIVE_Z,
TextureCubeMapNegativeZ = glConst.TEXTURE_CUBE_MAP_NEGATIVE_Z,
ProxyTextureCubeMap = glConst.PROXY_TEXTURE_CUBE_MAP
}
public enum RenderBufferInternalFormat : uint
{
RGBA8 = glConst.RGBA8,
Depth24_Stencil8 = glConst.DEPTH24_STENCIL8,
}
public enum glOperation : uint
{
StencilTest = glConst.STENCIL_TEST,
DepthTest = glConst.DEPTH_TEST,
PolygonOffsetFill = glConst.POLYGON_OFFSET_FILL,
PolygonOffsetLine = glConst.POLYGON_OFFSET_LINE,
PolygonOffsetPoint = glConst.POLYGON_OFFSET_POINT,
}
#pragma warning disable CA1008
public enum ShaderType : int
#pragma warning restore CA1008
{
Fragment = glConst.FRAGMENT_SHADER,
Vertex = glConst.VERTEX_SHADER,
Compute = glConst.COMPUTE_SHADER,
Geometry = glConst.GEOMETRY_SHADER,
}
#pragma warning disable CA1008
public enum BufferType : int
#pragma warning restore CA1008
{
ArrayBuffer = glConst.ARRAY_BUFFER,
ElementArrayBuffer = glConst.ELEMENT_ARRAY_BUFFER,
AtomicCounterBuffer = glConst.ATOMIC_COUNTER_BUFFER,
CopyHeadBuffer = glConst.COPY_READ_BUFFER,
COPY_WRITE_BUFFER = glConst.COPY_WRITE_BUFFER,
DISPATCH_INDIRECT_BUFFER = glConst.DISPATCH_INDIRECT_BUFFER,
DRAW_INDIRECT_BUFFER = glConst.DRAW_INDIRECT_BUFFER,
PIXEL_PACK_BUFFER = glConst.PIXEL_PACK_BUFFER,
PIXEL_UNPACK_BUFFER = glConst.PIXEL_UNPACK_BUFFER,
QUERY_BUFFER = glConst.QUERY_BUFFER,
ShaderStorageBuffer = glConst.SHADER_STORAGE_BUFFER,
TEXTURE_BUFFER = glConst.TEXTURE_BUFFER,
TRANSFORM_FEEDBACK_BUFFER = glConst.TRANSFORM_FEEDBACK_BUFFER,
UNIFORM_BUFFER = glConst.UNIFORM_BUFFER,
}
#pragma warning disable CA1008
public enum BufferUsage : int
#pragma warning restore CA1008
{
StreamDraw = 0x88E0,
StreamRead = 0x88E1,
StreamCopy = 0x88E2,
StaticDraw = 0x88E4,
StaticRead = 0x88E5,
StaticCopy = 0x88E6,
DynamicDraw = 0x88E8,
DynamicRead = 0x88E9,
DynamicCopy = 0x88EA
}
public enum MaskBufferBit
{
COLOR = glConst.COLOR_BUFFER_BIT,
DEPTH = glConst.DEPTH_BUFFER_BIT,
STENCIL = glConst.STENCIL_BUFFER_BIT,
}
public enum GeometryType : uint
{
POINTS = 0x0000,
LINES = 0x0001,
LINE_LOOP = 0x0002,
LINE_STRIP = 0x0003,
TRIANGLES = 0x0004,
TRIANGLE_STRIP = 0x0005,
TRIANGLE_FAN = 0x0006
}
public enum TextureFiltering
{
Nearest = 0x2600,
Linear = 0x2601
}
}
+98
View File
@@ -0,0 +1,98 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glException"
// 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 System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Text;
namespace StgSharp.Graphics.OpenGL
{
public sealed class GlErrorOverflowException : Exception
{
public GlErrorOverflowException(int errorCount, uint errorCode)
: base(
"Too many opengl error detected at certain position. " + $"The amount of errors exceeds {errorCount}. " + $"Code of the last error is {errorCode}") { }
}
public sealed class GlExecutionException : Exception
{
public GlExecutionException(uint errorCode) : base($"Critical OpenGL error: {errorCode}") { }
}
public sealed class GlArrayFormatException : Exception
{
internal GlArrayFormatException(string message) : base(message) { }
internal GlArrayFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { }
internal GlArrayFormatException(string message, Exception innerException) : base(message, innerException) { }
public GlArrayFormatException(PixelChannelLayout layout, string arrayname)
: base($"{arrayname} cannot be used as layout of {layout}") { }
}
public static partial class GlHelper
{
public static bool CheckArrayFormat(this Array array, PixelChannelLayout layout)
{
return layout switch
{
PixelChannelLayout.Byte or PixelChannelLayout.UByte332 or PixelChannelLayout.UByte233Rev => (array is byte[]) ||
(array is sbyte[]),
PixelChannelLayout.Short => array is short[],
PixelChannelLayout.UShort => array is ushort[],
PixelChannelLayout.Int => array is int[],
PixelChannelLayout.Float => array is float[],
PixelChannelLayout.UShort4444 => (array is ushort[]) || (array is byte[]),
PixelChannelLayout.UByte => (array is byte[]) || (array is sbyte[]),
PixelChannelLayout.UInt => array is uint[],
PixelChannelLayout.UShort565 or
PixelChannelLayout.UShort565Rev or
PixelChannelLayout.UShort4444Rev or
PixelChannelLayout.UShort5551 or
PixelChannelLayout.UShort1555Rev => array is ushort[],
PixelChannelLayout.UInt8888Rev or
PixelChannelLayout.UInt1010102 or
PixelChannelLayout.UInt2101010Rev => array is int[],
PixelChannelLayout.UInt8888 => array is uint[] or byte[],
_ => false,
};
}
}
}
@@ -0,0 +1,92 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glFucntionSourceManager"
// 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;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics.OpenGL
{
public partial class OpenGLFunction
{
private readonly int textureUnitCountGetter;
public int TextureUnitCount
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => textureUnitCountGetter;
}
private ConcurrentQueue<TextureUnit> UnusedTextureImageUint
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
} = [];
internal void ReturnAvailableUnit(IEnumerable<TextureUnit> source)
{
int v = glConst.TEXTURE0 + TextureUnitCount;
foreach (TextureUnit unit in source)
{
if ((int)unit > v) {
throw new InvalidOperationException(
"Source contains texture unit beyond context support.");
}
}
}
internal int TryGetAvailableTextureUnit(int count, out IEnumerable<TextureUnit> result)
{
result = new Queue<TextureUnit>();
for (int i = 0; i < count; i++)
{
if (UnusedTextureImageUint.TryDequeue(out TextureUnit unit))
{
(result as Queue<TextureUnit>)!.Enqueue(unit);
} else
{
return i;
}
}
return count;
}
private ConcurrentQueue<TextureUnit> InitializeUnusedTextureImageUint()
{
ConcurrentQueue<TextureUnit> result = new ConcurrentQueue<TextureUnit>();
for (int index = 0; index < TextureUnitCount; index++) {
result.Enqueue((TextureUnit)(glConst.TEXTURE0 + index));
}
return result;
}
}
}
+817
View File
@@ -0,0 +1,817 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glFunction"
// 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;
using StgSharp.Internal;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Numeric;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
private static readonly Dictionary<IntPtr, OpenGLFunction> contextToGLMap = [];
private static readonly ThreadLocal<OpenGLFunction> _currentGL = new ThreadLocal<OpenGLFunction>();
private OpenglContext* _context;
private Lazy<int> _attachmentColorRange;
private OpenGLFunction()
{
textureUnitCountGetter = glConst.MAX_TEXTURE_IMAGE_UNITS;
UnusedTextureImageUint = [];
_attachmentColorRange = new Lazy<int>(
() => { return GetMaskInteger((uint)glConst.MAX_COLOR_ATTACHMENTS); });
}
public int AttachmentColorRange
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _attachmentColorRange.Value;
}
public static OpenGLFunction CurrentGL
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _currentGL.Value!;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal set => _currentGL.Value = value;
}
internal IntPtr ContextHandle => (IntPtr)_context;
protected ref OpenglContext Context
{
get
{
#if DEBUG
ArgumentNullException.ThrowIfNull(_context, nameof(_context));
#endif
return ref (*_context);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ActiveTextureUnit(
uint type
)
{
_context->glActiveTexture(type);
}
[Conditional("DEBUG")]
public void Assert(
bool shouldReportWhenNormal
)
{
uint code = _context->glGetError();
if (code != glConst.NO_ERROR) {
throw new GlExecutionException(code);
}
if (shouldReportWhenNormal) {
Console.WriteLine("OpenGL runs normally");
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffer(
BufferType bufferType,
GlHandle handle
)
{
_context->glBindBuffer((uint)bufferType, handle.Value);
}
/// <summary>
/// Bind a frame BufferHandle to a frame BufferHandle target Same function as <see ///
/// href="https://docs._gl/gl3/glBindFramebuffer">glBindFramebuffer</see>.
/// </summary>
/// <param _label="target">
/// The frame BufferHandle target of the binding operation.
/// </param>
/// <param _label="handle">
/// The handle of the frame BufferHandle object to bind.
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindFrameBuffer(
FrameBufferTarget target,
GlHandle handle
)
{
_context->glBindFramebuffer((uint)target, handle.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindRenderBuffer(
GlHandle handle
)
{
_context->glBindRenderbuffer(glConst.RENDERBUFFER, handle.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindVertexArray(
GlHandle handle
)
{
_context->glBindVertexArray(handle.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public FrameBufferStatus CheckFrameBufferStatus(
FrameBufferTarget target
)
{
return (FrameBufferStatus)_context->glCheckFramebufferStatus((uint)target);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Clear(
MaskBufferBit mask
)
{
_context->glClear((uint)mask);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearError()
{
uint code = 0;
for (int i = 0; i < 1024; i++)
{
code = _context->glGetError();
if (code == 0) {
return;
}
// Console.WriteLine(code);
}
foreach (ProcessThread thread in Process.GetCurrentProcess().Threads) {
Debugger.Break();
}
throw new GlErrorOverflowException(1024, code);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void ClearGraphicError()
{
while (_context->glGetError() != 0) { }
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CombineFrameBufferRenderBuffer(
FrameBufferAttachment attachment,
GlHandle rboHandle
)
{
_context->glFramebufferRenderbuffer(glConst.FRAMEBUFFER, (uint)attachment,
glConst.RENDERBUFFER, rboHandle.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe GlHandle CreateGraphicProgram()
{
return GlHandle.Create(_context->glCreateProgram());
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe GlHandle[] CreateProgram(
int count
)
{
GlHandle[] h = new GlHandle[count];
for (int i = 0; i < count; i++) {
h.SetValue(i, _context->glCreateProgram());
}
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public GlHandle[] CreateShaderSet(
int count,
ShaderType type
)
{
GlHandle[] ret = new GlHandle[count];
uint t = (uint)type;
for (int i = 0; i < count; i++)
{
uint id = _context->glCreateShader(t);
if (id == 0)
{
uint error = _context->glGetError();
throw new InvalidOperationException($"Failed in creating shader: {error}");
}
ret[i] = GlHandle.Create(id);
}
return ret;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void DeleteBuffer(
GlHandle handle
)
{
_context->glDeleteBuffers(1, (uint*)&handle);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void DeleteBuffers(
GlHandle[] handle
)
{
if ((handle == null) || (handle.Length == 0)) {
throw new ArgumentNullException(nameof(handle));
}
fixed (GlHandle* hptr = handle)
{
uint* iptr = (uint*)hptr;
for (int i = 0; i < handle.Length; i++) {
_context->glDeleteBuffers(1, iptr + i);
}
}
}
/// <summary>
/// Delete a render BufferHandle object Very simlilar function as <see ///
/// 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 _label="bufferHandle">
/// Handle to BufferHandle to delete.
/// </param>
public unsafe void DeleteRenderBuffer(
GlHandle bufferHandle
)
{
_context->glDeleteRenderbuffers(1, &bufferHandle.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void DeleteVertexArrays(
GlHandle[] arrays
)
{
fixed (GlHandle* hptr = arrays)
{
uint* iptr = (uint*)hptr;
for (int i = 0; i < arrays.Length; i++) {
_context->glDeleteVertexArrays(1, iptr + i);
}
}
}
public void DepthMaskAccess(
bool isWrite
)
{
_context->glDepthMask(isWrite ? (byte)1 : (byte)0);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Disable(
glOperation operation
)
{
_context->glDisable((uint)operation);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void DrawArrays(
GeometryType mode,
int first,
int count
)
{
_context->glDrawArrays((uint)mode, first, count);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void DrawElements(
GeometryType mode,
int count,
TypeCode type,
IntPtr ptr
)
{
uint a;
a = type switch
{
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."}"}")
};
_context->glDrawElements((uint)mode, count, a, (nint*)ptr);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstanced(
GeometryType mode,
int count,
TypeCode type,
IntPtr ptr,
int amount
)
{
uint a;
a = type switch
{
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."}"}")
};
_context->glDrawElementsInstanced((uint)mode, count, a, (nint*)ptr, amount);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Enable(
glOperation operation
)
{
_context->glEnable((uint)operation);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FrameBufferTexture2d(
FrameBufferTarget target,
uint attachment,
Texture2DTarget texTarget,
GlHandle textureHandle,
int level
)
{
_context->glFramebufferTexture2D((uint)target, attachment, (uint)texTarget,
textureHandle.Value, level);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe GlHandle[] GenBuffers(
int count
)
{
GlHandle[] h = new GlHandle[count];
fixed (GlHandle* hptr = h)
{
for (int i = 0; i < count; i++) {
_context->glGenBuffers(count, ((uint*)hptr) + i);
}
}
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe GlHandle[] GenRenderBuffer(
int count
)
{
GlHandle[] h = new GlHandle[count];
fixed (GlHandle* hptr = h) {
_context->glGenRenderbuffers(count, (uint*)hptr);
}
return h;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe GlHandle[] GenTextures(
int count
)
{
GlHandle[] h = new GlHandle[count];
fixed (GlHandle* hptr = h) {
_context->glGenTextures(count, (uint*)hptr);
}
return h;
}
public unsafe GlHandle[] GenVertexArrays(
int count
)
{
GlHandle[] h = new GlHandle[count];
fixed (GlHandle* hptr = h) {
_context->glGenVertexArrays(count, (uint*)hptr);
}
return h;
}
public unsafe int GetMaskInteger(
uint statusCode
)
{
int ret = 0;
_context->glGetIntegerv(statusCode, &ret);
return ret;
}
public string GetShaderStatus(
Shader s,
int index,
int key
)
{
IntPtr sptr = IntPtr.Zero;
if (GraphicFramework.glCheckShaderStatus(ref Context, s.handle[index].Value, key,
ref sptr) == 0) {
return Marshal.PtrToStringAnsi(sptr);
}
return string.Empty;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void GetTextureImage<T>(
Texture2DTarget target,
int level,
ImageChannel channel,
PixelChannelLayout channelLayout,
T[] dataStream
) where T : unmanaged,INumber<T>
{
fixed (T* tptr = dataStream) {
_context->glGetTexImage((uint)target, level, (uint)channel, (uint)channelLayout,
(nint*)tptr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetTextureLevelProperty(
uint textureTypeMask,
int level,
uint propertyMask,
out int propertyValue
)
{
fixed (int* iptr = &propertyValue) {
_context->glGetTexLevelParameteriv(textureTypeMask, level, propertyMask, iptr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe GlHandle GetUniformLocation(
GlHandle program,
string name
)
{
byte[] code = Encoding.UTF8.GetBytes(name);
fixed (byte* ptr = code)
{
int ret = _context->glGetUniformLocation(program.Value, ptr);
#if DEBUG
if ((ret == glConst.INVALID_OPERATION) || (ret == glConst.INVALID_VALUE))
{
throw new InvalidOperationException();
}
if (ret == -1) {
throw new UniformEmptyReferenceException(nameof(program), name);
}
#endif
return GlHandle.CreateSigned(ret);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void LoadShaderSource(
GlHandle shaderHandle,
byte[] codeStream
)
{
fixed (byte* streamPtr = codeStream) {
_context->glShaderSource(shaderHandle.Value, 1, &streamPtr, (int*)0);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void LoadShaderSource(
GlHandle shaderHandle,
ReadOnlySpan<char> codeStream
)
{
fixed (char* streamPtr = codeStream) {
_context->glShaderSource(shaderHandle.Value, 1, (byte**)&streamPtr, (int*)0);
}
}
public unsafe void LoadShaderSource(
GlHandle shaderHandle,
ReadOnlySpan<byte> codeStream
)
{
fixed (byte* streamPtr = codeStream)
{
byte* bptr = streamPtr;
_context->glShaderSource(shaderHandle.Value, 1, &bptr, (int*)0);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PolygonMode(
FaceMode mode
)
{
_context->glPolygonMode(glConst.FRONT_AND_BACK, (uint)mode);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ReadPixels(
(int X, int Y) beginPosition,
(int width, int height) size,
FrameBufferChannel format,
PixelChannelLayout dataType,
ref byte[] stream
)
{
fixed (byte* bptr = stream) {
_context->glReadPixels(beginPosition.X, beginPosition.Y, size.width, size.height,
(uint)format, (uint)dataType, (nint*)bptr);
}
}
public void RereadImage(
in Image i,
(int X, int Y) beginPosition,
FrameBufferChannel format,
PixelChannelLayout dataType
)
{
byte[] pixels = i.PixelBuffer;
if (!pixels.CheckArrayFormat(dataType)) {
throw new GlArrayFormatException(dataType, "i.PixelArray");
}
fixed (byte* bptr = pixels) {
_context->glReadPixels(beginPosition.X, beginPosition.Y, i.Width, i.Height,
(uint)format, (uint)dataType, (nint*)bptr);
}
i.PixelUpdateCount++;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetBufferData<T>(
BufferType bufferType,
T bufferData,
BufferUsage usage
) where T : unmanaged,INumber<T>
{
int size = Marshal.SizeOf<T>();
T* p = &bufferData;
_context->glBufferData((uint)bufferType, (nuint)size, (nint*)p, (uint)usage);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetBufferData<T>(
BufferType bufferType,
T[] bufferArray,
BufferUsage usage
) where T : unmanaged,INumber<T>
{
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
if (bufferArray == null) {
return;
}
fixed (void* bufferPtr = bufferArray) {
_context->glBufferData((uint)bufferType, (nuint)size, (nint*)bufferPtr,
(uint)usage);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetBufferData<T>(
BufferType bufferType,
ReadOnlySpan<T> bufferSpan,
BufferUsage usage
) where T : unmanaged,INumber<T>
{
int size = bufferSpan.Length * Marshal.SizeOf<T>();
if (bufferSpan.IsEmpty) {
return;
}
fixed (void* bufferPtr = bufferSpan) {
_context->glBufferData((uint)bufferType, (nuint)size, (IntPtr*)bufferPtr,
(uint)usage);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetBufferData<T>(
BufferType bufferType,
Span<T> bufferArray,
BufferUsage usage
) where T : unmanaged, INumber<T>
{
int size = bufferArray.Length * Marshal.SizeOf<T>();
if (bufferArray.IsEmpty) {
return;
}
fixed (void* bufferPtr = bufferArray) {
_context->glBufferData((uint)bufferType, (nuint)size, (IntPtr*)bufferPtr,
(uint)usage);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetBufferVectorData<T>(
BufferType bufferType,
ReadOnlySpan<T> bufferSpan,
BufferUsage usage
) where T : unmanaged, IUnmanagedVector<T>
{
int size = bufferSpan.Length * Marshal.SizeOf<T>();
fixed (void* bufferPtr = bufferSpan) {
_context->glBufferData((uint)bufferType, (nuint)size, (IntPtr*)bufferPtr,
(uint)usage);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetBufferVectorData<T>(
BufferType bufferType,
T[] bufferArray,
BufferUsage usage
) where T : unmanaged, IUnmanagedVector<T>
{
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
if (bufferArray == null) {
return;
}
fixed (void* bufferPtr = bufferArray) {
_context->glBufferData((uint)bufferType, (nuint)size, (IntPtr*)bufferPtr,
(uint)usage);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetRenderBufferStorage(
RenderBufferInternalFormat internalFormat,
(int width, int height) size
)
{
_context->glRenderbufferStorage(glConst.RENDERBUFFER, (uint)internalFormat, size.width,
size.height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe void SetRenderBufferStorage(
RenderBufferInternalFormat internalFormat,
(uint width, uint height) size
)
{
_context->glRenderbufferStorage(glConst.RENDERBUFFER, (uint)internalFormat,
(int)size.width, (int)size.height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetVertexAttribute(
uint index,
int size,
TypeCode t,
bool normalized,
int stride,
int pointer
)
{
uint type = GraphicFramework.GLtype[(int)t];
_context->glVertexAttribPointer(index, size, type, (byte)(normalized ? 1 : 0), stride,
(nint*)pointer);
_context->glEnableVertexAttribArray(index);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureImage2d<T>(
Texture2DTarget target,
int level,
ImageChannel sourceChannel,
int width,
int height,
ImageChannel targetChannel,
PixelChannelLayout type,
T[] pixels
) where T : unmanaged, INumber<T>
{
fixed (T* tptr = pixels)
{
T* ptr = ((pixels == null) || (pixels.Length == 0)) ? (T*)IntPtr.Zero : tptr;
_context->glTexImage2D((uint)target, level, (int)sourceChannel, width, height, 0,
(uint)targetChannel, (uint)type, (nint*)tptr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureImage2d<T>(
Texture2DTarget target,
int level,
ImageChannel sourceChannel,
int width,
int height,
ImageChannel targetChannel,
PixelChannelLayout type,
Span<T> pixelSpan
) where T : unmanaged, INumber<T>
{
fixed (T* tPtr = pixelSpan) {
_context->glTexImage2D((uint)target, level, (int)sourceChannel, width, height, 0,
(uint)targetChannel, (uint)type, (nint*)tPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureParameter(
int target,
uint pname,
int param
)
{
_context->glTexParameteri((uint)target, pname, param);
}
public static bool TryGetFunctionPackage(
IntPtr handle,
out OpenGLFunction functionPackage
)
{
return contextToGLMap.TryGetValue(handle, out functionPackage);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttributeDivisor(
uint layoutIndex,
uint divisor
)
{
_context->glVertexAttribDivisor(layoutIndex, divisor);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void WaitAccomplishment()
{
_context->glFinish();
}
internal static OpenGLFunction BuildGlFunctionPackage(
IntPtr handle
)
{
if (contextToGLMap.TryGetValue(handle, out OpenGLFunction pack)) {
return pack;
}
pack = new OpenGLFunction
{
_context = (OpenglContext*)handle
};
contextToGLMap.Add(handle, pack);
return pack;
}
~OpenGLFunction()
{
_ = contextToGLMap.Remove(ContextHandle);
}
}
}
File diff suppressed because it is too large Load Diff
+544
View File
@@ -0,0 +1,544 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glFunction.v4_0"
// 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.OpenGL;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BeginQueryIndexed(
uint target,
uint index,
uint id
)
{
_context->glBeginQueryIndexed(target, index, id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTransformFeedback(
uint target,
uint id
)
{
_context->glBindTransformFeedback(target, id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendEquationi(
uint buf,
uint mode
)
{
_context->glBlendEquationi(buf, mode);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendEquationSeparatei(
uint buf,
uint modeRGB,
uint modeAlpha
)
{
_context->glBlendEquationSeparatei(buf, modeRGB, modeAlpha);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendFunci(
uint buf,
uint src,
uint dst
)
{
_context->glBlendFunci(buf, src, dst);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BlendFuncSeparatei(
uint buf,
uint srcRGB,
uint dstRGB,
uint srcAlpha,
uint dstAlpha
)
{
_context->glBlendFuncSeparatei(buf, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DeleteTransformFeedbacks(
int n,
ReadOnlySpan<uint> ids
)
{
fixed (uint* idsPtr = ids) {
_context->glDeleteTransformFeedbacks(n, idsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawArraysIndirect(
uint mode,
ReadOnlySpan<IntPtr> indirect
)
{
fixed (IntPtr* indirectPtr = indirect) {
_context->glDrawArraysIndirect(mode, indirectPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsIndirect(
uint mode,
ShaderType type,
ReadOnlySpan<IntPtr> indirect
)
{
fixed (IntPtr* indirectPtr = indirect) {
_context->glDrawElementsIndirect(mode, (uint)type, indirectPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedback(
uint mode,
uint id
)
{
_context->glDrawTransformFeedback(mode, id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackStream(
uint mode,
uint id,
uint stream
)
{
_context->glDrawTransformFeedbackStream(mode, id, stream);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void EndQueryIndexed(
uint target,
uint index
)
{
_context->glEndQueryIndexed(target, index);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GenTransformFeedbacks(
int n,
uint* ids
)
{
_context->glGenTransformFeedbacks(n, ids);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineName(
GlHandle program,
ShaderType shaderType,
uint index,
int bufSize,
int* length,
byte* name
)
{
_context->glGetActiveSubroutineName(program.Value, (uint)shaderType, index, bufSize,
length, name);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineUniformiv(
GlHandle program,
ShaderType shaderType,
uint index,
uint pName,
int* values
)
{
_context->glGetActiveSubroutineUniformiv(program.Value, (uint)shaderType, index, pName,
values);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveSubroutineUniformName(
GlHandle program,
ShaderType shaderType,
uint index,
int bufSize,
int* length,
byte* name
)
{
_context->glGetActiveSubroutineUniformName(program.Value, (uint)shaderType, index,
bufSize, length, name);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramStageiv(
GlHandle program,
ShaderType shaderType,
uint pName,
int* values
)
{
_context->glGetProgramStageiv(program.Value, (uint)shaderType, pName, values);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetQueryIndexediv(
uint target,
uint index,
uint pName,
int* @params
)
{
_context->glGetQueryIndexediv(target, index, pName, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetSubroutineIndex(
GlHandle program,
ShaderType shaderType,
ReadOnlySpan<byte> name
)
{
fixed (byte* namePtr = name) {
return _context->glGetSubroutineIndex(program.Value, (uint)shaderType, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetSubroutineUniformLocation(
GlHandle program,
ShaderType shaderType,
ReadOnlySpan<byte> name
)
{
fixed (byte* namePtr = name) {
return _context->glGetSubroutineUniformLocation(program.Value, (uint)shaderType, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniformdv(
GlHandle program,
int location,
double* @params
)
{
_context->glGetUniformdv(program.Value, location, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetUniformSubroutineuiv(
ShaderType shaderType,
int location,
uint* @params
)
{
_context->glGetUniformSubroutineuiv((uint)shaderType, location, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public byte IsTransformFeedback(
uint id
)
{
return _context->glIsTransformFeedback(id);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MinSampleShading(
float value
)
{
_context->glMinSampleShading(value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PatchParameterfv(
uint pName,
ReadOnlySpan<float> values
)
{
fixed (float* valuesPtr = values) {
_context->glPatchParameterfv(pName, valuesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PatchParameteri(
uint pName,
int value
)
{
_context->glPatchParameteri(pName, value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PauseTransformFeedback()
{
_context->glPauseTransformFeedback();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ResumeTransformFeedback()
{
_context->glResumeTransformFeedback();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform1d(
int location,
double x
)
{
_context->glUniform1d(location, x);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform1dv(
int location,
int count,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniform1dv(location, count, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform2d(
int location,
double x,
double y
)
{
_context->glUniform2d(location, x, y);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform2dv(
int location,
int count,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniform2dv(location, count, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform3d(
int location,
double x,
double y,
double z
)
{
_context->glUniform3d(location, x, y, z);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform3dv(
int location,
int count,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniform3dv(location, count, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform4d(
int location,
double x,
double y,
double z,
double w
)
{
_context->glUniform4d(location, x, y, z, w);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Uniform4dv(
int location,
int count,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniform4dv(location, count, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix2dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix2dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix2x3dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix2x3dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix2x4dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix2x4dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix3dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix3dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix3x2dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix3x2dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix3x4dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix3x4dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix4dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix4dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix4x2dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix4x2dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformMatrix4x3dv(
int location,
int count,
byte transpose,
ReadOnlySpan<double> value
)
{
fixed (double* valuePtr = value) {
_context->glUniformMatrix4x3dv(location, count, transpose, valuePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void UniformSubroutinesuiv(
ShaderType shaderType,
int count,
ReadOnlySpan<uint> indices
)
{
fixed (uint* indicesPtr = indices) {
_context->glUniformSubroutinesuiv((uint)shaderType, count, indicesPtr);
}
}
}
}
File diff suppressed because it is too large Load Diff
+190
View File
@@ -0,0 +1,190 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glFunction.v4_2"
// 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.OpenGL;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindImageTexture(
uint unit,
GlHandle texture,
int level,
byte layered,
int layer,
uint access,
uint format
)
{
_context->glBindImageTexture(unit, texture.Value, level, layered, layer, access,
format);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawArraysInstancedBaseInstance(
uint mode,
int first,
int count,
int instancecount,
uint baseinstance
)
{
_context->glDrawArraysInstancedBaseInstance(mode, first, count, instancecount,
baseinstance);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstancedBaseInstance(
uint mode,
int count,
ShaderType type,
ReadOnlySpan<IntPtr> indices,
int instancecount,
uint baseinstance
)
{
fixed (IntPtr* indicesPtr = indices) {
_context->glDrawElementsInstancedBaseInstance(mode, count, (uint)type, indicesPtr,
instancecount, baseinstance);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawElementsInstancedBaseVertexBaseInstance(
uint mode,
int count,
ShaderType type,
ReadOnlySpan<IntPtr> indices,
int instancecount,
int basevertex,
uint baseinstance
)
{
fixed (IntPtr* indicesPtr = indices) {
_context->glDrawElementsInstancedBaseVertexBaseInstance(mode, count, (uint)type,
indicesPtr, instancecount,
basevertex, baseinstance);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackInstanced(
uint mode,
uint id,
int instancecount
)
{
_context->glDrawTransformFeedbackInstanced(mode, id, instancecount);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DrawTransformFeedbackStreamInstanced(
uint mode,
uint id,
uint stream,
int instancecount
)
{
_context->glDrawTransformFeedbackStreamInstanced(mode, id, stream, instancecount);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetActiveAtomicCounterBufferiv(
GlHandle program,
GlHandle bufferIndex,
uint pname,
int* @params
)
{
_context->glGetActiveAtomicCounterBufferiv(program.Value, bufferIndex.Value, pname,
@params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetInternalformativ(
uint target,
uint internalformat,
uint pname,
int count,
int* @params
)
{
_context->glGetInternalformativ(target, internalformat, pname, count, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MemoryBarrier(
uint barriers
)
{
_context->glMemoryBarrier(barriers);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage1D(
uint target,
int levels,
uint internalformat,
int width
)
{
_context->glTexStorage1D(target, levels, internalformat, width);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage2D(
uint target,
int levels,
uint internalformat,
int width,
int height
)
{
_context->glTexStorage2D(target, levels, internalformat, width, height);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage3D(
uint target,
int levels,
uint internalformat,
int width,
int height,
int depth
)
{
_context->glTexStorage3D(target, levels, internalformat, width, height, depth);
}
}
}
+584
View File
@@ -0,0 +1,584 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glFunction.v4_3"
// 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.OpenGL;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindVertexBuffer(
uint bindingindex,
GlHandle buffer,
nint offset,
int stride
)
{
_context->glBindVertexBuffer(bindingindex, buffer.Value, offset, stride);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearBufferData(
uint target,
uint internalformat,
uint format,
ShaderType type,
ReadOnlySpan<IntPtr> data
)
{
fixed (IntPtr* dataPtr = data) {
_context->glClearBufferData(target, internalformat, format, (uint)type, dataPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearBufferSubData(
uint target,
uint internalformat,
nint offset,
nuint size,
uint format,
ShaderType type,
ReadOnlySpan<IntPtr> data
)
{
fixed (IntPtr* dataPtr = data) {
_context->glClearBufferSubData(target, internalformat, offset, size, format,
(uint)type, dataPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void CopyImageSubData(
uint srcName,
uint srcTarget,
int srcLevel,
int srcX,
int srcY,
int srcZ,
uint dstName,
uint dstTarget,
int dstLevel,
int dstX,
int dstY,
int dstZ,
int srcWidth,
int srcHeight,
int srcDepth
)
{
_context->glCopyImageSubData(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName,
dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight,
srcDepth);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageCallback(
IntPtr callback,
ReadOnlySpan<IntPtr> userParam
)
{
fixed (IntPtr* userParamPtr = userParam) {
_context->glDebugMessageCallback(callback, userParamPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageControl(
uint source,
ShaderType type,
uint severity,
int count,
ReadOnlySpan<uint> ids,
byte enabled
)
{
fixed (uint* idsPtr = ids) {
_context->glDebugMessageControl(source, (uint)type, severity, count, idsPtr,
enabled);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DebugMessageInsert(
uint source,
ShaderType type,
uint id,
uint severity,
int length,
ReadOnlySpan<byte> buf
)
{
fixed (byte* bufPtr = buf) {
_context->glDebugMessageInsert(source, (uint)type, id, severity, length, bufPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DispatchCompute(
uint num_groups_x,
uint num_groups_y,
uint num_groups_z
)
{
_context->glDispatchCompute(num_groups_x, num_groups_y, num_groups_z);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void DispatchComputeIndirect(
nint indirect
)
{
_context->glDispatchComputeIndirect(indirect);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void FramebufferParameteri(
uint target,
uint pname,
int param
)
{
_context->glFramebufferParameteri(target, pname, param);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetDebugMessageLog(
uint count,
int bufSize,
uint* sources,
uint* types,
uint* ids,
uint* severities,
int* lengths,
byte* messageLog
)
{
return _context->glGetDebugMessageLog(count, bufSize, sources, types, ids, severities,
lengths, messageLog);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetFramebufferParameteriv(
uint target,
uint pname,
int* @params
)
{
_context->glGetFramebufferParameteriv(target, pname, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetInternalformati64v(
uint target,
uint internalformat,
uint pname,
int count,
IntPtr* @params
)
{
_context->glGetInternalformati64v(target, internalformat, pname, count, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetObjectLabel(
uint identifier,
uint name,
int bufSize,
int* length,
byte* label
)
{
_context->glGetObjectLabel(identifier, name, bufSize, length, label);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetObjectPtrLabel(
ReadOnlySpan<IntPtr> ptr,
int bufSize,
int* length,
byte* label
)
{
fixed (IntPtr* ptrPtr = ptr) {
_context->glGetObjectPtrLabel(ptrPtr, bufSize, length, label);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramInterfaceiv(
GlHandle program,
uint programInterface,
uint pname,
int* @params
)
{
_context->glGetProgramInterfaceiv(program.Value, programInterface, pname, @params);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint GetProgramResourceIndex(
GlHandle program,
uint programInterface,
ReadOnlySpan<byte> name
)
{
fixed (byte* namePtr = name) {
return _context->glGetProgramResourceIndex(program.Value, programInterface, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramResourceiv(
GlHandle program,
uint programInterface,
uint index,
int propCount,
ReadOnlySpan<uint> props,
int count,
int* length,
int* @params
)
{
fixed (uint* propsPtr = props) {
_context->glGetProgramResourceiv(program.Value, programInterface, index, propCount,
propsPtr, count, length, @params);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetProgramResourceLocation(
GlHandle program,
uint programInterface,
ReadOnlySpan<byte> name
)
{
fixed (byte* namePtr = name) {
return _context->glGetProgramResourceLocation(program.Value, programInterface, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public int GetProgramResourceLocationIndex(
GlHandle program,
uint programInterface,
ReadOnlySpan<byte> name
)
{
fixed (byte* namePtr = name) {
return _context->glGetProgramResourceLocationIndex(program.Value, programInterface, namePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void GetProgramResourceName(
GlHandle program,
uint programInterface,
uint index,
int bufSize,
int* length,
byte* name
)
{
_context->glGetProgramResourceName(program.Value, programInterface, index, bufSize,
length, name);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateBufferData(
GlHandle buffer
)
{
_context->glInvalidateBufferData(buffer.Value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateBufferSubData(
GlHandle buffer,
nint offset,
nuint length
)
{
_context->glInvalidateBufferSubData(buffer.Value, offset, length);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateFramebuffer(
uint target,
int numAttachments,
ReadOnlySpan<uint> attachments
)
{
fixed (uint* attachmentsPtr = attachments) {
_context->glInvalidateFramebuffer(target, numAttachments, attachmentsPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateSubFramebuffer(
uint target,
int numAttachments,
ReadOnlySpan<uint> attachments,
int x,
int y,
int width,
int height
)
{
fixed (uint* attachmentsPtr = attachments) {
_context->glInvalidateSubFramebuffer(target, numAttachments, attachmentsPtr, x, y,
width, height);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateTexImage(
GlHandle texture,
int level
)
{
_context->glInvalidateTexImage(texture.Value, level);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void InvalidateTexSubImage(
GlHandle texture,
int level,
int xoffset,
int yoffset,
int zoffset,
int width,
int height,
int depth
)
{
_context->glInvalidateTexSubImage(texture.Value, level, xoffset, yoffset, zoffset,
width, height, depth);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawArraysIndirect(
uint mode,
ReadOnlySpan<IntPtr> indirect,
int drawcount,
int stride
)
{
fixed (IntPtr* indirectPtr = indirect) {
_context->glMultiDrawArraysIndirect(mode, indirectPtr, drawcount, stride);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawElementsIndirect(
uint mode,
ShaderType type,
ReadOnlySpan<IntPtr> indirect,
int drawcount,
int stride
)
{
fixed (IntPtr* indirectPtr = indirect) {
_context->glMultiDrawElementsIndirect(mode, (uint)type, indirectPtr, drawcount,
stride);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ObjectLabel(
uint identifier,
uint name,
int length,
ReadOnlySpan<byte> label
)
{
fixed (byte* labelPtr = label) {
_context->glObjectLabel(identifier, name, length, labelPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ObjectPtrLabel(
ReadOnlySpan<IntPtr> ptr,
int length,
ReadOnlySpan<byte> label
)
{
fixed (IntPtr* ptrPtr = ptr)
{
fixed (byte* labelPtr = label) {
_context->glObjectPtrLabel(ptrPtr, length, labelPtr);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PopDebugGroup()
{
_context->glPopDebugGroup();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PushDebugGroup(
uint source,
uint id,
int length,
ReadOnlySpan<byte> message
)
{
fixed (byte* messagePtr = message) {
_context->glPushDebugGroup(source, id, length, messagePtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ShaderStorageBlockBinding(
GlHandle program,
uint storageBlockIndex,
uint storageBlockBinding
)
{
_context->glShaderStorageBlockBinding(program.Value, storageBlockIndex, storageBlockBinding);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexBufferRange(
uint target,
uint internalformat,
GlHandle buffer,
nint offset,
nuint size
)
{
_context->glTexBufferRange(target, internalformat, buffer.Value, offset, size);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage2DMultisample(
uint target,
int samples,
uint internalformat,
int width,
int height,
byte fixedsamplelocations
)
{
_context->glTexStorage2DMultisample(target, samples, internalformat, width, height,
fixedsamplelocations);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TexStorage3DMultisample(
uint target,
int samples,
uint internalformat,
int width,
int height,
int depth,
byte fixedsamplelocations
)
{
_context->glTexStorage3DMultisample(target, samples, internalformat, width, height,
depth, fixedsamplelocations);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void TextureView(
GlHandle texture,
uint target,
GlHandle origtexture,
uint internalformat,
uint minlevel,
uint numlevels,
uint minlayer,
uint numlayers
)
{
_context->glTextureView(texture.Value, target, origtexture.Value, internalformat,
minlevel, numlevels, minlayer, numlayers);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribBinding(
uint attribindex,
uint bindingindex
)
{
_context->glVertexAttribBinding(attribindex, bindingindex);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribFormat(
uint attribindex,
int size,
ShaderType type,
byte normalized,
uint relativeoffset
)
{
_context->glVertexAttribFormat(attribindex, size, (uint)type, normalized,
relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribIFormat(
uint attribindex,
int size,
ShaderType type,
uint relativeoffset
)
{
_context->glVertexAttribIFormat(attribindex, size, (uint)type, relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexAttribLFormat(
uint attribindex,
int size,
ShaderType type,
uint relativeoffset
)
{
_context->glVertexAttribLFormat(attribindex, size, (uint)type, relativeoffset);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void VertexBindingDivisor(
uint bindingindex,
uint divisor
)
{
_context->glVertexBindingDivisor(bindingindex, divisor);
}
}
}
+179
View File
@@ -0,0 +1,179 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glFunction.v4_4"
// 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.OpenGL;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffersBase(
uint target,
uint first,
int count,
ReadOnlySpan<uint> buffers
)
{
fixed (uint* buffersPtr = buffers) {
_context->glBindBuffersBase(target, first, count, buffersPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindBuffersRange(
uint target,
uint first,
int count,
ReadOnlySpan<uint> buffers,
ReadOnlySpan<nint> offsets,
ReadOnlySpan<nuint> sizes
)
{
fixed (uint* buffersPtr = buffers)
{
fixed (nint* offsetsPtr = offsets)
{
fixed (nuint* sizesPtr = sizes) {
_context->glBindBuffersRange(target, first, count, buffersPtr, offsetsPtr,
sizesPtr);
}
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindImageTextures(
uint first,
int count,
ReadOnlySpan<uint> textures
)
{
fixed (uint* texturesPtr = textures) {
_context->glBindImageTextures(first, count, texturesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindSamplers(
uint first,
int count,
ReadOnlySpan<uint> samplers
)
{
fixed (uint* samplersPtr = samplers) {
_context->glBindSamplers(first, count, samplersPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindTextures(
uint first,
int count,
ReadOnlySpan<uint> textures
)
{
fixed (uint* texturesPtr = textures) {
_context->glBindTextures(first, count, texturesPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BindVertexBuffers(
uint first,
int count,
ReadOnlySpan<uint> buffers,
ReadOnlySpan<nint> offsets,
ReadOnlySpan<int> strides
)
{
fixed (uint* buffersPtr = buffers)
{
fixed (nint* offsetsPtr = offsets)
{
fixed (int* stridesPtr = strides) {
_context->glBindVertexBuffers(first, count, buffersPtr, offsetsPtr,
stridesPtr);
}
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void BufferStorage(
uint target,
nuint size,
ReadOnlySpan<IntPtr> data,
uint flags
)
{
fixed (IntPtr* dataPtr = data) {
_context->glBufferStorage(target, size, dataPtr, flags);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearTexImage(
GlHandle texture,
int level,
uint format,
ShaderType type,
ReadOnlySpan<IntPtr> data
)
{
fixed (IntPtr* dataPtr = data) {
_context->glClearTexImage(texture.Value, level, format, (uint)type, dataPtr);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void ClearTexSubImage(
GlHandle texture,
int level,
int xoffset,
int yoffset,
int zoffset,
int width,
int height,
int depth,
uint format,
ShaderType type,
ReadOnlySpan<IntPtr> data
)
{
fixed (IntPtr* dataPtr = data) {
_context->glClearTexSubImage(texture.Value, level, xoffset, yoffset, zoffset, width,
height, depth, format, (uint)type, dataPtr);
}
}
}
}
File diff suppressed because it is too large Load Diff
+102
View File
@@ -0,0 +1,102 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glFunction.v4_6"
// 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.OpenGL;
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Graphics.OpenGL
{
public unsafe partial class OpenGLFunction
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawArraysIndirectCount(
uint mode,
ReadOnlySpan<IntPtr> indirect,
nint drawcount,
int maxdrawcount,
int stride
)
{
fixed (IntPtr* indirectPtr = indirect) {
_context->glMultiDrawArraysIndirectCount(mode, indirectPtr, drawcount, maxdrawcount,
stride);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void MultiDrawElementsIndirectCount(
uint mode,
ShaderType type,
ReadOnlySpan<IntPtr> indirect,
nint drawcount,
int maxdrawcount,
int stride
)
{
fixed (IntPtr* indirectPtr = indirect) {
_context->glMultiDrawElementsIndirectCount(mode, (uint)type, indirectPtr, drawcount,
maxdrawcount, stride);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void PolygonOffsetClamp(
float factor,
float units,
float clamp
)
{
_context->glPolygonOffsetClamp(factor, units, clamp);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SpecializeShader(
GlHandle shader,
ReadOnlySpan<byte> pEntryPoint,
uint numSpecializationConstants,
ReadOnlySpan<uint> pConstantIndex,
ReadOnlySpan<uint> pConstantValue
)
{
fixed (byte* pEntryPointPtr = pEntryPoint)
{
fixed (uint* pConstantIndexPtr = pConstantIndex)
{
fixed (uint* pConstantValuePtr = pConstantValue) {
_context->glSpecializeShader(shader.Value, pEntryPointPtr,
numSpecializationConstants, pConstantIndexPtr,
pConstantValuePtr);
}
}
}
}
}
}
+84
View File
@@ -0,0 +1,84 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glHandle"
// 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 System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.AccessControl;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.OpenGL
{
[StructLayout(LayoutKind.Explicit, Size = 4)]
public struct GlHandle
{
[FieldOffset(0)] internal int SignedValue;
[FieldOffset(0)] internal uint Value;
public GlHandle()
{
Unsafe.SkipInit(out Value);
Unsafe.SkipInit(out SignedValue);
Unsafe.SkipInit(out this);
}
public static GlHandle Zero
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => new GlHandle
{
Value = 0
};
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static GlHandle Create(uint value)
{
return new GlHandle
{
Value = value
};
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static GlHandle CreateSigned(int value)
{
return new GlHandle
{
SignedValue = value
};
}
}
}
@@ -0,0 +1,120 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glRenderObjectGenrator"
// 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 System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.OpenGL
{
public partial class glRender
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected AutoTextureGL CreateAutoTexture(int count)
{
return new AutoTextureGL(count, this);
}
/// <summary>
/// Create a set of <see cref="ElementBuffer" />.
/// </summary>
/// <param _label="count">
/// Amount of EBO to be created.
/// </param>
/// <returns>
///
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected ElementBuffer CreateElementBuffer(int count)
{
return new ElementBuffer(count, this);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected FrameBuffer CreateFrameBuffer(int count)
{
return new FrameBuffer(count, this);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected RenderBuffer CreateRenderBuffer(int count)
{
return new RenderBuffer(count, this);
}
/// <summary>
/// Create a sets of <see cref="TextureGL" />
/// </summary>
/// <param _label="count">
/// Amount of textures to be created.
/// </param>
/// <returns>
///
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected TextureGL CreateTexture(int count)
{
return new TextureGL(count, this);
}
/// <summary>
/// Create a set of <see cref="VertexArray" />.
/// </summary>
/// <param _label="count">
/// Amount of VAO to be created.
/// </param>
/// <returns>
///
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected VertexArray CreateVertexArray(int count)
{
return new VertexArray(count, this);
}
/// <summary>
/// Create a set of <see cref="VertexBuffer" />.
/// </summary>
/// <param _label="count">
/// Amount of Object to be created.
/// </param>
/// <returns>
///
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected VertexBuffer CreateVertexBuffer(int count)
{
return new VertexBuffer(count, this);
}
}
}
@@ -0,0 +1,46 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glRenderThreadSecurity"
// 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 System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.Graphics.OpenGL
{
public partial class glRender
{
private static ConcurrentDictionary<Thread, glRender> threadLocalIndex
= new();
private readonly SynchronizationContext mainThreadContext = SynchronizationContext.Current;
}
}
+197
View File
@@ -0,0 +1,197 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glRenderStream"
// 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.Mathematics;
using StgSharp.Mathematics.Graphics;
using StgSharp.Threading;
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.OpenGL
{
public abstract partial class glRender : RenderStream
{
private protected static readonly ConcurrentDictionary<glRender, Thread> renderToThread
= new ConcurrentDictionary<glRender, Thread>();
private OpenGLFunction _context;
protected internal OpenGLFunction GL
{
get { return _context; }
}
/// <summary>
/// Initialize an opengl context and load all opengl functions.
/// </summary>
public unsafe void InitializeContext()
{
if (ContextHandle == default)
{
ContextHandle = Marshal.AllocHGlobal(Marshal.SizeOf<OpenglContext>());
OpenglContext* contextID = (OpenglContext*)ContextHandle;
contextID->glGetString = (delegate*<uint,byte*>)IntPtr.Zero;
}
if (GL == null) {
_context = OpenGLFunction.BuildGlFunctionPackage(ContextHandle);
}
}
/// <summary>
/// Initialize an OpenGl viewPortDisplay if current form has not been binded to any
/// viewPortDisplay. and set the viewPortDisplay binded to current form as current OpenGL
/// viewPortDisplay.
/// </summary>
/// <exception cref="Exception">
/// Something goes wrong and World fails in creating a new OpenGL viewPortDisplay.
/// </exception>
public unsafe void MakeAsCurrentContext()
{
GraphicFramework.glfwMakeContextCurrent(CanvasHandle);
OpenGLFunction.CurrentGL = this.GL;
}
/// <inheritdoc />
public override void RenderEnd()
{
if (!renderToThread.TryGetValue(this, out Thread t) || t != Thread.CurrentThread) {
throw new InvalidOperationException(
$"Current render has had been binded to thread {t!.ManagedThreadId}");
}
SwapBuffers();
renderToThread[this] = ThreadHelper.EmptyThread;
GraphicFramework.glfwMakeContextCurrent(IntPtr.Zero);
OpenGLFunction.CurrentGL = null;
}
/// <inheritdoc />
public override void RenderStart()
{
Thread current = Thread.CurrentThread;
if (!renderToThread.TryGetValue(this, out Thread t) || t == ThreadHelper.EmptyThread)
{
renderToThread[this] = current;
MakeAsCurrentContext();
return;
}
if (t != current) {
throw new InvalidOperationException(
$"Current render has had been binded to thread {t!.ManagedThreadId}");
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void SetSizeLimit(
int minWidth,
int minHeight,
int maxWidth,
int maxHeight
)
{
GraphicFramework.glfwSetWindowSizeLimits(this.CanvasHandle, minWidth, minHeight,
maxWidth, maxHeight);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal sealed override void PlatformSpecifiedInitialize()
{
InitializeContext();
MakeAsCurrentContext();
glManager.LoadOpenGLApiTo(BindedViewPortContext.GraphicHandle);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal sealed override void Terminate()
{
CustomizeDeinit();
}
protected sealed override Uniform<Matrix44> NativeCameraUniform(
ShaderProgram source,
string name
)
{
NativeCamera.GainAllUniforms(source, name);
return NativeCamera.convertedUniform;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected sealed override void NativeCameraViewRange(
Radius fieldOfRange,
Vec2 offset,
(float frontDepth, float backDepth) viewDepth
)
{
NativeCamera.SetViewRange(fieldOfRange, this.Size, offset, viewDepth);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected sealed override void NativeCameraViewTarget(
Vec3 position,
Vec3 direction,
Vec3 up
)
{
NativeCamera.SetViewDirection(position, direction, up);
}
#region Key Control
protected KeyStatus CheckKey(
KeyboardKey key
)
{
return GraphicFramework.glfwGetKey(this.CanvasHandle, (int)key);
}
protected KeyStatus CheckKey(
Mouse key
)
{
return GraphicFramework.glfwGetKey(this.CanvasHandle, (int)key);
}
protected KeyStatus CheckKey(
Joystick key
)
{
return GraphicFramework.glfwGetKey(this.CanvasHandle, (int)key);
}
#endregion
}
}
+111
View File
@@ -0,0 +1,111 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glType"
// 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 System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics.OpenGL
{
internal delegate void GLVULKANPROCNV();
public unsafe struct glHandleARB(
IntPtr value
) { }
/// <summary>
/// OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1].
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct GlClampF
{
public float value;
public GlClampF(
float a
)
{
value = a;
}
}
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct glHalfNv(
Half bin
)
{
[FieldOffset(0)] public Half binary = bin;
public float ToSingle()
{
return (float)binary;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct glSync
{
public IntPtr Handle;
}
[StructLayout(LayoutKind.Explicit, Size = 8)]
public struct GlFixed
{
[FieldOffset(0)] public int All;
[FieldOffset(0)] public short Decimals;
[FieldOffset(4)] public short Integer;
}
/// <summary>
/// OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the
/// range [0,1].
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct GlClampD
{
public double value;
public GlClampD(
double a
)
{
value = a;
}
}
}
+83
View File
@@ -0,0 +1,83 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="Pixels"
// 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 System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics
{
public interface IPixel
{
public float Red { get; set; }
public float Green { get; set; }
public float Blue { get; set; }
public float Alpha { get; set; }
internal int Size { get; }
}
[StructLayout(LayoutKind.Explicit, Size = 32)]
public unsafe struct Pixel32RGBA : IPixel
{
[FieldOffset(0)] private unsafe fixed byte data[4];
public int Size => 4;
float IPixel.Alpha
{
get => data[3] / 256 ;
set => data[3] = (byte)(value * 256);
}
float IPixel.Blue
{
get => data[2] / 256 ;
set => data[2] = (byte)(value * 256);
}
float IPixel.Green
{
get => data[1] / 256 ;
set => data[1] = (byte)(value * 256);
}
float IPixel.Red
{
get => data[0] / 256 ;
set => data[0] = (byte)(value * 256);
}
}
}
+101
View File
@@ -0,0 +1,101 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="PlainGeometryMesh"
// 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.Geometries;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphics;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphics
{
public class PlainGeometryMesh
{
private PlainGeometry _shape;
private TextureProvider _texture;
public PlainGeometryMesh(
[NotNull] PlainGeometry shape,
[NotNull] TextureProvider texture
)
{
if (shape.VertexCount > texture.TextureCoordinate.Length) {
throw new ArgumentException(
paramName:nameof(texture),
message:"Amount of texture coordination is too less");
}
_texture = texture;
_shape = shape;
}
// private Image _texture;
public PlainGeometryMesh(
PlainGeometry shape,
Image texture,
Vec2[] texCoord
)
{
ArgumentNullException.ThrowIfNull(shape);
ArgumentNullException.ThrowIfNull(texCoord);
if (shape.VertexCount > texCoord.Length) {
throw new ArgumentException(
paramName:nameof(texCoord),
message:"Amount of texture coordination is too less");
}
_texture = new TextureProvider(texture, texCoord);
}
public Vec4[] VertexArray => _shape.VertexStream;
public Image TextureImage
{
get => _texture.ProvideImage();
internal set => _texture.ReadImage(value);
}
public ReadOnlySpan<int> MeshIndices => _shape.VertexIndices;
public ReadOnlySpan<Vec4> TextureCoord => MemoryMarshal.Cast<Vec2, Vec4>(
_texture.TextureCoordinate);
public PlainGeometryMesh Resize(
PlainGeometry newShape
)
{
return new PlainGeometryMesh(newShape, _texture);
}
}
}
+268
View File
@@ -0,0 +1,268 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="RenderStream"
// 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.OpenGL;
using StgSharp.Mathematics;
using StgSharp.Mathematics.Graphics;
using StgSharp.Timing;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics
{
public abstract class RenderStream
{
private Camera nativeCamera;
private protected ViewPort primeArgs;
internal TimeSpanProvider _timeProvider;
public (int width, int height) Size
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => (Width, Height);
}
public abstract bool IsContextSharable { get; }
public int Height
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => primeArgs.Height;
}
public int Width
{
get => primeArgs.Width;
}
public IntPtr Monitor
{
get => primeArgs.Monitor;
internal set => primeArgs.Monitor = value;
}
public string Name
{
get => primeArgs.Name;
}
public ViewPort BindedViewPortContext
{
get => primeArgs;
internal set => primeArgs = value;
}
internal IntPtr CanvasHandle
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => primeArgs.ViewPortHandle;
}
internal IntPtr ContextHandle
{
get => primeArgs.GraphicHandle;
private protected set => primeArgs.GraphicHandle = value;
}
protected internal Camera NativeCamera
{
get => nativeCamera;
internal set => nativeCamera = value;
}
protected float FramePassed
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _timeProvider.CurrentSpan;
}
protected int PassedFrames
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _timeProvider.CurrentSpan;
}
protected float TimePassed
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => (float)_timeProvider.CurrentSecond;
}
protected TimeSpanProvider TimeProvider
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _timeProvider;
}
/// <summary>
/// Set the Size limit of current form
/// </summary>
/// <param _label="minWidth">
/// Minimum width of current form
/// </param>
/// <param _label="minHeight">
/// Minimum height of current form
/// </param>
/// <param _label="maxWidth">
/// Maximum width of current form
/// </param>
/// <param _label="maxHeight">
/// Maximum height of current form
/// </param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public abstract void SetSizeLimit(
int minWidth,
int minHeight,
int maxWidth,
int maxHeight
);
public static TTarget ShareContextFrom<TSource, TTarget>(
[NotNull]TSource source
) where TSource : RenderStream where TTarget : RenderStream, new()
{
TTarget target = new TTarget();
target.Initialize(source.BindedViewPortContext, source._timeProvider);
return target;
}
/**/
protected internal static void PollEvents()
{
GraphicFramework.glfwPollEvents();
}
private protected void SwapBuffers()
{
GraphicFramework.glfwSwapBuffers(CanvasHandle);
}
/**/
#region native camera operation
protected abstract void NativeCameraViewRange(
Radius fieldOfRange,
Vec2 offset,
(float frontDepth, float backDepth) viewDepth
);
protected abstract void NativeCameraViewTarget(
Vec3 position,
Vec3 direction,
Vec3 up
);
/// <summary>
/// Get <see cref="Uniform{T}" />(TView is <see cref="Matrix44" />) uniform from a shader.
/// This uniform will be used as projection matrix of this camera. Additionally, for
/// multi- shader rendering, each shader requires a uniform, so do not ignore return
/// value of this method.
/// </summary>
/// <param _label="source">
/// Shader using this camera
/// </param>
/// <param _label="name">
/// ContextName of projection camera named in shader
/// </param>
/// <returns>
/// <see cref="Uniform{T}" />(TView is <see cref="Matrix44" />) representing projection
/// matrix in shader program.
/// </returns>
protected abstract Uniform<Matrix44> NativeCameraUniform(
ShaderProgram source,
string name
);
#endregion
#region internal operation
public void Initialize(
ViewPort v,
TimeSpanProvider timeProvider
)
{
if (v == null) {
throw new ArgumentNullException(nameof(v));
}
primeArgs = v;
this._timeProvider = timeProvider;
nativeCamera = new Camera();
PlatformSpecifiedInitialize();
CustomizeInit();
GraphicFramework.glfwMakeContextCurrent(IntPtr.Zero);
}
internal abstract void PlatformSpecifiedInitialize();
internal abstract void Terminate();
#endregion
#region public operation
protected abstract void CustomizeDeinit();
protected abstract void CustomizeInit();
/// <summary>
/// Marking the start of current render operations, and set this renser context as
/// current.
/// </summary>
public abstract void RenderStart();
/// <summary>
/// Marking the end of current render operations, and release the binding of this renser
/// context to current, making it available for another thread as current.
/// </summary>
public abstract void RenderEnd();
#endregion
#region public resource generator
protected abstract Shader CreateShaderSegment(
ShaderType type,
int count
);
protected abstract ShaderProgram CreateShaderProgram();
#endregion
}
}
@@ -0,0 +1,203 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ShaderGenerator"
// 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 StgSharp.Mathematics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.ShaderEdit
{
public class ShaderGenerator
{
private Dictionary<int, ShaderParameter> uniformDefine;
private List<string> codeList;
private List<ShaderFunction> usedShaderFunctions;
public Uniform<T> DefineUniform<T>(string name, int index) where T: unmanaged
{
ShaderParameter p = new ShaderParameter(name, ShaderParameter.TypeMarshal<T>());
uniformDefine.Add(index, p);
// return new Uniform<TView>();
throw new NotImplementedException();
}
}
public class ShaderFunction
{
private List<string> codeList;
private List<ShaderParameter> inputList;
private ShaderParameter outPut;
private string name;
public int ParameterCount => inputList.Count;
public void EmitCall(ShaderFunction function, ShaderParameter outPut, params ShaderParameter[] inputParams)
{
if (inputParams.Length != function.ParameterCount)
{
// Param list length not equal
throw new ArgumentException(
"Provided parameters does not match function's parameter list.");
}
if (!ShaderParameter.IsSameType(outPut, function.outPut))
{
// Type of returning value not equal
throw new ArgumentException(
"Provided parameters does not match function's parameter list.");
}
for (int i = 0; i < inputParams.Length; i++)
{
if (!ShaderParameter.IsSameType(function.inputList[i], inputParams[i]))
{
// Input type not match
throw new InvalidCastException(
"Provided parameters does not match function's parameter list.");
}
}
string codeLine = string.Empty; // adding a line like " outvalue = Func(input1, input2,...); "
if (outPut != ShaderParameter.Void) {
codeLine += $"{outPut.name} = ";
}
codeLine += $"{function.name}(";
foreach (ShaderParameter inputParam in inputParams) {
codeLine += inputParam.name;
}
codeLine += ");\n";
codeList.Add(codeLine);
}
}
public class ShaderParameter
{
public static readonly ShaderParameter Void = new ShaderParameter(
string.Empty, InternalShaderType.Void);
internal readonly bool isReadOnly;
internal readonly InternalShaderType type;
internal readonly string name;
public ShaderParameter(string name, InternalShaderType type)
{
this.name = name;
this.type = type;
isReadOnly = false;
}
public static bool IsSameType(ShaderParameter param1, ShaderParameter param2)
{
if (param1.type != InternalShaderType.Struct)
{
return param1.type == param2.type;
} else
{
throw new Exception("Struct is currently not supported.");
}
}
public static InternalShaderType TypeMarshal<T>() where T: unmanaged
{
switch (Type.GetTypeCode(typeof(T)))
{
case TypeCode.Single:
return InternalShaderType.Float;
case TypeCode.Double:
return InternalShaderType.Double;
case TypeCode.Int32:
return InternalShaderType.Int;
case TypeCode.UInt32:
return InternalShaderType.UInt;
default:
break;
}
switch (typeof(T).Name)
{
case "vec4d":
return InternalShaderType.Vector4;
case "Matrix2x2":
return InternalShaderType.Matrix2x2;
case "Matrix2x3":
return InternalShaderType.Matrix2x3;
case "Matrix2x4":
return InternalShaderType.Matrix2x4;
case "Matrix3x2":
return InternalShaderType.Matrix3x2;
case "Matrix3x3":
return InternalShaderType.Matrix3x3;
case "Matrix3x4":
return InternalShaderType.Matrix3x4;
case "Matrix4x2":
return InternalShaderType.Matrix4x2;
case "Matrix4x3":
return InternalShaderType.Matrix4x3;
case "Matrix4x4":
return InternalShaderType.Matrix4x4;
default:
throw new ArgumentException("Not supported shader data type.");
}
}
}
public enum InternalShaderType
{
#pragma warning disable CS1591
Struct,
Void,
Int,
UInt,
Float,
Double,
Vector2,
Vector3,
Vector4,
VectorD2,
VectorD3,
VectorD4,
Matrix2x2,
Matrix2x3,
Matrix2x4,
Matrix3x2,
Matrix3x3,
Matrix3x4,
Matrix4x2,
Matrix4x3,
Matrix4x4,
#pragma warning restore CS1591
}
}
@@ -0,0 +1,96 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ShaderStruct"
// 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.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.ShaderEdit
{
public class ShaderStructMember
{
internal InternalShaderType type;
internal object value;
}
public class ShaderStruct
{
internal Dictionary<GlHandle, ShaderStructMember> uniformPair;
internal ShaderStruct() { }
public ShaderStruct(params (GlHandle, ShaderStructMember)[] uniformPairs)
{
uniformPair = new Dictionary<GlHandle, ShaderStructMember>();
if (uniformPairs.Length == 0) {
return;
}
foreach ((GlHandle, ShaderStructMember) item in uniformPairs) {
uniformPair.Add(item.Item1, item.Item2);
}
}
public unsafe void SetAllUniforms()
{
OpenglContext* gl = (OpenglContext*)OpenGL.OpenGLFunction.CurrentGL.ContextHandle;
foreach (KeyValuePair<GlHandle, ShaderStructMember> uniform in uniformPair)
{
int id = uniform.Key.SignedValue;
ShaderStructMember s = uniform.Value;
switch (s.type)
{
case InternalShaderType.Struct:
throw new ArgumentException(
"Incorrect type \"Struct\" defined in this self define type");
case InternalShaderType.Void:
throw new ArgumentException(
"Incorrect type \"Void\" defined in this self define type");
case InternalShaderType.Float:
gl->glUniform1f(id, (float)s.value);
break;
case InternalShaderType.Int:
gl->glUniform1f(id, (int)s.value);
break;
default:
throw new NotImplementedException();
throw new ArgumentException(
"Incorrect type \"Unknown\" defined in this self define type");
}
}
}//------------------------------------ End of Class ---------------------------------------
}
}
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\StgSharp.Common\StgSharp.Common.csproj" />
<ProjectReference Include="..\StgSharp.Mathematics\StgSharp.Mathematics.csproj" />
</ItemGroup>
</Project>
+64
View File
@@ -0,0 +1,64 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="TexturePipeline"
// 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.PipeLine;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics
{
public class TexturePipeline : IPipeLineConnectionPayload
{
private Image _value;
public TexturePipeline(Image i)
{
_value = i;
}
public object? ValueDefault => null;
public object Value
{
get => _value;
set
{
ArgumentNullException.ThrowIfNull(value);
if (value is not Image image) {
throw new ArgumentException("Value must be of type Image");
}
_value = image;
}
}
}
}
+95
View File
@@ -0,0 +1,95 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="TextureProvider"
// 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.Mathematics.Graphics;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace StgSharp.Graphics
{
public class TextureProvider : IImageProvider
{
private Vec2[] _texCoord;
private Image _tex;
public TextureProvider(
Image image,
Vec2[] coord
)
{
_tex = image;
_texCoord = coord;
}
public ref Vec2 this[
int index
]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ref _texCoord[index];
}
public Span<Vec2> TextureCoordinate
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => new Span<Vec2>(_texCoord);
}
public Image ProvideImage()
{
return _tex;
}
public void ReadImage(
IImageProvider provider
)
{
_tex = provider.ProvideImage();
}
public void UpdateFromImage(
[NotNull]Image i
)
{
if (i == _tex) {
return;
}
if (i.Size == _tex.Size)
{
_tex = i;
} else
{
throw new ArgumentException(
$"Size of {nameof(i)} does not equals to current image.");
}
}
}
}
+132
View File
@@ -0,0 +1,132 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="ViewPort"
// 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 System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
namespace StgSharp.Graphics
{
public class ViewPort
{
private static readonly ConcurrentDictionary<IntPtr, ViewPort> _handleToViewPortIndex = [];
private int _width, _height, _newWidth, _newHeight;
internal unsafe ViewPort()
{
_newHeight = 600;
_newWidth = 800;
FlushSize();
Name = new StackFrame(1, false).
GetMethod()!.DeclaringType!.Name;
Monitor = IntPtr.Zero;
ViewPortHandle = GraphicFramework.glfwCreateWindow(_newWidth, _newHeight,
Encoding.UTF8.GetBytes(Name),
Monitor, IntPtr.Zero);
if (ViewPortHandle == IntPtr.Zero) {
throw new InvalidOperationException("Unable to create viewport handle.");
}
_ = _handleToViewPortIndex.TryAdd(ViewPortHandle, this);
}
public unsafe ViewPort(
int width,
int height,
string name,
IntPtr monitor
)
{
_newWidth = width;
_newHeight = height;
FlushSize();
Name = name;
Monitor = monitor;
ViewPortHandle = GraphicFramework.glfwCreateWindow(_newWidth, _newHeight,
Encoding.UTF8.GetBytes(Name),
Monitor, IntPtr.Zero);
if (ViewPortHandle == IntPtr.Zero) {
throw new InvalidOperationException("Unable to create viewport handle.");
}
_ = _handleToViewPortIndex.TryAdd(ViewPortHandle, this);
}
public unsafe int Height
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _height;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal set => Interlocked.Exchange(ref _height, value);
}
public unsafe int Width
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => _width;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal set => Interlocked.Exchange(ref _width, value);
}
public IntPtr GraphicHandle { get; internal set; }
public IntPtr Monitor { get; internal set; }
public IntPtr ViewPortHandle { get; private set; }
public string Name { get; set; }
// [BlueprintNodeExecution]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool GetExistedViewPort(
IntPtr handle,
out ViewPort port
)
{
return _handleToViewPortIndex.TryGetValue(handle, out port);
}
internal unsafe void FlushSize()
{
_ = Interlocked.Exchange(ref _height, _newHeight);
_ = Interlocked.Exchange(ref _width, _newWidth);
}
internal void RequestFlushSizeInNextFrame(
int width,
int height
)
{
_ = Interlocked.Exchange(ref _newHeight, height);
_ = Interlocked .Exchange(ref _newWidth, width);
}
}
}
+76
View File
@@ -0,0 +1,76 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="vkEnum"
// 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 System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphics.Vulkan
{
internal enum VkStructureType : uint
{
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
}
internal enum VkResult
{
VK_SUCCESS = 0,
VK_NOT_READY = 1,
VK_TIMEOUT = 2,
VK_EVENT_SET = 3,
VK_EVENT_RESET = 4,
VK_INCOMPLETE = 5,
VK_ERROR_OUT_OF_HOST_MEMORY = -1,
VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
VK_ERROR_INITIALIZATION_FAILED = -3,
VK_ERROR_DEVICE_LOST = -4,
VK_ERROR_MEMORY_MAP_FAILED = -5,
VK_ERROR_LAYER_NOT_PRESENT = -6,
VK_ERROR_EXTENSION_NOT_PRESENT = -7,
VK_ERROR_FEATURE_NOT_PRESENT = -8,
VK_ERROR_INCOMPATIBLE_DRIVER = -9,
VK_ERROR_TOO_MANY_OBJECTS = -10,
VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
VK_ERROR_SURFACE_LOST_KHR = -1000000000,
VK_SUBOPTIMAL_KHR = 1000001003,
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
VK_RESULT_MAX_ENUM = 0x7FFFFFFF
}
}
+48
View File
@@ -0,0 +1,48 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="vkHandle"
// 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Graphics.Vulkan
{
[StructLayout(LayoutKind.Explicit, Size = 8)]
public struct vkHandle
{
[FieldOffset(0)] public int SignedHalfValue;
[FieldOffset(0)] public IntPtr Handle;
[FieldOffset(0)] public IntPtr UnsignedHandle;
[FieldOffset(0)] public uint HalfValue;
}
}
+109
View File
@@ -0,0 +1,109 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="framework"
// 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 System;
using System.Runtime.InteropServices;
#if Windows
// using Windows.Win32;
#endif
namespace StgSharp.Graphics
{
/// <summary>
/// Function handler to load an opengl function by searching its _label.
/// </summary>
/// <param _label="name">
/// the _label of the Opengl function
/// </param>
/// <returns>
/// An Intptr value representing the pointer to the function
/// </returns>
public delegate IntPtr glLoader(
string name
);
#region StgSharpDele
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate void FrameBufferSizeHandler(
IntPtr window,
int width,
int height
);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate void FramePositionHandler(
IntPtr window,
float width,
float height
);
#endregion
#region glDEBUG
internal unsafe delegate void GLDEBUGPROC(
int source,
int type,
uint id,
int severity,
int length,
sbyte* message,
void* userParam
);
internal unsafe delegate void GLDEBUGPROCARB(
int source,
int type,
uint id,
int severity,
int length,
sbyte* message,
void* userParam
);
internal unsafe delegate void GLDEBUGPROCKHR(
int source,
int type,
uint id,
int severity,
int length,
sbyte* message,
void* userParam
);
internal unsafe delegate void GLDEBUGPROCAMD(
uint id,
int category,
int severity,
int length,
sbyte* message,
void* userParam
);
#endregion
}
+74
View File
@@ -0,0 +1,74 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="frameworkSyncContext"
// 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 System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.Threading
{
public class FrameworkSyncContext : SynchronizationContext
{
private readonly BlockingCollection<SendOrPostCallback> _syncContexts = [];
private readonly Thread _mainThread = Thread.CurrentThread;
public FrameworkSyncContext()
{
_mainThread = Thread.CurrentThread;
}
public static FrameworkSyncContext MainThreadContext
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get;
} = new FrameworkSyncContext();
public override void Post(SendOrPostCallback d, object state)
{
_syncContexts.Add(d);
}
public override void Send(SendOrPostCallback d, object state)
{
if (Thread.CurrentThread == _mainThread)
{
d(state);
} else
{
Post(d, state);
}
}
}
}
+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
}
}
File diff suppressed because it is too large Load Diff
+108
View File
@@ -0,0 +1,108 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="StructDefine"
// 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.Runtime.InteropServices;
/**/
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
public unsafe struct glfwContext { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct glfwVideomode { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct glfwGammaramp { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWimage { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWgamepadstate { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWallocator { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct glfwMonitor { }
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct glfwWindow { }
[StructLayout(LayoutKind.Sequential)]
public struct GLFWwindowCallback { }
[StructLayout(LayoutKind.Sequential)]
public struct GLFWcursor { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWinitconfig { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWwndconfig { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWctxconfig { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWfbconfig { }
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWlibrary { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWmapelement { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWmapping { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWjoystick { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWls { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWplatform { }
[StructLayout(LayoutKind.Sequential)]
public unsafe struct GLFWmutex { }
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct VkExtensionProperties { }
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct uintptr_t { }
}
/**/
+161
View File
@@ -0,0 +1,161 @@
//-----------------------------------------------------------------------
// -----------------------------------------------------------------------
// file="glfw.function"
// 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 System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace StgSharp.Internal
{
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct GLFWFunction
{
public delegate* unmanaged[Cdecl]<IntPtr, int, int, IntPtr> glfwCreateCursor;
public delegate* unmanaged[Cdecl]<int, IntPtr> glfwCreateStandardCursor;
public delegate* unmanaged[Cdecl]<int, int, byte*, IntPtr, IntPtr, IntPtr> glfwCreateWindow;
public delegate* unmanaged[Cdecl]<void> glfwDefaultWindowHints;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwDestroyCursor;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwDestroyWindow;
public delegate* unmanaged[Cdecl]<byte*, int> glfwExtensionSupported;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwFocusWindow;
public delegate* unmanaged[Cdecl]<IntPtr, byte*> glfwGetClipboardString;
public delegate* unmanaged[Cdecl]<IntPtr> glfwGetCurrentContext;
public delegate* unmanaged[Cdecl]<IntPtr, double*, double*, void> glfwGetCursorPos;
public delegate* unmanaged[Cdecl]<byte**, int> glfwGetError;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetFrameBufferSize;
public delegate* unmanaged[Cdecl]<int, byte*> glfwGetGamepadName;
public delegate* unmanaged[Cdecl]<int, IntPtr, int> glfwGetGamepadState;
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr> glfwGetGammaRamp;
public delegate* unmanaged[Cdecl]<IntPtr, int, int> glfwGetInputMode;
public delegate* unmanaged[Cdecl]<int, int*, float*> glfwGetJoystickAxes;
public delegate* unmanaged[Cdecl]<int, int*, byte*> glfwGetJoystickButtons;
public delegate* unmanaged[Cdecl]<int, byte*> glfwGetJoystickGUID;
public delegate* unmanaged[Cdecl]<int, int*, byte*> glfwGetJoystickHats;
public delegate* unmanaged[Cdecl]<int, byte*> glfwGetJoystickName;
public delegate* unmanaged[Cdecl]<int, void*> glfwGetJoystickUserPointer;
public delegate* unmanaged[Cdecl]<IntPtr, int, KeyStatus> glfwGetKey;
public delegate* unmanaged[Cdecl]<int, int, byte*> glfwGetKeyName;
public delegate* unmanaged[Cdecl]<int, int> glfwGetKeyScancode;
public delegate* unmanaged[Cdecl]<IntPtr, float*, float*, void> glfwGetMonitorContentScale;
public delegate* unmanaged[Cdecl]<IntPtr, byte*> glfwGetMonitorName;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetMonitorPhysicalSize;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetMonitorPos;
public delegate* unmanaged[Cdecl]<int*, IntPtr*> glfwGetMonitors;
public delegate* unmanaged[Cdecl]<IntPtr, void*> glfwGetMonitorUserPointer;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, int*, int*, void> glfwGetMonitorWorkarea;
public delegate* unmanaged[Cdecl]<IntPtr, int, int> glfwGetMouseButton;
public delegate* unmanaged[Cdecl]<IntPtr> glfwGetPrimaryMonitor;
public delegate* unmanaged[Cdecl]<byte*, IntPtr> glfwGetProcAddress;
public delegate* unmanaged[Cdecl]<uint*, byte**> glfwGetRequiredInstanceExtensions;
public delegate* unmanaged[Cdecl]<double> glfwGetTime;
public delegate* unmanaged[Cdecl]<ulong> glfwGetTimerFrequency;
public delegate* unmanaged[Cdecl]<ulong> glfwGetTimerValue;
public delegate* unmanaged[Cdecl]<int*, int*, int*, void> glfwGetVersion;
public delegate* unmanaged[Cdecl]<byte*> glfwGetVersionString;
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr> glfwGetVideoMode;
public delegate* unmanaged[Cdecl]<IntPtr, int*, IntPtr*> glfwGetVideoModes;
public delegate* unmanaged[Cdecl]<IntPtr, int, int> glfwGetWindowAttrib;
public delegate* unmanaged[Cdecl]<IntPtr, float*, float*, void> glfwGetWindowContentScale;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, int*, int*, void> glfwGetWindowFrameSize;
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr> glfwGetWindowMonitor;
public delegate* unmanaged[Cdecl]<IntPtr, float> glfwGetWindowOpacity;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetWindowPos;
public delegate* unmanaged[Cdecl]<IntPtr, int*, int*, void> glfwGetWindowSize;
public delegate* unmanaged[Cdecl]<IntPtr, void*> glfwGetWindowUserPointer;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwHideWindow;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwIconifyWindow;
public delegate* unmanaged[Cdecl]<int> glfwInit;
public delegate* unmanaged[Cdecl]<int, int, void> glfwInitHint;
public delegate* unmanaged[Cdecl]<int, int> glfwJoystickIsGamePad;
public delegate* unmanaged[Cdecl]<int, int> glfwJoystickPresent;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwMakeContextCurrent;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwMaximizeWindow;
public delegate* unmanaged[Cdecl]<void> glfwPollEvents;
public delegate* unmanaged[Cdecl]<void> glfwPostEmptyEvent;
public delegate* unmanaged[Cdecl]<int> glfwRawMouseMotionSupported;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwRequestWindowAttention;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwRestoreWindow;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, uint, void>, delegate* unmanaged[Cdecl]<IntPtr, uint, void>> glfwSetCharCallback;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, uint, int, void>, delegate* unmanaged[Cdecl]<IntPtr, uint, int, void>> glfwSetCharModsCallback;
public delegate* unmanaged[Cdecl]<IntPtr, byte*, void> glfwSetClipboardString;
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr, void> glfwSetCursor;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetCursorEnterCallback;
public delegate* unmanaged[Cdecl]<IntPtr, double, double, void> glfwSetCursorPos;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>> glfwSetCursorPosCallback;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void>, delegate* unmanaged[Cdecl]<IntPtr, int, byte**, void>> glfwSetDropCallback;
public delegate* unmanaged[Cdecl]<delegate* unmanaged[Cdecl]<int, byte*, void>, delegate* unmanaged[Cdecl]<int, byte*, void>> glfwSetErrorCallback;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>> glfwSetFramebufferSizeCallback;
public delegate* unmanaged[Cdecl]<IntPtr, float, void> glfwSetGamma;
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr, void> glfwSetGammaRamp;
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetInputMode;
public delegate* unmanaged[Cdecl]<delegate* unmanaged[Cdecl]<int, int, void>, delegate* unmanaged[Cdecl]<int, int, void>> glfwSetJoystickCallback;
public delegate* unmanaged[Cdecl]<IntPtr, void*, void> glfwSetJoystickUserPointer;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, int, int, void>> glfwSetKeyCallback;
public delegate* unmanaged[Cdecl]<delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetMonitorCallback;
public delegate* unmanaged[Cdecl]<IntPtr, void*, void> glfwSetMonitorUserPointer;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, int, void>> glfwSetMouseButtonCallback;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>, delegate* unmanaged[Cdecl]<IntPtr, double, double, void>> glfwSetScrollCallback;
public delegate* unmanaged[Cdecl]<double, void> glfwSetTime;
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowAspectRatio;
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowAttrib;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, void>, delegate* unmanaged[Cdecl]<IntPtr, void>> glfwSetWindowCloseCallback;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, float, float, void>, delegate* unmanaged[Cdecl]<IntPtr, float, float, void>> glfwSetWindowContentScaleCallback;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetWindowFocusCallback;
public delegate* unmanaged[Cdecl]<IntPtr, int, IntPtr, void> glfwSetWindowIcon;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetWindowIconifyCallback;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, void>> glfwSetWindowMaximizeCallback;
public delegate* unmanaged[Cdecl]<IntPtr, IntPtr, int, int, int, int, int, void> glfwSetWindowMonitor;
public delegate* unmanaged[Cdecl]<IntPtr, float, void> glfwSetWindowOpacity;
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowPos;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>> glfwSetWindowPosCallback;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, void>, delegate* unmanaged[Cdecl]<IntPtr, void>> glfwSetWindowRefreshCallback;
public delegate* unmanaged[Cdecl]<IntPtr, int, void> glfwSetWindowShouldClose;
public delegate* unmanaged[Cdecl]<IntPtr, int, int, void> glfwSetWindowSize;
public delegate* unmanaged[Cdecl]<IntPtr, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>, delegate* unmanaged[Cdecl]<IntPtr, int, int, void>> glfwSetWindowSizeCallback;
public delegate* unmanaged[Cdecl]<IntPtr, int, int, int, int, void> glfwSetWindowSizeLimits;
public delegate* unmanaged[Cdecl]<IntPtr, byte*, void> glfwSetWindowTitle;
public delegate* unmanaged[Cdecl]<IntPtr, void*, void> glfwSetWindowUserPointer;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwShowWindow;
public delegate* unmanaged[Cdecl]<IntPtr, void> glfwSwapBuffers;
public delegate* unmanaged[Cdecl]<int, void> glfwSwapInterval;
public delegate* unmanaged[Cdecl]<void> glfwTerminate;
public delegate* unmanaged[Cdecl]<byte*, int> glfwUpdateGamePadMappings;
public delegate* unmanaged[Cdecl]<int> glfwVulkanSupported;
public delegate* unmanaged[Cdecl]<void> glfwWaitEvents;
public delegate* unmanaged[Cdecl]<double, void> glfwWaitEventsTimeout;
public delegate* unmanaged[Cdecl]<int, int, void> glfwWindowHint;
public delegate* unmanaged[Cdecl]<int, byte*, void> glfwWindowHintString;
public delegate* unmanaged[Cdecl]<IntPtr, int> glfwWindowShouldClose;
public GLFWFunction()
{
Unsafe.SkipInit(out this);
}
}
}