WebGLTimestampQueryPool.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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"><code>gl</code></td>
  31. <td class="description last"><p>The WebGL context.</p></td>
  32. </tr>
  33. <tr>
  34. <td class="name"><code>type</code></td>
  35. <td class="description last"><p>The type identifier for this query pool.</p></td>
  36. </tr>
  37. <tr>
  38. <td class="name"><code>maxQueries</code></td>
  39. <td class="description last"><p>Maximum number of queries this pool can hold.<br/>Default is <code>2048</code>.</p></td>
  40. </tr>
  41. </tbody>
  42. </table>
  43. </div>
  44. </div>
  45. <h2 class="subsection-title">Methods</h2>
  46. <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>
  47. <div class="method">
  48. <div class="description">
  49. <p>Allocates a pair of queries for a given render context.</p>
  50. </div>
  51. <table class="params">
  52. <tbody>
  53. <tr>
  54. <td class="name"><code>uid</code></td>
  55. <td class="description last"><p>A unique identifier for the render context.</p></td>
  56. </tr>
  57. </tbody>
  58. </table>
  59. <dl class="details">
  60. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TimestampQueryPool.html#allocateQueriesForContext">TimestampQueryPool#allocateQueriesForContext</a></dt>
  61. </dl>
  62. <dl class="details">
  63. <dt class="tag-returns"><strong>Returns:</strong> The base offset for the allocated queries, or null if allocation failed.</dt>
  64. </dl>
  65. </div>
  66. <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>
  67. <div class="method">
  68. <div class="description">
  69. <p>Begins a timestamp query for the specified render context.</p>
  70. </div>
  71. <table class="params">
  72. <tbody>
  73. <tr>
  74. <td class="name"><code>uid</code></td>
  75. <td class="description last"><p>A unique identifier for the render context.</p></td>
  76. </tr>
  77. </tbody>
  78. </table>
  79. </div>
  80. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  81. <div class="method">
  82. <div class="description">
  83. <p>Releases all resources held by this query pool.
  84. This includes deleting all query objects and clearing internal state.</p>
  85. </div>
  86. <dl class="details">
  87. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TimestampQueryPool.html#dispose">TimestampQueryPool#dispose</a></dt>
  88. </dl>
  89. </div>
  90. <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>
  91. <div class="method">
  92. <div class="description">
  93. <p>Ends the active timestamp query for the specified render context.</p>
  94. </div>
  95. <table class="params">
  96. <tbody>
  97. <tr>
  98. <td class="name"><code>uid</code></td>
  99. <td class="description last"><p>A unique identifier for the render context.</p></td>
  100. </tr>
  101. </tbody>
  102. </table>
  103. </div>
  104. <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>
  105. <div class="method">
  106. <div class="description">
  107. <p>Asynchronously resolves all completed queries and returns the total duration.</p>
  108. </div>
  109. <dl class="details">
  110. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="TimestampQueryPool.html#resolveQueriesAsync">TimestampQueryPool#resolveQueriesAsync</a></dt>
  111. </dl>
  112. <dl class="details">
  113. <dt class="tag-returns"><strong>Returns:</strong> The total duration in milliseconds, or the last valid value if resolution fails.</dt>
  114. </dl>
  115. </div>
  116. <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>
  117. <div class="method">
  118. <div class="description">
  119. <p>Resolves a single query, checking for completion and disjoint operation.</p>
  120. </div>
  121. <table class="params">
  122. <tbody>
  123. <tr>
  124. <td class="name"><code>query</code></td>
  125. <td class="description last"><p>The query object to resolve.</p></td>
  126. </tr>
  127. </tbody>
  128. </table>
  129. <dl class="details">
  130. <dt class="tag-returns"><strong>Returns:</strong> The elapsed time in milliseconds.</dt>
  131. </dl>
  132. </div>
  133. <h2 class="subsection-title">Source</h2>
  134. <p>
  135. <a href="https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js" target="_blank" rel="noopener" translate="no">src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js</a>
  136. </p>
  137. </article>
  138. </section>
  139. <script src="../scripts/linenumber.js"></script>
  140. <script src="../scripts/page.js"></script>
  141. </body>
  142. </html>
粤ICP备19079148号