Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: optional immersive rendering in visionOS #3335

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions src/renderer_mtl.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,10 +390,14 @@ namespace bgfx { namespace mtl

bool supportsTextureSampleCount(int sampleCount)
{
if (BX_ENABLED(BX_PLATFORM_VISIONOS) || (BX_ENABLED(BX_PLATFORM_IOS) && !iOSVersionEqualOrGreater("9.0.0")) )
if (BX_ENABLED(BX_PLATFORM_IOS) && !iOSVersionEqualOrGreater("9.0.0"))
simsaens marked this conversation as resolved.
Show resolved Hide resolved
{
return sampleCount == 1 || sampleCount == 2 || sampleCount == 4;
}
else
{
return [m_obj supportsTextureSampleCount:sampleCount];
}
}

bool depth24Stencil8PixelFormatSupported()
Expand Down Expand Up @@ -1046,11 +1050,12 @@ namespace bgfx { namespace mtl
struct SwapChainMtl
{
SwapChainMtl()
#if BX_PLATFORM_VISIONOS
: m_layerRenderer(NULL)
, m_frame(NULL)
#else
: m_metalLayer(nil)
#if BX_PLATFORM_VISIONOS
, m_layerRenderer(NULL)
, m_layerRendererDrawable(NULL)
, m_frame(NULL)
, m_useLayerRenderer(true)
#endif
, m_drawable(nil)
, m_drawableTexture(nil)
Expand All @@ -1067,17 +1072,17 @@ namespace bgfx { namespace mtl
void resize(FrameBufferMtl &_frameBuffer, uint32_t _width, uint32_t _height, uint32_t _flags, uint32_t _maximumDrawableCount);

id <MTLTexture> currentDrawableTexture();


#if BX_PLATFORM_VISIONOS
cp_layer_renderer_t m_layerRenderer;
cp_layer_renderer_configuration_t m_layerRendererConfiguration;
cp_frame_t m_frame;
cp_drawable_t m_drawable;
#else

CAMetalLayer* m_metalLayer;
id <CAMetalDrawable> m_drawable;
#if BX_PLATFORM_VISIONOS
cp_layer_renderer_t m_layerRenderer;
cp_drawable_t m_layerRendererDrawable;
cp_layer_renderer_configuration_t m_layerRendererConfiguration;
cp_frame_t m_frame;
bool m_useLayerRenderer;
#endif
id <CAMetalDrawable> m_drawable;

id <MTLTexture> m_drawableTexture;
Texture m_backBufferColorMsaa;
Texture m_backBufferDepth;
Expand Down
Loading
Loading