mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-29 16:22:39 +02:00
Added gfxSetDrawFlip() and gfxConfigureTransform().
This commit is contained in:
parent
ff8a95b47d
commit
3c4c35e6e5
@ -83,6 +83,12 @@ size_t gfxGetFramebufferSize(void);
|
||||
/// Sets the \ref GfxMode.
|
||||
void gfxSetMode(GfxMode mode);
|
||||
|
||||
/// Controls whether a vertical-flip is done when determining the pixel-offset within the actual framebuffer. By default this is enabled.
|
||||
void gfxSetDrawFlip(bool flip);
|
||||
|
||||
/// Configures transform. See the NATIVE_WINDOW_TRANSFORM_* enums in buffer_producer.h. The default is NATIVE_WINDOW_TRANSFORM_FLIP_V.
|
||||
void gfxConfigureTransform(u32 transform);
|
||||
|
||||
/// Flushes the framebuffer in the data cache. When \ref GfxMode is GfxMode_LinearDouble, this also transfers the linear-framebuffer to the actual framebuffer.
|
||||
void gfxFlushBuffers(void);
|
||||
|
||||
@ -94,10 +100,11 @@ static inline u32 gfxGetFramebufferDisplayOffset(u32 x, u32 y) {
|
||||
|
||||
extern size_t g_gfx_framebuf_aligned_width;
|
||||
extern size_t g_gfx_framebuf_display_height;
|
||||
extern bool g_gfx_drawflip;
|
||||
|
||||
//if (x >= g_gfx_framebuf_width || y >= g_gfx_framebuf_display_height) return (gfxGetFramebufferSize()-4)/4;//Return the last pixel-offset in the buffer, the data located here is not displayed due to alignment. (Disabled for perf)
|
||||
|
||||
y = g_gfx_framebuf_display_height-1-y;
|
||||
if (g_gfx_drawflip) y = g_gfx_framebuf_display_height-1-y;
|
||||
|
||||
tmp_pos = ((y & 127) / 16) + (x/16*8) + ((y/16/8)*(g_gfx_framebuf_aligned_width/16*8));
|
||||
tmp_pos *= 16*16 * 4;
|
||||
|
@ -40,6 +40,8 @@ size_t g_gfx_framebuf_display_width=0, g_gfx_framebuf_display_height=0;
|
||||
size_t g_gfx_singleframebuf_size=0;
|
||||
size_t g_gfx_singleframebuf_linear_size=0;
|
||||
|
||||
bool g_gfx_drawflip = true;
|
||||
|
||||
static AppletHookCookie g_gfx_autoresolution_applethookcookie;
|
||||
static bool g_gfx_autoresolution_enabled;
|
||||
|
||||
@ -55,7 +57,6 @@ extern nvioctl_fence g_nvgfx_nvhostgpu_gpfifo_fence;
|
||||
|
||||
//static Result _gfxGetDisplayResolution(u64 *width, u64 *height);
|
||||
|
||||
//TODO: Let the user configure some of this?
|
||||
static bufferProducerQueueBufferInput g_gfxQueueBufferData = {
|
||||
.timestamp = 0x0,
|
||||
.isAutoTimestamp = 0x1,
|
||||
@ -178,6 +179,9 @@ static Result _gfxInit(ViServiceType servicetype, const char *DisplayName, u32 L
|
||||
g_gfxFramebufSize = 0;
|
||||
g_gfxMode = GfxMode_LinearDouble;
|
||||
|
||||
g_gfx_drawflip = true;
|
||||
g_gfxQueueBufferData.transform = NATIVE_WINDOW_TRANSFORM_FLIP_V;
|
||||
|
||||
memset(g_gfx_ProducerSlotsRequested, 0, sizeof(g_gfx_ProducerSlotsRequested));
|
||||
memset(&g_gfx_DequeueBuffer_fence, 0, sizeof(g_gfx_DequeueBuffer_fence));
|
||||
|
||||
@ -539,6 +543,14 @@ void gfxSetMode(GfxMode mode) {
|
||||
g_gfxMode = mode;
|
||||
}
|
||||
|
||||
void gfxSetDrawFlip(bool flip) {
|
||||
g_gfx_drawflip = flip;
|
||||
}
|
||||
|
||||
void gfxConfigureTransform(u32 transform) {
|
||||
g_gfxQueueBufferData.transform = transform;
|
||||
}
|
||||
|
||||
void gfxFlushBuffers(void) {
|
||||
u32 *actual_framebuf = (u32*)&g_gfxFramebuf[g_gfxCurrentBuffer*g_gfx_singleframebuf_size];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user