Skip to content

Commit

Permalink
OpenGLテクスチャ読み込みのワークアラウンド(まだテストできていません)
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailJP committed Jun 19, 2024
1 parent 6cdca0e commit 18ccfb4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#define MIHAJONG_MAJOR_VER 2
#define MIHAJONG_MINOR_VER 4
#define MIHAJONG_PATCH_VER 3
#define MIHAJONG_VER "2.4.3"
#define MIHAJONG_PATCH_VER 4
#define MIHAJONG_VER "2.4.4"

#define MJCORE_MAJOR_VER 2
#define MJCORE_MINOR_VER 4
Expand Down Expand Up @@ -32,8 +32,8 @@

#define GRAPHIC_MAJOR_VER 2
#define GRAPHIC_MINOR_VER 4
#define GRAPHIC_PATCH_VER 2
#define GRAPHIC_VER "2.4.2"
#define GRAPHIC_PATCH_VER 4
#define GRAPHIC_VER "2.4.4"

#define CONFIG_MAJOR_VER 2
#define CONFIG_MINOR_VER 4
Expand Down
6 changes: 6 additions & 0 deletions graphic/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ namespace {
std::condition_variable condVar;
bool initialized = false;
}
#ifndef WITH_DIRECTX
thread_local bool isGraphicThread = false;
#endif

#if defined(_WIN32) && !defined(WITH_DIRECTX)
GdiplusStartupInput gdiplusInput;
Expand All @@ -37,6 +40,9 @@ EXPORT bool InitWindow(void* hInstance, int nCmdShow, LPCTSTR icon, Window* hwnd
{
/* ウィンドウの初期化 */
std::unique_lock<std::mutex> lock(initMutex);
#ifndef WITH_DIRECTX
isGraphicThread = true;
#endif
#if defined(_WIN32) && !defined(WITH_DIRECTX)
GdiplusStartup(&gdiplusToken, &gdiplusInput, nullptr);
#endif
Expand Down
8 changes: 8 additions & 0 deletions graphic/loadtex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,16 @@ namespace mihajong_graphic {
std::map<TexturePtr, unsigned> TextureHeight;
#endif
//}
#ifndef WITH_DIRECTX
extern thread_local bool isGraphicThread;
#endif

void LoadTexture(DevicePtr device, TexturePtr* texture, LPCTSTR resource) {
#ifndef WITH_DIRECTX
if (!isGraphicThread) {
return; // OpenGLの場合は違うスレッドで読み込んでも意味がない
}
#endif
#if defined(_WIN32) && !defined(WITH_DIRECTX)
using namespace Gdiplus;
#endif
Expand Down

0 comments on commit 18ccfb4

Please sign in to comment.