Add initial prototype.

This commit is contained in:
Rod Kay
2022-07-31 17:34:54 +10:00
commit 54a53b2ac0
1421 changed files with 358874 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
with
opengl.Display .privvy,
opengl.surface_Profile.privvy,
opengl.Surface .privvy,
egl.Binding,
System;
package body openGL.Context
is
use egl.Binding,
System;
procedure define (Self : in out Item; the_Display : access opengl.Display.item'Class;
the_surface_Profile : in opengl.surface_Profile.item)
is
use EGL,
opengl.Display .privvy,
opengl.surface_Profile.privvy;
contextAttribs : EGLint_array := [EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE];
begin
Self.egl_Context := eglCreateContext (to_eGL (the_Display.all),
to_eGL (the_surface_Profile),
EGL_NO_CONTEXT,
contextAttribs (contextAttribs'First)'Unchecked_Access);
if Self.egl_Context = EGL_NO_CONTEXT then
raise opengl.Error with "Unable to create an EGL Context.";
end if;
Self.Display := the_Display;
end define;
procedure make_Current (Self : in Item; read_Surface : in opengl.Surface.item;
write_Surface : in opengl.Surface.item)
is
use eGL,
opengl.Display.privvy,
opengl.Surface.privvy;
use type EGLBoolean;
Success : constant EGLBoolean := eglmakeCurrent (to_eGL (Self.Display.all),
to_eGL (read_Surface),
to_eGL (write_Surface),
Self.egl_Context);
begin
if Success = EGL_FALSE then
raise openGL.Error with "unable to make egl Context current";
end if;
end make_Current;
function egl_Context_debug (Self : in Item'Class) return egl.EGLConfig
is
begin
return self.egl_Context;
end egl_Context_debug;
end openGL.Context;

View File

@@ -0,0 +1,37 @@
with
openGL.Display,
openGL.surface_Profile,
openGL.Surface,
EGL;
package openGL.Context
--
-- Models an openGL context.
--
is
-- pragma Pure;
type Item is tagged private;
type View is access all Item'Class;
procedure define (Self : in out Item; the_Display : access opengl.Display.item'Class;
the_surface_Profile : in opengl.surface_Profile.item);
procedure make_Current (Self : in Item; read_Surface : in opengl.Surface.item;
write_Surface : in opengl.Surface.item);
function egl_Context_debug
(Self : in Item'Class) return egl.EGLConfig; -- tbd: move this to privvy pkg.
private
type Item is tagged
record
egl_Context : aliased egl.EGLContext;
Display : access opengl.Display.item'Class;
end record;
end openGL.Context;

View File

@@ -0,0 +1,44 @@
with eGL.Binding,
eGL.Pointers,
System;
package body openGL.Display
is
use eGL,
eGL.Binding,
eGL.Pointers;
function Default return Item
is
use type System.Address, eGL.EGLBoolean;
the_Display : Display.item;
Success : EGLBoolean;
Status : EGLBoolean;
begin
the_Display.Thin := eglGetDisplay (Display_Pointer (EGL_DEFAULT_DISPLAY));
if the_Display.Thin = egl_NO_DISPLAY then
raise openGL.Error with "Failed to open the default Display with eGL.";
end if;
Success := eglInitialize (the_Display.Thin, the_Display.Version_major'Unchecked_Access,
the_Display.Version_minor'Unchecked_Access);
if Success = egl_False then
raise openGL.Error with "Failed to initialise eGL using the default Display.";
end if;
Status := eglBindAPI (EGL_OPENGL_ES_API);
return the_Display;
end Default;
end openGL.Display;

View File

@@ -0,0 +1,29 @@
private
with
eGL;
package openGL.Display
--
-- Models an openGL display.
--
is
type Item is tagged private;
function Default return Item;
private
type Item is tagged
record
Thin : eGL.EGLDisplay;
Version_major,
Version_minor : aliased eGL.EGLint;
end record;
end openGL.Display;

View File

@@ -0,0 +1,21 @@
package body openGL.Screen
is
-- function Thin (Self : in Item) return xcb.xcb_screen_t.Pointer
-- is
-- begin
-- return Self.Thin;
-- end Thin;
-- procedure Thin_is (Self : in out Item; Now : in xcb.xcb_screen_t.Pointer)
-- is
-- begin
-- Self.Thin := Now;
-- end Thin_is;
procedure dummy is begin null; end dummy;
end openGL.Screen;

View File

@@ -0,0 +1,24 @@
package openGL.Screen
--
-- Models an openGL screen.
--
is
type Item is tagged limited private;
-- function Thin (Self : in Item) return xcb.xcb_screen_t.Pointer;
-- procedure Thin_is (Self : in out Item; Now : in xcb.xcb_screen_t.Pointer);
private
type Item is tagged limited
record
null; -- Thin : xcb.xcb_screen_t.Pointer;
end record;
procedure dummy;
end openGL.Screen;

View File

@@ -0,0 +1,58 @@
with
opengl.surface_Profile.privvy,
opengl.Display .privvy,
eGL.Binding,
interfaces.c.Strings,
System;
package body opengl.Surface
is
use eGL.Binding;
-- Forge
--
procedure define (Self : in out Item; surface_Profile : in opengl.surface_Profile.item'Class;
Display : in opengl.Display.Item;
Window_Id : in Natural)
is
use opengl.Display .privvy,
opengl.surface_Profile.privvy,
System;
begin
Self.egl_Surface := eglCreateWindowSurface (to_eGL (Display),
to_eGL (surface_Profile),
egl.NativeWindowType (Window_Id),
null); -- const EGLint *attribList);
if self.egl_Surface = EGL_NO_SURFACE then
raise opengl.Error with "unable to create an EGL surface for a window";
end if;
Self.Display := Display;
end define;
-- Operations
--
procedure swap_Buffers (Self : in Item)
is
use openGL.Display.privvy,
eGL;
use type EGLBoolean;
Success : egl.EGLBoolean;
begin
Success := eglSwapBuffers (to_eGL (Self.Display),
Self.egl_Surface);
if Success = EGL_FALSE then
raise opengl.Error with "unable to swap egl buffers";
end if;
end swap_Buffers;
end opengl.Surface;

View File

@@ -0,0 +1,43 @@
with
opengl.surface_Profile,
opengl.Display;
private
with
eGL;
package opengl.Surface
--
-- Models an openGL surface.
--
is
type Item is tagged private;
type Items is array (Positive range <>) of aliased Item;
type View is access all Item'class;
type Views is array (Positive range <>) of View;
-- Forge
--
procedure define (Self : in out Item; surface_Profile : in opengl.surface_Profile.item'Class;
Display : in opengl.Display.item;
Window_Id : in Natural);
-- Operations
--
procedure swap_Buffers (Self : in Item);
private
type Item is tagged
record
egl_Surface : egl.EGLSurface;
Display : openGL.Display.item;
end record;
end opengl.Surface;

View File

@@ -0,0 +1,251 @@
with eGL.binding;
with openGL.Display.privvy;
with Interfaces.C;
package body opengl.surface_Profile
is
use openGL.Display.privvy,
eGL,
eGL.Binding,
Interfaces;
subtype egl_attribute_List is EGLint_array;
function to_egl_Attributes (Desired : Qualities) return egl_attribute_List
is
use C;
the_Attributes : egl_attribute_List (1 .. 50);
Count : c.size_t := 0;
procedure add (Attribute : in EGLint;
Value : in EGLint)
is
begin
Count := Count + 1; the_Attributes (Count) := Attribute;
Count := Count + 1; the_Attributes (Count) := Value;
end add;
begin
add (EGL_SURFACE_TYPE, EGL_WINDOW_BIT);
add (EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT);
if desired.color_Buffer.Bits_blue /= Irrelevant then
add (EGL_BLUE_SIZE,
EGLint (desired.color_Buffer.Bits_blue));
end if;
if desired.color_Buffer.Bits_green /= Irrelevant then
add (EGL_GREEN_SIZE,
EGLint (desired.color_Buffer.Bits_green));
end if;
if desired.color_Buffer.Bits_luminence /= Irrelevant then
add (EGL_LUMINANCE_SIZE,
EGLint (desired.color_Buffer.Bits_luminence));
end if;
if desired.color_Buffer.Bits_alpha /= Irrelevant then
add (EGL_ALPHA_SIZE,
EGLint (desired.color_Buffer.Bits_alpha));
end if;
if desired.color_Buffer.Bits_alpha_mask /= Irrelevant then
add (EGL_ALPHA_MASK_SIZE,
EGLint (desired.color_Buffer.Bits_alpha_mask));
end if;
if desired.depth_buffer_Bits /= Irrelevant then
add (EGL_DEPTH_SIZE,
EGLint (desired.depth_buffer_Bits));
end if;
if desired.stencil_buffer_Bits /= Irrelevant then
add (EGL_STENCIL_SIZE,
EGLint (desired.stencil_buffer_Bits));
end if;
Count := Count + 1;
the_Attributes (Count) := EGL_NONE; -- add 'end-of-list' token
return the_Attributes (1 .. Count);
end to_egl_Attributes;
procedure define (Self : in out Item; the_Display : access opengl.Display.item'Class;
Screen : access openGL.Screen .item'Class;
Desired : in Qualities := default_Qualities)
is
use C;
config_Count : aliased EGLint;
attribList : egl_attribute_List := to_egl_Attributes (Desired);
Success : EGLBoolean;
begin
Self.Display := the_Display;
Success := eglChooseConfig (to_eGL (the_Display.all),
attribList (attribList'First)'Unchecked_Access,
self.egl_Config 'Unchecked_Access,
1,
config_Count 'Unchecked_Access);
if Success = EGL_FALSE then
raise opengl.Error with "eglChooseConfig failed";
end if;
if config_Count = 0 then
raise desired_Qualitites_unavailable;
end if;
end define;
function fetch_All (the_Display : access opengl.Display.item'class) return surface_Profile.items
is
use type EGLBoolean;
Count : aliased EGLint;
Success : EGLBoolean := eglGetConfigs (to_eGL (the_Display.all),
null,
1,
Count'Unchecked_Access);
begin
if Success = EGL_FALSE then
raise opengl.Error with "Failed to get egl Config count.";
end if;
if Count = 0 then
raise opengl.Error with "Found zero egl Configs.";
end if;
declare
egl_Configs : array (1 .. Count) of aliased EGLConfig;
the_Profiles : surface_Profile.items (1 .. Positive (Count));
begin
Success := eglGetConfigs (to_eGL (the_Display.all),
egl_Configs (1)'Unchecked_Access,
Count,
Count'Unchecked_Access);
if Success = EGL_FALSE then
raise opengl.Error with "Failed to get egl Configs.";
end if;
for Each in the_Profiles'Range
loop
the_Profiles (Each).egl_Config := egl_Configs (EGLint (Each));
the_Profiles (Each).Display := the_Display;
end loop;
return the_Profiles;
end;
end fetch_All;
function Quality (Self : in Item) return Qualities
is
the_Qualities : Qualities;
Success : EGLBoolean;
Value : aliased EGLint;
procedure check_Success
is
use type EGLBoolean;
begin
if Success = EGL_FALSE then
raise openGL.Error with "Unable to get eGL surface configuration attribute.";
end if;
end check_Success;
procedure set_Value (Attribute : out Natural)
is
begin
if Value = EGL_DONT_CARE then
Attribute := Irrelevant;
else
Attribute := Natural (Value);
end if;
end set_Value;
begin
Success := eglGetConfigAttrib (to_eGL (Self.Display.all), Self.egl_Config, EGL_RED_SIZE, Value'Unchecked_Access);
check_Success;
set_Value (the_Qualities.color_Buffer.Bits_red);
Success := eglGetConfigAttrib (to_eGL (Self.Display.all), Self.egl_Config, EGL_GREEN_SIZE, Value'Unchecked_Access);
check_Success;
set_Value (the_Qualities.color_Buffer.Bits_green);
Success := eglGetConfigAttrib (to_eGL (Self.Display.all), Self.egl_Config, EGL_BLUE_SIZE, Value'Unchecked_Access);
check_Success;
set_Value (the_Qualities.color_Buffer.Bits_blue);
Success := eglGetConfigAttrib (to_eGL (Self.Display.all), Self.egl_Config, EGL_LUMINANCE_SIZE, Value'Unchecked_Access);
check_Success;
set_Value (the_Qualities.color_Buffer.Bits_luminence);
Success := eglGetConfigAttrib (to_eGL (Self.Display.all), Self.egl_Config, EGL_ALPHA_SIZE, Value'Unchecked_Access);
check_Success;
set_Value (the_Qualities.color_Buffer.Bits_alpha);
Success := eglGetConfigAttrib (to_eGL (Self.Display.all), Self.egl_Config, EGL_ALPHA_MASK_SIZE, Value'Unchecked_Access);
check_Success;
set_Value (the_Qualities.color_Buffer.Bits_alpha_mask);
Success := eglGetConfigAttrib (to_eGL (Self.Display.all), Self.egl_Config, EGL_DEPTH_SIZE, Value'Unchecked_Access);
check_Success;
set_Value (the_Qualities.depth_buffer_Bits);
Success := eglGetConfigAttrib (to_eGL (Self.Display.all), Self.egl_Config, EGL_STENCIL_SIZE, Value'Unchecked_Access);
check_Success;
set_Value (the_Qualities.stencil_buffer_Bits);
return the_Qualities;
end Quality;
function value_Image (Value : in Natural) return String
is
begin
if Value = Irrelevant then
return "Irrelevant";
else
return Natural'Image (Value);
end if;
end value_Image;
function Image (Self : in color_Buffer) return String
is
begin
return
"Bits_red =>" & value_Image (Self.Bits_red)
& " Bits_green =>" & value_Image (Self.Bits_green)
& " Bits_blue =>" & value_Image (Self.Bits_blue)
& " Bits_luminence =>" & value_Image (Self.Bits_luminence)
& " Bits_alpha =>" & value_Image (Self.Bits_alpha)
& " Bits_alpha_mask =>" & value_Image (Self.Bits_alpha_mask);
end Image;
function Image (Self : in Qualities) return String
is
begin
return
Image (Self.color_Buffer)
& " depth_buffer_Bits =>" & value_Image (Self.depth_buffer_Bits)
& " stencil_buffer_Bits => " & value_Image (Self.stencil_buffer_Bits);
end Image;
end opengl.surface_Profile;

View File

@@ -0,0 +1,93 @@
with
openGL.Display,
openGL.Screen;
private
with
eGL;
package opengl.surface_Profile
--
-- Models an openGL surface profile.
--
is
type Item is tagged private;
type View is access all Item'Class;
type Items is array (Positive range <>) of Item;
-- Surface Quality
--
Irrelevant : constant Natural := Natural'Last;
type color_Buffer is
record
Bits_red : Natural := Irrelevant;
Bits_green : Natural := Irrelevant;
Bits_blue : Natural := Irrelevant;
Bits_luminence : Natural := Irrelevant;
Bits_alpha : Natural := Irrelevant;
Bits_alpha_mask : Natural := Irrelevant;
end record;
function Image (Self : in color_Buffer) return String;
type Qualities is
record
color_Buffer : surface_Profile.color_Buffer;
depth_buffer_Bits : Natural := Irrelevant;
stencil_buffer_Bits : Natural := Irrelevant;
end record;
function Image (Self : in Qualities) return String;
default_Qualities : constant Qualities;
-- Forge
--
desired_Qualitites_unavailable : exception;
procedure define (Self : in out Item; the_Display : access opengl.Display.item'Class;
Screen : access openGL.Screen .item'Class;
Desired : in Qualities := default_Qualities);
function fetch_All (the_Display : access opengl.Display.item'Class) return surface_Profile.items;
-- Attributes
--
function Quality (Self : in Item) return Qualities;
private
type Item is tagged
record
egl_Config : aliased egl.EGLConfig;
Display : access opengl.Display.item'Class;
end record;
default_Qualities : constant Qualities := (color_Buffer => (Bits_red => 8,
Bits_green => 8,
Bits_blue => 8,
Bits_luminence => Irrelevant,
Bits_alpha => Irrelevant,
Bits_alpha_mask => Irrelevant),
depth_buffer_Bits => 24,
stencil_buffer_Bits => Irrelevant);
end opengl.surface_Profile;

View File

@@ -0,0 +1,12 @@
package body opengl.Display.privvy
is
function to_eGL (Self : in Display.item'Class) return eGL.EGLDisplay
is
begin
return Self.Thin;
end to_eGL;
end opengl.Display.privvy;

View File

@@ -0,0 +1,12 @@
with
eGL;
package opengl.Display.privvy
is
function to_eGL (Self : in Display.item'Class) return eGL.EGLDisplay;
end opengl.Display.privvy;

View File

@@ -0,0 +1,10 @@
package body opengl.Surface.privvy
is
function to_eGL (Self : in Surface.item'Class) return egl.EGLSurface
is
begin
return Self.egl_Surface;
end to_eGL;
end opengl.Surface.privvy;

View File

@@ -0,0 +1,10 @@
with
eGL;
package opengl.Surface.privvy
is
function to_eGL (Self : in Surface.item'Class) return egl.EGLSurface;
end opengl.Surface.privvy;

View File

@@ -0,0 +1,10 @@
package body opengl.surface_Profile.privvy
is
function to_eGL (Self : in Item'Class) return egl.EGLConfig
is
begin
return Self.egl_Config;
end to_eGL;
end opengl.surface_Profile.privvy;

View File

@@ -0,0 +1,10 @@
with
eGL;
package opengl.surface_Profile.privvy
is
function to_eGL (Self : in surface_Profile.Item'Class) return egl.EGLConfig;
end opengl.surface_Profile.privvy;

View File

@@ -0,0 +1,217 @@
with
eGL.Pointers,
eGL.NativeDisplayType,
Interfaces.C.Strings,
System;
package eGL.Binding
is
function eglGetError return eGL.EGLint;
function eglGetDisplay
(display_id : in eGL.NativeDisplayType.Item) return eGL.EGLDisplay;
function eglInitialize
(dpy : in eGL.EGLDisplay;
major : in eGL.Pointers.EGLint_Pointer;
minor : in eGL.Pointers.EGLint_Pointer) return eGL.EGLBoolean;
function eglTerminate (dpy : in eGL.EGLDisplay) return eGL.EGLBoolean;
function eglQueryString
(dpy : in eGL.EGLDisplay;
name : in eGL.EGLint) return Interfaces.C.Strings.chars_ptr;
function eglGetConfigs
(dpy : in eGL.EGLDisplay;
configs : in eGL.Pointers.EGLConfig_Pointer;
config_size : in eGL.EGLint;
num_config : in eGL.Pointers.EGLint_Pointer) return eGL.EGLBoolean;
function eglChooseConfig
(dpy : in eGL.EGLDisplay;
attrib_list : in eGL.Pointers.EGLint_Pointer;
configs : in eGL.Pointers.EGLConfig_Pointer;
config_size : in eGL.EGLint;
num_config : in eGL.Pointers.EGLint_Pointer) return eGL.EGLBoolean;
function eglGetConfigAttrib
(dpy : in eGL.EGLDisplay;
config : in eGL.EGLConfig;
attribute : in eGL.EGLint;
value : in eGL.Pointers.EGLint_Pointer) return eGL.EGLBoolean;
function eglCreateWindowSurface
(dpy : in eGL.EGLDisplay;
config : in eGL.EGLConfig;
win : in eGL.NativeWindowType;
attrib_list : in eGL.Pointers.EGLint_Pointer) return eGL.EGLSurface;
function eglCreatePbufferSurface
(dpy : in eGL.EGLDisplay;
config : in eGL.EGLConfig;
attrib_list : in eGL.Pointers.EGLint_Pointer) return eGL.EGLSurface;
function eglCreatePixmapSurface
(dpy : in eGL.EGLDisplay;
config : in eGL.EGLConfig;
pixmap : in eGL.NativePixmapType;
attrib_list : in eGL.Pointers.EGLint_Pointer) return eGL.EGLSurface;
function eglDestroySurface
(dpy : in eGL.EGLDisplay;
surface : in eGL.EGLSurface) return eGL.EGLBoolean;
function eglQuerySurface
(dpy : in eGL.EGLDisplay;
surface : in eGL.EGLSurface;
attribute : in eGL.EGLint;
value : in eGL.Pointers.EGLint_Pointer) return eGL.EGLBoolean;
function eglBindAPI (api : in eGL.EGLenum) return eGL.EGLBoolean;
function eglQueryAPI return eGL.EGLenum;
function eglWaitClient return eGL.EGLBoolean;
function eglReleaseThread return eGL.EGLBoolean;
function eglCreatePbufferFromClientBuffer
(dpy : in eGL.EGLDisplay;
buftype : in eGL.EGLenum;
buffer : in eGL.EGLClientBuffer;
config : in eGL.EGLConfig;
attrib_list : in eGL.Pointers.EGLint_Pointer) return eGL.EGLSurface;
function eglSurfaceAttrib
(dpy : in eGL.EGLDisplay;
surface : in eGL.EGLSurface;
attribute : in eGL.EGLint;
value : in eGL.EGLint) return eGL.EGLBoolean;
function eglBindTexImage
(dpy : in eGL.EGLDisplay;
surface : in eGL.EGLSurface;
buffer : in eGL.EGLint) return eGL.EGLBoolean;
function eglReleaseTexImage
(dpy : in eGL.EGLDisplay;
surface : in eGL.EGLSurface;
buffer : in eGL.EGLint) return eGL.EGLBoolean;
function eglSwapInterval
(dpy : in eGL.EGLDisplay;
interval : in eGL.EGLint)
return eGL.EGLBoolean;
function eglCreateContext
(dpy : in eGL.EGLDisplay;
config : in eGL.EGLConfig;
share_context : in eGL.EGLContext;
attrib_list : in eGL.Pointers.EGLint_Pointer) return eGL.EGLContext;
function eglDestroyContext
(dpy : in eGL.EGLDisplay;
ctx : in eGL.EGLContext) return eGL.EGLBoolean;
function eglMakeCurrent
(dpy : in eGL.EGLDisplay;
draw : in eGL.EGLSurface;
read : in eGL.EGLSurface;
ctx : in eGL.EGLContext) return eGL.EGLBoolean;
function eglGetCurrentContext return eGL.EGLContext;
function eglGetCurrentSurface
(readdraw : in eGL.EGLint) return eGL.EGLSurface;
function eglGetCurrentDisplay return eGL.EGLDisplay;
function eglQueryContext
(dpy : in eGL.EGLDisplay;
ctx : in eGL.EGLContext;
attribute : in eGL.EGLint;
value : in eGL.Pointers.EGLint_Pointer) return eGL.EGLBoolean;
function eglWaitGL return eGL.EGLBoolean;
function eglWaitNative (engine : in eGL.EGLint) return eGL.EGLBoolean;
function eglSwapBuffers
(dpy : in eGL.EGLDisplay;
surface : in eGL.EGLSurface) return eGL.EGLBoolean;
function eglCopyBuffers
(dpy : in eGL.EGLDisplay;
surface : in eGL.EGLSurface;
target : in eGL.NativePixmapType) return eGL.EGLBoolean;
function eglGetProcAddress
(procname : in Interfaces.C.Strings.chars_ptr) return void_ptr;
-- Out-of-band handle values.
--
egl_DEFAULT_DISPLAY : constant access eGL.Display;
egl_NO_CONTEXT : constant eGL.EGLContext;
egl_NO_DISPLAY : constant eGL.EGLDisplay;
egl_NO_SURFACE : constant eGL.EGLSurface;
-- Out-of-band attribute value.
--
egl_DONT_CARE : constant eGL.EGLint;
private
use System;
egl_DEFAULT_DISPLAY : constant access eGL.Display := null;
egl_NO_CONTEXT : constant eGL.EGLContext := null_Address;
egl_NO_DISPLAY : constant eGL.EGLDisplay := null_Address;
egl_NO_SURFACE : constant eGL.EGLSurface := null_Address;
egl_DONT_CARE : constant eGL.EGLint := -1;
pragma Import (C, eglGetError, "eglGetError");
pragma Import (C, eglGetDisplay, "eglGetDisplay");
pragma Import (C, eglInitialize, "eglInitialize");
pragma Import (C, eglTerminate, "eglTerminate");
pragma Import (C, eglQueryString, "eglQueryString");
pragma Import (C, eglGetConfigs, "eglGetConfigs");
pragma Import (C, eglChooseConfig, "eglChooseConfig");
pragma Import (C, eglGetConfigAttrib, "eglGetConfigAttrib");
pragma Import (C, eglCreateWindowSurface, "eglCreateWindowSurface");
pragma Import (C, eglCreatePbufferSurface, "eglCreatePbufferSurface");
pragma Import (C, eglCreatePixmapSurface, "eglCreatePixmapSurface");
pragma Import (C, eglDestroySurface, "eglDestroySurface");
pragma Import (C, eglQuerySurface, "eglQuerySurface");
pragma Import (C, eglBindAPI, "eglBindAPI");
pragma Import (C, eglQueryAPI, "eglQueryAPI");
pragma Import (C, eglWaitClient, "eglWaitClient");
pragma Import (C, eglReleaseThread, "eglReleaseThread");
pragma Import (C, eglCreatePbufferFromClientBuffer,
"eglCreatePbufferFromClientBuffer");
pragma Import (C, eglSurfaceAttrib, "eglSurfaceAttrib");
pragma Import (C, eglBindTexImage, "eglBindTexImage");
pragma Import (C, eglReleaseTexImage, "eglReleaseTexImage");
pragma Import (C, eglSwapInterval, "eglSwapInterval");
pragma Import (C, eglCreateContext, "eglCreateContext");
pragma Import (C, eglDestroyContext, "eglDestroyContext");
pragma Import (C, eglMakeCurrent, "eglMakeCurrent");
pragma Import (C, eglGetCurrentContext, "eglGetCurrentContext");
pragma Import (C, eglGetCurrentSurface, "eglGetCurrentSurface");
pragma Import (C, eglGetCurrentDisplay, "eglGetCurrentDisplay");
pragma Import (C, eglQueryContext, "eglQueryContext");
pragma Import (C, eglWaitGL, "eglWaitGL");
pragma Import (C, eglWaitNative, "eglWaitNative");
pragma Import (C, eglSwapBuffers, "eglSwapBuffers");
pragma Import (C, eglCopyBuffers, "eglCopyBuffers");
pragma Import (C, eglGetProcAddress, "eglGetProcAddress");
end eGL.Binding;

View File

@@ -0,0 +1,12 @@
with
eGL.Pointers;
package eGL.NativeDisplayType
is
subtype Item is eGL.Pointers.Display_Pointer;
type Item_array is array (C.size_t range <>) of aliased Item;
type Pointer is access all eGL.NativeDisplayType.Item;
type Pointer_array is array (C.size_t range <>) of aliased Pointer;
end eGL.NativeDisplayType;

View File

@@ -0,0 +1,28 @@
package eGL.Pointers
is
type Display_Pointer is access all eGL.Display;
type NativeWindowType_Pointer is access all eGL.NativeWindowType;
type NativePixmapType_Pointer is access all eGL.NativePixmapType;
type EGLint_Pointer is access all eGL.EGLint;
type EGLBoolean_Pointer is access all eGL.EGLBoolean;
type EGLenum_Pointer is access all eGL.EGLenum;
type EGLConfig_Pointer is access all eGL.EGLConfig;
type EGLContext_Pointer is access all eGL.EGLContext;
type EGLDisplay_Pointer is access all eGL.EGLDisplay;
type EGLSurface_Pointer is access all eGL.EGLSurface;
type EGLClientBuffer_Pointer is access all eGL.EGLClientBuffer;
type Display_Pointer_array is array (C.size_t range <>) of aliased Display_Pointer;
type NativeWindowType_Pointer_array is array (C.size_t range <>) of aliased NativeWindowType_Pointer;
type NativePixmapType_Pointer_array is array (C.size_t range <>) of aliased NativePixmapType_Pointer;
type EGLint_Pointer_array is array (C.size_t range <>) of aliased EGLint_Pointer;
type EGLBoolean_Pointer_array is array (C.size_t range <>) of aliased EGLBoolean_Pointer;
type EGLenum_Pointer_array is array (C.size_t range <>) of aliased EGLenum_Pointer;
type EGLConfig_Pointer_array is array (C.size_t range <>) of aliased EGLConfig_Pointer;
type EGLContext_Pointer_array is array (C.size_t range <>) of aliased EGLContext_Pointer;
type EGLDisplay_Pointer_array is array (C.size_t range <>) of aliased EGLDisplay_Pointer;
type EGLSurface_Pointer_array is array (C.size_t range <>) of aliased EGLSurface_Pointer;
type EGLClientBuffer_Pointer_array is array (C.size_t range <>) of aliased EGLClientBuffer_Pointer;
end eGL.Pointers;

View File

@@ -0,0 +1,210 @@
with
Interfaces.C,
System;
package eGL
is
use Interfaces;
---------
-- Types
--
subtype void_Ptr is System.Address;
subtype Display is System.Address;
subtype NativeWindowType is Interfaces.C.unsigned_long;
subtype NativePixmapType is Interfaces.C.unsigned_long;
subtype EGLint is Interfaces.Integer_32;
subtype EGLBoolean is Interfaces.C.unsigned;
subtype EGLenum is Interfaces.C.unsigned;
subtype EGLConfig is void_ptr;
subtype EGLContext is void_ptr;
subtype EGLDisplay is void_ptr;
subtype EGLSurface is void_ptr;
subtype EGLClientBuffer is void_ptr;
type void_Ptr_array is array (C.size_t range <>) of aliased void_Ptr;
type Display_array is array (C.size_t range <>) of aliased eGL.Display;
type NativeWindowType_array is array (C.size_t range <>) of aliased eGL.NativeWindowType;
type NativePixmapType_array is array (C.size_t range <>) of aliased eGL.NativePixmapType;
type EGLint_array is array (C.size_t range <>) of aliased eGL.EGLint;
type EGLBoolean_array is array (C.size_t range <>) of aliased eGL.EGLBoolean;
type EGLenum_array is array (C.size_t range <>) of aliased eGL.EGLenum;
type EGLConfig_array is array (C.size_t range <>) of aliased eGL.EGLConfig;
type EGLContext_array is array (C.size_t range <>) of aliased eGL.EGLContext;
type EGLDisplay_array is array (C.size_t range <>) of aliased eGL.EGLDisplay;
type EGLSurface_array is array (C.size_t range <>) of aliased eGL.EGLSurface;
type EGLClientBuffer_array is array (C.size_t range <>) of aliased eGL.EGLClientBuffer;
-------------
-- Constants
--
EGL_VERSION_1_0 : constant := 1;
EGL_VERSION_1_1 : constant := 1;
EGL_VERSION_1_2 : constant := 1;
EGL_VERSION_1_3 : constant := 1;
EGL_VERSION_1_4 : constant := 1;
EGL_FALSE : constant := 0;
EGL_TRUE : constant := 1;
EGL_SUCCESS : constant := 16#3000#;
EGL_NOT_INITIALIZED : constant := 16#3001#;
EGL_BAD_ACCESS : constant := 16#3002#;
EGL_BAD_ALLOC : constant := 16#3003#;
EGL_BAD_ATTRIBUTE : constant := 16#3004#;
EGL_BAD_CONFIG : constant := 16#3005#;
EGL_BAD_CONTEXT : constant := 16#3006#;
EGL_BAD_CURRENT_SURFACE : constant := 16#3007#;
EGL_BAD_DISPLAY : constant := 16#3008#;
EGL_BAD_MATCH : constant := 16#3009#;
EGL_BAD_NATIVE_PIXMAP : constant := 16#300a#;
EGL_BAD_NATIVE_WINDOW : constant := 16#300b#;
EGL_BAD_PARAMETER : constant := 16#300c#;
EGL_BAD_SURFACE : constant := 16#300d#;
EGL_CONTEXT_LOST : constant := 16#300e#;
EGL_BUFFER_SIZE : constant := 16#3020#;
EGL_ALPHA_SIZE : constant := 16#3021#;
EGL_BLUE_SIZE : constant := 16#3022#;
EGL_GREEN_SIZE : constant := 16#3023#;
EGL_RED_SIZE : constant := 16#3024#;
EGL_DEPTH_SIZE : constant := 16#3025#;
EGL_STENCIL_SIZE : constant := 16#3026#;
EGL_CONFIG_CAVEAT : constant := 16#3027#;
EGL_CONFIG_ID : constant := 16#3028#;
EGL_LEVEL : constant := 16#3029#;
EGL_MAX_PBUFFER_HEIGHT : constant := 16#302a#;
EGL_MAX_PBUFFER_PIXELS : constant := 16#302b#;
EGL_MAX_PBUFFER_WIDTH : constant := 16#302c#;
EGL_NATIVE_RENDERABLE : constant := 16#302d#;
EGL_NATIVE_VISUAL_ID : constant := 16#302e#;
EGL_NATIVE_VISUAL_TYPE : constant := 16#302f#;
EGL_PRESERVED_RESOURCES : constant := 16#3030#;
EGL_SAMPLES : constant := 16#3031#;
EGL_SAMPLE_BUFFERS : constant := 16#3032#;
EGL_SURFACE_TYPE : constant := 16#3033#;
EGL_TRANSPARENT_TYPE : constant := 16#3034#;
EGL_TRANSPARENT_BLUE_VALUE : constant := 16#3035#;
EGL_TRANSPARENT_GREEN_VALUE : constant := 16#3036#;
EGL_TRANSPARENT_RED_VALUE : constant := 16#3037#;
EGL_NONE : constant := 16#3038#;
EGL_BIND_TO_TEXTURE_RGB : constant := 16#3039#;
EGL_BIND_TO_TEXTURE_RGBA : constant := 16#303a#;
EGL_MIN_SWAP_INTERVAL : constant := 16#303b#;
EGL_MAX_SWAP_INTERVAL : constant := 16#303c#;
EGL_LUMINANCE_SIZE : constant := 16#303d#;
EGL_ALPHA_MASK_SIZE : constant := 16#303e#;
EGL_COLOR_BUFFER_TYPE : constant := 16#303f#;
EGL_RENDERABLE_TYPE : constant := 16#3040#;
EGL_MATCH_NATIVE_PIXMAP : constant := 16#3041#;
EGL_CONFORMANT : constant := 16#3042#;
EGL_SLOW_CONFIG : constant := 16#3050#;
EGL_NON_CONFORMANT_CONFIG : constant := 16#3051#;
EGL_TRANSPARENT_RGB : constant := 16#3052#;
EGL_RGB_BUFFER : constant := 16#308e#;
EGL_LUMINANCE_BUFFER : constant := 16#308f#;
EGL_NO_TEXTURE : constant := 16#305c#;
EGL_TEXTURE_RGB : constant := 16#305d#;
EGL_TEXTURE_RGBA : constant := 16#305e#;
EGL_TEXTURE_2D : constant := 16#305f#;
EGL_PBUFFER_BIT : constant := 16#1#;
EGL_PIXMAP_BIT : constant := 16#2#;
EGL_WINDOW_BIT : constant := 16#4#;
EGL_VG_COLORSPACE_LINEAR_BIT : constant := 16#20#;
EGL_VG_ALPHA_FORMAT_PRE_BIT : constant := 16#40#;
EGL_MULTISAMPLE_RESOLVE_BOX_BIT : constant := 16#200#;
EGL_SWAP_BEHAVIOR_PRESERVED_BIT : constant := 16#400#;
EGL_OPENGL_ES_BIT : constant := 16#1#;
EGL_OPENVG_BIT : constant := 16#2#;
EGL_OPENGL_ES2_BIT : constant := 16#4#;
EGL_OPENGL_BIT : constant := 16#8#;
EGL_VENDOR : constant := 16#3053#;
EGL_VERSION : constant := 16#3054#;
EGL_EXTENSIONS : constant := 16#3055#;
EGL_CLIENT_APIS : constant := 16#308d#;
EGL_HEIGHT : constant := 16#3056#;
EGL_WIDTH : constant := 16#3057#;
EGL_LARGEST_PBUFFER : constant := 16#3058#;
EGL_TEXTURE_FORMAT : constant := 16#3080#;
EGL_TEXTURE_TARGET : constant := 16#3081#;
EGL_MIPMAP_TEXTURE : constant := 16#3082#;
EGL_MIPMAP_LEVEL : constant := 16#3083#;
EGL_RENDER_BUFFER : constant := 16#3086#;
EGL_VG_COLORSPACE : constant := 16#3087#;
EGL_VG_ALPHA_FORMAT : constant := 16#3088#;
EGL_HORIZONTAL_RESOLUTION : constant := 16#3090#;
EGL_VERTICAL_RESOLUTION : constant := 16#3091#;
EGL_PIXEL_ASPECT_RATIO : constant := 16#3092#;
EGL_SWAP_BEHAVIOR : constant := 16#3093#;
EGL_MULTISAMPLE_RESOLVE : constant := 16#3099#;
EGL_BACK_BUFFER : constant := 16#3084#;
EGL_SINGLE_BUFFER : constant := 16#3085#;
EGL_VG_COLORSPACE_sRGB : constant := 16#3089#;
EGL_VG_COLORSPACE_LINEAR : constant := 16#308a#;
EGL_VG_ALPHA_FORMAT_NONPRE : constant := 16#308b#;
EGL_VG_ALPHA_FORMAT_PRE : constant := 16#308c#;
EGL_DISPLAY_SCALING : constant := 10000;
EGL_BUFFER_PRESERVED : constant := 16#3094#;
EGL_BUFFER_DESTROYED : constant := 16#3095#;
EGL_OPENVG_IMAGE : constant := 16#3096#;
EGL_CONTEXT_CLIENT_TYPE : constant := 16#3097#;
EGL_CONTEXT_CLIENT_VERSION : constant := 16#3098#;
EGL_MULTISAMPLE_RESOLVE_DEFAULT : constant := 16#309a#;
EGL_MULTISAMPLE_RESOLVE_BOX : constant := 16#309b#;
EGL_OPENGL_ES_API : constant := 16#30a0#;
EGL_OPENVG_API : constant := 16#30a1#;
EGL_OPENGL_API : constant := 16#30a2#;
EGL_DRAW : constant := 16#3059#;
EGL_READ : constant := 16#305a#;
EGL_CORE_NATIVE_ENGINE : constant := 16#305b#;
EGL_COLORSPACE : constant := 16#3087#;
EGL_ALPHA_FORMAT : constant := 16#3088#;
EGL_COLORSPACE_sRGB : constant := 16#3089#;
EGL_COLORSPACE_LINEAR : constant := 16#308a#;
EGL_ALPHA_FORMAT_NONPRE : constant := 16#308b#;
EGL_ALPHA_FORMAT_PRE : constant := 16#308c#;
end eGL;