diff --git a/shell/mac/ViewController.mm b/shell/mac/ViewController.mm index cc854c7fea..92f3b01088 100644 --- a/shell/mac/ViewController.mm +++ b/shell/mac/ViewController.mm @@ -196,6 +196,11 @@ - (void)loadView { #if IGL_BACKEND_OPENGL case igl::BackendFlavor::OpenGL: { + const bool enableStencilBuffer = + config_.depthTextureFormat == igl::TextureFormat::S8_UInt_Z24_UNorm || + config_.depthTextureFormat == igl::TextureFormat::S_UInt8; + const NSOpenGLPixelFormatAttribute stencilSize = enableStencilBuffer ? 8 : 0; + NSOpenGLPixelFormat* pixelFormat; if (config_.backendVersion.majorVersion == 4 && config_.backendVersion.minorVersion == 1) { static NSOpenGLPixelFormatAttribute attributes[] = { @@ -211,6 +216,8 @@ - (void)loadView { 32, NSOpenGLPFADepthSize, 24, + NSOpenGLPFAStencilSize, + stencilSize, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core, 0, @@ -232,6 +239,8 @@ - (void)loadView { 32, NSOpenGLPFADepthSize, 24, + NSOpenGLPFAStencilSize, + stencilSize, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, 0, @@ -252,6 +261,8 @@ - (void)loadView { 32, NSOpenGLPFADepthSize, 24, + NSOpenGLPFAStencilSize, + stencilSize, NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersionLegacy, 0,