first commit
This commit is contained in:
397
rendering_api/metal/depends/metal-cpp/MetalKit/MTKView.hpp
Normal file
397
rendering_api/metal/depends/metal-cpp/MetalKit/MTKView.hpp
Normal file
@@ -0,0 +1,397 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2020-2021 Apple Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// MetalKit/MTKView.hpp
|
||||
//
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "MetalKitPrivate.hpp"
|
||||
|
||||
#include <AppKit/AppKit.hpp>
|
||||
#include <Metal/Metal.hpp>
|
||||
#include <QuartzCore/QuartzCore.hpp>
|
||||
|
||||
#include <CoreGraphics/CGColorSpace.h>
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace MTK
|
||||
{
|
||||
class ViewDelegate
|
||||
{
|
||||
public:
|
||||
virtual ~ViewDelegate() { }
|
||||
virtual void drawInMTKView( class View* pView ) { }
|
||||
virtual void drawableSizeWillChange( class View* pView, CGSize size ) { }
|
||||
};
|
||||
|
||||
class View : public NS::Referencing< MTK::View, NS::View >
|
||||
{
|
||||
public:
|
||||
static View* alloc();
|
||||
View* init( CGRect frame, const MTL::Device* pDevice );
|
||||
View* init( NS::Coder* pCoder );
|
||||
|
||||
void setDevice( const MTL::Device* pDevice );
|
||||
MTL::Device* device() const;
|
||||
|
||||
void setDelegate( const MTK::ViewDelegate* pDelegate );
|
||||
ViewDelegate* delegate() const;
|
||||
|
||||
CA::MetalDrawable* currentDrawable() const;
|
||||
|
||||
void setFramebufferOnly( bool framebufferOnly );
|
||||
bool framebufferOnly() const;
|
||||
|
||||
void setDepthStencilAttachmentTextureUsage( MTL::TextureUsage textureUsage );
|
||||
MTL::TextureUsage depthStencilAttachmentTextureUsage() const;
|
||||
|
||||
void setMultisampleColorAttachmentTextureUsage( MTL::TextureUsage textureUsage );
|
||||
MTL::TextureUsage multisampleColorAttachmentTextureUsage() const;
|
||||
|
||||
void setPresentsWithTransaction( bool presentsWithTransaction );
|
||||
bool presentsWithTransaction() const;
|
||||
|
||||
void setColorPixelFormat( MTL::PixelFormat colorPixelFormat );
|
||||
MTL::PixelFormat colorPixelFormat() const;
|
||||
|
||||
void setDepthStencilPixelFormat( MTL::PixelFormat colorPixelFormat );
|
||||
MTL::PixelFormat depthStencilPixelFormat() const;
|
||||
|
||||
void setSampleCount( NS::UInteger sampleCount );
|
||||
NS::UInteger sampleCount() const;
|
||||
|
||||
void setClearColor( MTL::ClearColor clearColor );
|
||||
MTL::ClearColor clearColor() const;
|
||||
|
||||
void setClearDepth( double clearDepth );
|
||||
double clearDepth() const;
|
||||
|
||||
void setClearStencil( uint32_t clearStencil );
|
||||
uint32_t clearStencil() const;
|
||||
|
||||
MTL::Texture* depthStencilTexture() const;
|
||||
|
||||
MTL::Texture* multisampleColorTexture() const;
|
||||
|
||||
void releaseDrawables() const;
|
||||
|
||||
MTL::RenderPassDescriptor* currentRenderPassDescriptor() const;
|
||||
|
||||
void setPreferredFramesPerSecond( NS::Integer preferredFramesPerSecond );
|
||||
NS::Integer preferredFramesPerSecond() const;
|
||||
|
||||
void setEnableSetNeedsDisplay( bool enableSetNeedsDisplay );
|
||||
bool enableSetNeedsDisplay() const;
|
||||
|
||||
void setAutoresizeDrawable( bool autoresizeDrawable );
|
||||
bool autoresizeDrawable();
|
||||
|
||||
void setDrawableSize( CGSize drawableSize );
|
||||
CGSize drawableSize() const;
|
||||
|
||||
CGSize preferredDrawableSize() const;
|
||||
MTL::Device* preferredDevice() const;
|
||||
|
||||
void setPaused( bool paused );
|
||||
bool isPaused() const;
|
||||
|
||||
void setColorSpace( CGColorSpaceRef colorSpace );
|
||||
CGColorSpaceRef colorSpace() const;
|
||||
|
||||
void draw();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
_NS_INLINE MTK::View* MTK::View::alloc()
|
||||
{
|
||||
return NS::Object::alloc< View >( _MTK_PRIVATE_CLS( MTKView ) );
|
||||
}
|
||||
|
||||
_NS_INLINE MTK::View* MTK::View::init( CGRect frame, const MTL::Device* pDevice )
|
||||
{
|
||||
return NS::Object::sendMessage< View* >( this, _MTK_PRIVATE_SEL( initWithFrame_device_ ), frame, pDevice );
|
||||
}
|
||||
|
||||
_NS_INLINE MTK::View* MTK::View::init( NS::Coder* pCoder )
|
||||
{
|
||||
return NS::Object::sendMessage< View* >( this, _MTK_PRIVATE_SEL( initWithCoder_ ), pCoder );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setDevice( const MTL::Device* pDevice )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setDevice_ ), pDevice );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::Device* MTK::View::device() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::Device* >( this, _MTK_PRIVATE_SEL( device ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setDelegate( const MTK::ViewDelegate* pDelegate )
|
||||
{
|
||||
// TODO: Same problem as NS::Application::setDelegate.
|
||||
// Requires a similar soution
|
||||
NS::Value* pWrapper = NS::Value::value( pDelegate );
|
||||
|
||||
// drawInMTKView:
|
||||
|
||||
void (*drawDispatch)( NS::Value*, SEL, id ) = []( NS::Value* pSelf, SEL _cmd, id pMTKView ){
|
||||
auto pDel = reinterpret_cast< MTK::ViewDelegate* >( pSelf->pointerValue() );
|
||||
pDel->drawInMTKView( (MTK::View *)pMTKView );
|
||||
};
|
||||
|
||||
class_addMethod( (Class)objc_lookUpClass( "NSValue" ), sel_registerName( "drawInMTKView:" ), (IMP)drawDispatch, "v@:@" );
|
||||
|
||||
// mtkView:drawableSizeWillChange:
|
||||
|
||||
void (*drawableSizeWillChange)( NS::Value*, SEL, View*, CGSize ) = []( NS::Value* pSelf, SEL, View* pMTKView, CGSize size){
|
||||
auto pDel = reinterpret_cast< MTK::ViewDelegate* >( pSelf->pointerValue() );
|
||||
pDel->drawableSizeWillChange( pMTKView, size );
|
||||
};
|
||||
|
||||
#if CGFLOAT_IS_DOUBLE
|
||||
const char* cbparams = "v@:@{CGSize=dd}";
|
||||
#else
|
||||
const char* cbparams = "v@:@{CGSize=ff}";
|
||||
#endif // CGFLOAT_IS_DOUBLE
|
||||
|
||||
class_addMethod( (Class)objc_lookUpClass( "NSValue" ), sel_registerName( "mtkView:drawableSizeWillChange:"), (IMP)drawableSizeWillChange, cbparams );
|
||||
|
||||
// This circular reference leaks the wrapper object to keep it around for the dispatch to work.
|
||||
// It may be better to hoist it to the MTK::View as a member.
|
||||
objc_setAssociatedObject( (id)pWrapper, "mtkviewdelegate_cpp", (id)pWrapper, OBJC_ASSOCIATION_RETAIN_NONATOMIC );
|
||||
|
||||
NS::Object::sendMessage< void >( this, sel_registerName( "setDelegate:" ), pWrapper );
|
||||
}
|
||||
|
||||
_NS_INLINE MTK::ViewDelegate* MTK::View::delegate() const
|
||||
{
|
||||
NS::Value* pWrapper = NS::Object::sendMessage< NS::Value* >( this, _MTK_PRIVATE_SEL( delegate ) );
|
||||
if ( pWrapper )
|
||||
{
|
||||
return reinterpret_cast< ViewDelegate* >( pWrapper->pointerValue() );
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
_NS_INLINE CA::MetalDrawable* MTK::View::currentDrawable() const
|
||||
{
|
||||
return NS::Object::sendMessage< CA::MetalDrawable* >( this, _MTK_PRIVATE_SEL( currentDrawable ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setFramebufferOnly( bool framebufferOnly )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setFramebufferOnly_ ), framebufferOnly );
|
||||
}
|
||||
|
||||
_NS_INLINE bool MTK::View::framebufferOnly() const
|
||||
{
|
||||
return NS::Object::sendMessage< bool >( this, _MTK_PRIVATE_SEL( framebufferOnly ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setDepthStencilAttachmentTextureUsage( MTL::TextureUsage textureUsage )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setDepthStencilAttachmentTextureUsage_ ), textureUsage );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::TextureUsage MTK::View::depthStencilAttachmentTextureUsage() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::TextureUsage >( this, _MTK_PRIVATE_SEL( depthStencilAttachmentTextureUsage ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setMultisampleColorAttachmentTextureUsage( MTL::TextureUsage textureUsage )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setMultisampleColorAttachmentTextureUsage_ ), textureUsage );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::TextureUsage MTK::View::multisampleColorAttachmentTextureUsage() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::TextureUsage >( this, _MTK_PRIVATE_SEL( multisampleColorAttachmentTextureUsage ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setPresentsWithTransaction( bool presentsWithTransaction )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setPresentsWithTransaction_ ), presentsWithTransaction );
|
||||
}
|
||||
|
||||
_NS_INLINE bool MTK::View::presentsWithTransaction() const
|
||||
{
|
||||
return NS::Object::sendMessage< bool >( this, _MTK_PRIVATE_SEL( presentsWithTransaction ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setColorPixelFormat( MTL::PixelFormat colorPixelFormat )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setColorPixelFormat_ ), colorPixelFormat );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::PixelFormat MTK::View::colorPixelFormat() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTK_PRIVATE_SEL( colorPixelFormat ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setDepthStencilPixelFormat( MTL::PixelFormat colorPixelFormat )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setDepthStencilPixelFormat_ ), colorPixelFormat );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::PixelFormat MTK::View::depthStencilPixelFormat() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::PixelFormat >( this, _MTK_PRIVATE_SEL( depthStencilPixelFormat ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setSampleCount( NS::UInteger sampleCount )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setSampleCount_), sampleCount );
|
||||
}
|
||||
|
||||
_NS_INLINE NS::UInteger MTK::View::sampleCount() const
|
||||
{
|
||||
return NS::Object::sendMessage< NS::UInteger >( this, _MTK_PRIVATE_SEL( sampleCount ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setClearColor( MTL::ClearColor clearColor )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setClearColor_ ), clearColor );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::ClearColor MTK::View::clearColor() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::ClearColor >( this, _MTK_PRIVATE_SEL( clearColor) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setClearDepth( double clearDepth )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setClearDepth_ ), clearDepth );
|
||||
}
|
||||
|
||||
_NS_INLINE double MTK::View::clearDepth() const
|
||||
{
|
||||
return NS::Object::sendMessage< double >( this, _MTK_PRIVATE_SEL( clearDepth ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setClearStencil( uint32_t clearStencil )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setClearStencil_ ), clearStencil );
|
||||
}
|
||||
|
||||
_NS_INLINE uint32_t MTK::View::clearStencil() const
|
||||
{
|
||||
return NS::Object::sendMessage< uint32_t >( this, _MTK_PRIVATE_SEL( clearStencil ) );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::Texture* MTK::View::depthStencilTexture() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::Texture* >( this, _MTK_PRIVATE_SEL( depthStencilTexture ) );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::Texture* MTK::View::multisampleColorTexture() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::Texture* >( this, _MTK_PRIVATE_SEL( multisampleColorTexture ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::releaseDrawables() const
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( releaseDrawables ) );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::RenderPassDescriptor* MTK::View::currentRenderPassDescriptor() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::RenderPassDescriptor* >( this, _MTK_PRIVATE_SEL( currentRenderPassDescriptor ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setPreferredFramesPerSecond( NS::Integer preferredFramesPerSecond )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setPreferredFramesPerSecond_ ), preferredFramesPerSecond );
|
||||
}
|
||||
|
||||
_NS_INLINE NS::Integer MTK::View::preferredFramesPerSecond() const
|
||||
{
|
||||
return NS::Object::sendMessage< NS::Integer >( this, _MTK_PRIVATE_SEL( preferredFramesPerSecond ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setEnableSetNeedsDisplay( bool enableSetNeedsDisplay )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setEnableSetNeedsDisplay_ ), enableSetNeedsDisplay );
|
||||
}
|
||||
|
||||
_NS_INLINE bool MTK::View::enableSetNeedsDisplay() const
|
||||
{
|
||||
return NS::Object::sendMessage< bool >( this, _MTK_PRIVATE_SEL( enableSetNeedsDisplay ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setAutoresizeDrawable( bool autoresizeDrawable )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setAutoresizeDrawable_ ), autoresizeDrawable );
|
||||
}
|
||||
|
||||
_NS_INLINE bool MTK::View::autoresizeDrawable()
|
||||
{
|
||||
return NS::Object::sendMessage< bool >( this, _MTK_PRIVATE_SEL( autoresizeDrawable ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setDrawableSize( CGSize drawableSize )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setDrawableSize_ ), drawableSize );
|
||||
}
|
||||
|
||||
_NS_INLINE CGSize MTK::View::drawableSize() const
|
||||
{
|
||||
return NS::Object::sendMessage< CGSize >( this, _MTK_PRIVATE_SEL( drawableSize ) );
|
||||
}
|
||||
|
||||
_NS_INLINE CGSize MTK::View::preferredDrawableSize() const
|
||||
{
|
||||
return NS::Object::sendMessage< CGSize >( this, _MTK_PRIVATE_SEL( preferredDrawableSize ) );
|
||||
}
|
||||
|
||||
_NS_INLINE MTL::Device* MTK::View::preferredDevice() const
|
||||
{
|
||||
return NS::Object::sendMessage< MTL::Device* >( this, _MTK_PRIVATE_SEL( preferredDevice ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setPaused( bool paused )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setPaused_ ), paused );
|
||||
}
|
||||
|
||||
_NS_INLINE bool MTK::View::isPaused() const
|
||||
{
|
||||
return NS::Object::sendMessage< bool >( this, _MTK_PRIVATE_SEL( isPaused ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::setColorSpace( CGColorSpaceRef colorSpace )
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( setColorspace_), colorSpace );
|
||||
}
|
||||
|
||||
_NS_INLINE CGColorSpaceRef MTK::View::colorSpace() const
|
||||
{
|
||||
return NS::Object::sendMessage< CGColorSpaceRef >( this, _MTK_PRIVATE_SEL( colorspace ) );
|
||||
}
|
||||
|
||||
_NS_INLINE void MTK::View::draw()
|
||||
{
|
||||
NS::Object::sendMessage< void >( this, _MTK_PRIVATE_SEL( draw ) );
|
||||
}
|
28
rendering_api/metal/depends/metal-cpp/MetalKit/MetalKit.hpp
Normal file
28
rendering_api/metal/depends/metal-cpp/MetalKit/MetalKit.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2020-2021 Apple Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// MetalKit/MetalKit.hpp
|
||||
//
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include "MTKView.hpp"
|
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2020-2021 Apple Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// MetalKit/MetalKitPrivate.hpp
|
||||
//
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#include <objc/runtime.h>
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#define _MTK_PRIVATE_CLS( symbol ) ( Private::Class::s_k ## symbol )
|
||||
#define _MTK_PRIVATE_SEL( accessor ) ( Private::Selector::s_k ## accessor )
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#if defined( MTK_PRIVATE_IMPLEMENTATION )
|
||||
|
||||
#define _MTK_PRIVATE_VISIBILITY __attribute__( ( visibility( "default" ) ) )
|
||||
#define _MTK_PRIVATE_IMPORT __attribute__( ( weak_import ) )
|
||||
|
||||
#if __OBJC__
|
||||
#define _MTK_PRIVATE_OBJC_LOOKUP_CLASS( symbol ) ( ( __bridge void* ) objc_lookUpClass( # symbol ) )
|
||||
#else
|
||||
#define _MTK_PRIVATE_OBJC_LOOKUP_CLASS( symbol ) objc_lookUpClass( # symbol )
|
||||
#endif // __OBJC__
|
||||
|
||||
#define _MTK_PRIVATE_DEF_CLS( symbol ) void* s_k ## symbol _MTK_PRIVATE_VISIBILITY = _MTK_PRIVATE_OBJC_LOOKUP_CLASS( symbol );
|
||||
#define _MTK_PRIVATE_DEF_SEL( accessor, symbol ) SEL s_k ## accessor _MTK_PRIVATE_VISIBILITY = sel_registerName( symbol );
|
||||
#define _MTK_PRIVATE_DEF_CONST( type, symbol ) _NS_EXTERN type const MTK ## symbo _MTK_PRIVATE_IMPORT; \
|
||||
type const MTK::symbol = ( nullptr != &MTK ## symbol ) ? MTK ## symbol : nullptr;
|
||||
|
||||
|
||||
#else
|
||||
|
||||
#define _MTK_PRIVATE_DEF_CLS( symbol ) extern void* s_k ## symbol;
|
||||
#define _MTK_PRIVATE_DEF_SEL( accessor, symbol ) extern SEL s_k ## accessor;
|
||||
#define _MTK_PRIVATE_DEF_CONST( type, symbol )
|
||||
|
||||
|
||||
#endif // MTK_PRIVATE_IMPLEMENTATION
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace MTK::Private::Class {
|
||||
|
||||
_MTK_PRIVATE_DEF_CLS( MTKView );
|
||||
|
||||
} // Class
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
namespace MTK::Private::Selector
|
||||
{
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( autoresizeDrawable,
|
||||
"autoresizeDrawable" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( clearColor,
|
||||
"clearColor" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( clearDepth,
|
||||
"clearDepth" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( clearStencil,
|
||||
"clearStencil" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( colorPixelFormat,
|
||||
"colorPixelFormat" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( colorspace,
|
||||
"colorspace" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( currentDrawable,
|
||||
"currentDrawable" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( currentRenderPassDescriptor,
|
||||
"currentRenderPassDescriptor" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( device,
|
||||
"device" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( delegate,
|
||||
"delegate" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( depthStencilAttachmentTextureUsage,
|
||||
"depthStencilAttachmentTextureUsage" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( depthStencilPixelFormat,
|
||||
"depthStencilPixelFormat" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( depthStencilTexture,
|
||||
"depthStencilTexture" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( draw,
|
||||
"draw" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( drawableSize,
|
||||
"drawableSize" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( drawInMTKView_,
|
||||
"drawInMTKView:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( enableSetNeedsDisplay,
|
||||
"enableSetNeedsDisplay" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( framebufferOnly,
|
||||
"framebufferOnly" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( initWithCoder_,
|
||||
"initWithCoder:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( initWithFrame_device_,
|
||||
"initWithFrame:device:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( multisampleColorAttachmentTextureUsage,
|
||||
"multisampleColorAttachmentTextureUsage" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( multisampleColorTexture,
|
||||
"multisampleColorTexture" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( isPaused,
|
||||
"isPaused" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( preferredFramesPerSecond,
|
||||
"preferredFramesPerSecond" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( preferredDevice,
|
||||
"preferredDevice" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( preferredDrawableSize,
|
||||
"preferredDrawableSize" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( presentsWithTransaction,
|
||||
"presentsWithTransaction" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( sampleCount,
|
||||
"sampleCount" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setAutoresizeDrawable_,
|
||||
"setAutoresizeDrawable:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setClearColor_,
|
||||
"setClearColor:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setClearDepth_,
|
||||
"setClearDepth:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setClearStencil_,
|
||||
"setClearStencil:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setColorPixelFormat_,
|
||||
"setColorPixelFormat:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setColorspace_,
|
||||
"setColorspace:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setDelegate_,
|
||||
"setDelegate:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setDepthStencilAttachmentTextureUsage_,
|
||||
"setDepthStencilAttachmentTextureUsage:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setDepthStencilPixelFormat_,
|
||||
"setDepthStencilPixelFormat:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setDevice_,
|
||||
"setDevice:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setDrawableSize_,
|
||||
"setDrawableSize:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setEnableSetNeedsDisplay_,
|
||||
"setEnableSetNeedsDisplay:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setFramebufferOnly_,
|
||||
"setFramebufferOnly:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setMultisampleColorAttachmentTextureUsage_,
|
||||
"setMultisampleColorAttachmentTextureUsage:" )
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setPaused_,
|
||||
"setPaused:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setPreferredFramesPerSecond_,
|
||||
"setPreferredFramesPerSecond:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setPresentsWithTransaction_,
|
||||
"setPresentsWithTransaction:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( setSampleCount_,
|
||||
"setSampleCount:" );
|
||||
|
||||
_MTK_PRIVATE_DEF_SEL( releaseDrawables,
|
||||
"releaseDrawables" );
|
||||
|
||||
}
|
||||
|
||||
//---------
|
||||
|
Reference in New Issue
Block a user