mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 13:02:38 +02:00
Store pixel-format in a global instead of hard-coding it and added a disabled func for setting it. Added a pixel-format comment to gfx.h.
This commit is contained in:
parent
3c4c35e6e5
commit
2022d545dc
@ -22,6 +22,8 @@ typedef enum
|
|||||||
GfxMode_LinearDouble ///< Double-buffering with linear framebuffer, which is transferred to the actual framebuffer by \ref gfxFlushBuffers().
|
GfxMode_LinearDouble ///< Double-buffering with linear framebuffer, which is transferred to the actual framebuffer by \ref gfxFlushBuffers().
|
||||||
} GfxMode;
|
} GfxMode;
|
||||||
|
|
||||||
|
/// Framebuffer pixel-format is RGBA8888, there's no known way to change this.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initializes the graphics subsystem.
|
* @brief Initializes the graphics subsystem.
|
||||||
* @warning Do not use \ref viInitialize when using this function.
|
* @warning Do not use \ref viInitialize when using this function.
|
||||||
|
@ -34,6 +34,8 @@ static GfxMode g_gfxMode = GfxMode_LinearDouble;
|
|||||||
|
|
||||||
static u8 *g_gfxFramebufLinear;
|
static u8 *g_gfxFramebufLinear;
|
||||||
|
|
||||||
|
static s32 g_gfxPixelFormat = 0;
|
||||||
|
|
||||||
size_t g_gfx_framebuf_width=0, g_gfx_framebuf_aligned_width=0;
|
size_t g_gfx_framebuf_width=0, g_gfx_framebuf_aligned_width=0;
|
||||||
size_t g_gfx_framebuf_height=0, g_gfx_framebuf_aligned_height=0;
|
size_t g_gfx_framebuf_height=0, g_gfx_framebuf_aligned_height=0;
|
||||||
size_t g_gfx_framebuf_display_width=0, g_gfx_framebuf_display_height=0;
|
size_t g_gfx_framebuf_display_width=0, g_gfx_framebuf_display_height=0;
|
||||||
@ -136,7 +138,7 @@ static Result _gfxDequeueBuffer(void) {
|
|||||||
|
|
||||||
memcpy(&tmp_fence, fence, sizeof(bufferProducerFence));//Offical sw waits on the fence from the previous DequeueBuffer call. Using the fence from the current DequeueBuffer call results in nvgfxEventWait() failing.
|
memcpy(&tmp_fence, fence, sizeof(bufferProducerFence));//Offical sw waits on the fence from the previous DequeueBuffer call. Using the fence from the current DequeueBuffer call results in nvgfxEventWait() failing.
|
||||||
|
|
||||||
rc = bufferProducerDequeueBuffer(async, g_gfx_framebuf_width, g_gfx_framebuf_height, 0, 0x300, &g_gfxCurrentProducerBuffer, fence);
|
rc = bufferProducerDequeueBuffer(async, g_gfx_framebuf_width, g_gfx_framebuf_height, g_gfxPixelFormat, 0x300, &g_gfxCurrentProducerBuffer, fence);
|
||||||
|
|
||||||
//Only run nvgfxEventWait when the fence is valid and the id is not NO_FENCE.
|
//Only run nvgfxEventWait when the fence is valid and the id is not NO_FENCE.
|
||||||
if (R_SUCCEEDED(rc) && tmp_fence.is_valid && tmp_fence.nv_fences[0].id!=0xffffffff) rc = nvgfxEventWait(tmp_fence.nv_fences[0].id, tmp_fence.nv_fences[0].value, -1);
|
if (R_SUCCEEDED(rc) && tmp_fence.is_valid && tmp_fence.nv_fences[0].id!=0xffffffff) rc = nvgfxEventWait(tmp_fence.nv_fences[0].id, tmp_fence.nv_fences[0].value, -1);
|
||||||
@ -181,6 +183,7 @@ static Result _gfxInit(ViServiceType servicetype, const char *DisplayName, u32 L
|
|||||||
|
|
||||||
g_gfx_drawflip = true;
|
g_gfx_drawflip = true;
|
||||||
g_gfxQueueBufferData.transform = NATIVE_WINDOW_TRANSFORM_FLIP_V;
|
g_gfxQueueBufferData.transform = NATIVE_WINDOW_TRANSFORM_FLIP_V;
|
||||||
|
g_gfxPixelFormat = 0;
|
||||||
|
|
||||||
memset(g_gfx_ProducerSlotsRequested, 0, sizeof(g_gfx_ProducerSlotsRequested));
|
memset(g_gfx_ProducerSlotsRequested, 0, sizeof(g_gfx_ProducerSlotsRequested));
|
||||||
memset(&g_gfx_DequeueBuffer_fence, 0, sizeof(g_gfx_DequeueBuffer_fence));
|
memset(&g_gfx_DequeueBuffer_fence, 0, sizeof(g_gfx_DequeueBuffer_fence));
|
||||||
@ -551,6 +554,10 @@ void gfxConfigureTransform(u32 transform) {
|
|||||||
g_gfxQueueBufferData.transform = transform;
|
g_gfxQueueBufferData.transform = transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*void gfxSetPixelFormat(s32 format) {
|
||||||
|
g_gfxPixelFormat = format;
|
||||||
|
}*/
|
||||||
|
|
||||||
void gfxFlushBuffers(void) {
|
void gfxFlushBuffers(void) {
|
||||||
u32 *actual_framebuf = (u32*)&g_gfxFramebuf[g_gfxCurrentBuffer*g_gfx_singleframebuf_size];
|
u32 *actual_framebuf = (u32*)&g_gfxFramebuf[g_gfxCurrentBuffer*g_gfx_singleframebuf_size];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user