From 49d674c4019c3e8d107cfbaaa04bd4f926c83c06 Mon Sep 17 00:00:00 2001 From: vinsentli Date: Tue, 26 Nov 2024 19:16:51 -0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90igl=20nanovg=20part-1=E3=80=91shell=20?= =?UTF-8?q?|=20ios=20|=20add=20stencil=20buffer=20(#214)?= 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/214 Reviewed By: EricGriffith, syeh1 Differential Revision: D66506219 Pulled By: corporateshark fbshipit-source-id: 6489cb7b9bf9d990fc50f575f1172c27c52e4ee9 --- 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 8fa521b8b3..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::Z_UNorm16, 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; };