Skip to content

Commit

Permalink
gl: Remove unused functions and procedures from OpenGL bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
onox committed Apr 14, 2024
1 parent 9538ef1 commit f7ba633
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 67 deletions.
13 changes: 0 additions & 13 deletions orka_opengl/src/gl-api.ads
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,6 @@ private package GL.API is
("glShaderSource", UInt, Size, Low_Level.CharPtr_Array,
Low_Level.Int_Array);

package Get_Shader_Source is new Loader.String_Getter_With_4_Params
("glGetShaderSource", Size, UInt);

package Compile_Shader is new Loader.Procedure_With_1_Param
("glCompileShader", UInt);

Expand Down Expand Up @@ -634,12 +631,6 @@ private package GL.API is
package Get_Program_Info_Log is new Loader.String_Getter_With_4_Params
("glGetProgramInfoLog", Size, UInt);

package Use_Program is new Loader.Procedure_With_1_Param
("glUseProgram", UInt);

package Validate_Program is new Loader.Procedure_With_1_Param
("glValidateProgram", UInt);

package Get_Uniform_Location is new Loader.Function_With_2_Params
("glGetUniformLocation", UInt, C.char_array, Int);

Expand Down Expand Up @@ -693,10 +684,6 @@ private package GL.API is
package Validate_Program_Pipeline is new Loader.Procedure_With_1_Param
("glValidateProgramPipeline", UInt);

package Create_Shader_Program is new Loader.Function_With_3_Params
("glCreateShaderProgramv", Objects.Shaders.Shader_Type, Size,
Low_Level.CharPtr_Array, UInt);

-----------------------------------------------------------------------------
-- Queries --
-----------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion orka_opengl/src/gl-objects-pipelines.adb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ package body GL.Objects.Pipelines is

procedure Bind (Object : Pipeline) is
begin
API.Use_Program.Ref (0);
API.Bind_Program_Pipeline.Ref (Object.Reference.GL_Id);
end Bind;

Expand Down
3 changes: 1 addition & 2 deletions orka_opengl/src/gl-objects-pipelines.ads
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ package GL.Objects.Pipelines is
procedure Use_Program_Stages
(Object : Pipeline;
Stages : Stage_Bits;
Program : Programs.Program)
with Pre => (if Program /= Programs.Internal.No_Program then Program.Separable);
Program : Programs.Program);
-- Use the specified stages from the given program in the pipeline

procedure Bind (Object : Pipeline);
Expand Down
25 changes: 0 additions & 25 deletions orka_opengl/src/gl-objects-programs.adb
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,12 @@ package body GL.Objects.Programs is
end;
end Info_Log;

procedure Use_Program (Subject : Program) is
begin
API.Use_Program.Ref (Subject.Reference.GL_Id);
end Use_Program;

procedure Set_Separable (Subject : Program; Separable : Boolean) is
begin
API.Program_Parameter_Bool.Ref (Subject.Reference.GL_Id, Enums.Program_Separable,
Low_Level.Bool (Separable));
end Set_Separable;

function Separable (Subject : Program) return Boolean is
Separable_Value : Int := 0;
begin
API.Get_Program_Param.Ref
(Subject.Reference.GL_Id, Enums.Program_Separable, Separable_Value);
return Separable_Value /= 0;
end Separable;

function Compute_Work_Group_Size (Object : Program) return Compute.Dimension_Size_Array is
Values : Compute.Dimension_Size_Array := [others => 0];
begin
Expand All @@ -102,18 +89,6 @@ package body GL.Objects.Programs is
Object.Reference.GL_Id := API.Create_Program.Ref.all;
end Initialize_Id;

procedure Initialize_Id
(Object : in out Program;
Kind : Shaders.Shader_Type;
Source : String)
is
C_Shader_Source : C.Strings.chars_ptr := C.Strings.New_String (Source);
C_Source : constant Low_Level.CharPtr_Array := [C_Shader_Source];
begin
Object.Reference.GL_Id := API.Create_Shader_Program.Ref (Kind, 1, C_Source);
C.Strings.Free (C_Shader_Source);
end Initialize_Id;

overriding
procedure Delete_Id (Object : in out Program) is
begin
Expand Down
6 changes: 0 additions & 6 deletions orka_opengl/src/gl-objects-programs.ads
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ package GL.Objects.Programs is

function Info_Log (Subject : Program) return String;

procedure Use_Program (Subject : Program);
-- Use the shaders of the given program during rendering

procedure Set_Separable (Subject : Program; Separable : Boolean);
function Separable (Subject : Program) return Boolean;

function Compute_Work_Group_Size (Object : Program) return Compute.Dimension_Size_Array;
-- Size (per dimension) of a local work group in the linked compute stage
Expand Down Expand Up @@ -68,8 +64,6 @@ package GL.Objects.Programs is
overriding
procedure Initialize_Id (Object : in out Program);

procedure Initialize_Id (Object : in out Program; Kind : Shaders.Shader_Type; Source : String);

overriding
procedure Delete_Id (Object : in out Program);

Expand Down
19 changes: 0 additions & 19 deletions orka_opengl/src/gl-objects-shaders.adb
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,6 @@ package body GL.Objects.Shaders is
C.Strings.Free (C_Shader_Source);
end Set_Source;

function Source (Subject : Shader) return String is
Source_Length : Size := 0;
begin
API.Get_Shader_Param.Ref
(Subject.Reference.GL_Id, Enums.Shader_Source_Length, Source_Length);

if Source_Length = 0 then
return "";
end if;

declare
Shader_Source : String (1 .. Integer (Source_Length));
begin
API.Get_Shader_Source.Ref
(Subject.Reference.GL_Id, Source_Length, Source_Length, Shader_Source);
return Shader_Source (1 .. Integer (Source_Length));
end;
end Source;

procedure Compile (Subject : Shader) is
begin
API.Compile_Shader.Ref (Subject.Reference.GL_Id);
Expand Down
1 change: 0 additions & 1 deletion orka_opengl/src/gl-objects-shaders.ads
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ package GL.Objects.Shaders is
type Shader (Kind : Shader_Type) is new GL_Object with private;

procedure Set_Source (Subject : Shader; Source : String);
function Source (Subject : Shader) return String;

procedure Compile (Subject : Shader);

Expand Down

0 comments on commit f7ba633

Please sign in to comment.