gfx: Add a buffer index to gfxGetFramebufferHandle().

This commit is contained in:
Jules Blok 2018-06-25 15:26:45 +02:00 committed by fincs
parent 4f331eb9f7
commit e234129598
2 changed files with 7 additions and 4 deletions

View File

@ -73,8 +73,8 @@ void gfxWaitForVsync(void);
/// Swaps the framebuffers (for double-buffering).
void gfxSwapBuffers(void);
/// Get the current framebuffer nvmap handle, with optional output ptrs for the current offset in the buffer.
u32 gfxGetFramebufferHandle(u32* offset);
/// Get the specified framebuffer nvmap handle where index specifies the buffer number beginning with the back buffer, with optional output ptr for the offset in the buffer.
u32 gfxGetFramebufferHandle(u32 index, u32* offset);
/// Get the current framebuffer address, with optional output ptrs for the display framebuffer width/height. The display width/height is adjusted by \ref gfxConfigureCrop and \ref gfxConfigureResolution.
u8* gfxGetFramebuffer(u32* width, u32* height);

View File

@ -503,8 +503,11 @@ void gfxSwapBuffers(void) {
if (R_FAILED(rc)) fatalSimple(MAKERESULT(Module_Libnx, LibnxError_BadGfxDequeueBuffer));
}
u32 gfxGetFramebufferHandle(u32* offset) {
if (offset) *offset = g_gfxCurrentBuffer*g_gfx_singleframebuf_size;
u32 gfxGetFramebufferHandle(u32 index, u32* offset) {
if (offset) {
index = (g_gfxCurrentBuffer + index) & (g_nvgfx_totalframebufs-1);
*offset = index*g_gfx_singleframebuf_size;
}
return g_gfxFramebufHandle;
}