opengl.tasks: Only check tasks are the same during debug build mode.

This commit is contained in:
Rod Kay
2024-04-24 19:48:30 +10:00
parent 55099f4991
commit 55cac1b347

View File

@@ -1,22 +1,34 @@
with
openGL.Errors;
package body openGL.Tasks package body openGL.Tasks
is is
use openGL.Errors;
procedure check procedure check
is is
use Ada,
ada.Task_Identification;
calling_Task : constant Task_Id := Task_Identification.current_Task;
-- TODO: Use the assert instead of the exception for performance.
-- pragma assert (Renderer_Task = calling_Task,
-- "Calling task '" & Task_Identification.Image (current_Task) & "'"
-- & " /= Renderer task '" & Task_Identification.Image (Renderer_Task) & "'");
begin begin
if Renderer_Task /= calling_Task if Debugging
then then
raise Error with "Calling task '" & Task_Identification.Image (current_Task) & "'" declare
& " /= Renderer task '" & Task_Identification.Image (Renderer_Task) & "'"; use Ada,
ada.Task_Identification;
calling_Task : constant Task_Id := Task_Identification.current_Task;
-- TODO: Use the assert instead of the exception for performance.
-- pragma assert (Renderer_Task = calling_Task,
-- "Calling task '" & Task_Identification.Image (current_Task) & "'"
-- & " /= Renderer task '" & Task_Identification.Image (Renderer_Task) & "'");
begin
if Renderer_Task /= calling_Task
then
raise Error with "Calling task '" & Task_Identification.Image (current_Task) & "'"
& " /= Renderer task '" & Task_Identification.Image (Renderer_Task) & "'";
end if;
end;
end if; end if;
end check; end check;
@@ -25,7 +37,11 @@ is
function check return Boolean function check return Boolean
is is
begin begin
check; if Debugging
then
check;
end if;
return True; return True;
end check; end check;