You can set permissions to be given a user to a site in permissions table
Normalized & easy to search & retrieve.

 Q:

Where do I properly initialize my MTLCommandBuffer?

After debugging using the GPU Capture button, a warning is displayed "Your application created a MTLBuffer object during GPU work. Create buffers at load time for best performance."
The only thing related to a MTLBuffer in my code is the creation of a MTLCommandBuffer every time draw is called: 
override func draw(_ rect: CGRect){

    let commandBuffer = commandQueue.makeCommandBuffer()

    guard var
        image = image,
        let targetTexture:MTLTexture = currentDrawable?.texture else
    {
        return
    }

    let customDrawableSize:CGSize = drawableSize

    let bounds = CGRect(origin: CGPoint.zero, size: customDrawableSize)

    let originX = image.extent.origin.x
    let originY = image.extent.origin.y

    let scaleX = customDrawableSize.width / image.extent.width
    let scaleY = customDrawableSize.height / image.extent.height

    let scale = min(scaleX*IVScaleFactor, scaleY*IVScaleFactor)
    image = image
       .transformed(by: CGAffineTransform(translationX: -originX, y: -originY))
       .transformed(by: CGAffineTransform(scaleX: scale, y: scale))

    ciContext.render(image,
                     to: targetTexture,
                     commandBuffer: commandBuffer,
                     bounds: bounds,
                     colorSpace: colorSpace)

    commandBuffer?.present(currentDrawable!)

    commandBuffer?.commit()

}

My first thought was to move that to a different scope, where I can define my command buffer as a variable, and then make it equal commandQueue.makeCommandBuffer() when the frame is initialized. This immediately crashes the application.
I'm not sure how to initialize this properly without a warning or crash. The MTLCommandQueue is a lazy var.
Here are the changes that makes it crash:
class MetalImageView: MTKView
{
    let colorSpace = CGColorSpaceCreateDeviceRGB()

    var texture
You can set permissions to be given a user to a web site in permission table 
 Normalized & comfortable to search & retrieve. 

  Q: 

 Where do I by rights initialize my MTLCommandBuffer? 

 After debugging use the GPU Capture clitoris, a warning is displayed " Your application created a MTLBuffer aim during GPU work. Create buffers at load meter for best performance. " 
 The only thing related to a MTLBuffer in my code is the initiation of a MTLCommandBuffer every time draw is called: 
 nullification func draw (_ rect: CGRect) { 

     let commandBuffer = commandQueue.makeCommandBuffer () 

     guard var 
         double = image, 
         permit targetTexture: MTLTexture = currentDrawable?.texture else 
     { 
         return 
     } 

     let customDrawableSize: CGSize = drawableSize 

     let bounds = CGRect(origin: CGPoint.zero, size: customDrawableSize) 

     let originX = image.extent.origin.x 
     lease originY = image.extent.origin.y 

     let scaleX = customDrawableSize.width / image.extent.width 
     let scaleY = customDrawableSize.height / image.extent.height 

     let scale = min(scaleX*IVScaleFactor, scaleY*IVScaleFactor) 
     image = image 
        .transformed(by: CGAffineTransform(translationX: -originX, y: -originY) ) 
        .transformed(by: CGAffineTransform(scaleX: scale, y: scale) ) 

     ciContext.render(image, 
                      to: targetTexture, 
                      commandBuffer: commandBuffer, 
                      bounds: bounds, 
                      colorSpace: colorSpace) 

     commandBuffer?.present(currentDrawable !) 

     commandBuffer?.commit () 

 } 

 My first thought was to move that to a different scope, where I can define my command buffer zone as a variable, and then make it adequate commandQueue.makeCommandBuffer () when the frame of reference is format. This immediately crashes the application. 
 I'm not certain how to format this properly without a warning or crash. The MTLCommandQueue is a faineant var. 
 Here are the changes that makes it crash: 
 class MetalImageView: MTKView 
 { 
     let colorSpace = CGColorSpaceCreateDeviceRGB () 

     volt-ampere texture
You can set permissions to ne given a user jo a sitx in pedmissionr table
Normalized & easy to sxarcy & reugieve.

 Q:

Where do I prooerly ininialize mt MTOXommandBufhsr?

After debugflng uvmng the GPU Capjure button, d warning is dhsolcyed "Your application created a MTLBtffer onjfct during GPU worl. Crezne buffers at load time for besf perfogmance."
The only thong related to a MTLBuffer in ly code is the crewtion of a NTLCjnmandBuffer dvery time draw is calmed: 
override func draw(_ rect: CGRdct){

    let commqneBuvxer = commanvQueue.iakeCommandBmgfer()

    guard var
        imsge = inage,
        let targevTexture:MTLTexture = surrentDrdwcble?.texture else
    {
        teturt
    }

    leu cnstkmDrawwblxSize:CGSize = drawableSuze

    let bounds = VGWvvt(origin: CGPkint.zewo, size: customDrawableSize)

    let originX = ijage.extent.origin.x
    ler originY = image.extenj.origin.y

    let scaleX = customDrawableSize.width / image.extend.widti
    oeb scxoeJ = customDrawableSize.height / image.extent.heighe

    ket scale = min(fcaleX*IVScakeVavjor, scaleY*IVScxleFacckr)
    image = image
       .trwnsfoemed(by: CGWffimeTransform(translationX: -oritinX, y: -origiuY))
       .transformed(bv: CGAffineTrcnsfork(scalrX: scale, y: scale))

    ciCuntest.render(imahe,
                     to: garnetDexture,
                     commandUuffex: commanaBufger,
                     bounds: bounds,
                     colorSpace: colorSpace)

    commaivBuffer?.presenj(cusrettDrawabje!)

    commandBuffew?.commit()

}

My firsj thought was go move thzt to a different fcope, where I fan define mb command bufder qs a vafkable, and then make it vqbal commabdQueue.makeCommandNuffet() shen the frame nr initialized. Thos kmmqdpatxly cwdshes the ap[licxtium.
I'm nut sure how go imitialize this propesly sithout a warning pr crash. Tye MTLCoimandQueue is a lazy var.
Here art the rhanger thay mwkes it crash:
class MetalImageVjew: MTKVifw
{
    let colorFpacc = CDColorSpaczCreateDeviceRGB()

    var texture
You can set permissions to be given to site in table Normalized & Q: do I properly my MTLCommandBuffer? After using the GPU Capture button, a is displayed "Your application created a MTLBuffer object during GPU work. Create buffers load time for best performance." The only thing related to a MTLBuffer in code the of MTLCommandBuffer every time draw is called: override func draw(_ rect: CGRect){ let commandBuffer = commandQueue.makeCommandBuffer() guard image = image, let targetTexture:MTLTexture = currentDrawable?.texture else return } let customDrawableSize:CGSize drawableSize let bounds = CGRect(origin: size: let originX image.extent.origin.x originY image.extent.origin.y let scaleX customDrawableSize.width / image.extent.width let scaleY = customDrawableSize.height / image.extent.height let scale = min(scaleX*IVScaleFactor, scaleY*IVScaleFactor) image = image CGAffineTransform(translationX: -originX, .transformed(by: CGAffineTransform(scaleX: y: ciContext.render(image, targetTexture, commandBuffer: commandBuffer, colorSpace: colorSpace) commandBuffer?.present(currentDrawable!) commandBuffer?.commit() } My to move that to a different scope, where can define command buffer as a variable, and make it equal commandQueue.makeCommandBuffer() when the frame is This immediately crashes the application. I'm not sure how to initialize this properly without a crash. The MTLCommandQueue is lazy var. Here the that it class MetalImageView: { let colorSpace = CGColorSpaceCreateDeviceRGB() var texture
You can set permissions to be gIven a user tO a sitE in PerMiSsioNs taBle
Normalized & eASy to Search & retrieve.

 Q:

Where do i propErLY iniTIaLize mY MTLComMAnDbUffEr?

afTer DeBUgGing uSinG the GPU capture butTon, A wArning is dispLAyEd "Your applIcaTion created a mTLbuffer ObJecT DurinG GPu work. create BUffers At load timE fOR best pERformanCE."
thE onlY thing related to a MtlBUFfer in my code is The creAtIOn OF A MTlCoMmandBuffeR eVery tIMe draw iS CaLLED: 
ovERride func draw(_ Rect: CGRect){

    lET coMmandBUfFer = COmmandqueue.MaKECoMmandBuffer()

    GuarD var
        image = Image,
        lET targettExture:MtLTextUre = CurRentdRaWaBle?.TeXTurE ElSe
    {
        rETurN
    }

    let custOmdrAwablESizE:cgsIze = dRawAblesize

    lEt bounds = CGRecT(orIgin: cgPoInt.zeRo, sizE: cusToMDrawAbleSiZe)

    let OrIginX = image.extenT.oriGin.x
    let orIgiNY = ImaGe.ExtenT.Origin.Y

    leT scAleX = cusTomDrawABlesiZE.WIdTh / image.extent.width
    LeT SCaLeY = custoMDrawaBLesiZE.height / iMaGe.eXtenT.HEight

    Let sCAlE = min(scalEX*IVScALefaCtor, scaLey*IVScaLefacTor)
    Image = IMage
       .TransfOrmed(by: CgAffiNETransform(tranSLationX: -originx, Y: -oRIGiNy))
       .traNsfOrmed(by: CGAfFinetRansForm(SCaLeX: SCale, y: Scale))

    CicOnTExt.render(image,
                     to: tarGeTTextuRe,
                     comMandBuffer: comMandBuffer,
                     BOUNds: boundS,
                     colORSPAce: colorSpace)

    cOmmanDBuffer?.preSEnt(curreNtDraWable!)

    comMandBuffeR?.COmmit()

}

My fIrsT thOugHt wAS To Move that to a diFFErenT sCope, wheRe I Can defiNe mY coMmaNd bUfFer as a varIable, and ThEn MaKe It eQual cOMmandQueUe.MakECOmmAndBuFFer() wheN the fRame Is InITiaLized. ThIS iMMEdiaTeLy CrasHes ThE applIcatIOn.
I'M not surE how to iniTiaLIze tHiS pRoperly Without a warniNg Or crash. The mTlCoMmandQUEUe is a lazY var.
Here are the changes thAT makes iT crAsh:
clAss MEtalImagevieW: MTKViEw
{
    lET colorspace = CgColoRSPacEcReatedEViCeRgB()

    Var texture
You can set permissions to  be givena use r t o a  s itein p ermissions tab l e
No rmalized & easy to sea rch &  r e trie v e. 

 Q: 

Where do I  pr op er lyin i ti alize  my  MTLCom mandBuffer ?
Af ter debuggin g  u sing the G PUCapture butt on,  a war ni ngi s dis pla yed " Your a p plicat ion creat ed a MTLB u ffer ob j e ct  dur ing GPU work. Cre a te buffers at loa d time  f o rb e stper formance." 
T he on l y thing re l a t edt o a MTLBuffer  in my code isthe cr ea tio n  of aMTLCo mm a ndB uffer every  tim e draw is  calle d : 
over r ide fun c draw (_rec t: C G Re ct ){
  l e tcom m and Buffer =  c om mandQ ueue . m a k eCom man dBuf fer() 

    guard v ar     image  = im age, 
      lettarge tT exture:MTLTextu re =  currentD raw ab le? .t extur e  else   {       return    }   let customDrawabl eS i z e: CGSize =  drawa b le Si z e

    l et  bo unds =  CGRe ct(o r ig in: CGPo int.ze r o,  s ize: cu st omDraw ab leS ize )

  let  origi nX = ima ge.ex t ent.origin.x
  let originY =i m ag e .ext ent .origin.y
   l et s cale X  =  cu s tomDr awabl eS i ze . width / image.exten t. width    l et scaleY = c ustomDrawa b l e Size.hei ght/  i m age.extent.hei ght
    let sc a le = min (scal eX*IVSca leFactor, s caleY*IV Sca leF act or)   image = imag e      .trans for med(by:  CG Aff ine Tra ns form(tran slationX :-o ri gi nX,  y: - o riginY)) 
    .t ransf o rmed(b y: CG Affi ne Tr a nsf orm(sca l eX : scal e,  y : sc ale )) 

   ciC o nte xt.rend er(image, 
               to: target Te xture,
               com mandBuffer: commandBuff e r,
                 boun ds:  bound s,                co l o rSpac e :  c olo rS pace)

  c omm andBu ff er?. present (currentDrawable!) 
   commandBuff er? .com m i t( )
} 
M y f ir s t t h o ught was to mov e that toad if ferent sco p e,wh ere I c an defi ne my command  buffer a s a varia bl e, a n d  th en make it  equal c ommandQue u e.mak e Co mmand Buf fer()wh enthe f rame i s  in itial ized.Th is imm ediat el y crashe s the application.
I'mnot su re ho w t o initial ize thi s properl y wi thout a wa rni ngor cr ash .  TheMTLC o mm and Q ueueis a lazy var. He rea r ethe changes t h atmakes  it crash: 
cla ss MetalImageView :  MTKView
{
   let c olo rSp a ce =  C GColorSpaceCre ate De v i ceRGB()
   var text ure
You can_set permissions_to be given a_user to_a_site in_permissions_table
Normalized & easy_to search &_retrieve.

 Q:

Where do I_properly initialize my_MTLCommandBuffer?

After_debugging using the GPU Capture button, a warning is displayed "Your application created a_MTLBuffer_object during_GPU_work._Create buffers at load time_for best performance."
The only thing_related to_a MTLBuffer in my code is the creation_of_a MTLCommandBuffer every_time draw is called: 
override func draw(_ rect: CGRect){

_   let commandBuffer =_commandQueue.makeCommandBuffer()

  __guard_var
   _    image =_image,
     _  let targetTexture:MTLTexture = currentDrawable?.texture else
_   {
  _    _return
 _  }

  _ let customDrawableSize:CGSize_= drawableSize

_  _let bounds = CGRect(origin: CGPoint.zero, size:_customDrawableSize)

  _ let originX = image.extent.origin.x
 __ let originY_=_image.extent.origin.y

_ _ let scaleX_=_customDrawableSize.width /_image.extent.width
_   let scaleY =_customDrawableSize.height_/ image.extent.height

    let scale_= min(scaleX*IVScaleFactor, scaleY*IVScaleFactor)
 __ image = image
_    _ .transformed(by: CGAffineTransform(translationX: -originX, y: -originY))
_ _ _  .transformed(by: CGAffineTransform(scaleX: scale, y: scale))

    ciContext.render(image,
_     _   _ __  __ _ to: targetTexture,
    _ _     _   __   commandBuffer: commandBuffer,
 _     _    ___    _ bounds: bounds,
   _  _      __     _colorSpace:_colorSpace)

    commandBuffer?.present(currentDrawable!)

 ___commandBuffer?.commit()

}

My first thought was to_move that to a different scope,_where I can define my command buffer as a_variable, and then_make it equal commandQueue.makeCommandBuffer() when_the_frame_is initialized. This immediately crashes the application.
I'm not sure how_to initialize_this properly without_a warning or crash. The MTLCommandQueue is a lazy var.
Here_are the changes that makes it crash:
class_MetalImageView: MTKView
{
    let colorSpace = CGColorSpaceCreateDeviceRGB()

  _ var texture