mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-10 12:21:39 +01:00
+ add support for the GLX_SGI_swap_control extension
* import all GLX procedures and functions via the glXGetProcAddress and glXGetProcAddressARB functions, if they are available. This is necessary, because not all GLX extension functions are exported statically by libGL.so git-svn-id: trunk@20516 -
This commit is contained in:
parent
fbc519faeb
commit
506f1ff3e4
@ -300,6 +300,9 @@ var
|
||||
glXReleaseBufferMESA: function(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl;
|
||||
glXCopySubBufferMESA: procedure(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl;
|
||||
|
||||
// GLX_SGI_swap_control
|
||||
glXSwapIntervalSGI: function(interval: Integer): Integer; cdecl;
|
||||
|
||||
// GLX_SGI_video_sync
|
||||
glXGetVideoSyncSGI: function(var counter: LongWord): Integer; cdecl;
|
||||
glXWaitVideoSyncSGI: function(divisor, remainder: Integer; var count: LongWord): Integer; cdecl;
|
||||
@ -346,6 +349,7 @@ function GLX_ARB_create_context_robustness(Display: PDisplay; Screen: Integer):
|
||||
function GLX_ARB_multisample(Display: PDisplay; Screen: Integer): boolean;
|
||||
function GLX_EXT_visual_info(Display: PDisplay; Screen: Integer): boolean;
|
||||
function GLX_MESA_pixmap_colormap(Display: PDisplay; Screen: Integer): boolean;
|
||||
function GLX_SGI_swap_control(Display: PDisplay; Screen: Integer): boolean;
|
||||
function GLX_SGI_video_sync(Display: PDisplay; Screen: Integer): boolean;
|
||||
function GLX_SGIS_multisample(Display: PDisplay; Screen: Integer): boolean;
|
||||
|
||||
@ -548,6 +552,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function GLX_SGI_swap_control(Display: PDisplay; Screen: Integer): boolean;
|
||||
var
|
||||
GlxExtensions: PChar;
|
||||
begin
|
||||
Result := GLX_version_1_1(Display);
|
||||
if Result then
|
||||
begin
|
||||
GlxExtensions := glXQueryExtensionsString(Display, Screen);
|
||||
Result := glext_ExtensionSupported('GLX_SGI_swap_control', GlxExtensions) and
|
||||
Assigned(glXSwapIntervalSGI);
|
||||
end;
|
||||
end;
|
||||
|
||||
function GLX_SGI_video_sync(Display: PDisplay; Screen: Integer): boolean;
|
||||
var
|
||||
GlxExtensions: PChar;
|
||||
@ -576,7 +593,13 @@ end;
|
||||
|
||||
function GetProc(handle: PtrInt; name: PChar): Pointer;
|
||||
begin
|
||||
Result := GetProcAddress(handle, name);
|
||||
if Assigned(glXGetProcAddress) then
|
||||
Result := glXGetProcAddress(name)
|
||||
else
|
||||
if Assigned(glXGetProcAddressARB) then
|
||||
Result := glXGetProcAddressARB(name)
|
||||
else
|
||||
Result := GetProcAddress(handle, name);
|
||||
if (Result = nil) and GLXDumpUnresolvedFunctions then
|
||||
WriteLn('Unresolved: ', name);
|
||||
end;
|
||||
@ -596,6 +619,16 @@ begin
|
||||
if OurLibGL = 0 then
|
||||
exit;
|
||||
|
||||
// glXGetProcAddress and glXGetProcAddressARB are imported first,
|
||||
// so we can use them (when they are available) to resolve all the
|
||||
// other imports
|
||||
|
||||
// GLX 1.4 and later
|
||||
glXGetProcAddress := GetProc(OurLibGL, 'glXGetProcAddress');
|
||||
// GLX_ARB_get_proc_address
|
||||
glXGetProcAddressARB := GetProc(OurLibGL, 'glXGetProcAddressARB');
|
||||
|
||||
// GLX 1.0
|
||||
glXChooseVisual := GetProc(OurLibGL, 'glXChooseVisual');
|
||||
glXCreateContext := GetProc(OurLibGL, 'glXCreateContext');
|
||||
glXDestroyContext := GetProc(OurLibGL, 'glXDestroyContext');
|
||||
@ -637,11 +670,7 @@ begin
|
||||
glXQueryContext := GetProc(OurLibGL, 'glXQueryContext');
|
||||
glXSelectEvent := GetProc(OurLibGL, 'glXSelectEvent');
|
||||
glXGetSelectedEvent := GetProc(OurLibGL, 'glXGetSelectedEvent');
|
||||
// GLX 1.4 and later
|
||||
glXGetProcAddress := GetProc(OurLibGL, 'glXGetProcAddress');
|
||||
// Extensions
|
||||
// GLX_ARB_get_proc_address
|
||||
glXGetProcAddressARB := GetProc(OurLibGL, 'glXGetProcAddressARB');
|
||||
// GLX_ARB_create_context
|
||||
glXCreateContextAttribsARB := GetProc(OurLibGL, 'glXCreateContextAttribsARB');
|
||||
// GLX_MESA_pixmap_colormap
|
||||
@ -649,6 +678,8 @@ begin
|
||||
// Unknown Mesa GLX extension
|
||||
glXReleaseBufferMESA := GetProc(OurLibGL, 'glXReleaseBufferMESA');
|
||||
glXCopySubBufferMESA := GetProc(OurLibGL, 'glXCopySubBufferMESA');
|
||||
// GLX_SGI_swap_control
|
||||
glXSwapIntervalSGI := GetProc(OurLibGL, 'glXSwapIntervalSGI');
|
||||
// GLX_SGI_video_sync
|
||||
glXGetVideoSyncSGI := GetProc(OurLibGL, 'glXGetVideoSyncSGI');
|
||||
glXWaitVideoSyncSGI := GetProc(OurLibGL, 'glXWaitVideoSyncSGI');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user