Skip to content

Commit ec307bc

Browse files
authored
Add more wgpu helpers/types (#19548)
Split off from #19058
1 parent 56f26cf commit ec307bc

File tree

3 files changed

+39
-10
lines changed

3 files changed

+39
-10
lines changed

crates/bevy_render/src/render_resource/bind_group_entries.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ impl<'a> IntoBinding<'a> for &'a TextureView {
147147
}
148148
}
149149

150+
impl<'a> IntoBinding<'a> for &'a wgpu::TextureView {
151+
#[inline]
152+
fn into_binding(self) -> BindingResource<'a> {
153+
BindingResource::TextureView(self)
154+
}
155+
}
156+
150157
impl<'a> IntoBinding<'a> for &'a [&'a wgpu::TextureView] {
151158
#[inline]
152159
fn into_binding(self) -> BindingResource<'a> {
@@ -161,6 +168,13 @@ impl<'a> IntoBinding<'a> for &'a Sampler {
161168
}
162169
}
163170

171+
impl<'a> IntoBinding<'a> for &'a [&'a wgpu::Sampler] {
172+
#[inline]
173+
fn into_binding(self) -> BindingResource<'a> {
174+
BindingResource::SamplerArray(self)
175+
}
176+
}
177+
164178
impl<'a> IntoBinding<'a> for BindingResource<'a> {
165179
#[inline]
166180
fn into_binding(self) -> BindingResource<'a> {
@@ -175,6 +189,13 @@ impl<'a> IntoBinding<'a> for wgpu::BufferBinding<'a> {
175189
}
176190
}
177191

192+
impl<'a> IntoBinding<'a> for &'a [wgpu::BufferBinding<'a>] {
193+
#[inline]
194+
fn into_binding(self) -> BindingResource<'a> {
195+
BindingResource::BufferArray(self)
196+
}
197+
}
198+
178199
pub trait IntoBindingArray<'b, const N: usize> {
179200
fn into_array(self) -> [BindingResource<'b>; N];
180201
}

crates/bevy_render/src/render_resource/bind_group_layout_entries.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,4 +568,8 @@ pub mod binding_types {
568568
}
569569
.into_bind_group_layout_entry_builder()
570570
}
571+
572+
pub fn acceleration_structure() -> BindGroupLayoutEntryBuilder {
573+
BindingType::AccelerationStructure.into_bind_group_layout_entry_builder()
574+
}
571575
}

crates/bevy_render/src/render_resource/mod.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,31 @@ pub use wgpu::{
3838
BufferInitDescriptor, DispatchIndirectArgs, DrawIndexedIndirectArgs, DrawIndirectArgs,
3939
TextureDataOrder,
4040
},
41-
AdapterInfo as WgpuAdapterInfo, AddressMode, AstcBlock, AstcChannel, BindGroupDescriptor,
42-
BindGroupEntry, BindGroupLayoutDescriptor, BindGroupLayoutEntry, BindingResource, BindingType,
41+
AccelerationStructureFlags, AccelerationStructureGeometryFlags,
42+
AccelerationStructureUpdateMode, AdapterInfo as WgpuAdapterInfo, AddressMode, AstcBlock,
43+
AstcChannel, BindGroupDescriptor, BindGroupEntry, BindGroupLayoutDescriptor,
44+
BindGroupLayoutEntry, BindingResource, BindingType, Blas, BlasBuildEntry, BlasGeometries,
45+
BlasGeometrySizeDescriptors, BlasTriangleGeometry, BlasTriangleGeometrySizeDescriptor,
4346
BlendComponent, BlendFactor, BlendOperation, BlendState, BufferAddress, BufferAsyncError,
4447
BufferBinding, BufferBindingType, BufferDescriptor, BufferSize, BufferUsages, ColorTargetState,
4548
ColorWrites, CommandEncoder, CommandEncoderDescriptor, CompareFunction, ComputePass,
4649
ComputePassDescriptor, ComputePipelineDescriptor as RawComputePipelineDescriptor,
47-
DepthBiasState, DepthStencilState, DownlevelFlags, Extent3d, Face, Features as WgpuFeatures,
48-
FilterMode, FragmentState as RawFragmentState, FrontFace, ImageSubresourceRange, IndexFormat,
49-
Limits as WgpuLimits, LoadOp, Maintain, MapMode, MultisampleState, Operations, Origin3d,
50-
PipelineCompilationOptions, PipelineLayout, PipelineLayoutDescriptor, PolygonMode,
51-
PrimitiveState, PrimitiveTopology, PushConstantRange, RenderPassColorAttachment,
52-
RenderPassDepthStencilAttachment, RenderPassDescriptor,
50+
CreateBlasDescriptor, CreateTlasDescriptor, DepthBiasState, DepthStencilState, DownlevelFlags,
51+
Extent3d, Face, Features as WgpuFeatures, FilterMode, FragmentState as RawFragmentState,
52+
FrontFace, ImageSubresourceRange, IndexFormat, Limits as WgpuLimits, LoadOp, Maintain, MapMode,
53+
MultisampleState, Operations, Origin3d, PipelineCompilationOptions, PipelineLayout,
54+
PipelineLayoutDescriptor, PolygonMode, PrimitiveState, PrimitiveTopology, PushConstantRange,
55+
RenderPassColorAttachment, RenderPassDepthStencilAttachment, RenderPassDescriptor,
5356
RenderPipelineDescriptor as RawRenderPipelineDescriptor, Sampler as WgpuSampler,
5457
SamplerBindingType, SamplerBindingType as WgpuSamplerBindingType, SamplerDescriptor,
5558
ShaderModule, ShaderModuleDescriptor, ShaderSource, ShaderStages, StencilFaceState,
5659
StencilOperation, StencilState, StorageTextureAccess, StoreOp, TexelCopyBufferInfo,
5760
TexelCopyBufferLayout, TexelCopyTextureInfo, TextureAspect, TextureDescriptor,
5861
TextureDimension, TextureFormat, TextureFormatFeatureFlags, TextureFormatFeatures,
5962
TextureSampleType, TextureUsages, TextureView as WgpuTextureView, TextureViewDescriptor,
60-
TextureViewDimension, VertexAttribute, VertexBufferLayout as RawVertexBufferLayout,
61-
VertexFormat, VertexState as RawVertexState, VertexStepMode, COPY_BUFFER_ALIGNMENT,
63+
TextureViewDimension, Tlas, TlasInstance, TlasPackage, VertexAttribute,
64+
VertexBufferLayout as RawVertexBufferLayout, VertexFormat, VertexState as RawVertexState,
65+
VertexStepMode, COPY_BUFFER_ALIGNMENT,
6266
};
6367

6468
pub use crate::mesh::VertexBufferLayout;

0 commit comments

Comments
 (0)