<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Andrew,<div class=""><br class=""></div><div class="">Thank you for the compliment ;)</div><div class=""><br class=""></div><div class="">And thank you for the 2 advices</div><div class=""><br class=""></div><div class="">And the question about use of size or stride ? I understand that the underlaying float data are aligned in this specific case, but I wonder in fact if the shader compiler align memory the same way the swift compiler do, I suppose yes unless it would be a nightmare, but murphy’s principle says me … take care ;)</div><div class=""><br class=""></div><div class="">Thanks in advance</div><div class=""><br class=""></div><div class="">Gerard</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 8 Sep 2016, at 07:21, Andrew Trick &lt;<a href="mailto:atrick@apple.com" class="">atrick@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><br class="Apple-interchange-newline">On Sep 3, 2016, at 6:03 PM, Gerard Iglesias via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">This is my funny version… I succeeded and I didn’t come back to find an other way…<div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;">// Grab a pointer to the constant buffer's data store</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;">// Since we are using Swift, it is easier to cast the pointer to the ShadowPass type to fill the constant buffer</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;">// We need to make a copy of these so the block captures the correct data</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;">//let shadowPtr = UnsafeMutablePointer&lt;ShadowPass&gt;(constantBufferForFrame.contents())</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">&nbsp;</span>shadowPtr = constantBufferForFrame.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">contents</span><span class="" style="font-variant-ligatures: no-common-ligatures;">().</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">assumingMemoryBound</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(to:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">ShadowPass</span><span class="" style="font-variant-ligatures: no-common-ligatures;">.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures;">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">shadowPtr.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">pointee</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">&nbsp;</span>=<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">shadowPassData</span><span class="" style="font-variant-ligatures: no-common-ligatures;">[</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">0</span><span class="" style="font-variant-ligatures: no-common-ligatures;">]</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">                </span></span><br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;">//More Swift specific stuff - advance pointer and cast to MainPass</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;&nbsp; &nbsp;</span><br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;">//let mainPtr = UnsafeMutablePointer&lt;MainPass&gt;(shadowPtr.advanced(by: 1))</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">&nbsp;</span>mainPtr = constantBufferForFrame.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">contents</span><span class="" style="font-variant-ligatures: no-common-ligatures;">().</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">advanced</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(by:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">MemoryLayout</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&lt;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">ShadowPass</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&gt;.</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="" style="color: rgb(112, 61, 170);">size</span><span class="" style="font-variant-ligatures: no-common-ligatures;">).</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">assumingMemoryBound</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(to:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">MainPass</span><span class="" style="font-variant-ligatures: no-common-ligatures;">.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures;">)</span></span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);"><span class="" style="font-variant-ligatures: no-common-ligatures;">mainPtr.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">pointee</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">&nbsp;</span>=<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures;">mainPassFrameData</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">                </span></span><br class="webkit-block-placeholder"></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;">//Advance and cast to ObjectData</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><span class="" style="font-variant-ligatures: no-common-ligatures;"></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, 132, 0);"><span class="" style="font-variant-ligatures: no-common-ligatures;">//var ptr = UnsafeMutablePointer&lt;ObjectData&gt;(mainPtr.advanced(by: 1))</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">var</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">&nbsp;</span>ptr = constantBufferForFrame.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">contents</span><span class="" style="font-variant-ligatures: no-common-ligatures;">().</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">advanced</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(by:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">MemoryLayout</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&lt;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">ShadowPass</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&gt;.</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="" style="color: rgb(112, 61, 170);">size</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp;+<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">MemoryLayout</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&lt;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">MainPass</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&gt;.<span class="" style="color: rgb(112, 61, 170);">size</span><span class="" style="font-variant-ligatures: no-common-ligatures;">).</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(62, 30, 129);">assumingMemoryBound</span><span class="" style="font-variant-ligatures: no-common-ligatures;">(to:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(79, 129, 135);">ObjectData</span><span class="" style="font-variant-ligatures: no-common-ligatures;">.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures;">)</span></span></span></div></div></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Gerard,</div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="">I like your code. A couple of things to consider:</div><div class=""><br class=""></div><div class="">1. If the memory has never been bound to a type (i.e. it's straight from MTLBuffer.newBuffer), then rather than “assuming” memory is bound to these types, you should just bind it here (substitute all your assumingMemoryBound(to: _) with bindMemory(to: _, capacity: 1). Think of it as two-phase initialization of the memory. First declare the memory's type (e.g. some structure that holds a bunch of floats), then write individual float values into the memory.</div><div class=""><br class=""></div><div class="">2. If you want the compiler to compute byte offsets for you like the original code, then can be done as follows:</div><div class=""><br class=""></div><div class="">&nbsp; let mainPtr = UnsafeMutableRawPointer(shadowPtr + 1).bindMemory(</div><div class="">&nbsp; &nbsp; to: MainPass.self, capacity: 1)</div><div class="">&nbsp; mainPtr.pointee = mainPassFrameData</div><div class="">&nbsp; ...</div><div class=""><br class=""></div><div class="">However, your approach of computing byte offsets is more explicit.</div><div class=""><br class=""></div><div class="">My migration guide landed on<span class="Apple-converted-space">&nbsp;</span><a href="http://swift.org/" class="">swift.org</a><span class="Apple-converted-space">&nbsp;</span>today! I think it will be a big help.</div><div class=""><a href="https://swift.org/migration-guide/se-0107-migrate.html" class="">https://swift.org/migration-guide/se-0107-migrate.html</a></div><div class=""><br class=""></div><div class="">-Andy</div></div><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><blockquote type="cite" class=""><div class="">On 3 Sep 2016, at 19:22, Patrice Kouame &lt;<a href="mailto:pkouame@me.com" class="">pkouame@me.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Gerard-&nbsp;<div class=""><br class=""></div><div class="">Excellent! &nbsp;Looking forward to seeing your fix (hoping you get your book back soon ;-) )</div><div class=""><br class=""></div><div class="">I think Xcode/Swift gags on the last ptr advance to objectData. &nbsp;I recently tried another variant using withUnsafeMutablePointer like this:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;var ptr : UnsafeMutablePointer&lt;ObjectData&gt;&nbsp; = withUnsafeMutablePointer(to: &amp;mainPtr) {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $0.withMemoryRebound(to: ObjectData.self, capacity: objectsToRender) {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $0.pointee = renderables[0].objectData</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class="">..but still crashes with no hints.</div><div class=""><br class=""></div><div class="">My bug report also mentions that the Xcode migration/conversion tool is incomplete. &nbsp;</div><div class="">It handles the “simpler" UnsafeMutableRawPointer&lt;X&gt; to UnsafeMutablePonter&lt;Y&gt; with bindMemory cases correctly (one still has to mind the capacity value though)</div><div class="">In all fairness, migrating/converting automagically in these cases is always a little bit tricky - the proposed Xcode fixes should always be reviewed by a human...</div><div class=""><br class=""></div><div class="">Patrice</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Sep 3, 2016, at 1:05 PM, Gerard Iglesias via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class=""><div class=""><div class="" style="direction: inherit;">Ok</div><div class="" style="direction: inherit;"><br class=""></div><div class="" style="direction: inherit;">For the record I succeeded this transformation phase last week</div><div class="" style="direction: inherit;"><br class=""></div><div class="" style="direction: inherit;">I remember the tedious stuff to advance pointer from one struct to the other kind of struct... it worked</div><div class="" style="direction: inherit;"><br class=""></div><div class="" style="direction: inherit;">But I don't have my MacBook with me, only the phone, the six :)</div><br class="">Gérard&nbsp;</div><div class=""><br class="">Le 3 sept. 2016 à 18:22, Patrice Kouame &lt;<a href="mailto:pkouame@me.com" class="">pkouame@me.com</a>&gt; a écrit&nbsp;:<br class=""><br class=""></div><blockquote type="cite" class=""><div class="">Indeed. There is a difference between stride and size, but I interpreted capacity incorrectly for my purposes. &nbsp;It should indicate the number of &lt;T&gt; elements (not their size - right?) and the snippets below should work.<div class=""><br class=""><div class="">Still, compiler crashes and Xcode IDE is left in inconsistent state. &nbsp;So I filed this Apple radar against Developer Tools.</div><div class=""><br class=""></div><div class=""><h2 id="" class="problemHeadingNew problemHeading" style="outline: none; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; height: 26px; padding: 1px 0px 5px; margin: 0px; font-size: 15px; font-family: Helvetica, Arial, sans-serif;"><span id="displayFullDetailsProblemID" class="probNo" style="outline: none; color: rgb(102, 102, 102); font-weight: normal; padding: 0px 10px 0px 0px;"><span class="Apple-tab-span" style="white-space: pre;">        </span>28150447 -&nbsp;Swift 3 UnsafeMutablePointer conversion crashes the compiler and IDE</span></h2><div class="">Should I file a Swift bug too? Would that be helpful?</div><div class=""><br class=""></div><div class="">Regards, Patrice</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Sep 3, 2016, at 11:39 AM, Gerard Iglesias via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class=""><div class=""><div class="" style="direction: inherit;">Hello,</div><div class="" style="direction: inherit;"><br class=""></div><div class="" style="direction: inherit;">I think that it is more secure to use stride in place of size, sometimes it is not the same value.</div><div class="" style="direction: inherit;"><br class=""></div><div class="" style="direction: inherit;">I use it in my own use of raw bindings&nbsp;</div><div class="" style="direction: inherit;"><br class=""></div><div class="" style="direction: inherit;">Regards</div><br class="">Gérard&nbsp;</div><div class=""><br class="">Le 3 sept. 2016 à 10:03, Patrice Kouame via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; a écrit&nbsp;:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div class="">Hi Jacob -&nbsp;</div><div class=""><br class=""></div>I think you’re right. “capacity” should be the count of type T elements in my buffer. &nbsp;So in my case that line should read<div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">&nbsp;</span>shadowPtr = constantBufferForFrame.contents().bindMemory(to: ShadowPass.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, capacity: shadowPassData.count)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">The&nbsp;withMemoryRebound&nbsp;calls need similar adjustments. The pointer to MainPass is actually a single structure to it should be safe to do this</span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">let</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">&nbsp;</span>mainPtr :<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UnsafeMutablePointer</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&lt;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">MainPass</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&gt; = shadowPtr.advanced(by:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">1</span><span class="" style="font-variant-ligatures: no-common-ligatures;">).withMemoryRebound(to: MainPass.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, capacity:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">1</span><span class="" style="font-variant-ligatures: no-common-ligatures;">) {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $0.pointee = mainPassFrameData</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">Whereas the unsafe pointer to &lt;ObjectData&gt; is actually a buffer of renderable objects, so this should work:</span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">var</span><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">&nbsp;</span>ptr :<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">UnsafeMutablePointer</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&lt;</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(112, 61, 170);">ObjectData</span><span class="" style="font-variant-ligatures: no-common-ligatures;">&gt; = mainPtr.advanced(by:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(39, 42, 216);">1</span><span class="" style="font-variant-ligatures: no-common-ligatures;">).withMemoryRebound(to: ObjectData.</span><span class="" style="font-variant-ligatures: no-common-ligatures; color: rgb(186, 45, 162);">self</span><span class="" style="font-variant-ligatures: no-common-ligatures;">, capacity: objectsToRender) {_ in</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-tab-span" style="white-space: pre;">        </span>}</span></div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div></span></div></span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">There are surely ways to refactor and simplify this, but I’m trying to retain as much of the original sample code approach as possible.</span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;"><br class=""></span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">However, the compiler still segs badly.&nbsp;</span></div><div class=""><span class="" style="font-variant-ligatures: no-common-ligatures;">Xcode also borks an internal error often.&nbsp;</span>Only cleaning or restarting the project can clear up that state.</div><div class="">Compilers (or Playgrounds for that matter) should never crash, and I’m not sure where to file this bug : Swift or Apple radar against Xcode or both? I now Xcode 8 is beta but…it’s been doing this for quite a while now...</div><div class=""><br class=""></div><div class="">In both our “close to the metal” (no pun intended) cases, it seems like a lot of churning for very little gain. Don’t you think? The easier, but “unsafe” casting afforded previously did the trick with the normal caveats.</div><div class="">Don’t get me wrong, I love Swift and “get" all the neat type safety features. Guess we can’t have our cake and eat it too, especially when interfacing with “unsafe” C APIs.</div><div class=""><br class=""></div><div class="">Anyway, back to rtfm … maybe some of the Swift Gods can chime in? &nbsp;;-)&nbsp;</div><div class=""><br class=""></div><div class="">I must be doing something stupid...Patrice</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Sep 3, 2016, at 2:32 AM, Jacob Bandes-Storch &lt;<a href="mailto:jtbandes@gmail.com" class="">jtbandes@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Patrice,<div class="">I don't have a solution for you, but I just wanted to point out what I think may be an error with your use of the new UnsafeRawPointer APIs:</div><div class=""><br class=""></div><div class=""><span class="" style="font-family: menlo; font-size: 11px;">constantBufferForFrame.<wbr class="">contents().bindMemory(to: ShadowPass.</span><span class="" style="font-family: menlo; font-size: 11px; color: rgb(186, 45, 162);">self</span><span class="" style="font-family: menlo; font-size: 11px;">, capacity: MemoryLayout&lt;</span><span class="" style="font-family: menlo; font-size: 11px; color: rgb(112, 61, 170);">ShadowPass</span><span class="" style="font-family: menlo; font-size: 11px;">&gt;.size)</span><br class=""></div><div class=""><br class=""></div><div class="">I believe the `capacity` should actually be the number of ShadowPass elements in the buffer, not the size of each element. Using `bindMemory(to: ShadowPass.self` already implies that MemoryLayout&lt;ShadowPass&gt;.size is the size of each element.</div><div class=""><br class=""></div><div class="">More info at<span class="Apple-converted-space">&nbsp;</span><a href="https://developer.apple.com/reference/swift/unsaferawpointer/2428875-bindmemory" class="">https://developer.apple.com/reference/swift/unsaferawpointer/2428875-bindmemory</a><br class=""></div><div class=""><br class=""></div><div class="">I just updated a small Metal project of mine to Swift 3. I ran into some compiler (playground) crashes, but it does seem to work most of the time. Although I only have 1 buffer :-)<span class="Apple-converted-space">&nbsp;</span><a href="https://github.com/jtbandes/Metalbrot.playground" class="">https://github.com/jtbandes/Metalbrot.playground</a></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature"><div dir="ltr" class=""><div class="">Jacob<br class=""></div></div></div></div><br class=""><div class="gmail_quote">On Fri, Sep 2, 2016 at 11:00 AM, Patrice Kouame via swift-users<span class="Apple-converted-space">&nbsp;</span><span dir="ltr" class="">&lt;<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>&gt;</span><span class="Apple-converted-space">&nbsp;</span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><span class="">Hi all -&nbsp;</span><div class=""><span class=""><br class=""></span></div><div class=""><span class="">I’m converting Apple’s Swift Sample "</span><span class="">Adopting Metal II: Designing and Implementing a Real-World Metal Renderer” in Xcode 8 beta6 to the latest UnsafeMutablePointer API for&nbsp;untyped memory access. &nbsp;</span><div class=""><span class="">Changes are necessary in MetalView.swift (Apple hasn’t updated their sample code for the latest beta yet…)&nbsp;</span></div><div class=""><span class="">The Swift Compiler crashes (Segmentation Fault:&nbsp;</span>11) on the attempt:<div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span class="">// Grab a pointer to the constant buffer's data store</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="">// Since we are using Swift, it is easier to cast the pointer to the ShadowPass type to fill the constant buffer</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="">// We need to make a copy of these so the block captures the correct data</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class=""></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">//&nbsp; &nbsp; &nbsp; let shadowPtr = UnsafeMutablePointer&lt;<wbr class="">ShadowPass&gt;(<wbr class="">constantBufferForFrame.<wbr class="">contents())</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space">&nbsp;</span>shadowPtr = constantBufferForFrame.<wbr class="">contents().bindMemory(to: ShadowPass.</span><span class="" style="color: rgb(186, 45, 162);">self</span><span class="">, capacity: MemoryLayout&lt;</span><span class="" style="color: rgb(112, 61, 170);">ShadowPass</span><span class="">&gt;.size)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; shadowPtr.pointee = shadowPassData[</span><span class="" style="color: rgb(39, 42, 216);">0</span><span class="">]</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class=""></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="">//More Swift specific stuff - advance pointer and cast to MainPass</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class=""></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">//&nbsp; &nbsp; &nbsp; let mainPtr = UnsafeMutablePointer&lt;MainPass&gt;<wbr class="">(shadowPtr.advanced(by: 1))</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">//&nbsp; &nbsp; &nbsp; mainPtr.pointee = mainPassFrameData</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space">&nbsp;</span>mainPtr :<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(112, 61, 170);">UnsafeMutablePointer</span><span class="">&lt;</span><span class="" style="color: rgb(112, 61, 170);">MainPass</span><span class="">&gt;<wbr class="">&nbsp; = shadowPtr.advanced(by:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(39, 42, 216);">1</span><span class="">).withMemoryRebound(to: MainPass.</span><span class="" style="color: rgb(186, 45, 162);">self</span><span class="">, capacity: MemoryLayout&lt;</span><span class="" style="color: rgb(112, 61, 170);">MainPass</span><span class="">&gt;.size) {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $0.pointee = mainPassFrameData</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="">//Advance and cast to ObjectData</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">//&nbsp; &nbsp; &nbsp; var ptr = UnsafeMutablePointer&lt;<wbr class="">ObjectData&gt;(mainPtr.advanced(<wbr class="">by: 1))</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">var</span><span class=""><span class="Apple-converted-space">&nbsp;</span>ptr :<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(112, 61, 170);">UnsafeMutablePointer</span><span class="">&lt;</span><span class="" style="color: rgb(112, 61, 170);">ObjectDat<wbr class="">a</span><span class="">&gt; = mainPtr.advanced(by:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(39, 42, 216);">1</span><span class="">).withMemoryRebound(to: ObjectData.</span><span class="" style="color: rgb(186, 45, 162);">self</span><span class="">, capacity: MemoryLayout&lt;</span><span class="" style="color: rgb(112, 61, 170);">ObjectData</span><span class="">&gt;.size) {</span><span class="" style="color: rgb(186, 45, 162);">_</span><span class=""><span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">in</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class=""></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space">&nbsp;</span>shadowOffset =<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(39, 42, 216);">0</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space">&nbsp;</span>mainPassOffset = MemoryLayout&lt;</span><span class="" style="color: rgb(112, 61, 170);">ShadowPass</span><span class="">&gt;.size + shadowOffset</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space">&nbsp;</span>objectDataOffset = MemoryLayout&lt;</span><span class="" style="color: rgb(112, 61, 170);">MainPass</span><span class="">&gt;.size + mainPassOffset</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class=""></span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; color: rgb(0, 132, 0);"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="">// Update position of all the objects</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">if</span><span class=""><span class="Apple-converted-space">&nbsp;</span>multithreadedUpdate {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DispatchQueue.<wbr class="">concurrentPerform(iterations: objectsToRender) { i<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">in</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">let</span><span class=""><span class="Apple-converted-space">&nbsp;</span>thisPtr = ptr.advanced(by: i)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">_</span><span class=""><span class="Apple-converted-space">&nbsp;</span>=<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">self</span><span class="">.renderables[i].<wbr class="">UpdateData(ptr, deltaTime:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(39, 42, 216);">1.0</span><span class="">/</span><span class="" style="color: rgb(39, 42, 216);">60.0</span><span class="">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">else</span><span class=""><span class="Apple-converted-space">&nbsp;</span>{</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">for</span><span class=""><span class="Apple-converted-space">&nbsp;</span>index<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">in</span><span class=""><span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(39, 42, 216);">0</span><span class="">..&lt;objectsToRender {</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ptr = renderables[index].UpdateData(<wbr class="">ptr, deltaTime:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(39, 42, 216);">1.0</span><span class="">/</span><span class="" style="color: rgb(39, 42, 216);">60.0</span><span class="">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; }</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp; ptr = ptr.advanced(by: objectsToRender)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo; min-height: 13px;"><span class="">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</span><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: menlo;"><span class="">&nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(186, 45, 162);">_</span><span class=""><span class="Apple-converted-space">&nbsp;</span>= groundPlane!.UpdateData(ptr, deltaTime:<span class="Apple-converted-space">&nbsp;</span></span><span class="" style="color: rgb(39, 42, 216);">1.0</span><span class="">/</span><span class="" style="color: rgb(39, 42, 216);">60.0</span><span class="">)</span></div><div class=""><span class=""><br class=""></span></div><div class="">Any help is appreciated.&nbsp; I have the latest Xcode log handy if necessary.&nbsp; Here’s a clip of the stack trace.</div><div class=""><br class=""></div><div class=""><div class="">0 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010714a99d PrintStackTraceSignalHandler(<wbr class="">void*) + 45</div><div class="">1 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010714a3e6 SignalHandler(int) + 470</div><div class="">2 &nbsp;libsystem_platform.dylib 0x00007fff91461bba _sigtramp + 26</div><div class="">3 &nbsp;libsystem_platform.dylib 000000000000000000 _sigtramp + 1857676384</div><div class="">4 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001047207b3 (anonymous namespace)::SILGenApply::<wbr class="">visitExpr(swift::Expr*) + 51</div><div class="">5 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0000000104723ace (anonymous namespace)::SILGenApply::<wbr class="">visitApplyExpr(swift::<wbr class="">ApplyExpr*) + 5182</div><div class="">6 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0000000104711cc1 prepareApplyExpr(swift::<wbr class="">Lowering::SILGenFunction&amp;, swift::Expr*) + 273</div><div class="">7 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001047624e7 swift::ASTVisitor&lt;(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext&gt;::<wbr class="">visit(swift::Expr*, swift::Lowering::SGFContext) + 103</div><div class="">8 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0000000104762313 swift::Lowering::<wbr class="">SILGenFunction::emitExprInto(<wbr class="">swift::Expr*, swift::Lowering::<wbr class="">Initialization*) + 195</div><div class="">9 &nbsp;swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010474fbc3 swift::Lowering::<wbr class="">SILGenFunction::<wbr class="">emitPatternBinding(swift::<wbr class="">PatternBindingDecl*, unsigned int) + 195</div><div class="">10 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001047077bd swift::ASTVisitor&lt;swift::<wbr class="">Lowering::SILGenFunction, void, void, void, void, void, void&gt;::visit(swift::Decl*) + 125</div><div class="">11 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001047c0019 swift::ASTVisitor&lt;(anonymous namespace)::StmtEmitter, void, void, void, void, void, void&gt;::visit(swift::Stmt*) + 4169</div><div class="">12 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001047809ba swift::Lowering::<wbr class="">SILGenFunction::emitFunction(<wbr class="">swift::FuncDecl*) + 314</div><div class="">13 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001046fd775 swift::Lowering::SILGenModule:<wbr class="">:emitFunction(swift::FuncDecl*<wbr class="">)::$_1::operator()(swift::<wbr class="">SILFunction*) const + 1877</div><div class="">14 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001046fc322 swift::Lowering::SILGenModule:<wbr class="">:emitFunction(swift::FuncDecl*<wbr class="">) + 626</div><div class="">15 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001047c7007 (anonymous namespace)::SILGenType::<wbr class="">emitType() + 1271</div><div class="">16 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001047c6a9e swift::Lowering::SILGenModule:<wbr class="">:visitNominalTypeDecl(swift::<wbr class="">NominalTypeDecl*) + 30</div><div class="">17 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x0000000104709093 swift::Lowering::SILGenModule:<wbr class="">:emitSourceFile(swift::<wbr class="">SourceFile*, unsigned int) + 1795</div><div class="">18 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010470ad4d swift::SILModule::<wbr class="">constructSIL(swift::<wbr class="">ModuleDecl*, swift::SILOptions&amp;, swift::FileUnit*, llvm::Optional&lt;unsigned int&gt;, bool, bool) + 1629</div><div class="">19 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00000001045621bf performCompile(swift::<wbr class="">CompilerInstance&amp;, swift::CompilerInvocation&amp;, llvm::ArrayRef&lt;char const*&gt;, int&amp;, swift::FrontendObserver*) + 19487</div><div class="">20 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010455b2c5 swift::performFrontend(llvm::<wbr class="">ArrayRef&lt;char const*&gt;, char const*, void*, swift::FrontendObserver*) + 17029</div><div class="">21 swift &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x000000010451888d main + 8685</div><div class="">22 libdyld.dylib &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x00007fff91255255 start + 1</div></div><span class="gmail-HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Patrice</div><div class=""><span class=""><br class=""></span></div></font></span></div></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-users</a><br class=""><br class=""></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-users mailing list</span><br class=""><span class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a></span><br class=""></div></blockquote></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-users" class="">https://lists.swift.org/mailman/listinfo/swift-users</a></div></blockquote></div></blockquote></div><br class=""></div></body></html>