This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For stackoverflow question: | |
// http://stackoverflow.com/questions/30445801/ios8-metal-compute-pipeline-slower-than-cpu | |
// I. CODE INVOKED ONCE, AT THE INIT STAGE: | |
_mtlCharTable = [_mtlDevice newBufferWithBytes:_charTable->pointer length:_charTable->bytesTotal options:0]; | |
_mtlSearchMasks = [_mtlDevice newBufferWithBytesNoCopy:_searchIndexes.mask length:_searchIndexes.bytesTotalMask options:0 deallocator:nil]; | |
//iPhone 6: maxTotalThreadsPerThreadgroup: 512, threadExecutionWidth: 32 | |
uint threadsPerThreadGroup = [_mtlComputePipelineState maxTotalThreadsPerThreadgroup];// / 4.0; |