libretro.api.video.context¶
Hardware rendering API context types and callbacks.
Module Attributes
Passed to |
|
Notify the core that the hardware rendering context has been (re)created or destroyed. |
|
Return the current frontend-managed hardware framebuffer object. |
|
Look up a function pointer in the active hardware rendering API. |
Classes
Hardware rendering API supported by libretro. |
|
Description of the hardware rendering context a core requires, with callbacks for reacting to or querying the context. |
- class HardwareContext[source]¶
Bases:
IntEnumHardware rendering API supported by libretro.
Corresponds to
retro_hw_context_typeinlibretro.h.See also
VideoDriverThe
Protocolthat implements one or more of these context types.
- NONE = 0¶
Software rendering only.
Note
The active
VideoDrivermay still use a hardware rendering API, but it won’t be exposed to the core.
- OPENGL = 1¶
OpenGL 2.x, or a newer OpenGL version with the compatibility profile.
- OPENGLES2 = 2¶
OpenGL ES 2.0.
- OPENGL_CORE = 3¶
OpenGL 3.2+ core profile.
- OPENGLES3 = 4¶
OpenGL ES 3.0.
- OPENGLES_VERSION = 5¶
OpenGL ES with version specified by
version_majorandversion_minor.
- VULKAN = 6¶
Vulkan.
Note
libretro.py doesn’t currently support Vulkan contexts. Pull requests are welcome!
- D3D11 = 7¶
Direct3D 11.
Note
libretro.py doesn’t currently support Direct3D contexts. Pull requests are welcome!
- D3D10 = 8¶
Direct3D 10.
Note
libretro.py doesn’t currently support Direct3D contexts. Pull requests are welcome!
- D3D12 = 9¶
Direct3D 12.
Note
libretro.py doesn’t currently support Direct3D contexts. Pull requests are welcome!
- D3D9 = 10¶
Direct3D 9.
Note
libretro.py doesn’t currently support Direct3D contexts. Pull requests are welcome!
- __new__(value)¶
- classmethod value in self¶
Return True if value is in cls.
value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)
- classmethod self[name]¶
Return the member matching name.
- __init__()¶
- classmethod iter(self)¶
Return members in definition order.
- classmethod len(self)¶
Return the number of members (no aliases)
- retro_hw_context_reset_t¶
Notify the core that the hardware rendering context has been (re)created or destroyed.
Registered by the core and called by the frontend when a hardware rendering context is initialized, lost, or about to be torn down. A core should treat all GPU resources as invalid after this is called as a reset and recreate them; for a destroy notification, it should simply free its resources without further GPU calls.
Corresponds to
retro_hw_context_reset_tinlibretro.h.
- retro_hw_get_current_framebuffer_t¶
Return the current frontend-managed hardware framebuffer object.
Registered by the frontend and called by the core to obtain the framebuffer it should render into for the current frame.
- Returns:
An opaque
c_uintptridentifying the framebuffer (typically an OpenGL FBO ID). The value may change from frame to frame.
Note
This callback exists for historical reasons and is only meaningful for OpenGL contexts.
Corresponds to
retro_hw_get_current_framebuffer_tinlibretro.h.
- retro_hw_get_proc_address_t¶
Look up a function pointer in the active hardware rendering API.
Registered by the frontend and called by the core to obtain entry points such as
glClearor other GPU API functions.- Parameters:
sym – Name of the symbol to look up, as a
bytes-like object.- Returns:
A
c_void_ptrto the requested function, orNoneif the symbol could not be resolved.
Note
The returned pointer must be cast to the correct function signature before use.
Corresponds to
retro_hw_get_proc_address_tinlibretro.h.
- class retro_hw_render_callback[source]¶
Bases:
StructureDescription of the hardware rendering context a core requires, with callbacks for reacting to or querying the context.
Corresponds to
retro_hw_render_callbackinlibretro.h.>>> from libretro.api.video import retro_hw_render_callback, HardwareContext >>> cb = retro_hw_render_callback() >>> cb.context_type == HardwareContext.NONE True
- classmethod __new__(*args, **kwargs)¶
- __init__(context_type=HardwareContext.NONE, context_reset=None, get_current_framebuffer=None, get_proc_address=None, depth=False, stencil=False, bottom_left_origin=False, version_major=0, version_minor=0, cache_context=False, context_destroy=None, debug_context=False)[source]¶
Create a new
retro_hw_render_callback.
- context_type¶
Hardware rendering API to use.
- context_reset¶
Called when the rendering context is created or reset.
See also
VideoDriver.reinit()The suggested method to call this callback.
- get_current_framebuffer¶
Return the current hardware framebuffer. Set by the frontend.
Note
This callback exists for historical reasons and is only meaningful for OpenGL contexts.
See also
VideoDriver.current_framebufferThe suggested property to implement this callback.
- get_proc_address¶
Looks up a rendering API function by name. Set by the frontend.
See also
VideoDriver.get_proc_address()The suggested method to implement this callback.
- depth¶
Whether the framebuffer should have a depth component.
Note
This field exists for historical reasons and is only meaningful for OpenGL contexts.
- stencil¶
Whether the framebuffer should have a stencil component.
Note
This field exists for historical reasons and is only meaningful for OpenGL contexts.
- bottom_left_origin¶
Whether to use bottom-left origin convention.
- version_major¶
Major version number for the rendering context.
- version_minor¶
Minor version number for the rendering context.
- cache_context¶
Whether the frontend should avoid resetting the context.
- context_destroy¶
Called before the context is destroyed.
- debug_context¶
Whether to create a debug rendering context.
- __deepcopy__(_)[source]¶
Return a deep copy of this object. Intended for use with
copy.deepcopy().
- HW_FRAME_BUFFER_VALID = c_void_p(18446744073709551615)¶
Passed to
retro_video_refresh_tto signal that the next video frame should be rendered with the GPU context state instead of a software-accessible framebuffer.