Skip to content

Commit

Permalink
Allow using integrated GPU on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
edo9300 committed Mar 31, 2022
1 parent 8c16ed1 commit 57f7758
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions include/SIrrCreationParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ namespace irr
SDK_version_do_not_use(IRRLICHT_SDK_VERSION),
PrivateData(0),
#if defined(_IRR_COMPILE_WITH_IOS_DEVICE_) || defined(_IRR_ANDROID_PLATFORM_) || defined(_IRR_EMSCRIPTEN_PLATFORM_)
OGLES2ShaderPath("media/Shaders/")
OGLES2ShaderPath("media/Shaders/"),
#else
OGLES2ShaderPath("../../media/Shaders/")
OGLES2ShaderPath("../../media/Shaders/"),
#endif
UseIntegratedGPU(false)
{
}

Expand Down Expand Up @@ -91,6 +92,7 @@ namespace irr
UsePerformanceTimer = other.UsePerformanceTimer;
PrivateData = other.PrivateData;
OGLES2ShaderPath = other.OGLES2ShaderPath;
UseIntegratedGPU = other.UseIntegratedGPU;
return *this;
}

Expand Down Expand Up @@ -321,6 +323,11 @@ namespace irr
/** This is about the shaders which can be found in media/Shaders by default. It's only necessary
to set when using OGL-ES 2.0 */
irr::io::path OGLES2ShaderPath;


//! Created the OpenGL context on the integrated GPU.
/** This is only used on OpenGL contexts created on MacOS. */
bool UseIntegratedGPU;
};


Expand Down
4 changes: 4 additions & 0 deletions source/Irrlicht/CNSOGLManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,14 @@
NSOpenGLPFASampleBuffers, 1,
NSOpenGLPFASamples, Params.AntiAlias,
NSOpenGLPFAStencilSize, static_cast<NSOpenGLPixelFormatAttribute>(Params.Stencilbuffer ? 1 : 0),
NSOpenGLPFAAllowOfflineRenderers,
//NSOpenGLPFAFullScreen,
0
};

if(!Params.UseIntegratedGPU)
Attribs[15] = 0;

u32 Steps = 6;

// Choose the best pixel format.
Expand Down

0 comments on commit 57f7758

Please sign in to comment.