From c80096e5cc25f846ae132ecf24595fabd0379945 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sun, 17 Dec 2017 22:34:51 -0500 Subject: [PATCH] Imported an enum from Android for use with bufferProducerConnect/bufferProducerDisconnect. --- nx/include/switch/gfx/buffer_producer.h | 10 ++++++++++ nx/source/gfx/gfx.c | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/gfx/buffer_producer.h b/nx/include/switch/gfx/buffer_producer.h index f81b84a8..619dc0e1 100644 --- a/nx/include/switch/gfx/buffer_producer.h +++ b/nx/include/switch/gfx/buffer_producer.h @@ -36,6 +36,16 @@ enum { // NATIVE_WINDOW_DEFAULT_HEIGHT = 7, }; +//From Android window.h. +/* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */ +enum { + //... + /* Buffers will be queued after being filled using the CPU + */ + NATIVE_WINDOW_API_CPU = 2, + //... +}; + Result bufferProducerInitialize(binderSession *session); void bufferProducerExit(); diff --git a/nx/source/gfx/gfx.c b/nx/source/gfx/gfx.c index 30c19117..012f2c28 100644 --- a/nx/source/gfx/gfx.c +++ b/nx/source/gfx/gfx.c @@ -149,7 +149,7 @@ static Result _gfxInit(viServiceType servicetype, const char *DisplayName, u32 L if (R_SUCCEEDED(rc)) rc = bufferProducerInitialize(&g_gfxBinderSession); - if (R_SUCCEEDED(rc)) rc = bufferProducerConnect(2, 0, &g_gfx_Connect_QueueBufferOutput); + if (R_SUCCEEDED(rc)) rc = bufferProducerConnect(NATIVE_WINDOW_API_CPU, 0, &g_gfx_Connect_QueueBufferOutput); if (R_SUCCEEDED(rc)) g_gfx_ProducerConnected = 1; @@ -195,7 +195,7 @@ static Result _gfxInit(viServiceType servicetype, const char *DisplayName, u32 L for(i=0; i<2; i++) { if (g_gfx_ProducerSlotsRequested[i]) bufferProducerDetachBuffer(i); } - if (g_gfx_ProducerConnected) bufferProducerDisconnect(2); + if (g_gfx_ProducerConnected) bufferProducerDisconnect(NATIVE_WINDOW_API_CPU); nvgfxExit(); bufferProducerExit();