Function get_current_software_framebuffer

Source
pub unsafe fn get_current_software_framebuffer(
    callback: retro_environment_t,
    data: retro_framebuffer,
) -> Option<retro_framebuffer>
Expand description

Unstable Returns a preallocated framebuffer which the core can use for rendering the frame into when not using set_hw_render. The framebuffer returned from this call must not be used after the current call to Core::on_run returns.

The goal of this call is to allow zero-copy behavior where a core can render directly into video memory, avoiding extra bandwidth cost by copying memory from core to video memory.

If this call succeeds and the core renders into it, the framebuffer pointer and pitch can be passed to RunContext::draw_framebuffer. If the buffer from get_current_software_framebuffer is to be used, the core must pass the exact same pointer as returned by get_current_software_framebuffer; i.e. passing a pointer which is offset from the buffer is undefined. The width, height and pitch parameters must also match exactly to the values obtained from get_current_software_framebuffer.

It is possible for a frontend to return a different pixel format than the one used in set_pixel_format. This can happen if the frontend needs to perform conversion.

It is still valid for a core to render to a different buffer even if get_current_software_framebuffer succeeds.

A frontend must make sure that the pointer obtained from this function is writeable (and readable).

ยงThis feature is unstable and guarded by the unstable-env-commands feature flag.

Please be advised that this feature might change without further notice and no guarantees about its stability can be made.