From 88143c13e6c742dcfbaa48fb46bdbc16a866f75e Mon Sep 17 00:00:00 2001 From: vinsentli Date: Tue, 17 Dec 2024 16:38:48 -0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90igl=20nanovg=20part-1=E3=80=91shell=20?= =?UTF-8?q?|=20mac=20|=20add=20stencil=20buffer=20(#216)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This is a prerequisite pull request for igl nanovg(https://github.com/facebook/igl/pull/213). Pull Request resolved: https://github.com/facebook/igl/pull/216 Reviewed By: EricGriffith Differential Revision: D66678263 Pulled By: corporateshark fbshipit-source-id: 9c7713d391fde908d28206d5af77011f154ffabc --- shell/mac/ViewController.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) 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,