yum-mirror/VkFFT
git clone https://git.yummers.dev/yum-mirror/VkFFT
ba7001c
develop
1//------------------------------------------------------------------------------------------------------------------------------------------------------------- 2// 3// Metal/MTLBlitCommandEncoder.hpp 4// 5// Copyright 2020-2021 Apple Inc. 6// 7// Licensed under the Apache License, Version 2.0 (the "License"); 8// you may not use this file except in compliance with the License. 9// You may obtain a copy of the License at 10// 11// http://www.apache.org/licenses/LICENSE-2.0 12// 13// Unless required by applicable law or agreed to in writing, software 14// distributed under the License is distributed on an "AS IS" BASIS, 15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16// See the License for the specific language governing permissions and 17// limitations under the License. 18// 19//------------------------------------------------------------------------------------------------------------------------------------------------------------- 20 21#pragma once 22 23#include "MTLDefines.hpp" 24#include "MTLHeaderBridge.hpp" 25#include "MTLPrivate.hpp" 26 27#include <Foundation/Foundation.hpp> 28 29#include "MTLBlitCommandEncoder.hpp" 30#include "MTLCommandEncoder.hpp" 31#include "MTLTypes.hpp" 32 33namespace MTL 34{ 35_MTL_OPTIONS (NS ::UInteger ,BlitOption ) { 36BlitOptionNone = 0 , 37BlitOptionDepthFromDepthStencil = 1 , 38BlitOptionStencilFromDepthStencil = 2 , 39BlitOptionRowLinearPVRTC = 4 , 40}; 41 42class BlitCommandEncoder :public NS ::Referencing < BlitCommandEncoder ,CommandEncoder > 43{ 44public : 45void synchronizeResource (const class Resource * resource ); 46 47void synchronizeTexture (const class Texture * texture ,NS ::UInteger slice ,NS ::UInteger level ); 48 49void copyFromTexture (const class Texture * sourceTexture ,NS ::UInteger sourceSlice ,NS ::UInteger sourceLevel ,MTL ::Origin sourceOrigin ,MTL ::Size sourceSize ,const class Texture * destinationTexture ,NS ::UInteger destinationSlice ,NS ::UInteger destinationLevel ,MTL ::Origin destinationOrigin ); 50 51void copyFromBuffer (const class Buffer * sourceBuffer ,NS ::UInteger sourceOffset ,NS ::UInteger sourceBytesPerRow ,NS ::UInteger sourceBytesPerImage ,MTL ::Size sourceSize ,const class Texture * destinationTexture ,NS ::UInteger destinationSlice ,NS ::UInteger destinationLevel ,MTL ::Origin destinationOrigin ); 52 53void copyFromBuffer (const class Buffer * sourceBuffer ,NS ::UInteger sourceOffset ,NS ::UInteger sourceBytesPerRow ,NS ::UInteger sourceBytesPerImage ,MTL ::Size sourceSize ,const class Texture * destinationTexture ,NS ::UInteger destinationSlice ,NS ::UInteger destinationLevel ,MTL ::Origin destinationOrigin ,MTL ::BlitOption options ); 54 55void copyFromTexture (const class Texture * sourceTexture ,NS ::UInteger sourceSlice ,NS ::UInteger sourceLevel ,MTL ::Origin sourceOrigin ,MTL ::Size sourceSize ,const class Buffer * destinationBuffer ,NS ::UInteger destinationOffset ,NS ::UInteger destinationBytesPerRow ,NS ::UInteger destinationBytesPerImage ); 56 57void copyFromTexture (const class Texture * sourceTexture ,NS ::UInteger sourceSlice ,NS ::UInteger sourceLevel ,MTL ::Origin sourceOrigin ,MTL ::Size sourceSize ,const class Buffer * destinationBuffer ,NS ::UInteger destinationOffset ,NS ::UInteger destinationBytesPerRow ,NS ::UInteger destinationBytesPerImage ,MTL ::BlitOption options ); 58 59void generateMipmaps (const class Texture * texture ); 60 61void fillBuffer (const class Buffer * buffer ,NS ::Range range ,uint8_t value ); 62 63void copyFromTexture (const class Texture * sourceTexture ,NS ::UInteger sourceSlice ,NS ::UInteger sourceLevel ,const class Texture * destinationTexture ,NS ::UInteger destinationSlice ,NS ::UInteger destinationLevel ,NS ::UInteger sliceCount ,NS ::UInteger levelCount ); 64 65void copyFromTexture (const class Texture * sourceTexture ,const class Texture * destinationTexture ); 66 67void copyFromBuffer (const class Buffer * sourceBuffer ,NS ::UInteger sourceOffset ,const class Buffer * destinationBuffer ,NS ::UInteger destinationOffset ,NS ::UInteger size ); 68 69void updateFence (const class Fence * fence ); 70 71void waitForFence (const class Fence * fence ); 72 73void getTextureAccessCounters (const class Texture * texture ,MTL ::Region region ,NS ::UInteger mipLevel ,NS ::UInteger slice ,bool resetCounters ,const class Buffer * countersBuffer ,NS ::UInteger countersBufferOffset ); 74 75void resetTextureAccessCounters (const class Texture * texture ,MTL ::Region region ,NS ::UInteger mipLevel ,NS ::UInteger slice ); 76 77void optimizeContentsForGPUAccess (const class Texture * texture ); 78 79void optimizeContentsForGPUAccess (const class Texture * texture ,NS ::UInteger slice ,NS ::UInteger level ); 80 81void optimizeContentsForCPUAccess (const class Texture * texture ); 82 83void optimizeContentsForCPUAccess (const class Texture * texture ,NS ::UInteger slice ,NS ::UInteger level ); 84 85void resetCommandsInBuffer (const class IndirectCommandBuffer * buffer ,NS ::Range range ); 86 87void copyIndirectCommandBuffer (const class IndirectCommandBuffer * source ,NS ::Range sourceRange ,const class IndirectCommandBuffer * destination ,NS ::UInteger destinationIndex ); 88 89void optimizeIndirectCommandBuffer (const class IndirectCommandBuffer * indirectCommandBuffer ,NS ::Range range ); 90 91void sampleCountersInBuffer (const class CounterSampleBuffer * sampleBuffer ,NS ::UInteger sampleIndex ,bool barrier ); 92 93void resolveCounters (const class CounterSampleBuffer * sampleBuffer ,NS ::Range range ,const class Buffer * destinationBuffer ,NS ::UInteger destinationOffset ); 94}; 95 96} 97 98// method: synchronizeResource: 99_MTL_INLINE voidMTL ::BlitCommandEncoder ::synchronizeResource (const MTL ::Resource * resource ) 100{ 101Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (synchronizeResource_ ),resource ); 102} 103 104// method: synchronizeTexture:slice:level: 105_MTL_INLINE voidMTL ::BlitCommandEncoder ::synchronizeTexture (const MTL ::Texture * texture ,NS ::UInteger slice ,NS ::UInteger level ) 106{ 107Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (synchronizeTexture_slice_level_ ),texture ,slice ,level ); 108} 109 110// method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin: 111_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyFromTexture (const MTL ::Texture * sourceTexture ,NS ::UInteger sourceSlice ,NS ::UInteger sourceLevel ,MTL ::Origin sourceOrigin ,MTL ::Size sourceSize ,const MTL ::Texture * destinationTexture ,NS ::UInteger destinationSlice ,NS ::UInteger destinationLevel ,MTL ::Origin destinationOrigin ) 112{ 113Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_ ),sourceTexture ,sourceSlice ,sourceLevel ,sourceOrigin ,sourceSize ,destinationTexture ,destinationSlice ,destinationLevel ,destinationOrigin ); 114} 115 116// method: copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin: 117_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyFromBuffer (const MTL ::Buffer * sourceBuffer ,NS ::UInteger sourceOffset ,NS ::UInteger sourceBytesPerRow ,NS ::UInteger sourceBytesPerImage ,MTL ::Size sourceSize ,const MTL ::Texture * destinationTexture ,NS ::UInteger destinationSlice ,NS ::UInteger destinationLevel ,MTL ::Origin destinationOrigin ) 118{ 119Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_ ),sourceBuffer ,sourceOffset ,sourceBytesPerRow ,sourceBytesPerImage ,sourceSize ,destinationTexture ,destinationSlice ,destinationLevel ,destinationOrigin ); 120} 121 122// method: copyFromBuffer:sourceOffset:sourceBytesPerRow:sourceBytesPerImage:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:options: 123_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyFromBuffer (const MTL ::Buffer * sourceBuffer ,NS ::UInteger sourceOffset ,NS ::UInteger sourceBytesPerRow ,NS ::UInteger sourceBytesPerImage ,MTL ::Size sourceSize ,const MTL ::Texture * destinationTexture ,NS ::UInteger destinationSlice ,NS ::UInteger destinationLevel ,MTL ::Origin destinationOrigin ,MTL ::BlitOption options ) 124{ 125Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyFromBuffer_sourceOffset_sourceBytesPerRow_sourceBytesPerImage_sourceSize_toTexture_destinationSlice_destinationLevel_destinationOrigin_options_ ),sourceBuffer ,sourceOffset ,sourceBytesPerRow ,sourceBytesPerImage ,sourceSize ,destinationTexture ,destinationSlice ,destinationLevel ,destinationOrigin ,options ); 126} 127 128// method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage: 129_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyFromTexture (const MTL ::Texture * sourceTexture ,NS ::UInteger sourceSlice ,NS ::UInteger sourceLevel ,MTL ::Origin sourceOrigin ,MTL ::Size sourceSize ,const MTL ::Buffer * destinationBuffer ,NS ::UInteger destinationOffset ,NS ::UInteger destinationBytesPerRow ,NS ::UInteger destinationBytesPerImage ) 130{ 131Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_ ),sourceTexture ,sourceSlice ,sourceLevel ,sourceOrigin ,sourceSize ,destinationBuffer ,destinationOffset ,destinationBytesPerRow ,destinationBytesPerImage ); 132} 133 134// method: copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:options: 135_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyFromTexture (const MTL ::Texture * sourceTexture ,NS ::UInteger sourceSlice ,NS ::UInteger sourceLevel ,MTL ::Origin sourceOrigin ,MTL ::Size sourceSize ,const MTL ::Buffer * destinationBuffer ,NS ::UInteger destinationOffset ,NS ::UInteger destinationBytesPerRow ,NS ::UInteger destinationBytesPerImage ,MTL ::BlitOption options ) 136{ 137Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyFromTexture_sourceSlice_sourceLevel_sourceOrigin_sourceSize_toBuffer_destinationOffset_destinationBytesPerRow_destinationBytesPerImage_options_ ),sourceTexture ,sourceSlice ,sourceLevel ,sourceOrigin ,sourceSize ,destinationBuffer ,destinationOffset ,destinationBytesPerRow ,destinationBytesPerImage ,options ); 138} 139 140// method: generateMipmapsForTexture: 141_MTL_INLINE voidMTL ::BlitCommandEncoder ::generateMipmaps (const MTL ::Texture * texture ) 142{ 143Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (generateMipmapsForTexture_ ),texture ); 144} 145 146// method: fillBuffer:range:value: 147_MTL_INLINE voidMTL ::BlitCommandEncoder ::fillBuffer (const MTL ::Buffer * buffer ,NS ::Range range ,uint8_t value ) 148{ 149Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (fillBuffer_range_value_ ),buffer ,range ,value ); 150} 151 152// method: copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount: 153_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyFromTexture (const MTL ::Texture * sourceTexture ,NS ::UInteger sourceSlice ,NS ::UInteger sourceLevel ,const MTL ::Texture * destinationTexture ,NS ::UInteger destinationSlice ,NS ::UInteger destinationLevel ,NS ::UInteger sliceCount ,NS ::UInteger levelCount ) 154{ 155Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyFromTexture_sourceSlice_sourceLevel_toTexture_destinationSlice_destinationLevel_sliceCount_levelCount_ ),sourceTexture ,sourceSlice ,sourceLevel ,destinationTexture ,destinationSlice ,destinationLevel ,sliceCount ,levelCount ); 156} 157 158// method: copyFromTexture:toTexture: 159_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyFromTexture (const MTL ::Texture * sourceTexture ,const MTL ::Texture * destinationTexture ) 160{ 161Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyFromTexture_toTexture_ ),sourceTexture ,destinationTexture ); 162} 163 164// method: copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size: 165_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyFromBuffer (const MTL ::Buffer * sourceBuffer ,NS ::UInteger sourceOffset ,const MTL ::Buffer * destinationBuffer ,NS ::UInteger destinationOffset ,NS ::UInteger size ) 166{ 167Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyFromBuffer_sourceOffset_toBuffer_destinationOffset_size_ ),sourceBuffer ,sourceOffset ,destinationBuffer ,destinationOffset ,size ); 168} 169 170// method: updateFence: 171_MTL_INLINE voidMTL ::BlitCommandEncoder ::updateFence (const MTL ::Fence * fence ) 172{ 173Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (updateFence_ ),fence ); 174} 175 176// method: waitForFence: 177_MTL_INLINE voidMTL ::BlitCommandEncoder ::waitForFence (const MTL ::Fence * fence ) 178{ 179Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (waitForFence_ ),fence ); 180} 181 182// method: getTextureAccessCounters:region:mipLevel:slice:resetCounters:countersBuffer:countersBufferOffset: 183_MTL_INLINE voidMTL ::BlitCommandEncoder ::getTextureAccessCounters (const MTL ::Texture * texture ,MTL ::Region region ,NS ::UInteger mipLevel ,NS ::UInteger slice ,bool resetCounters ,const MTL ::Buffer * countersBuffer ,NS ::UInteger countersBufferOffset ) 184{ 185Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (getTextureAccessCounters_region_mipLevel_slice_resetCounters_countersBuffer_countersBufferOffset_ ),texture ,region ,mipLevel ,slice ,resetCounters ,countersBuffer ,countersBufferOffset ); 186} 187 188// method: resetTextureAccessCounters:region:mipLevel:slice: 189_MTL_INLINE voidMTL ::BlitCommandEncoder ::resetTextureAccessCounters (const MTL ::Texture * texture ,MTL ::Region region ,NS ::UInteger mipLevel ,NS ::UInteger slice ) 190{ 191Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (resetTextureAccessCounters_region_mipLevel_slice_ ),texture ,region ,mipLevel ,slice ); 192} 193 194// method: optimizeContentsForGPUAccess: 195_MTL_INLINE voidMTL ::BlitCommandEncoder ::optimizeContentsForGPUAccess (const MTL ::Texture * texture ) 196{ 197Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (optimizeContentsForGPUAccess_ ),texture ); 198} 199 200// method: optimizeContentsForGPUAccess:slice:level: 201_MTL_INLINE voidMTL ::BlitCommandEncoder ::optimizeContentsForGPUAccess (const MTL ::Texture * texture ,NS ::UInteger slice ,NS ::UInteger level ) 202{ 203Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (optimizeContentsForGPUAccess_slice_level_ ),texture ,slice ,level ); 204} 205 206// method: optimizeContentsForCPUAccess: 207_MTL_INLINE voidMTL ::BlitCommandEncoder ::optimizeContentsForCPUAccess (const MTL ::Texture * texture ) 208{ 209Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (optimizeContentsForCPUAccess_ ),texture ); 210} 211 212// method: optimizeContentsForCPUAccess:slice:level: 213_MTL_INLINE voidMTL ::BlitCommandEncoder ::optimizeContentsForCPUAccess (const MTL ::Texture * texture ,NS ::UInteger slice ,NS ::UInteger level ) 214{ 215Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (optimizeContentsForCPUAccess_slice_level_ ),texture ,slice ,level ); 216} 217 218// method: resetCommandsInBuffer:withRange: 219_MTL_INLINE voidMTL ::BlitCommandEncoder ::resetCommandsInBuffer (const MTL ::IndirectCommandBuffer * buffer ,NS ::Range range ) 220{ 221Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (resetCommandsInBuffer_withRange_ ),buffer ,range ); 222} 223 224// method: copyIndirectCommandBuffer:sourceRange:destination:destinationIndex: 225_MTL_INLINE voidMTL ::BlitCommandEncoder ::copyIndirectCommandBuffer (const MTL ::IndirectCommandBuffer * source ,NS ::Range sourceRange ,const MTL ::IndirectCommandBuffer * destination ,NS ::UInteger destinationIndex ) 226{ 227Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (copyIndirectCommandBuffer_sourceRange_destination_destinationIndex_ ),source ,sourceRange ,destination ,destinationIndex ); 228} 229 230// method: optimizeIndirectCommandBuffer:withRange: 231_MTL_INLINE voidMTL ::BlitCommandEncoder ::optimizeIndirectCommandBuffer (const MTL ::IndirectCommandBuffer * indirectCommandBuffer ,NS ::Range range ) 232{ 233Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (optimizeIndirectCommandBuffer_withRange_ ),indirectCommandBuffer ,range ); 234} 235 236// method: sampleCountersInBuffer:atSampleIndex:withBarrier: 237_MTL_INLINE voidMTL ::BlitCommandEncoder ::sampleCountersInBuffer (const MTL ::CounterSampleBuffer * sampleBuffer ,NS ::UInteger sampleIndex ,bool barrier ) 238{ 239Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (sampleCountersInBuffer_atSampleIndex_withBarrier_ ),sampleBuffer ,sampleIndex ,barrier ); 240} 241 242// method: resolveCounters:inRange:destinationBuffer:destinationOffset: 243_MTL_INLINE voidMTL ::BlitCommandEncoder ::resolveCounters (const MTL ::CounterSampleBuffer * sampleBuffer ,NS ::Range range ,const MTL ::Buffer * destinationBuffer ,NS ::UInteger destinationOffset ) 244{ 245Object ::sendMessage < void > (this ,_MTL_PRIVATE_SEL (resolveCounters_inRange_destinationBuffer_destinationOffset_ ),sampleBuffer ,range ,destinationBuffer ,destinationOffset ); 246}