Skip to content

Commit

Permalink
Port obsolescent syntax for array aggregates to Ada 2022 array syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
onox committed Apr 1, 2024
1 parent 76bbb8d commit b686cc2
Show file tree
Hide file tree
Showing 88 changed files with 487 additions and 497 deletions.
2 changes: 1 addition & 1 deletion orka/src/orka/orka-behaviors.ads
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private

overriding
function Position (Object : Origin_Behavior) return Vector4 is
((0.0, 0.0, 0.0, 1.0));
([0.0, 0.0, 0.0, 1.0]);

Null_Behavior : constant Behavior_Ptr := new Origin_Behavior;

Expand Down
12 changes: 6 additions & 6 deletions orka/src/orka/orka-cameras.adb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ package body Orka.Cameras is
(Object : in out Camera;
X, Y, Z : Float_64) is
begin
Object.Scale := (X, Y, Z, 0.0);
Object.Scale := [X, Y, Z, 0.0];
end Set_Input_Scale;

procedure Set_Up_Direction
Expand Down Expand Up @@ -97,10 +97,10 @@ package body Orka.Cameras is
Up : constant Vector4 := Cross (Side, Forward);
begin
return
((Side (X), Up (X), -Forward (X), 0.0),
(Side (Y), Up (Y), -Forward (Y), 0.0),
(Side (Z), Up (Z), -Forward (Z), 0.0),
(0.0, 0.0, 0.0, 1.0));
[[Side (X), Up (X), -Forward (X), 0.0],
[Side (Y), Up (Y), -Forward (Y), 0.0],
[Side (Z), Up (Z), -Forward (Z), 0.0],
[0.0, 0.0, 0.0, 1.0]];
end Look_At;

function Rotate_To_Up (Object : Camera'Class) return Matrix4 is
Expand Down Expand Up @@ -143,7 +143,7 @@ package body Orka.Cameras is
Mode := Update;

if Is_Set then
Change := (0.0, 0.0, 0.0, 0.0);
Change := [0.0, 0.0, 0.0, 0.0];
end if;
end Get;
end Change_Updater;
Expand Down
10 changes: 5 additions & 5 deletions orka/src/orka/orka-cameras.ads
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ package Orka.Cameras is

subtype Distance is Float_64 range 0.0 .. Float_64'Last;

Default_Scale : Vector4 := (0.002, 0.002, 1.0, 0.0);
Default_Scale : Vector4 := [0.002, 0.002, 1.0, 0.0];

-----------------------------------------------------------------------------

Expand Down Expand Up @@ -125,11 +125,11 @@ private
type Camera is abstract tagged record
Lens : Camera_Lens;
Scale : Vector4 := Default_Scale;
Up : Vector4 := (0.0, 1.0, 0.0, 0.0);
Up : Vector4 := [0.0, 1.0, 0.0, 0.0];
end record;

type First_Person_Camera is abstract new Camera with record
Position : Vector4 := (0.0, 0.0, 0.0, 1.0);
Position : Vector4 := [0.0, 0.0, 0.0, 1.0];
end record;

type Third_Person_Camera is abstract new Camera and Observing_Camera with record
Expand All @@ -141,7 +141,7 @@ private

subtype Matrix4 is Orka.Transforms.Doubles.Matrices.Matrix4;

Y_Axis : constant Vector4 := (0.0, 1.0, 0.0, 0.0);
Y_Axis : constant Vector4 := [0.0, 1.0, 0.0, 0.0];

function Look_At (Target, Camera, Up_World : Vector4) return Matrix4;

Expand All @@ -155,7 +155,7 @@ private

procedure Get (Value : in out Vector4; Mode : out Update_Mode);
private
Change : Vector4 := (0.0, 0.0, 0.0, 0.0);
Change : Vector4 := [0.0, 0.0, 0.0, 0.0];
Is_Set : Boolean := False;
Update : Update_Mode := Absolute;
end Change_Updater;
Expand Down
4 changes: 2 additions & 2 deletions orka/src/orka/orka-containers-bounded_vectors.adb
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ package body Orka.Containers.Bounded_Vectors is
Index : constant Index_Type := Container.Length + Index_Type'First - 1;
begin
Element := Container.Elements (Index);
Container.Elements (Index .. Index) := (others => <>);
Container.Elements (Index .. Index) := [others => <>];
Container.Length := Container.Length - 1;
end Remove_Last;

procedure Clear (Container : in out Vector) is
begin
Container.Elements := (others => <>);
Container.Elements := [others => <>];
Container.Length := 0;
end Clear;

Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-containers-bounded_vectors.ads
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private
-----------------------------------------------------------------------------

type Vector (Capacity : Length_Type) is tagged record
Elements : Element_Array (Index_Type'First .. Capacity) := (others => <>);
Elements : Element_Array (Index_Type'First .. Capacity) := [others => <>];
Length : Length_Type := 0;
end record;
pragma Preelaborable_Initialization (Vector);
Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-containers-ring_buffers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ package body Orka.Containers.Ring_Buffers is
begin
-- Make position in buffer null to fix references in case Element_Type
-- is/contains a controlled type
Container.Elements (Container.Tail .. Container.Tail) := (others => <>);
Container.Elements (Container.Tail .. Container.Tail) := [others => <>];

Container.Tail := (Container.Tail mod Container.Capacity) + 1;
Container.Count := Container.Count - 1;
Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-containers-ring_buffers.ads
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private
type Element_Array is array (Positive range <>) of Element_Type;

type Buffer (Capacity : Positive) is tagged record
Elements : Element_Array (1 .. Capacity) := (others => <>);
Elements : Element_Array (1 .. Capacity) := [others => <>];
Head, Tail : Positive := 1;
Count : Natural := 0;
end record;
Expand Down
40 changes: 19 additions & 21 deletions orka/src/orka/orka-frame_graphs.adb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ package body Orka.Frame_Graphs is

function Get_Next_ID return Natural is
begin
return Result : Natural := Last_ID do
return Result : constant Natural := Last_ID do
Last_ID := Last_ID + 1;
end return;
end Get_Next_ID;
Expand Down Expand Up @@ -965,7 +965,7 @@ package body Orka.Frame_Graphs is
is
package Programs renames Orka.Rendering.Programs;

Default_Size : constant Size_3D := (Default.Width, Default.Height, 1);
Default_Size : constant Size_3D := [Default.Width, Default.Height, 1];

Format : constant Attachment_Format :=
Get_Attachment_Format (Resource.Data.Description.Format);
Expand Down Expand Up @@ -1088,7 +1088,7 @@ package body Orka.Frame_Graphs is
procedure Compute_Ordering_Render_Passes (Object : in out Renderable_Graph) is
Stack : Pass_Index_Vectors.Vector (Positive (Object.Graph.Passes.Length));

Depths : Render_Pass_References_Array (1 .. Object.Graph.Passes.Length) := (others => 0);
Depths : Render_Pass_References_Array (1 .. Object.Graph.Passes.Length) := [others => 0];

-- Look up the last render pass *before* the present pass
-- (e.g. the pass which writes to the presented resource)
Expand All @@ -1105,7 +1105,7 @@ package body Orka.Frame_Graphs is
Stack.Remove_Last (Index);

declare
Depth_Pass : Natural := Depths (Index);
Depth_Pass : constant Natural := Depths (Index);
Pass : Render_Pass_Data renames Object.Graph.Passes (Index);
begin
for Index in Pass.Read_Offset .. Pass.Read_Offset + Pass.Read_Count - 1 loop
Expand Down Expand Up @@ -1302,7 +1302,7 @@ package body Orka.Frame_Graphs is
begin
-- Clear color to black and depth to 0.0 (because of reversed Z)
Framebuffer.Set_Default_Values
((Color => (0.0, 0.0, 0.0, 1.0), Depth => 0.0, others => <>));
((Color => [0.0, 0.0, 0.0, 1.0], Depth => 0.0, others => <>));

if Framebuffer = Default then
-- The resource is 'read' by the present pass
Expand Down Expand Up @@ -1484,14 +1484,13 @@ package body Orka.Frame_Graphs is
State => Render_Pass_Framebuffer_State,
Pass => Object.Present_Render_Pass,
Input_Resources =>
(1 =>
(Mode => Texture_Read,
Data => Present_Resource.Data,
Binding => 0,
Layer => 0,
Written => True,
Implicit => False)),
Output_Resources => (1 .. 0 => <>),
[(Mode => Texture_Read,
Data => Present_Resource.Data,
Binding => 0,
Layer => 0,
Written => True,
Implicit => False)],
Output_Resources => [],
References => 0,
Is_Present => True);
end;
Expand Down Expand Up @@ -1634,14 +1633,13 @@ package body Orka.Frame_Graphs is
State => Render_Pass_Framebuffer_State,
Pass => Object.Present_Render_Pass,
Input_Resources =>
(1 =>
(Mode => Texture_Read,
Data => Present_Resource.Data,
Binding => 0,
Layer => 0,
Written => True,
Implicit => False)),
Output_Resources => (1 .. 0 => <>),
[(Mode => Texture_Read,
Data => Present_Resource.Data,
Binding => 0,
Layer => 0,
Written => True,
Implicit => False)],
Output_Resources => [],
Present_By_Blit => Object.Present_Mode = Blit_To_Default);
end;
end if;
Expand Down
10 changes: 5 additions & 5 deletions orka/src/orka/orka-frame_graphs.ads
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ private
Clear_Mask : GL.Buffers.Buffer_Bits := (others => False);
Invalidate_Mask : GL.Buffers.Buffer_Bits := (others => False);

Clear_Buffers : GL.Buffers.Color_Buffer_List (0 .. 7) := (others => GL.Buffers.None);
Render_Buffers : GL.Buffers.Color_Buffer_List (0 .. 7) := (others => GL.Buffers.None);
Clear_Buffers : GL.Buffers.Color_Buffer_List (0 .. 7) := [others => GL.Buffers.None];
Render_Buffers : GL.Buffers.Color_Buffer_List (0 .. 7) := [others => GL.Buffers.None];
Buffers_Equal : Boolean;

Invalidate_Points : Rendering.Framebuffers.Use_Point_Array := (others => False);
Invalidate_Points : Rendering.Framebuffers.Use_Point_Array := [others => False];

Depth_Writes : Boolean;
Stencil_Writes : Boolean;
Expand Down Expand Up @@ -414,8 +414,8 @@ private
Last_FB_Index : Render_Pass_Index; -- Used when Present_Mode = Blit_To_Default
Present_Resource : Handle_Type := No_Resource;

Render_Pass_References : Render_Pass_References_Array (1 .. Maximum_Passes) := (others => 0);
Resource_References : Resource_References_Array (1 .. Maximum_Resources) := (others => 0);
Render_Pass_References : Render_Pass_References_Array (1 .. Maximum_Passes) := [others => 0];
Resource_References : Resource_References_Array (1 .. Maximum_Resources) := [others => 0];

Pass_Order : Render_Pass_Array (1 .. Maximum_Passes);
Pass_Count : Natural := 0;
Expand Down
4 changes: 2 additions & 2 deletions orka/src/orka/orka-ktx.adb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ package body Orka.KTX is
with Size => 32 * 13, Pack;

Identifier : constant Resources.Byte_Array
:= (16#AB#, 16#4B#, 16#54#, 16#58#, 16#20#, 16#31#,
16#31#, 16#BB#, 16#0D#, 16#0A#, 16#1A#, 16#0A#);
:= [16#AB#, 16#4B#, 16#54#, 16#58#, 16#20#, 16#31#,
16#31#, 16#BB#, 16#0D#, 16#0A#, 16#1A#, 16#0A#];

Endianness_Reference : constant := 16#04030201#;

Expand Down
4 changes: 2 additions & 2 deletions orka/src/orka/orka-loops.adb
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ package body Orka.Loops is
Status : Futures.Status;
begin
Orka.Jobs.Chain
((Render_Start_Job, Fixed_Update_Job, Finished_Job,
Render_Scene_Job, Render_Finish_Job));
([Render_Start_Job, Fixed_Update_Job, Finished_Job,
Render_Scene_Job, Render_Finish_Job]);

Job_Manager.Queue.Enqueue (Render_Start_Job, Handle);

Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-rendering-buffers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ package body Orka.Rendering.Buffers is
Length : constant Size :=
Size (if Object.Kind = Single_Vector_Type then Object.Length * 4 else Object.Length);

Data_Array : Float_32_Array := (Data (X), Data (Y), Data (Z), Data (W));
Data_Array : Float_32_Array := [Data (X), Data (Y), Data (Z), Data (W)];
begin
Pointers.Single.Clear_Sub_Data (Object.Buffer, Single_Type, 0, Length, Data_Array);
end Clear_Data;
Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-rendering-debug-bounding_boxes.adb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package body Orka.Rendering.Debug.Bounding_Boxes is

function Create_Bounding_Box
(Location : Resources.Locations.Location_Ptr;
Color : Transforms.Vector4 := (1.0, 1.0, 1.0, 1.0)) return Bounding_Box
Color : Transforms.Vector4 := [1.0, 1.0, 1.0, 1.0]) return Bounding_Box
is
use Rendering.Programs;
begin
Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-rendering-debug-bounding_boxes.ads
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ package Orka.Rendering.Debug.Bounding_Boxes is

function Create_Bounding_Box
(Location : Resources.Locations.Location_Ptr;
Color : Transforms.Vector4 := (1.0, 1.0, 1.0, 1.0)) return Bounding_Box;
Color : Transforms.Vector4 := [1.0, 1.0, 1.0, 1.0]) return Bounding_Box;

function Create_Graph
(Object : Bounding_Box;
Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-rendering-debug-coordinate_axes.adb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ package body Orka.Rendering.Debug.Coordinate_Axes is
procedure Set_Data
(Object : in out Coordinate_Axes;
Width, Height : Positive;
Axis_Size : Transforms.Vector4 := (4.0, 100.0, 16.0, 32.0);
Axis_Size : Transforms.Vector4 := [4.0, 100.0, 16.0, 32.0];
View, Proj : Transforms.Matrix4;
Transforms : Rendering.Buffers.Buffer) is
begin
Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-rendering-debug-coordinate_axes.ads
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ package Orka.Rendering.Debug.Coordinate_Axes is
procedure Set_Data
(Object : in out Coordinate_Axes;
Width, Height : Positive;
Axis_Size : Transforms.Vector4 := (4.0, 100.0, 16.0, 32.0);
Axis_Size : Transforms.Vector4 := [4.0, 100.0, 16.0, 32.0];
View, Proj : Transforms.Matrix4;
Transforms : Rendering.Buffers.Buffer)
with Pre => Transforms.Length > 0;
Expand Down
4 changes: 2 additions & 2 deletions orka/src/orka/orka-rendering-debug-spheres.adb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package body Orka.Rendering.Debug.Spheres is

function Create_Sphere
(Location : Resources.Locations.Location_Ptr;
Color : Transforms.Vector4 := (1.0, 1.0, 1.0, 1.0);
Color : Transforms.Vector4 := [1.0, 1.0, 1.0, 1.0];
Normals : Boolean := False;
Cells_Horizontal : Positive := 36;
Cells_Vertical : Positive := 18) return Sphere
Expand Down Expand Up @@ -111,7 +111,7 @@ package body Orka.Rendering.Debug.Spheres is
State_Hidden : constant Orka.Rendering.States.State :=
(Depth_Func => GL.Types.LEqual,
Polygon_Mode => GL.Rasterization.Line,
Blend_Functions => (others => (Src_Alpha, One_Minus_Src_Alpha, One, Zero)),
Blend_Functions => [others => (Src_Alpha, One_Minus_Src_Alpha, One, Zero)],
Blending => True,
others => <>);

Expand Down
2 changes: 1 addition & 1 deletion orka/src/orka/orka-rendering-debug-spheres.ads
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ package Orka.Rendering.Debug.Spheres is

function Create_Sphere
(Location : Resources.Locations.Location_Ptr;
Color : Transforms.Vector4 := (1.0, 1.0, 1.0, 1.0);
Color : Transforms.Vector4 := [1.0, 1.0, 1.0, 1.0];
Normals : Boolean := False;
Cells_Horizontal : Positive := 36;
Cells_Vertical : Positive := 18) return Sphere;
Expand Down
8 changes: 4 additions & 4 deletions orka/src/orka/orka-rendering-effects-filters.adb
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ package body Orka.Rendering.Effects.Filters is

State : constant Orka.Rendering.States.State := (others => <>);

Resources_Horizontal : Orka.Frame_Graphs.Resource_Array (1 .. Passes) :=
Resources_Horizontal : constant Orka.Frame_Graphs.Resource_Array (1 .. Passes) :=
[for I in 1 .. Passes =>
(Name => +("sep-filter-horizontal-" & I'Image),
Description => Color,
others => <>)];

Resources_Vertical : Orka.Frame_Graphs.Resource_Array (1 .. Passes) :=
Resources_Vertical : constant Orka.Frame_Graphs.Resource_Array (1 .. Passes) :=
[for I in 1 .. Passes =>
(Name => +("sep-filter-vertical-" & I'Image),
Description => Color,
Expand Down Expand Up @@ -228,13 +228,13 @@ package body Orka.Rendering.Effects.Filters is

State : constant Orka.Rendering.States.State := (others => <>);

Resources_Horizontal : Orka.Frame_Graphs.Resource_Array (1 .. Passes) :=
Resources_Horizontal : constant Orka.Frame_Graphs.Resource_Array (1 .. Passes) :=
[for I in 1 .. Passes =>
(Name => +("avg-filter-horizontal-" & I'Image),
Description => Color,
others => <>)];

Resources_Vertical : Orka.Frame_Graphs.Resource_Array (1 .. Passes) :=
Resources_Vertical : constant Orka.Frame_Graphs.Resource_Array (1 .. Passes) :=
[for I in 1 .. Passes =>
(Name => +("avg-filter-vertical-" & I'Image),
Description => Color,
Expand Down
8 changes: 4 additions & 4 deletions orka/src/orka/orka-rendering-framebuffers.adb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ package body Orka.Rendering.Framebuffers is

Result.GL_Framebuffer.Set_Default_Samples (Samples);

Result.Set_Draw_Buffers ((0 => GL.Buffers.Color_Attachment0));
Result.Set_Draw_Buffers ([0 => GL.Buffers.Color_Attachment0]);
Result.Set_Read_Buffer (GL.Buffers.Color_Attachment0);
end return;
end Create_Framebuffer;
Expand All @@ -64,7 +64,7 @@ package body Orka.Rendering.Framebuffers is
others => <>)
do
-- Assumes a double-buffered context (Front_Left for single-buffered)
Result.Set_Draw_Buffers ((0 => GL.Buffers.Back_Left));
Result.Set_Draw_Buffers ([0 => GL.Buffers.Back_Left]);
Result.Set_Read_Buffer (GL.Buffers.Back_Left);
end return;
end Create_Default_Framebuffer;
Expand All @@ -91,11 +91,11 @@ package body Orka.Rendering.Framebuffers is

-- Adjust viewport
GL.Viewports.Set_Viewports
((0 => (X => 0.0,
([0 => (X => 0.0,
Y => 0.0,
Width => Single (Object.Width),
Height => Single (Object.Height))
));
]);

-- Check attachments
if not Object.Default then
Expand Down
Loading

0 comments on commit b686cc2

Please sign in to comment.