Function bevy::render::render_resource::binding_types::storage_buffer
pub fn storage_buffer<T>(
has_dynamic_offset: bool
) -> BindGroupLayoutEntryBuilderwhere
T: ShaderType,
Examples found in repository?
examples/shader/gpu_readback.rs (line 166)
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
fn from_world(world: &mut World) -> Self {
let render_device = world.resource::<RenderDevice>();
let layout = render_device.create_bind_group_layout(
None,
&BindGroupLayoutEntries::single(
ShaderStages::COMPUTE,
storage_buffer::<Vec<u32>>(false),
),
);
let shader = world.load_asset("shaders/gpu_readback.wgsl");
let pipeline_cache = world.resource::<PipelineCache>();
let pipeline = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor {
label: Some("GPU readback compute shader".into()),
layout: vec![layout.clone()],
push_constant_ranges: Vec::new(),
shader: shader.clone(),
shader_defs: Vec::new(),
entry_point: "main".into(),
});
ComputePipeline { layout, pipeline }
}