all: Fix unconstrained_Conversion's whose types have different sizes.

This commit is contained in:
Rod Kay
2025-09-21 13:16:24 +10:00
parent b02c1a92f7
commit 9469acaf91
7 changed files with 22 additions and 64 deletions

View File

@@ -99,8 +99,7 @@ is
type GLvoid_access is access all GLvoid;
function to_GL is new ada.unchecked_Conversion (attribute.data_Kind, gl.GLenum); -- TODO: Address different sizes warning.
function to_GL is new ada.unchecked_Conversion (storage_Offset, GLvoid_access);
function to_GL is new ada.unchecked_Conversion (storage_Offset, GLvoid_access);
begin
Tasks.check;
@@ -109,7 +108,7 @@ is
glVertexAttribPointer (Index => Self.gl_Location,
Size => Self.Size,
the_Type => to_GL (Self.data_Kind),
the_Type => Self.data_Kind'enum_Rep,
Normalized => Self.Normalized,
Stride => Self.vertex_Stride,
Ptr => to_GL (Self.Offset));

View File

@@ -2,6 +2,7 @@ with
GL,
system.storage_Elements;
package openGL.Attribute
--
-- Models an openGL shader attribute.
@@ -76,6 +77,7 @@ private
Normalized : gl.GLboolean;
end record;
for data_Kind use (GL_BYTE => 16#1400#,
GL_UNSIGNED_BYTE => 16#1401#,
GL_SHORT => 16#1402#,

View File

@@ -1,6 +1,6 @@
with
ada.unchecked_Deallocation,
ada.unchecked_Conversion;
ada.unchecked_Deallocation;
package body openGL.Font
is
@@ -232,13 +232,12 @@ is
Spacing : in Vector_3 := Origin_3D;
Mode : in fontImpl.RenderMode := fontImpl.RENDER_ALL) return Vector_3
is
function to_Integer is new ada.Unchecked_Conversion (fontImpl.RenderMode, Integer);
begin
return Self.impl.Render (Text,
Length,
Position,
Spacing,
to_Integer (Mode));
Mode'enum_Rep);
end check_Glyphs;

View File

@@ -8,8 +8,8 @@ with
GL.lean,
GL.Pointers,
freetype_c.Binding,
ada.unchecked_Conversion;
freetype_c.Binding;
package body openGL.FontImpl.Texture
is
@@ -167,8 +167,6 @@ is
use GL,
GL.Binding;
function to_Integer is new ada.unchecked_Conversion (fontImpl.RenderMode, Integer);
Tmp : Vector_3;
begin
@@ -180,9 +178,11 @@ is
GlyphImpl.texture.ResetActiveTexture;
Tmp := FontImpl.item (Self.all).Render (Text, Length,
Position, Spacing,
to_Integer (Mode));
Tmp := FontImpl.item (Self.all).Render (Text,
Length,
Position,
Spacing,
Mode'enum_Rep);
return Tmp;
end Render;