Merge pull request #1 from lotaviods/amd_gpu_fixes

AMD chunk rendering failure caused by multithreaded OpenGL context usage
This commit is contained in:
JuiceyDev 2026-03-08 11:26:02 +01:00 committed by GitHub
commit afd41f33e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View file

@ -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;

View file

@ -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