1
0

WebGLTimestampQueryPool.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>WebGLTimestampQueryPool - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="TimestampQueryPool.html">TimestampQueryPool</a> → </p>
  13. <h1 translate="no">WebGLTimestampQueryPool</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>Manages a pool of WebGL timestamp queries for performance measurement.
  17. Handles creation, execution, and resolution of timer queries using WebGL extensions.</p></div>
  18. </header>
  19. <article>
  20. <div class="container-overview">
  21. <h2>Constructor</h2>
  22. <h3 class="name name-method" id="WebGLTimestampQueryPool" translate="no">new <a href="#WebGLTimestampQueryPool">WebGLTimestampQueryPool</a><span class="signature">( gl : <span class="param-type">WebGLRenderingContext | WebGL2RenderingContext</span>, type : <span class="param-type">string</span>, maxQueries : <span class="param-type">number</span> )</span> </h3>
  23. <div class="method">
  24. <div class="description">
  25. <p>Creates a new WebGL timestamp query pool.</p>
  26. </div>
  27. <table class="params">
  28. <tbody>
  29. <tr>
  30. <td class="name">
  31. <strong>gl</strong>
  32. </td>
  33. <td class="description last">
  34. <p>The WebGL context.</p>
  35. </td>
  36. </tr>
  37. <tr>
  38. <td class="name">
  39. <strong>type</strong>
  40. </td>
  41. <td class="description last">
  42. <p>The type identifier for this query pool.</p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td class="name">
  47. <strong>maxQueries</strong>
  48. </td>
  49. <td class="description last">
  50. <p>Maximum number of queries this pool can hold.</p>
  51. <p>Default is <code>2048</code>.</p>
  52. </td>
  53. </tr>
  54. </tbody>
  55. </table>
  56. </div>
  57. </div>
  58. <h2 class="subsection-title">Methods</h2>
  59. <h3 class="name name-method" id="allocateQueriesForContext" translate="no">.<a href="#allocateQueriesForContext">allocateQueriesForContext</a><span class="signature">( uid : <span class="param-type">string</span> )</span><span class="type-signature"> : number</span> </h3>
  60. <div class="method">
  61. <div class="description">
  62. <p>Allocates a pair of queries for a given render context.</p>
  63. </div>
  64. <table class="params">
  65. <tbody>
  66. <tr>
  67. <td class="name">
  68. <strong>uid</strong>
  69. </td>
  70. <td class="description last">
  71. <p>A unique identifier for the render context.</p>
  72. </td>
  73. </tr>
  74. </tbody>
  75. </table>
  76. <dl class="details">
  77. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TimestampQueryPool.html#allocateQueriesForContext">TimestampQueryPool#allocateQueriesForContext</a></dt>
  78. </dl>
  79. <dl class="details">
  80. <dt class="tag-returns"><strong>Returns:</strong> The base offset for the allocated queries, or null if allocation failed.</dt>
  81. </dl>
  82. </div>
  83. <h3 class="name name-method" id="beginQuery" translate="no">.<a href="#beginQuery">beginQuery</a><span class="signature">( uid : <span class="param-type">string</span> )</span> </h3>
  84. <div class="method">
  85. <div class="description">
  86. <p>Begins a timestamp query for the specified render context.</p>
  87. </div>
  88. <table class="params">
  89. <tbody>
  90. <tr>
  91. <td class="name">
  92. <strong>uid</strong>
  93. </td>
  94. <td class="description last">
  95. <p>A unique identifier for the render context.</p>
  96. </td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. </div>
  101. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  102. <div class="method">
  103. <div class="description">
  104. <p>Releases all resources held by this query pool.
  105. This includes deleting all query objects and clearing internal state.</p>
  106. </div>
  107. <dl class="details">
  108. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TimestampQueryPool.html#dispose">TimestampQueryPool#dispose</a></dt>
  109. </dl>
  110. </div>
  111. <h3 class="name name-method" id="endQuery" translate="no">.<a href="#endQuery">endQuery</a><span class="signature">( uid : <span class="param-type">string</span> )</span> </h3>
  112. <div class="method">
  113. <div class="description">
  114. <p>Ends the active timestamp query for the specified render context.</p>
  115. </div>
  116. <table class="params">
  117. <tbody>
  118. <tr>
  119. <td class="name">
  120. <strong>uid</strong>
  121. </td>
  122. <td class="description last">
  123. <p>A unique identifier for the render context.</p>
  124. </td>
  125. </tr>
  126. </tbody>
  127. </table>
  128. </div>
  129. <h3 class="name name-method" id="resolveQueriesAsync" translate="no">.<a href="#resolveQueriesAsync">resolveQueriesAsync</a><span class="signature">()</span><span class="type-signature"> : Promise.&lt;number></span> <span class="type-signature">(async) </span></h3>
  130. <div class="method">
  131. <div class="description">
  132. <p>Asynchronously resolves all completed queries and returns the total duration.</p>
  133. </div>
  134. <dl class="details">
  135. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TimestampQueryPool.html#resolveQueriesAsync">TimestampQueryPool#resolveQueriesAsync</a></dt>
  136. </dl>
  137. <dl class="details">
  138. <dt class="tag-returns"><strong>Returns:</strong> The total duration in milliseconds, or the last valid value if resolution fails.</dt>
  139. </dl>
  140. </div>
  141. <h3 class="name name-method" id="resolveQuery" translate="no">.<a href="#resolveQuery">resolveQuery</a><span class="signature">( query : <span class="param-type">WebGLQuery</span> )</span><span class="type-signature"> : Promise.&lt;number></span> <span class="type-signature">(async) </span></h3>
  142. <div class="method">
  143. <div class="description">
  144. <p>Resolves a single query, checking for completion and disjoint operation.</p>
  145. </div>
  146. <table class="params">
  147. <tbody>
  148. <tr>
  149. <td class="name">
  150. <strong>query</strong>
  151. </td>
  152. <td class="description last">
  153. <p>The query object to resolve.</p>
  154. </td>
  155. </tr>
  156. </tbody>
  157. </table>
  158. <dl class="details">
  159. <dt class="tag-returns"><strong>Returns:</strong> The elapsed time in milliseconds.</dt>
  160. </dl>
  161. </div>
  162. <h2 class="subsection-title">Source</h2>
  163. <p>
  164. <a href="https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js" translate="no" target="_blank" rel="noopener">src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js</a>
  165. </p>
  166. </article>
  167. </section>
  168. <script src="../scripts/linenumber.js"></script>
  169. <script src="../scripts/page.js"></script>
  170. </body>
  171. </html>
粤ICP备19079148号