mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-30 18:16:31 +03:00
Removed GLThreadMutexLock and GLThreadMutexUnlock. It was simply wrong.
Added "ForceUseGLSharedContext" for the texture loader, but i'm having problems, i think it's the gpu driver. Fixed console font color recovery.
This commit is contained in:
@@ -19,7 +19,6 @@ class EE_API cTextureLoader : public cObjectLoader {
|
||||
* @param ClampMode Defines the CLAMP MODE
|
||||
* @param CompressTexture If use the DXT compression on the texture loading ( if the card can display them, will convert RGB to DXT1, RGBA to DXT5 )
|
||||
* @param KeepLocalCopy Keep the array data copy. ( useful if want to reload the texture )
|
||||
* @return The internal Texture Id
|
||||
*/
|
||||
cTextureLoader( cIOStream& Stream, const bool& Mipmap = false, const EE_CLAMP_MODE& ClampMode = CLAMP_TO_EDGE, const bool& CompressTexture = false, const bool& KeepLocalCopy = false );
|
||||
|
||||
@@ -85,6 +84,14 @@ 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
|
||||
@@ -100,6 +107,7 @@ class EE_API cTextureLoader : public cObjectLoader {
|
||||
EE_CLAMP_MODE mClampMode;
|
||||
bool mCompressTexture;
|
||||
bool mLocalCopy;
|
||||
bool mForceGLThreaded;
|
||||
cPack * mPack;
|
||||
cIOStream * mStream;
|
||||
|
||||
|
||||
@@ -128,7 +128,6 @@ class EE_API cEngine {
|
||||
Backend::cBackend * mBackend;
|
||||
std::list<cWindow*> mWindows;
|
||||
cWindow * mWindow;
|
||||
cMutex mGLThreadMutex;
|
||||
bool mSharedGLContext;
|
||||
|
||||
cEngine();
|
||||
|
||||
@@ -512,10 +512,6 @@ class EE_API cWindow {
|
||||
void LogSuccessfulInit( const std::string& BackendName, const std::string& ProcessPath = "" );
|
||||
|
||||
void LogFailureInit( const std::string& ClassName, const std::string& BackendName );
|
||||
|
||||
void GLThreadMutexLock();
|
||||
|
||||
void GLThreadMutexUnlock();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 2.8.0, 2013-09-18T00:46:23. -->
|
||||
<!-- Written by QtCreator 2.8.0, 2013-09-25T22:58:50. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@@ -682,6 +682,15 @@
|
||||
<value type="QString" key="GenericProjectManager.GenericBuildConfiguration.BuildDirectory">/home/programming/eepp/make/linux</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">--with-static-backend gmake</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.Command">premake4</value>
|
||||
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}../../../</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Process Step</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets"/>
|
||||
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
|
||||
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments">-j4 eepp-ew</value>
|
||||
@@ -691,7 +700,7 @@
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clone of </value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clone of Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
|
||||
@@ -208,14 +208,14 @@ void cConsole::Draw() {
|
||||
|
||||
mFont->Color( eeColorA ( mFontLineColor.R(), mFontLineColor.G(), mFontLineColor.B(), static_cast<Uint8>(mCurAlpha) ) );
|
||||
|
||||
mFont->Color( OldColor );
|
||||
|
||||
if ( (eeUint)mTBuf->CurPos() == mTBuf->Buffer().size() ) {
|
||||
mFont->Draw( "_", mFontSize + mFont->GetTextWidth() , CurY );
|
||||
} else {
|
||||
mFont->SetText( "> " + mTBuf->Buffer().substr( 0, mTBuf->CurPos() ) );
|
||||
mFont->Draw( "_", mFontSize + mFont->GetTextWidth() , CurY );
|
||||
}
|
||||
|
||||
mFont->Color( OldColor );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ cTextureLoader::cTextureLoader( cIOStream& Stream,
|
||||
mClampMode(ClampMode),
|
||||
mCompressTexture(CompressTexture),
|
||||
mLocalCopy(KeepLocalCopy),
|
||||
mForceGLThreaded(false),
|
||||
mPack(NULL),
|
||||
mStream(&Stream),
|
||||
mImagePtr(NULL),
|
||||
@@ -107,6 +108,7 @@ cTextureLoader::cTextureLoader( const std::string& Filepath,
|
||||
mClampMode(ClampMode),
|
||||
mCompressTexture(CompressTexture),
|
||||
mLocalCopy(KeepLocalCopy),
|
||||
mForceGLThreaded(false),
|
||||
mPack(NULL),
|
||||
mStream(NULL),
|
||||
mImagePtr(NULL),
|
||||
@@ -139,6 +141,7 @@ cTextureLoader::cTextureLoader( const unsigned char * ImagePtr,
|
||||
mClampMode(ClampMode),
|
||||
mCompressTexture(CompressTexture),
|
||||
mLocalCopy(KeepLocalCopy),
|
||||
mForceGLThreaded(false),
|
||||
mPack(NULL),
|
||||
mStream(NULL),
|
||||
mImagePtr(ImagePtr),
|
||||
@@ -171,6 +174,7 @@ cTextureLoader::cTextureLoader( cPack * Pack,
|
||||
mClampMode(ClampMode),
|
||||
mCompressTexture(CompressTexture),
|
||||
mLocalCopy(KeepLocalCopy),
|
||||
mForceGLThreaded(false),
|
||||
mPack(Pack),
|
||||
mStream(NULL),
|
||||
mImagePtr(NULL),
|
||||
@@ -206,6 +210,7 @@ cTextureLoader::cTextureLoader( const unsigned char * Pixels,
|
||||
mClampMode(ClampMode),
|
||||
mCompressTexture(CompressTexture),
|
||||
mLocalCopy(KeepLocalCopy),
|
||||
mForceGLThreaded(false),
|
||||
mPack(NULL),
|
||||
mStream(NULL),
|
||||
mImagePtr(NULL),
|
||||
@@ -419,7 +424,10 @@ void cTextureLoader::LoadFromPixels() {
|
||||
flags = ( mClampMode == CLAMP_REPEAT) ? (flags | SOIL_FLAG_TEXTURE_REPEATS) : flags;
|
||||
flags = ( mCompressTexture ) ? ( flags | SOIL_FLAG_COMPRESS_TO_DXT ) : flags;
|
||||
|
||||
if ( mThreaded && cEngine::instance()->IsSharedGLContextEnabled() && cEngine::instance()->GetCurrentWindow()->IsThreadedGLContext() ) {
|
||||
if ( ( mThreaded || mForceGLThreaded ) &&
|
||||
( mForceGLThreaded || cEngine::instance()->IsSharedGLContextEnabled() ) &&
|
||||
cEngine::instance()->GetCurrentWindow()->IsThreadedGLContext() )
|
||||
{
|
||||
cEngine::instance()->GetCurrentWindow()->SetGLContextThread();
|
||||
}
|
||||
|
||||
@@ -452,7 +460,10 @@ void cTextureLoader::LoadFromPixels() {
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, PreviousTexture );
|
||||
|
||||
if ( mThreaded && cEngine::instance()->IsSharedGLContextEnabled() && cEngine::instance()->GetCurrentWindow()->IsThreadedGLContext() ) {
|
||||
if ( ( mThreaded || mForceGLThreaded ) &&
|
||||
( mForceGLThreaded || cEngine::instance()->IsSharedGLContextEnabled() ) &&
|
||||
cEngine::instance()->GetCurrentWindow()->IsThreadedGLContext() )
|
||||
{
|
||||
cEngine::instance()->GetCurrentWindow()->UnsetGLContextThread();
|
||||
}
|
||||
|
||||
@@ -528,6 +539,14 @@ cTexture * cTextureLoader::GetTexture() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const bool& cTextureLoader::ForceUseGLSharedContext() const {
|
||||
return mForceGLThreaded;
|
||||
}
|
||||
|
||||
void cTextureLoader::ForceUseGLSharedContext( bool force ) {
|
||||
mForceGLThreaded = force;
|
||||
}
|
||||
|
||||
void cTextureLoader::Unload() {
|
||||
if ( mLoaded ) {
|
||||
cTextureFactory::instance()->Remove( mTexId );
|
||||
@@ -549,6 +568,7 @@ void cTextureLoader::Reset() {
|
||||
mSize = 0;
|
||||
mTexLoaded = false;
|
||||
mDirectUpload = false;
|
||||
mForceGLThreaded = false;
|
||||
mImgType = STBI_unknown;
|
||||
mIsCompressed = 0;
|
||||
}
|
||||
|
||||
@@ -295,13 +295,11 @@ bool cWindowSDL::IsThreadedGLContext() {
|
||||
}
|
||||
|
||||
void cWindowSDL::SetGLContextThread() {
|
||||
GLThreadMutexLock();
|
||||
SDL_GL_MakeCurrent( mSDLWindow, mGLContextThread );
|
||||
}
|
||||
|
||||
void cWindowSDL::UnsetGLContextThread() {
|
||||
SDL_GL_MakeCurrent( mSDLWindow, NULL );
|
||||
GLThreadMutexUnlock();
|
||||
}
|
||||
|
||||
std::string cWindowSDL::GetVersion() {
|
||||
|
||||
@@ -536,14 +536,6 @@ void cWindow::SetGLContextThread() {
|
||||
void cWindow::UnsetGLContextThread() {
|
||||
}
|
||||
|
||||
void cWindow::GLThreadMutexLock() {
|
||||
cEngine::instance()->mGLThreadMutex.Lock();
|
||||
}
|
||||
|
||||
void cWindow::GLThreadMutexUnlock() {
|
||||
cEngine::instance()->mGLThreadMutex.Unlock();
|
||||
}
|
||||
|
||||
#if EE_PLATFORM == EE_PLATFORM_ANDROID
|
||||
void * cWindow::GetJNIEnv() {
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user