<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
That makes a lot of sense!  </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Couldn't you stop the reordering of events by tracing the pointer calls as they happen, and only defer the data copy? Send the data with some sort of 'fake' trace event that doesn't appear in the trace?</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
But maybe its not worth it if everyone should swear off user arrays anyway <span id="😋" title=":yum:">😋 </span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Josh </div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> José Fonseca <jose.r.fonseca@gmail.com><br>
<b>Sent:</b> April 4, 2019 9:27 AM<br>
<b>To:</b> Josh Simonot<br>
<b>Cc:</b> apitrace@lists.freedesktop.org<br>
<b>Subject:</b> Re: deferred user arrays</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">There's confirmation on <a href="https://github.com/apitrace/apitrace/blob/master/docs/BUGS.markdown#known-issues">
https://github.com/apitrace/apitrace/blob/master/docs/BUGS.markdown#known-issues</a> but not much rationale.<br>
</div>
<div><br>
</div>
<div>The reason is this, when an application does</div>
<div><br>
</div>
<div>   glVertexPointer(4, GL_FLOAT, 0, 0x12345678);</div>
<div><br>
</div>
<div>there's no way to know how large is the array pointed.  It could be anywhere from 0 to 2**32 vertices.  In fact the pointer could be invalid -- OpenGL implementations are not supposed to deference the pointer until a draw happens.</div>
<div><br>
</div>
<div>We could play tricks like intercept malloc calls, inspect the virtual address memory regions, and what not, but these are all best guesses that can easily go wrong.</div>
<div><br>
</div>
<div>Only when a glDraw happens do we know, for example, that's 6 vertices:</div>
<div><br>
</div>
<div>    glDrawArrays(GL_TRIANGLES, 0, 6)</div>
<div><br>
</div>
<div>  That is , 4*4*6 = 96 bytes, if I'm not mistaken.  OpenGL must copy these 96 and only these 96 bytes now.  It must assume the pointed data changed since glVertexPointer call, anbd that it will change again after glDrawArrays.  And this is why user arrays
 are so inefficient.</div>
<div><br>
</div>
<div>Apitrace too, needs to defer all logic about user arrays to the glDraw.  It must not touch those pointers before/after.</div>
<div><br>
</div>
<div>This is admittedly all a bit quirky.  That said, newly written applications should stay away from user arrays and use VBOs, where performance is great, and none of this reordering business is necessary.</div>
<div><br>
</div>
<div>Jose</div>
</div>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Wed, Apr 3, 2019 at 9:40 PM Josh Simonot <<a href="mailto:jsimonot@live.ca">jsimonot@live.ca</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Could someone help me understand why the tracing of user array pointers is deferred?  and can you confirm that this would cause the functions in the trace to be ordered differently than the order my application actually calls them?</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Thanks,</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
</div>
_______________________________________________<br>
apitrace mailing list<br>
<a href="mailto:apitrace@lists.freedesktop.org" target="_blank">apitrace@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/apitrace" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/apitrace</a></blockquote>
</div>
</div>
</div>
</div>
</body>
</html>