metal: initial support

This commit is contained in:
Samuliak 2024-07-02 08:28:41 +02:00
parent 29d9ed7224
commit f0547d1a71
167 changed files with 28839 additions and 1271 deletions

View file

@ -0,0 +1,41 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXDefines.hpp
//
// Copyright 2020-2023 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.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "../Foundation/NSDefines.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _MTLFX_EXPORT _NS_EXPORT
#define _MTLFX_EXTERN _NS_EXTERN
#define _MTLFX_INLINE _NS_INLINE
#define _MTLFX_PACKED _NS_PACKED
#define _MTLFX_CONST( type, name ) _NS_CONST( type, name )
#define _MTLFX_ENUM( type, name ) _NS_ENUM( type, name )
#define _MTLFX_OPTIONS( type, name ) _NS_OPTIONS( type, name )
#define _MTLFX_VALIDATE_SIZE( mtlfx, name ) _NS_VALIDATE_SIZE( mtlfx, name )
#define _MTLFX_VALIDATE_ENUM( mtlfx, name ) _NS_VALIDATE_ENUM( mtlfx, name )
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,285 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXPrivate.hpp
//
// Copyright 2020-2023 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.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include <objc/runtime.h>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#define _MTLFX_PRIVATE_CLS( symbol ) ( Private::Class::s_k##symbol )
#define _MTLFX_PRIVATE_SEL( accessor ) ( Private::Selector::s_k##accessor )
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#if defined( MTLFX_PRIVATE_IMPLEMENTATION )
#if defined( METALCPP_SYMBOL_VISIBILITY_HIDDEN )
#define _MTLFX_PRIVATE_VISIBILITY __attribute__( ( visibility("hidden" ) ) )
#else
#define _MTLFX_PRIVATE_VISIBILITY __attribute__( ( visibility("default" ) ) )
#endif // METALCPP_SYMBOL_VISIBILITY_HIDDEN
#define _MTLFX_PRIVATE_IMPORT __attribute__( ( weak_import ) )
#ifdef __OBJC__
#define _MTLFX_PRIVATE_OBJC_LOOKUP_CLASS( symbol ) ( ( __bridge void* ) objc_lookUpClass( #symbol ) )
#define _MTLFX_PRIVATE_OBJC_GET_PROTOCOL( symbol ) ( ( __bridge void* ) objc_getProtocol( #symbol ) )
#else
#define _MTLFX_PRIVATE_OBJC_LOOKUP_CLASS( symbol ) objc_lookUpClass(#symbol)
#define _MTLFX_PRIVATE_OBJC_GET_PROTOCOL( symbol ) objc_getProtocol(#symbol)
#endif // __OBJC__
#define _MTLFX_PRIVATE_DEF_CLS( symbol ) void* s_k##symbol _MTLFX_PRIVATE_VISIBILITY = _MTLFX_PRIVATE_OBJC_LOOKUP_CLASS( symbol )
#define _MTLFX_PRIVATE_DEF_PRO( symbol ) void* s_k##symbol _MTLFX_PRIVATE_VISIBILITY = _MTLFX_PRIVATE_OBJC_GET_PROTOCOL( symbol )
#define _MTLFX_PRIVATE_DEF_SEL( accessor, symbol ) SEL s_k##accessor _MTLFX_PRIVATE_VISIBILITY = sel_registerName( symbol )
#include <dlfcn.h>
#define MTLFX_DEF_FUNC( name, signature ) using Fn##name = signature; \
Fn##name name = reinterpret_cast< Fn##name >( dlsym( RTLD_DEFAULT, #name ) )
namespace MTLFX::Private
{
template <typename _Type>
inline _Type const LoadSymbol(const char* pSymbol)
{
const _Type* pAddress = static_cast<_Type*>(dlsym(RTLD_DEFAULT, pSymbol));
return pAddress ? *pAddress : nullptr;
}
} // MTLFX::Private
#if defined( __MAC_13_0 ) || defined( __MAC_14_0 ) || defined( __IPHONE_16_0 ) || defined( __IPHONE_17_0 ) || defined( __TVOS_16_0 ) || defined( __TVOS_17_0 )
#define _MTLFX_PRIVATE_DEF_STR( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##symbol _MTLFX_PRIVATE_IMPORT; \
type const MTLFX::symbol = ( nullptr != &MTLFX##symbol ) ? MTLFX##ssymbol : nullptr
#define _MTLFX_PRIVATE_DEF_CONST( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##ssymbol _MTLFX_PRIVATE_IMPORT; \
type const MTLFX::symbol = (nullptr != &MTLFX##ssymbol) ? MTLFX##ssymbol : nullptr
#define _MTLFX_PRIVATE_DEF_WEAK_CONST( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##ssymbol; \
type const MTLFX::symbol = Private::LoadSymbol< type >( "MTLFX" #symbol )
#else
#define _MTLFX_PRIVATE_DEF_STR( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##ssymbol; \
type const MTLFX::symbol = Private::LoadSymbol< type >( "MTLFX" #symbol )
#define _MTLFX_PRIVATE_DEF_CONST( type, symbol ) \
_MTLFX_EXTERN type const MTLFX##ssymbol; \
type const MTLFX::symbol = Private::LoadSymbol< type >( "MTLFX" #symbol )
#define _MTLFX_PRIVATE_DEF_WEAK_CONST( type, symbol ) _MTLFX_PRIVATE_DEF_CONST( type, symbol )
#endif // defined( __MAC_13_0 ) || defined( __MAC_14_0 ) || defined( __IPHONE_16_0 ) || defined( __IPHONE_17_0 ) || defined( __TVOS_16_0 ) || defined( __TVOS_17_0 )
#else
#define _MTLFX_PRIVATE_DEF_CLS( symbol ) extern void* s_k##symbol
#define _MTLFX_PRIVATE_DEF_PRO( symbol ) extern void* s_k##symbol
#define _MTLFX_PRIVATE_DEF_SEL( accessor, symbol ) extern SEL s_k##accessor
#define _MTLFX_PRIVATE_DEF_STR( type, symbol ) extern type const MTLFX::symbol
#define _MTLFX_PRIVATE_DEF_CONST( type, symbol ) extern type const MTLFX::symbol
#define _MTLFX_PRIVATE_DEF_WEAK_CONST( type, symbol ) extern type const MTLFX::symbol
#endif // MTLFX_PRIVATE_IMPLEMENTATION
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTLFX
{
namespace Private
{
namespace Class
{
_MTLFX_PRIVATE_DEF_CLS( MTLFXSpatialScalerDescriptor );
_MTLFX_PRIVATE_DEF_CLS( MTLFXTemporalScalerDescriptor );
} // Class
} // Private
} // MTLFX
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTLFX
{
namespace Private
{
namespace Protocol
{
_MTLFX_PRIVATE_DEF_PRO( MTLFXSpatialScaler );
_MTLFX_PRIVATE_DEF_PRO( MTLFXTemporalScaler );
} // Protocol
} // Private
} // MTLFX
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTLFX
{
namespace Private
{
namespace Selector
{
_MTLFX_PRIVATE_DEF_SEL( colorProcessingMode,
"colorProcessingMode" );
_MTLFX_PRIVATE_DEF_SEL( colorTexture,
"colorTexture" );
_MTLFX_PRIVATE_DEF_SEL( colorTextureFormat,
"colorTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( colorTextureUsage,
"colorTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( depthTexture,
"depthTexture" );
_MTLFX_PRIVATE_DEF_SEL( depthTextureFormat,
"depthTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( depthTextureUsage,
"depthTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( encodeToCommandBuffer_,
"encodeToCommandBuffer:" );
_MTLFX_PRIVATE_DEF_SEL( exposureTexture,
"exposureTexture" );
_MTLFX_PRIVATE_DEF_SEL( fence,
"fence" );
_MTLFX_PRIVATE_DEF_SEL( inputContentHeight,
"inputContentHeight" );
_MTLFX_PRIVATE_DEF_SEL( inputContentMaxScale,
"inputContentMaxScale" );
_MTLFX_PRIVATE_DEF_SEL( inputContentMinScale,
"inputContentMinScale" );
_MTLFX_PRIVATE_DEF_SEL( inputContentWidth,
"inputContentWidth" );
_MTLFX_PRIVATE_DEF_SEL( inputHeight,
"inputHeight" );
_MTLFX_PRIVATE_DEF_SEL( inputWidth,
"inputWidth" );
_MTLFX_PRIVATE_DEF_SEL( isAutoExposureEnabled,
"isAutoExposureEnabled" );
_MTLFX_PRIVATE_DEF_SEL( isDepthReversed,
"isDepthReversed" );
_MTLFX_PRIVATE_DEF_SEL( isInputContentPropertiesEnabled,
"isInputContentPropertiesEnabled" );
_MTLFX_PRIVATE_DEF_SEL( jitterOffsetX,
"jitterOffsetX" );
_MTLFX_PRIVATE_DEF_SEL( jitterOffsetY,
"jitterOffsetY" );
_MTLFX_PRIVATE_DEF_SEL( motionTexture,
"motionTexture" );
_MTLFX_PRIVATE_DEF_SEL( motionTextureFormat,
"motionTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( motionTextureUsage,
"motionTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( motionVectorScaleX,
"motionVectorScaleX" );
_MTLFX_PRIVATE_DEF_SEL( motionVectorScaleY,
"motionVectorScaleY" );
_MTLFX_PRIVATE_DEF_SEL( newSpatialScalerWithDevice_,
"newSpatialScalerWithDevice:" );
_MTLFX_PRIVATE_DEF_SEL( newTemporalScalerWithDevice_,
"newTemporalScalerWithDevice:" );
_MTLFX_PRIVATE_DEF_SEL( outputHeight,
"outputHeight" );
_MTLFX_PRIVATE_DEF_SEL( outputTexture,
"outputTexture" );
_MTLFX_PRIVATE_DEF_SEL( outputTextureFormat,
"outputTextureFormat" );
_MTLFX_PRIVATE_DEF_SEL( outputTextureUsage,
"outputTextureUsage" );
_MTLFX_PRIVATE_DEF_SEL( outputWidth,
"outputWidth" );
_MTLFX_PRIVATE_DEF_SEL( preExposure,
"preExposure" );
_MTLFX_PRIVATE_DEF_SEL( reset,
"reset" );
_MTLFX_PRIVATE_DEF_SEL( setAutoExposureEnabled_,
"setAutoExposureEnabled:" );
_MTLFX_PRIVATE_DEF_SEL( setColorProcessingMode_,
"setColorProcessingMode:" );
_MTLFX_PRIVATE_DEF_SEL( setColorTexture_,
"setColorTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setColorTextureFormat_,
"setColorTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setDepthReversed_,
"setDepthReversed:" );
_MTLFX_PRIVATE_DEF_SEL( setDepthTexture_,
"setDepthTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setDepthTextureFormat_,
"setDepthTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setExposureTexture_,
"setExposureTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setFence_,
"setFence:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentHeight_,
"setInputContentHeight:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentMaxScale_,
"setInputContentMaxScale:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentMinScale_,
"setInputContentMinScale:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentPropertiesEnabled_,
"setInputContentPropertiesEnabled:" );
_MTLFX_PRIVATE_DEF_SEL( setInputContentWidth_,
"setInputContentWidth:" );
_MTLFX_PRIVATE_DEF_SEL( setInputHeight_,
"setInputHeight:" );
_MTLFX_PRIVATE_DEF_SEL( setInputWidth_,
"setInputWidth:" );
_MTLFX_PRIVATE_DEF_SEL( setJitterOffsetX_,
"setJitterOffsetX:" );
_MTLFX_PRIVATE_DEF_SEL( setJitterOffsetY_,
"setJitterOffsetY:" );
_MTLFX_PRIVATE_DEF_SEL( setMotionTexture_,
"setMotionTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setMotionTextureFormat_,
"setMotionTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setMotionVectorScaleX_,
"setMotionVectorScaleX:" );
_MTLFX_PRIVATE_DEF_SEL( setMotionVectorScaleY_,
"setMotionVectorScaleY:" );
_MTLFX_PRIVATE_DEF_SEL( setOutputHeight_,
"setOutputHeight:" );
_MTLFX_PRIVATE_DEF_SEL( setOutputTexture_,
"setOutputTexture:" );
_MTLFX_PRIVATE_DEF_SEL( setOutputTextureFormat_,
"setOutputTextureFormat:" );
_MTLFX_PRIVATE_DEF_SEL( setOutputWidth_,
"setOutputWidth:" );
_MTLFX_PRIVATE_DEF_SEL( setPreExposure_,
"setPreExposure:" );
_MTLFX_PRIVATE_DEF_SEL( setReset_,
"setReset:" );
_MTLFX_PRIVATE_DEF_SEL( supportedInputContentMaxScaleForDevice_,
"supportedInputContentMaxScaleForDevice:" );
_MTLFX_PRIVATE_DEF_SEL( supportedInputContentMinScaleForDevice_,
"supportedInputContentMinScaleForDevice:" );
_MTLFX_PRIVATE_DEF_SEL( supportsDevice_,
"supportsDevice:" );
} // Selector
} // Private
} // MTLFX
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,372 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXSpatialScaler.hpp
//
// Copyright 2020-2023 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.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "../Metal/Metal.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTLFX
{
_MTLFX_ENUM( NS::Integer, SpatialScalerColorProcessingMode )
{
SpatialScalerColorProcessingModePerceptual = 0,
SpatialScalerColorProcessingModeLinear = 1,
SpatialScalerColorProcessingModeHDR = 2
};
class SpatialScalerDescriptor : public NS::Copying< SpatialScalerDescriptor >
{
public:
static class SpatialScalerDescriptor* alloc();
class SpatialScalerDescriptor* init();
MTL::PixelFormat colorTextureFormat() const;
void setColorTextureFormat( MTL::PixelFormat format );
MTL::PixelFormat outputTextureFormat() const;
void setOutputTextureFormat( MTL::PixelFormat format );
NS::UInteger inputWidth() const;
void setInputWidth( NS::UInteger width );
NS::UInteger inputHeight() const;
void setInputHeight( NS::UInteger height );
NS::UInteger outputWidth() const;
void setOutputWidth( NS::UInteger width );
NS::UInteger outputHeight() const;
void setOutputHeight( NS::UInteger height );
SpatialScalerColorProcessingMode colorProcessingMode() const;
void setColorProcessingMode( SpatialScalerColorProcessingMode mode );
class SpatialScaler* newSpatialScaler( const MTL::Device* pDevice );
static bool supportsDevice( const MTL::Device* );
};
class SpatialScaler : public NS::Referencing< SpatialScaler >
{
public:
MTL::TextureUsage colorTextureUsage() const;
MTL::TextureUsage outputTextureUsage() const;
NS::UInteger inputContentWidth() const;
void setInputContentWidth( NS::UInteger width );
NS::UInteger inputContentHeight() const;
void setInputContentHeight( NS::UInteger height );
MTL::Texture* colorTexture() const;
void setColorTexture( MTL::Texture* pTexture );
MTL::Texture* outputTexture() const;
void setOutputTexture( MTL::Texture* pTexture );
MTL::PixelFormat colorTextureFormat() const;
MTL::PixelFormat outputTextureFormat() const;
NS::UInteger inputWidth() const;
NS::UInteger inputHeight() const;
NS::UInteger outputWidth() const;
NS::UInteger outputHeight() const;
SpatialScalerColorProcessingMode colorProcessingMode() const;
MTL::Fence* fence() const;
void setFence( MTL::Fence* pFence );
void encodeToCommandBuffer( MTL::CommandBuffer* pCommandBuffer );
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScalerDescriptor* MTLFX::SpatialScalerDescriptor::alloc()
{
return NS::Object::alloc< SpatialScalerDescriptor >( _MTLFX_PRIVATE_CLS( MTLFXSpatialScalerDescriptor ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScalerDescriptor* MTLFX::SpatialScalerDescriptor::init()
{
return NS::Object::init< SpatialScalerDescriptor >();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::SpatialScalerDescriptor::colorTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setColorTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setColorTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::SpatialScalerDescriptor::outputTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setOutputTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setOutputTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerDescriptor::inputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setInputWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerDescriptor::inputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setInputHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerDescriptor::outputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setOutputWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setOutputWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScalerDescriptor::outputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setOutputHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setOutputHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScalerColorProcessingMode MTLFX::SpatialScalerDescriptor::colorProcessingMode() const
{
return Object::sendMessage< SpatialScalerColorProcessingMode >( this, _MTLFX_PRIVATE_SEL( colorProcessingMode ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScalerDescriptor::setColorProcessingMode( SpatialScalerColorProcessingMode mode )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setColorProcessingMode_ ), mode );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScaler* MTLFX::SpatialScalerDescriptor::newSpatialScaler( const MTL::Device* pDevice )
{
return Object::sendMessage< SpatialScaler* >( this, _MTLFX_PRIVATE_SEL( newSpatialScalerWithDevice_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::SpatialScalerDescriptor::supportsDevice( const MTL::Device* pDevice )
{
return Object::sendMessageSafe< bool >( _NS_PRIVATE_CLS( MTLFXSpatialScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportsDevice_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::SpatialScaler::colorTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( colorTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::SpatialScaler::outputTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( outputTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScaler::inputContentWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputContentWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScaler::setInputContentWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputContentWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScaler::inputContentHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputContentHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScaler::setInputContentHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputContentHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::SpatialScaler::colorTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( colorTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScaler::setColorTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setColorTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::SpatialScaler::outputTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( outputTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScaler::setOutputTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setOutputTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::SpatialScaler::colorTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::SpatialScaler::outputTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScaler::inputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScaler::inputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScaler::outputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::SpatialScaler::outputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::SpatialScalerColorProcessingMode MTLFX::SpatialScaler::colorProcessingMode() const
{
return Object::sendMessage< SpatialScalerColorProcessingMode >( this, _MTLFX_PRIVATE_SEL( colorProcessingMode ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Fence* MTLFX::SpatialScaler::fence() const
{
return Object::sendMessage< MTL::Fence* >( this, _MTLFX_PRIVATE_SEL( fence ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScaler::setFence( MTL::Fence* pFence )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setFence_ ), pFence );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::SpatialScaler::encodeToCommandBuffer( MTL::CommandBuffer* pCommandBuffer )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( encodeToCommandBuffer_ ), pCommandBuffer );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,695 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MTLFXTemporalScaler.hpp
//
// Copyright 2020-2023 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.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXDefines.hpp"
#include "MTLFXPrivate.hpp"
#include "../Metal/Metal.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
namespace MTLFX
{
class TemporalScalerDescriptor : public NS::Copying< TemporalScalerDescriptor >
{
public:
static class TemporalScalerDescriptor* alloc();
class TemporalScalerDescriptor* init();
MTL::PixelFormat colorTextureFormat() const;
void setColorTextureFormat( MTL::PixelFormat format );
MTL::PixelFormat depthTextureFormat() const;
void setDepthTextureFormat( MTL::PixelFormat format );
MTL::PixelFormat motionTextureFormat() const;
void setMotionTextureFormat( MTL::PixelFormat format );
MTL::PixelFormat outputTextureFormat() const;
void setOutputTextureFormat( MTL::PixelFormat format );
NS::UInteger inputWidth() const;
void setInputWidth( NS::UInteger width );
NS::UInteger inputHeight() const;
void setInputHeight( NS::UInteger height );
NS::UInteger outputWidth() const;
void setOutputWidth( NS::UInteger width );
NS::UInteger outputHeight() const;
void setOutputHeight( NS::UInteger height );
bool isAutoExposureEnabled() const;
void setAutoExposureEnabled( bool enabled );
bool isInputContentPropertiesEnabled() const;
void setInputContentPropertiesEnabled( bool enabled );
float inputContentMinScale() const;
void setInputContentMinScale( float scale );
float inputContentMaxScale() const;
void setInputContentMaxScale( float scale );
class TemporalScaler* newTemporalScaler( const MTL::Device* pDevice ) const;
static float supportedInputContentMinScale( const MTL::Device* pDevice );
static float supportedInputContentMaxScale( const MTL::Device* pDevice );
static bool supportsDevice( const MTL::Device* pDevice );
};
class TemporalScaler : public NS::Referencing< TemporalScaler >
{
public:
MTL::TextureUsage colorTextureUsage() const;
MTL::TextureUsage depthTextureUsage() const;
MTL::TextureUsage motionTextureUsage() const;
MTL::TextureUsage outputTextureUsage() const;
NS::UInteger inputContentWidth() const;
void setInputContentWidth( NS::UInteger width );
NS::UInteger inputContentHeight() const;
void setInputContentHeight( NS::UInteger height );
MTL::Texture* colorTexture() const;
void setColorTexture( MTL::Texture* pTexture );
MTL::Texture* depthTexture() const;
void setDepthTexture( MTL::Texture* pTexture );
MTL::Texture* motionTexture() const;
void setMotionTexture( MTL::Texture* pTexture );
MTL::Texture* outputTexture() const;
void setOutputTexture( MTL::Texture* pTexture );
MTL::Texture* exposureTexture() const;
void setExposureTexture( MTL::Texture* pTexture );
float preExposure() const;
void setPreExposure( float preExposure );
float jitterOffsetX() const;
void setJitterOffsetX( float offset );
float jitterOffsetY() const;
void setJitterOffsetY( float offset );
float motionVectorScaleX() const;
void setMotionVectorScaleX( float scale );
float motionVectorScaleY() const;
void setMotionVectorScaleY( float scale );
bool reset() const;
void setReset( bool reset );
bool isDepthReversed() const;
void setDepthReversed( bool depthReversed );
MTL::PixelFormat colorTextureFormat() const;
MTL::PixelFormat depthTextureFormat() const;
MTL::PixelFormat motionTextureFormat() const;
MTL::PixelFormat outputTextureFormat() const;
NS::UInteger inputWidth() const;
NS::UInteger inputHeight() const;
NS::UInteger outputWidth() const;
NS::UInteger outputHeight() const;
float inputContentMinScale() const;
float inputContentMaxScale() const;
MTL::Fence* fence() const;
void setFence( MTL::Fence* pFence );
void encodeToCommandBuffer( MTL::CommandBuffer* pCommandBuffer );
};
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::TemporalScalerDescriptor* MTLFX::TemporalScalerDescriptor::alloc()
{
return NS::Object::alloc< TemporalScalerDescriptor >( _MTLFX_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::TemporalScalerDescriptor* MTLFX::TemporalScalerDescriptor::init()
{
return NS::Object::init< TemporalScalerDescriptor >();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::colorTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setColorTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setColorTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::depthTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( depthTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setDepthTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setDepthTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::motionTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( motionTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setMotionTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setMotionTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScalerDescriptor::outputTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setOutputTextureFormat( MTL::PixelFormat format )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setOutputTextureFormat_ ), format );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerDescriptor::inputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerDescriptor::inputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerDescriptor::outputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setOutputWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setOutputWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScalerDescriptor::outputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setOutputHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setOutputHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::isAutoExposureEnabled() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isAutoExposureEnabled ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setAutoExposureEnabled( bool enabled )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setAutoExposureEnabled_ ), enabled );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::isInputContentPropertiesEnabled() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isInputContentPropertiesEnabled ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputContentPropertiesEnabled( bool enabled )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputContentPropertiesEnabled_ ), enabled );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerDescriptor::inputContentMinScale() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( inputContentMinScale ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputContentMinScale( float scale )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputContentMinScale_ ), scale );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerDescriptor::inputContentMaxScale() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( inputContentMaxScale ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScalerDescriptor::setInputContentMaxScale( float scale )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputContentMaxScale_ ), scale );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTLFX::TemporalScaler* MTLFX::TemporalScalerDescriptor::newTemporalScaler( const MTL::Device* pDevice ) const
{
return Object::sendMessage< TemporalScaler* >( this, _MTLFX_PRIVATE_SEL( newTemporalScalerWithDevice_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerDescriptor::supportedInputContentMinScale( const MTL::Device* pDevice )
{
float scale = 1.0f;
if ( nullptr != methodSignatureForSelector( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportedInputContentMinScaleForDevice_ ) ) )
{
scale = sendMessage< float >( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportedInputContentMinScaleForDevice_ ), pDevice );
}
return scale;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScalerDescriptor::supportedInputContentMaxScale( const MTL::Device* pDevice )
{
float scale = 1.0f;
if ( nullptr != methodSignatureForSelector( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportedInputContentMaxScaleForDevice_ ) ) )
{
scale = sendMessage< float >( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportedInputContentMaxScaleForDevice_ ), pDevice );
}
else if ( supportsDevice( pDevice ) )
{
scale = 2.0f;
}
return scale;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScalerDescriptor::supportsDevice( const MTL::Device* pDevice )
{
return Object::sendMessageSafe< bool >( _NS_PRIVATE_CLS( MTLFXTemporalScalerDescriptor ), _MTLFX_PRIVATE_SEL( supportsDevice_ ), pDevice );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScaler::colorTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( colorTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScaler::depthTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( depthTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScaler::motionTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( motionTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::TextureUsage MTLFX::TemporalScaler::outputTextureUsage() const
{
return Object::sendMessage< MTL::TextureUsage >( this, _MTLFX_PRIVATE_SEL( outputTextureUsage ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScaler::inputContentWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputContentWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setInputContentWidth( NS::UInteger width )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputContentWidth_ ), width );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScaler::inputContentHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputContentHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setInputContentHeight( NS::UInteger height )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setInputContentHeight_ ), height );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScaler::colorTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( colorTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setColorTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setColorTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScaler::depthTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( depthTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setDepthTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setDepthTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScaler::motionTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( motionTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setMotionTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setMotionTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScaler::outputTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( outputTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setOutputTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setOutputTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Texture* MTLFX::TemporalScaler::exposureTexture() const
{
return Object::sendMessage< MTL::Texture* >( this, _MTLFX_PRIVATE_SEL( exposureTexture ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setExposureTexture( MTL::Texture* pTexture )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setExposureTexture_ ), pTexture );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScaler::preExposure() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( preExposure ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setPreExposure( float preExposure )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setPreExposure_ ), preExposure );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScaler::jitterOffsetX() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( jitterOffsetX ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setJitterOffsetX( float offset )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setJitterOffsetX_ ), offset );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScaler::jitterOffsetY() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( jitterOffsetY ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setJitterOffsetY( float offset )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setJitterOffsetY_ ), offset );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScaler::motionVectorScaleX() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( motionVectorScaleX ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setMotionVectorScaleX( float scale )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setMotionVectorScaleX_ ), scale );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScaler::motionVectorScaleY() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( motionVectorScaleY ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setMotionVectorScaleY( float scale )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setMotionVectorScaleY_ ), scale );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScaler::reset() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( reset ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setReset( bool reset )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setReset_ ), reset );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE bool MTLFX::TemporalScaler::isDepthReversed() const
{
return Object::sendMessage< bool >( this, _MTLFX_PRIVATE_SEL( isDepthReversed ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setDepthReversed( bool depthReversed )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setDepthReversed_ ), depthReversed );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScaler::colorTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( colorTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScaler::depthTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( depthTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScaler::motionTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( motionTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::PixelFormat MTLFX::TemporalScaler::outputTextureFormat() const
{
return Object::sendMessage< MTL::PixelFormat >( this, _MTLFX_PRIVATE_SEL( outputTextureFormat ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScaler::inputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScaler::inputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( inputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScaler::outputWidth() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputWidth ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE NS::UInteger MTLFX::TemporalScaler::outputHeight() const
{
return Object::sendMessage< NS::UInteger >( this, _MTLFX_PRIVATE_SEL( outputHeight ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScaler::inputContentMinScale() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( inputContentMinScale ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE float MTLFX::TemporalScaler::inputContentMaxScale() const
{
return Object::sendMessage< float >( this, _MTLFX_PRIVATE_SEL( inputContentMaxScale ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE MTL::Fence* MTLFX::TemporalScaler::fence() const
{
return Object::sendMessage< MTL::Fence* >( this, _MTLFX_PRIVATE_SEL( fence ) );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::setFence( MTL::Fence* pFence )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( setFence_ ), pFence );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
_MTLFX_INLINE void MTLFX::TemporalScaler::encodeToCommandBuffer( MTL::CommandBuffer* pCommandBuffer )
{
Object::sendMessage< void >( this, _MTL_PRIVATE_SEL( encodeToCommandBuffer_ ), pCommandBuffer );
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------

View file

@ -0,0 +1,28 @@
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
//
// MetalFX/MetalFX.hpp
//
// Copyright 2020-2023 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.
//
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
//-------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "MTLFXSpatialScaler.hpp"
#include "MTLFXTemporalScaler.hpp"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------