-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbase.pyi
More file actions
59 lines (50 loc) · 1.84 KB
/
base.pyi
File metadata and controls
59 lines (50 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
This type stub file was generated by pyright.
"""
import abc
import contextlib
"""Base class for OpenGL context handlers.
`ContextBase` defines a common API that OpenGL rendering contexts should conform
to. In addition, it provides a `make_current` context manager that:
1. Makes this OpenGL context current within the appropriate rendering thread.
2. Yields an object exposing a `call` method that can be used to execute OpenGL
calls within the rendering thread.
See the docstring for `dm_control.utils.render_executor` for further details
regarding rendering threads.
"""
_CURRENT_CONTEXT_FOR_THREAD = ...
_CURRENT_THREAD_FOR_CONTEXT = ...
class ContextBase(metaclass=abc.ABCMeta):
"""Base class for managing OpenGL contexts."""
def __init__(self, max_width, max_height, render_executor_class=...) -> None:
"""Initializes this context."""
...
def keep_alive(self, obj): # -> None:
...
def dont_keep_alive(self, obj): # -> None:
...
def increment_refcount(self): # -> None:
...
def decrement_refcount(self): # -> None:
...
@property
def terminated(self): # -> bool:
...
@property
def thread(self): # -> Thread | None:
...
def free(self): # -> None:
"""Frees resources associated with this context if its refcount is zero."""
...
def __del__(self): # -> None:
...
@contextlib.contextmanager
def make_current(self): # -> Generator[PassthroughRenderExecutor, Any, None]:
"""Context manager that makes this Renderer's OpenGL context current.
Yields:
An object that exposes a `call` method that can be used to call a
function on the dedicated rendering thread.
Raises:
RuntimeError: If this context is already current on another thread.
"""
...