From 974667a4666f52fa92db0147846b36b8d337f0d6 Mon Sep 17 00:00:00 2001 From: vinsentli Date: Tue, 26 Nov 2024 10:51:07 +0800 Subject: [PATCH 1/2] shell | ios | add stencil buffer --- shell/ios/ViewController.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/ios/ViewController.mm b/shell/ios/ViewController.mm index 8fa521b8b3..3395e404c7 100644 --- a/shell/ios/ViewController.mm +++ b/shell/ios/ViewController.mm @@ -130,7 +130,7 @@ - (void)initRenderSessionController { IGL_DEBUG_ASSERT(platformDevice); return igl::SurfaceTextures{ .color = platformDevice->createTextureFromNativeDrawable((CAEAGLLayer*)layer_, nullptr), - .depth = platformDevice->createTextureFromNativeDepth((CAEAGLLayer*)layer_, igl::TextureFormat::Z_UNorm16, nullptr), + .depth = platformDevice->createTextureFromNativeDepth((CAEAGLLayer*)layer_, igl::TextureFormat::S8_UInt_Z24_UNorm, nullptr), }; } #endif From e202050325bcaa69c35c9008a096557e268a1fd8 Mon Sep 17 00:00:00 2001 From: vinsentli Date: Tue, 26 Nov 2024 14:14:31 +0800 Subject: [PATCH 2/2] ios | add stencil buffer --- shell/ios/AppDelegate.mm | 3 +++ shell/ios/ViewController.mm | 2 +- shell/shared/renderSession/RenderSessionConfig.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/ios/AppDelegate.mm b/shell/ios/AppDelegate.mm index d2aa3c00e2..4f428ea044 100644 --- a/shell/ios/AppDelegate.mm +++ b/shell/ios/AppDelegate.mm @@ -42,6 +42,7 @@ - (BOOL)application:(UIApplication*)application .majorVersion = 3, .minorVersion = 0}, .swapchainColorTextureFormat = igl::TextureFormat::BGRA_SRGB, + .depthTextureFormat = igl::TextureFormat::S8_UInt_Z32_UNorm, }, #endif #if IGL_BACKEND_OPENGL @@ -52,6 +53,7 @@ - (BOOL)application:(UIApplication*)application .majorVersion = 3, .minorVersion = 0}, .swapchainColorTextureFormat = igl::TextureFormat::BGRA_SRGB, + .depthTextureFormat = igl::TextureFormat::S8_UInt_Z24_UNorm, }, #endif { @@ -60,6 +62,7 @@ - (BOOL)application:(UIApplication*)application .majorVersion = 2, .minorVersion = 0}, .swapchainColorTextureFormat = igl::TextureFormat::BGRA_SRGB, + .depthTextureFormat = igl::TextureFormat::S8_UInt_Z24_UNorm, }, #endif // @fb-only diff --git a/shell/ios/ViewController.mm b/shell/ios/ViewController.mm index 3395e404c7..f8455d15cc 100644 --- a/shell/ios/ViewController.mm +++ b/shell/ios/ViewController.mm @@ -130,7 +130,7 @@ - (void)initRenderSessionController { IGL_DEBUG_ASSERT(platformDevice); return igl::SurfaceTextures{ .color = platformDevice->createTextureFromNativeDrawable((CAEAGLLayer*)layer_, nullptr), - .depth = platformDevice->createTextureFromNativeDepth((CAEAGLLayer*)layer_, igl::TextureFormat::S8_UInt_Z24_UNorm, nullptr), + .depth = platformDevice->createTextureFromNativeDepth((CAEAGLLayer*)layer_, config_.depthTextureFormat, nullptr), }; } #endif diff --git a/shell/shared/renderSession/RenderSessionConfig.h b/shell/shared/renderSession/RenderSessionConfig.h index 4fd5b140e7..8b3eec6a10 100644 --- a/shell/shared/renderSession/RenderSessionConfig.h +++ b/shell/shared/renderSession/RenderSessionConfig.h @@ -16,6 +16,7 @@ struct RenderSessionConfig { std::string displayName; BackendVersion backendVersion; igl::TextureFormat swapchainColorTextureFormat = igl::TextureFormat::BGRA_UNorm8; + igl::TextureFormat depthTextureFormat = igl::TextureFormat::Z_UNorm16; igl::ColorSpace swapchainColorSpace = igl::ColorSpace::SRGB_NONLINEAR; };