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

64 lines
19 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="A trait to support getting data used for batching draw commands via phase items."><title>GetFullBatchData 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="#">GetFull<wbr>Batch<wbr>Data</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.BufferInputData" title="BufferInputData">BufferInputData</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.get_batch_indirect_parameters_index" title="get_batch_indirect_parameters_index">get_batch_indirect_parameters_index</a></li><li><a href="#tymethod.get_binned_batch_data" title="get_binned_batch_data">get_binned_batch_data</a></li><li><a href="#tymethod.get_binned_index" title="get_binned_index">get_binned_index</a></li><li><a href="#tymethod.get_index_and_compare_data" title="get_index_and_compare_data">get_index_and_compare_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">GetFullBatchData</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#99-151">Source</a> </span></div><pre class="rust item-decl"><code>pub trait GetFullBatchData: <a class="trait" href="trait.GetBatchData.html" title="trait bevy_render::batching::GetBatchData">GetBatchData</a> {
type <a href="#associatedtype.BufferInputData" class="associatedtype">BufferInputData</a>: <a class="trait" href="../../bytemuck/pod/trait.Pod.html" title="trait bytemuck::pod::Pod">Pod</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>;
// Required methods
fn <a href="#tymethod.get_binned_batch_data" class="fn">get_binned_batch_data</a>(
param: &amp;<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a>&lt;'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>&gt;,
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>),
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.BufferData" title="type bevy_render::batching::GetBatchData::BufferData">BufferData</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.get_index_and_compare_data" class="fn">get_index_and_compare_data</a>(
param: &amp;<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a>&lt;'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>&gt;,
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>),
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="struct" href="../../nonmax/struct.NonMaxU32.html" title="struct nonmax::NonMaxU32">NonMaxU32</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>&lt;Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.CompareData" title="type bevy_render::batching::GetBatchData::CompareData">CompareData</a>&gt;)&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.get_binned_index" class="fn">get_binned_index</a>(
param: &amp;<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a>&lt;'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>&gt;,
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>),
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../nonmax/struct.NonMaxU32.html" title="struct nonmax::NonMaxU32">NonMaxU32</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.get_batch_indirect_parameters_index" class="fn">get_batch_indirect_parameters_index</a>(
param: &amp;<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a>&lt;'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>&gt;,
indirect_parameters_buffer: &amp;mut <a class="struct" href="gpu_preprocessing/struct.IndirectParametersBuffer.html" title="struct bevy_render::batching::gpu_preprocessing::IndirectParametersBuffer">IndirectParametersBuffer</a>,
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>),
instance_index: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.u32.html">u32</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../nonmax/struct.NonMaxU32.html" title="struct nonmax::NonMaxU32">NonMaxU32</a>&gt;;
}</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 version allows for binning and GPU preprocessing.</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.BufferInputData" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#102">Source</a><h4 class="code-header">type <a href="#associatedtype.BufferInputData" class="associatedtype">BufferInputData</a>: <a class="trait" href="../../bytemuck/pod/trait.Pod.html" title="trait bytemuck::pod::Pod">Pod</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></h4></section></summary><div class="docblock"><p>The per-instance data that was inserted into the
<a href="../render_resource/struct.BufferVec.html" title="struct bevy_render::render_resource::BufferVec"><code>crate::render_resource::BufferVec</code></a> during extraction.</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_binned_batch_data" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#110-113">Source</a><h4 class="code-header">fn <a href="#tymethod.get_binned_batch_data" class="fn">get_binned_batch_data</a>(
param: &amp;<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a>&lt;'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>&gt;,
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>),
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.BufferData" title="type bevy_render::batching::GetBatchData::BufferData">BufferData</a>&gt;</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>.</p>
<p>This is only called when building uniforms on CPU. In the GPU instance
buffer 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><details class="toggle method-toggle" open><summary><section id="tymethod.get_index_and_compare_data" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#122-125">Source</a><h4 class="code-header">fn <a href="#tymethod.get_index_and_compare_data" class="fn">get_index_and_compare_data</a>(
param: &amp;<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a>&lt;'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>&gt;,
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>),
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;(<a class="struct" href="../../nonmax/struct.NonMaxU32.html" title="struct nonmax::NonMaxU32">NonMaxU32</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>&lt;Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.CompareData" title="type bevy_render::batching::GetBatchData::CompareData">CompareData</a>&gt;)&gt;</h4></section></summary><div class="docblock"><p>Returns the index of the <a href="trait.GetFullBatchData.html#associatedtype.BufferInputData" title="associated type bevy_render::batching::GetFullBatchData::BufferInputData"><code>GetFullBatchData::BufferInputData</code></a> that the
GPU preprocessing phase will use.</p>
<p>We already inserted the <a href="trait.GetFullBatchData.html#associatedtype.BufferInputData" title="associated type bevy_render::batching::GetFullBatchData::BufferInputData"><code>GetFullBatchData::BufferInputData</code></a> during the
extraction phase before we got here, so this function shouldnt need to
look up any render data. If CPU instance buffer building is in use, this
function will never be called.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.get_binned_index" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#134-137">Source</a><h4 class="code-header">fn <a href="#tymethod.get_binned_index" class="fn">get_binned_index</a>(
param: &amp;<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a>&lt;'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>&gt;,
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>),
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../nonmax/struct.NonMaxU32.html" title="struct nonmax::NonMaxU32">NonMaxU32</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the index of the <a href="trait.GetFullBatchData.html#associatedtype.BufferInputData" title="associated type bevy_render::batching::GetFullBatchData::BufferInputData"><code>GetFullBatchData::BufferInputData</code></a> that the
GPU preprocessing phase will use, for the binning path.</p>
<p>We already inserted the <a href="trait.GetFullBatchData.html#associatedtype.BufferInputData" title="associated type bevy_render::batching::GetFullBatchData::BufferInputData"><code>GetFullBatchData::BufferInputData</code></a> during the
extraction phase before we got here, so this function shouldnt need to
look up any render data. If CPU instance buffer building is in use, this
function will never be called.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.get_batch_indirect_parameters_index" class="method"><a class="src rightside" href="../../src/bevy_render/batching/mod.rs.html#145-150">Source</a><h4 class="code-header">fn <a href="#tymethod.get_batch_indirect_parameters_index" class="fn">get_batch_indirect_parameters_index</a>(
param: &amp;<a class="type" href="../../bevy_ecs/system/system_param/type.SystemParamItem.html" title="type bevy_ecs::system::system_param::SystemParamItem">SystemParamItem</a>&lt;'_, '_, Self::<a class="associatedtype" href="trait.GetBatchData.html#associatedtype.Param" title="type bevy_render::batching::GetBatchData::Param">Param</a>&gt;,
indirect_parameters_buffer: &amp;mut <a class="struct" href="gpu_preprocessing/struct.IndirectParametersBuffer.html" title="struct bevy_render::batching::gpu_preprocessing::IndirectParametersBuffer">IndirectParametersBuffer</a>,
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>),
instance_index: <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.u32.html">u32</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../nonmax/struct.NonMaxU32.html" title="struct nonmax::NonMaxU32">NonMaxU32</a>&gt;</h4></section></summary><div class="docblock"><p>Pushes <a href="gpu_preprocessing/struct.IndirectParameters.html" title="struct bevy_render::batching::gpu_preprocessing::IndirectParameters"><code>gpu_preprocessing::IndirectParameters</code></a> necessary to draw this
batch onto the given <a href="gpu_preprocessing/struct.IndirectParametersBuffer.html" title="struct bevy_render::batching::gpu_preprocessing::IndirectParametersBuffer"><code>IndirectParametersBuffer</code></a>, and returns its
index.</p>
<p>This is only used if GPU culling is enabled (which requires GPU
preprocessing).</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.GetFullBatchData.js" async></script></section></div></main></body></html>