Skip to content

Commit

Permalink
Implements optional code path for immersive rendering based on the ty…
Browse files Browse the repository at this point in the history
…pe of nwh
  • Loading branch information
simsaens committed Aug 4, 2024
1 parent 409fbc5 commit dbd3737
Show file tree
Hide file tree
Showing 2 changed files with 312 additions and 222 deletions.
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"))
{
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

0 comments on commit dbd3737

Please sign in to comment.