Skip to content

Commit

Permalink
【igl nanovg part-1】shell | mac | add stencil buffer (#216)
Browse files Browse the repository at this point in the history
Summary:
This is a prerequisite pull request for igl nanovg(#213).

Pull Request resolved: #216

Reviewed By: EricGriffith

Differential Revision: D66678263

Pulled By: corporateshark

fbshipit-source-id: 9c7713d391fde908d28206d5af77011f154ffabc
  • Loading branch information
vinsentli authored and facebook-github-bot committed Dec 18, 2024
1 parent 1aab60b commit 88143c1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions shell/mac/ViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand All @@ -211,6 +216,8 @@ - (void)loadView {
32,
NSOpenGLPFADepthSize,
24,
NSOpenGLPFAStencilSize,
stencilSize,
NSOpenGLPFAOpenGLProfile,
NSOpenGLProfileVersion4_1Core,
0,
Expand All @@ -232,6 +239,8 @@ - (void)loadView {
32,
NSOpenGLPFADepthSize,
24,
NSOpenGLPFAStencilSize,
stencilSize,
NSOpenGLPFAOpenGLProfile,
NSOpenGLProfileVersion3_2Core,
0,
Expand All @@ -252,6 +261,8 @@ - (void)loadView {
32,
NSOpenGLPFADepthSize,
24,
NSOpenGLPFAStencilSize,
stencilSize,
NSOpenGLPFAOpenGLProfile,
NSOpenGLProfileVersionLegacy,
0,
Expand Down

0 comments on commit 88143c1

Please sign in to comment.