mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Textures loaded from other thread than the main gl context thread, will use the
shared opengl context if available.
This commit is contained in:
@@ -84,14 +84,6 @@ class EE_API cTextureLoader : public cObjectLoader {
|
||||
|
||||
/** @return The texture instance ( if it was loaded ). */
|
||||
cTexture * GetTexture() const;
|
||||
|
||||
/** In the case that the image loading is made outside the GL context main thread,
|
||||
** you'll need to force the use of the GL Shared Context
|
||||
** @see cWindow::IsThreadedGLContext */
|
||||
void ForceUseGLSharedContext( bool force );
|
||||
|
||||
/** @return If the use of a gl shared context to load the texture is being forced */
|
||||
const bool& ForceUseGLSharedContext() const;
|
||||
protected:
|
||||
Uint32 mLoadType; // From memory, from path, from pack
|
||||
Uint8 * mPixels; // Texture Info
|
||||
@@ -107,7 +99,6 @@ class EE_API cTextureLoader : public cObjectLoader {
|
||||
EE_CLAMP_MODE mClampMode;
|
||||
bool mCompressTexture;
|
||||
bool mLocalCopy;
|
||||
bool mForceGLThreaded;
|
||||
cPack * mPack;
|
||||
cIOStream * mStream;
|
||||
|
||||
@@ -125,7 +116,7 @@ class EE_API cTextureLoader : public cObjectLoader {
|
||||
int mImgType;
|
||||
int mIsCompressed;
|
||||
|
||||
cClock mTE;
|
||||
cClock mTE;
|
||||
|
||||
void LoadFile();
|
||||
void LoadFromPath();
|
||||
|
||||
@@ -14,6 +14,9 @@ class EE_API cThread : NonCopyable {
|
||||
public:
|
||||
typedef void (*FuncType)(void*);
|
||||
|
||||
/** @return The current thread id */
|
||||
static Uint32 GetCurrentThreadId();
|
||||
|
||||
/** @brief Construct the thread from a functor with no argument
|
||||
** This constructor works for function objects, as well
|
||||
** as free function.
|
||||
@@ -102,6 +105,9 @@ class EE_API cThread : NonCopyable {
|
||||
** on some operating systems. You should rather try to make
|
||||
** the thread function terminate by itself. */
|
||||
void Terminate();
|
||||
|
||||
/** @return The id of the thread */
|
||||
Uint32 Id();
|
||||
protected:
|
||||
cThread();
|
||||
private:
|
||||
|
||||
@@ -109,7 +109,7 @@ class EE_API cEngine {
|
||||
*/
|
||||
ContextSettings CreateContextSettings( cIniFile * ini, std::string iniKeyName = "EEPP" );
|
||||
|
||||
/** Enabling Shared GL Context allows asynchronous OpenGL resource loading ( only if is supported by the backend, SDL 2 backend is the only one supported ).
|
||||
/** Enabling Shared GL Context allows asynchronous OpenGL resource loading ( only if is supported by the backend and the OS, SDL 2 backend is the only one supported ).
|
||||
** If the cTextureLoader is threaded, will upload the texture in another thread to the GPU. So, it will not block the main rendering thread.
|
||||
** Shared GL Context is disabled by default.
|
||||
*/
|
||||
@@ -122,6 +122,9 @@ class EE_API cEngine {
|
||||
|
||||
/** @return If the Shared GL Context is enabled and ready to use. */
|
||||
bool IsSharedGLContextEnabled();
|
||||
|
||||
/** @return The id of the thread that was used to initialize the OpenGL Context. */
|
||||
Uint32 GetMainThreadId();
|
||||
protected:
|
||||
friend class cWindow;
|
||||
|
||||
@@ -129,6 +132,7 @@ class EE_API cEngine {
|
||||
std::list<cWindow*> mWindows;
|
||||
cWindow * mWindow;
|
||||
bool mSharedGLContext;
|
||||
Uint32 mMainThreadId;
|
||||
|
||||
cEngine();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user