mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-27 15:12:58 +00:00
Merge pull request #1 from lotaviods/amd_gpu_fixes
AMD chunk rendering failure caused by multithreaded OpenGL context usage
This commit is contained in:
commit
afd41f33e8
|
|
@ -34,7 +34,9 @@ static pthread_once_t s_glCtxKeyOnce = PTHREAD_ONCE_INIT;
|
|||
static void makeGLCtxKey() { pthread_key_create(&s_glCtxKey, nullptr); }
|
||||
|
||||
// Pre-created pool of shared contexts for worker threads
|
||||
static const int MAX_SHARED_CONTEXTS = 8;
|
||||
|
||||
// TODO: WAS MAX_SHARED_CONTEXTS = 8 but seems to no render well on AMD cards
|
||||
static const int MAX_SHARED_CONTEXTS = 3;
|
||||
static GLFWwindow *s_sharedContexts[MAX_SHARED_CONTEXTS] = {};
|
||||
static int s_sharedContextCount = 0;
|
||||
static int s_nextSharedContext = 0;
|
||||
|
|
|
|||
|
|
@ -1704,7 +1704,7 @@ void Minecraft::run_middle()
|
|||
timer->advanceTime();
|
||||
}
|
||||
|
||||
//__int64 beforeTickTime = System::nanoTime();
|
||||
__int64 beforeTickTime = System::nanoTime();
|
||||
for (int i = 0; i < timer->ticks; i++)
|
||||
{
|
||||
bool bLastTimerTick = ( i == ( timer->ticks - 1 ) );
|
||||
|
|
@ -1790,7 +1790,7 @@ void Minecraft::run_middle()
|
|||
// CompressedTileStorage::tick(); // 4J added
|
||||
// SparseDataStorage::tick(); // 4J added
|
||||
}
|
||||
//__int64 tickDuraction = System::nanoTime() - beforeTickTime;
|
||||
__int64 tickDuraction = System::nanoTime() - beforeTickTime;
|
||||
MemSect(31);
|
||||
checkGlError(L"Pre render");
|
||||
MemSect(0);
|
||||
|
|
@ -1895,10 +1895,10 @@ void Minecraft::run_middle()
|
|||
Sleep(10);
|
||||
}
|
||||
*/
|
||||
|
||||
renderFpsMeter(tickDuraction);
|
||||
if (options->renderDebug)
|
||||
{
|
||||
//renderFpsMeter(tickDuraction);
|
||||
|
||||
|
||||
#if DEBUG_RENDER_SHOWS_PACKETS
|
||||
// To show data for only one packet type
|
||||
|
|
|
|||
Loading…
Reference in a new issue