Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vsync python #820

Closed
gionnigio opened this issue Sep 2, 2018 · 2 comments
Closed

Vsync python #820

gionnigio opened this issue Sep 2, 2018 · 2 comments
Assignees
Labels

Comments

@gionnigio
Copy link

gionnigio commented Sep 2, 2018

i dont really know if it is bug or its intentional but:

bge.render.setVsync(bge.render.VSYNC_ON)
bge.render.getVsync()
returns 1

bge.render.setVsync(bge.render.VSYNC_OFF)
bge.render.getVsync()
returns 0

bge.render.setVsync(bge.render.VSYNC_ADAPTIVE)
bge.render.getVsync()
returns 0 as vsyncoff

upbge 0.2.3

@panzergame panzergame self-assigned this Sep 5, 2018
@panzergame panzergame added the bug label Sep 5, 2018
@panzergame
Copy link
Contributor

@lordloki, @youle31: Currently setVsyncand getVsync are using the swap interval value directly. But some systems/GPU are not handling adaptive vsync (interval = -1) and so the swap interval still remains 0 or 1 and is interpreted as VSYNC_ON or VSYNC_OFF.

To avoid this situation I suggest to let in RAS_ICanvas a value of the current set Vsync mode (from an enum). The setter will set the vsync mode AND the swap interval value whereas getter will just read the vsync mode and not care about swap interval.

What do you think ?

@youle31
Copy link
Collaborator

youle31 commented Sep 12, 2018

hi, I don't really know what is swap interval but if there is a possibility to display a warning when "adaptative vsync" is not supported, it can be useful i guess too. Else, to be honest, i'm not familiar with vsync...

panzergame added a commit that referenced this issue Sep 15, 2018
Previously bge.render.getVsync wasn't returning the value set by setVsync when
VSYNC_ADAPTIVE was used. It can be justified by the fact that adaptive is set
by using a negative swap interval value but the GLX get function still returns
a positive swap interval value and the flag GLX_LATE_SWAPS_TEAR_EXT meaning
adaptive is enabled.

In any case GLX could refuse a swap interval and the user should be able to do
setVsync(getVsync()) with no change on the swap control. To achieve this behaviour
RAS_ICanvas store the current swap control in a enum variable m_controlSwap,
this variable is used in getter GetSwapControl used by bge.render.getVsync().
The setter is virtual and overloaded in each canvas implementation, they use
a common table to find the swap interval associated to the swap control mode:
RAS_ICanvas::swapInterval.

Finally KX_PythonInit is using swap control enum value from RAS_ICanvas instead
of the one from DNA to avoid conversions.

Fix issue #820.
panzergame added a commit that referenced this issue Sep 29, 2018
Previously bge.render.getVsync wasn't returning the value set by setVsync when
VSYNC_ADAPTIVE was used. It can be justified by the fact that adaptive is set
by using a negative swap interval value but the GLX get function still returns
a positive swap interval value and the flag GLX_LATE_SWAPS_TEAR_EXT meaning
adaptive is enabled.

In any case GLX could refuse a swap interval and the user should be able to do
setVsync(getVsync()) with no change on the swap control. To achieve this behaviour
RAS_ICanvas store the current swap control in a enum variable m_controlSwap,
this variable is used in getter GetSwapControl used by bge.render.getVsync().
The setter is virtual and overloaded in each canvas implementation, they use
a common table to find the swap interval associated to the swap control mode:
RAS_ICanvas::swapInterval.

Finally KX_PythonInit is using swap control enum value from RAS_ICanvas instead
of the one from DNA to avoid conversions.

Fix issue #820.
youle31 pushed a commit that referenced this issue May 26, 2019
Previously bge.render.getVsync wasn't returning the value set by setVsync when
VSYNC_ADAPTIVE was used. It can be justified by the fact that adaptive is set
by using a negative swap interval value but the GLX get function still returns
a positive swap interval value and the flag GLX_LATE_SWAPS_TEAR_EXT meaning
adaptive is enabled.

In any case GLX could refuse a swap interval and the user should be able to do
setVsync(getVsync()) with no change on the swap control. To achieve this behaviour
RAS_ICanvas store the current swap control in a enum variable m_controlSwap,
this variable is used in getter GetSwapControl used by bge.render.getVsync().
The setter is virtual and overloaded in each canvas implementation, they use
a common table to find the swap interval associated to the swap control mode:
RAS_ICanvas::swapInterval.

Finally KX_PythonInit is using swap control enum value from RAS_ICanvas instead
of the one from DNA to avoid conversions.

Fix issue #820.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants