the Fiddler's picture

[OpenGL] The 3.2 specs contain unsigned long tokens

Project:The Open Toolkit library
Version:0.9.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:open
Description

OpenGL versions prior to 3.2, limited OpenGL constants to 32bit integers. Version 3.2 introduces a new 64bit constant, TimeoutIgnored, with a value of 0xffffffff ffffffff. This token is only used in the parameter of the WaitSync method (ARB_sync extension).

To wrap this method correctly, we will need to add support for 64bit enums. As an added complication, 64bit values cannot be used in the "All" enum.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Inertia's picture

#1

This issue prevents a cleanup of GL_ARB_sync

Possible solution:

C: void WaitSync(sync sync,bitfield flags,uint64 timeout)
 
C#: void WaitSync(sync sync,bitfield flags)
{
  Delegates.WaitSync( sync, flags, 0xffffffffffffffff);
}

This overload would not conflict with the correct signature, but assumes that TimeoutIgnored is the only accepted 3rd parameter for this function (which it is for now).

the Fiddler's picture

#2

I think the best solution is to map the last parameter to a ulong and add an overload by hand, which will take a 64bit enum with TimeoutIgnored as its only value.

Inertia's picture

#3

My suggestion considered that the timeout parameter is designed to specify a timespan, not a token-parameter. Currently WaitSync's timeout parameter is unused (and the token the only valid parameter), but it will likely become usable at some point and the enum might be more confusing than the 2-parameter overload would be. Anyways, I've made it an enum for now.

http://www.opengl.org/registry/specs/ARB/sync.txt

enum SyncCondition
{
SYNC_GPU_COMMANDS_COMPLETE 0x9117
}

C: sync FenceSync(enum condition,bitfield flags)
SVN: IntPtr FenceSync(OpenTK.Graphics.OpenGL.ArbSync condition, Int32 flags)
New: IntPtr FenceSync(SyncCondition condition, Int32 flags)

Quote for clarification: "An INVALID_ENUM error is generated if condition is not SYNC_GPU_COMMANDS_COMPLETE. If flags is not zero, an INVALID_VALUE error is generated."

C: boolean IsSync(sync sync)
SVN: bool IsSync(IntPtr sync)
(correct)

C: void DeleteSync(sync sync)
SVN: void DeleteSync(IntPtr sync)
(correct)

enum ClientWaitSyncResult
{
ALREADY_SIGNALED 0x911A
TIMEOUT_EXPIRED 0x911B
CONDITION_SATISFIED 0x911C
WAIT_FAILED 0x911D
}

enum ClientWaitSyncFlags
{
SYNC_FLUSH_COMMANDS_BIT 0x00000001
}

C: enum ClientWaitSync(sync sync,bitfield flags,uint64 timeout)
SVN: OpenTK.Graphics.OpenGL.ArbSync ClientWaitSync(IntPtr sync, UInt32 flags, UInt64 timeout)
New: ClientWaitSync ClientWaitSync(IntPtr sync, ClientWaitSyncFlags flags, UInt64 timeout)

enum WaitSyncTimeout : ulong
{
TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
}

C: void WaitSync(sync sync,bitfield flags,uint64 timeout)
SVN: void WaitSync(IntPtr sync, UInt32 flags, UInt64 timeout)
New: void WaitSync(IntPtr sync, UInt32 flags, WaitSyncTimeout timeout)

enum GetInteger64PName
{
MAX_SERVER_WAIT_TIMEOUT 0x9111
}

C: void GetInteger64v(enum pname, int64 *params);
SVN: void GetInteger64(OpenTK.Graphics.OpenGL.ArbSync pname, [OutAttribute] Int64* @params)
New: void GetInteger64(GetInteger64PName pname, [OutAttribute] Int64* @params)

Note: glGetInteger64i_v also exists, but is not mentioned in this spec.

enum GetSyncPName
{
OBJECT_TYPE 0x9112
SYNC_CONDITION 0x9113
SYNC_STATUS 0x9114
SYNC_FLAGS 0x9115
}

C: void GetSynciv(sync sync,enum pname,sizei bufSize,sizei *length, int *values)
SVN: void GetSync(IntPtr sync, OpenTK.Graphics.OpenGL.ArbSync pname, Int32 bufSize, [OutAttribute] Int32* length, [OutAttribute] Int32* values)
New: void GetSync(IntPtr sync, GetSyncPName pname, Int32 bufSize, [OutAttribute] Int32* length, [OutAttribute] Int32* values)

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

Not required, a suggestion:

The following may be returned by GetSync in the 'values' parameter, it might be nice to add an overload like this to interpret them:

void GetSync(IntPtr sync, GetSyncPName pname, Int32 bufSize, [Out] All values)

or put all 4 tokens into a single (new) enum and return that instead of the All-enum.

"spec" wrote:

Returned in values for GetSynciv pname OBJECT_TYPE:

SYNC_FENCE 0x9116

Returned in values for GetSynciv pname SYNC_CONDITION:

SYNC_GPU_COMMANDS_COMPLETE 0x9117

Returned in values for GetSynciv pname SYNC_STATUS:

UNSIGNALED 0x9118
SIGNALED 0x9119