Files
phy/bevy_render/render_phase/trait.BinnedPhaseItem.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

32 lines
10 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Represents phase items that are placed into bins. The `BinKey` specifies which bin theyre to be placed in. Bin keys are sorted, and items within the same bin are eligible to be batched together. The elements within the bins arent themselves sorted."><title>BinnedPhaseItem in bevy_render::render_phase - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="bevy_render" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="icon" href="https://bevyengine.org/assets/icon.png"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../../bevy_render/index.html"><img src="https://bevyengine.org/assets/icon.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../bevy_render/index.html"><img src="https://bevyengine.org/assets/icon.png" alt="logo"></a><h2><a href="../../bevy_render/index.html">bevy_<wbr>render</a><span class="version">0.15.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Binned<wbr>Phase<wbr>Item</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.BinKey" title="BinKey">BinKey</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.new" title="new">new</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In bevy_<wbr>render::<wbr>render_<wbr>phase</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">bevy_render</a>::<wbr><a href="index.html">render_phase</a></span><h1>Trait <span class="trait">BinnedPhaseItem</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/bevy_render/render_phase/mod.rs.html#1013-1033">Source</a> </span></div><pre class="rust item-decl"><code>pub trait BinnedPhaseItem: <a class="trait" href="trait.PhaseItem.html" title="trait bevy_render::render_phase::PhaseItem">PhaseItem</a> {
type <a href="#associatedtype.BinKey" class="associatedtype">BinKey</a>: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>;
// Required method
fn <a href="#tymethod.new" class="fn">new</a>(
key: Self::<a class="associatedtype" href="trait.BinnedPhaseItem.html#associatedtype.BinKey" title="type bevy_render::render_phase::BinnedPhaseItem::BinKey">BinKey</a>,
representative_entity: (<a class="struct" href="../../bevy_ecs/entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>, <a class="struct" href="../sync_world/struct.MainEntity.html" title="struct bevy_render::sync_world::MainEntity">MainEntity</a>),
batch_range: <a class="struct" href="https://doc.rust-lang.org/1.84.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.u32.html">u32</a>&gt;,
extra_index: <a class="struct" href="struct.PhaseItemExtraIndex.html" title="struct bevy_render::render_phase::PhaseItemExtraIndex">PhaseItemExtraIndex</a>,
) -&gt; Self;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Represents phase items that are placed into bins. The <code>BinKey</code> specifies
which bin theyre to be placed in. Bin keys are sorted, and items within the
same bin are eligible to be batched together. The elements within the bins
arent themselves sorted.</p>
<p>An example of a binned phase item is <code>Opaque3d</code>, for which the rendering
order isnt critical.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.BinKey" class="method"><a class="src rightside" href="../../src/bevy_render/render_phase/mod.rs.html#1020">Source</a><h4 class="code-header">type <a href="#associatedtype.BinKey" class="associatedtype">BinKey</a>: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a></h4></section></summary><div class="docblock"><p>The key used for binning <a href="trait.PhaseItem.html" title="trait bevy_render::render_phase::PhaseItem"><code>PhaseItem</code></a>s into bins. Order the members of
<a href="trait.BinnedPhaseItem.html#associatedtype.BinKey" title="associated type bevy_render::render_phase::BinnedPhaseItem::BinKey"><code>BinnedPhaseItem::BinKey</code></a> by the order of binding for best
performance. For example, pipeline id, draw function id, mesh asset id,
lowest variable bind group id such as the material bind group id, and
its dynamic offsets if any, next bind group and offsets, etc. This
reduces the need for rebinding between bins and improves performance.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.new" class="method"><a class="src rightside" href="../../src/bevy_render/render_phase/mod.rs.html#1027-1032">Source</a><h4 class="code-header">fn <a href="#tymethod.new" class="fn">new</a>(
key: Self::<a class="associatedtype" href="trait.BinnedPhaseItem.html#associatedtype.BinKey" title="type bevy_render::render_phase::BinnedPhaseItem::BinKey">BinKey</a>,
representative_entity: (<a class="struct" href="../../bevy_ecs/entity/struct.Entity.html" title="struct bevy_ecs::entity::Entity">Entity</a>, <a class="struct" href="../sync_world/struct.MainEntity.html" title="struct bevy_render::sync_world::MainEntity">MainEntity</a>),
batch_range: <a class="struct" href="https://doc.rust-lang.org/1.84.0/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.u32.html">u32</a>&gt;,
extra_index: <a class="struct" href="struct.PhaseItemExtraIndex.html" title="struct bevy_render::render_phase::PhaseItemExtraIndex">PhaseItemExtraIndex</a>,
) -&gt; Self</h4></section></summary><div class="docblock"><p>Creates a new binned phase item from the key and per-entity data.</p>
<p>Unlike <a href="trait.SortedPhaseItem.html" title="trait bevy_render::render_phase::SortedPhaseItem"><code>SortedPhaseItem</code></a>s, this is generally called “just in time”
before rendering. The resulting phase item isnt stored in any data
structures, resulting in significant memory savings.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.84.0/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/bevy_render/render_phase/trait.BinnedPhaseItem.js" async></script></section></div></main></body></html>