34 lines
12 KiB
HTML
34 lines
12 KiB
HTML
<!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="A trait to support getting data used for batching draw commands via phase items."><title>GetBatchData in bevy_render::batching - 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="#">GetBatch<wbr>Data</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.BufferData" title="BufferData">BufferData</a></li><li><a href="#associatedtype.CompareData" title="CompareData">CompareData</a></li><li><a href="#associatedtype.Param" title="Param">Param</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.get_batch_data" title="get_batch_data">get_batch_data</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>batching</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">batching</a></span><h1>Trait <span class="trait">GetBatchData</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/batching/mod.rs.html#69-93">Source</a> </span></div><pre class="rust item-decl"><code>pub trait GetBatchData {
|
|
type <a href="#associatedtype.Param" class="associatedtype">Param</a>: <a class="trait" href="../../bevy_ecs/system/system_param/trait.SystemParam.html" title="trait bevy_ecs::system::system_param::SystemParam">SystemParam</a> + 'static;
|
|
type <a href="#associatedtype.CompareData" class="associatedtype">CompareData</a>: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>;
|
|
type <a href="#associatedtype.BufferData" class="associatedtype">BufferData</a>: <a class="trait" href="../render_resource/trait.GpuArrayBufferable.html" title="trait bevy_render::render_resource::GpuArrayBufferable">GpuArrayBufferable</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/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static;
|
|
|
|
// Required method
|
|
fn <a href="#tymethod.get_batch_data" class="fn">get_batch_data</a>(
|
|
param: &<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a><'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>>,
|
|
query_item: (<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>),
|
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.BufferData" title="type bevy_render::batching::GetBatchData::BufferData">BufferData</a>, <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.CompareData" title="type bevy_render::batching::GetBatchData::CompareData">CompareData</a>>)>;
|
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A trait to support getting data used for batching draw commands via phase
|
|
items.</p>
|
|
<p>This is a simple version that only allows for sorting, not binning, as well
|
|
as only CPU processing, not GPU preprocessing. For these fancier features,
|
|
see <a href="trait.GetFullBatchData.html" title="trait bevy_render::batching::GetFullBatchData"><code>GetFullBatchData</code></a>.</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.Param" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#72">Source</a><h4 class="code-header">type <a href="#associatedtype.Param" class="associatedtype">Param</a>: <a class="trait" href="../../bevy_ecs/system/system_param/trait.SystemParam.html" title="trait bevy_ecs::system::system_param::SystemParam">SystemParam</a> + 'static</h4></section></summary><div class="docblock"><p>The system parameters <a href="trait.GetBatchData.html#tymethod.get_batch_data" title="associated function bevy_render::batching::GetBatchData::get_batch_data"><code>GetBatchData::get_batch_data</code></a> needs in
|
|
order to compute the batch data.</p>
|
|
</div></details><details class="toggle" open><summary><section id="associatedtype.CompareData" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#76">Source</a><h4 class="code-header">type <a href="#associatedtype.CompareData" class="associatedtype">CompareData</a>: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a></h4></section></summary><div class="docblock"><p>Data used for comparison between phase items. If the pipeline id, draw
|
|
function id, per-instance data buffer dynamic offset and this data
|
|
matches, the draws can be batched.</p>
|
|
</div></details><details class="toggle" open><summary><section id="associatedtype.BufferData" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#80">Source</a><h4 class="code-header">type <a href="#associatedtype.BufferData" class="associatedtype">BufferData</a>: <a class="trait" href="../render_resource/trait.GpuArrayBufferable.html" title="trait bevy_render::render_resource::GpuArrayBufferable">GpuArrayBufferable</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/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + 'static</h4></section></summary><div class="docblock"><p>The per-instance data to be inserted into the
|
|
<a href="../render_resource/enum.GpuArrayBuffer.html" title="enum bevy_render::render_resource::GpuArrayBuffer"><code>crate::render_resource::GpuArrayBuffer</code></a> containing these data for all
|
|
instances.</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.get_batch_data" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#89-92">Source</a><h4 class="code-header">fn <a href="#tymethod.get_batch_data" class="fn">get_batch_data</a>(
|
|
param: &<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a><'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>>,
|
|
query_item: (<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>),
|
|
) -> <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><(Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.BufferData" title="type bevy_render::batching::GetBatchData::BufferData">BufferData</a>, <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.CompareData" title="type bevy_render::batching::GetBatchData::CompareData">CompareData</a>>)></h4></section></summary><div class="docblock"><p>Get the per-instance data to be inserted into the
|
|
<a href="../render_resource/enum.GpuArrayBuffer.html" title="enum bevy_render::render_resource::GpuArrayBuffer"><code>crate::render_resource::GpuArrayBuffer</code></a>. If the instance can be
|
|
batched, also return the data used for comparison when deciding whether
|
|
draws can be batched, else return None for the <code>CompareData</code>.</p>
|
|
<p>This is only called when building instance data on CPU. In the GPU
|
|
instance data building path, we use
|
|
<a href="trait.GetFullBatchData.html#tymethod.get_index_and_compare_data" title="associated function bevy_render::batching::GetFullBatchData::get_index_and_compare_data"><code>GetFullBatchData::get_index_and_compare_data</code></a> instead.</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/batching/trait.GetBatchData.js" async></script></section></div></main></body></html> |