OpenGL force discrete or dedicated board use (ISSUE) lazarus / 70-OpenGL ---------------------------------------------------------------------- LeP · 2026-03-02 18:12 Posted here, even though it's not strictly related to OPENGL. Needing to set the device used for rendering in OPENGL, I found an old repo searching the web with broken code to fix this. I fixed the code (a few things) and tested it in both Delphi and Lazarus. In Delphi, it works fine, but in Lazarus, it gives me an internal compilation error (Lazarus 4.6 / FPC 3.2.2): QuoteFatal: Internal error 200709272 I haven't found a way to fix it, and I saw that a report on FPC has been around for years at this link: https://gitlab.com/freepascal.org/fpc/source/-/work_items/29778 If anyone wants to refresh the report (I don't have an account). This is the code (the unit name has also been changed in the tests): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit OPENGL_SETDEVICE; {$mode ObjFPC}{$H+} interface {$ifndef fpc}uses WinApi.Windows;{$endif}             // Force usage of dedicated GPU for OpenGL with Delphi and FreePascal/Lazarus on Multi-GPU systems such as Notebooks on Windows// Insert that into your main source file, which is for example the .dpr (Delphi) or .lpr (Lazarus) file or use it like a unit// NOTE: this works only if the screen (NVidia panel) is set in Auto Mode const   ForceDedicatedGPUUsage = 1;   //set 0 for integrated GPU (like as for Intel CPU or Amd CPU) and 1 for dedicate as NVidia implementation{$if defined(Win64) or defined(Win32)}{$ifdef fpc} {$asmmode intel}{$endif}procedure NvOptimusEnablement; {$ifdef fpc}assembler; nostackframe;{$endif}asm{$ifdef cpux64}{$ifndef fpc} .NOFRAME{$endif}{$endif} dd ForceDedicatedGPUUsageend; procedure AmdPowerXpressRequestHighPerformance; {$ifdef fpc}assembler; nostackframe;{$endif}asm{$ifdef cpux64}{$ifndef fpc} .NOFRAME{$endif}{$endif} dd ForceDedicatedGPUUsageend;{$endif} exports NvOptimusEnablement,      AmdPowerXpressRequestHighPerformance; end.