mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Add INDIRECT_FIRST_INSTANCE feature (#2206)
This commit is contained in:
@@ -170,6 +170,7 @@ impl super::Adapter {
|
||||
|
||||
let mut features = wgt::Features::empty()
|
||||
| wgt::Features::DEPTH_CLIP_CONTROL
|
||||
| wgt::Features::INDIRECT_FIRST_INSTANCE
|
||||
| wgt::Features::MAPPABLE_PRIMARY_BUFFERS
|
||||
//TODO: Naga part
|
||||
//| wgt::Features::TEXTURE_BINDING_ARRAY
|
||||
|
||||
@@ -872,6 +872,7 @@ impl super::PrivateCapabilities {
|
||||
|
||||
let mut features = F::empty()
|
||||
| F::TEXTURE_COMPRESSION_BC
|
||||
| F::INDIRECT_FIRST_INSTANCE
|
||||
| F::MAPPABLE_PRIMARY_BUFFERS
|
||||
| F::VERTEX_WRITABLE_STORAGE
|
||||
| F::TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES
|
||||
|
||||
@@ -104,6 +104,9 @@ impl PhysicalDeviceFeatures {
|
||||
.image_cube_array(
|
||||
downlevel_flags.contains(wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES),
|
||||
)
|
||||
.draw_indirect_first_instance(
|
||||
requested_features.contains(wgt::Features::INDIRECT_FIRST_INSTANCE),
|
||||
)
|
||||
//.dual_src_blend(requested_features.contains(wgt::Features::DUAL_SRC_BLENDING))
|
||||
.multi_draw_indirect(
|
||||
requested_features.contains(wgt::Features::MULTI_DRAW_INDIRECT),
|
||||
@@ -339,6 +342,10 @@ impl PhysicalDeviceFeatures {
|
||||
self.core.fragment_stores_and_atomics != 0,
|
||||
);
|
||||
|
||||
features.set(
|
||||
F::INDIRECT_FIRST_INSTANCE,
|
||||
self.core.draw_indirect_first_instance != 0,
|
||||
);
|
||||
//if self.core.dual_src_blend != 0
|
||||
features.set(F::MULTI_DRAW_INDIRECT, self.core.multi_draw_indirect != 0);
|
||||
features.set(F::POLYGON_MODE_LINE, self.core.fill_mode_non_solid != 0);
|
||||
|
||||
@@ -189,6 +189,15 @@ bitflags::bitflags! {
|
||||
///
|
||||
/// This is a web and native feature.
|
||||
const TEXTURE_COMPRESSION_BC = 1 << 1;
|
||||
/// Allows non-zero value for the "first instance" in indirect draw calls.
|
||||
///
|
||||
/// Supported Platforms:
|
||||
/// - Vulkan (mostly)
|
||||
/// - DX12
|
||||
/// - Metal
|
||||
///
|
||||
/// This is a web and native feature.
|
||||
const INDIRECT_FIRST_INSTANCE = 1 << 2;
|
||||
/// Enables use of Timestamp Queries. These queries tell the current gpu timestamp when
|
||||
/// all work before the query is finished. Call [`CommandEncoder::write_timestamp`],
|
||||
/// [`RenderPassEncoder::write_timestamp`], or [`ComputePassEncoder::write_timestamp`] to
|
||||
@@ -206,7 +215,7 @@ bitflags::bitflags! {
|
||||
/// - DX12 (works)
|
||||
///
|
||||
/// This is a web and native feature.
|
||||
const TIMESTAMP_QUERY = 1 << 2;
|
||||
const TIMESTAMP_QUERY = 1 << 3;
|
||||
/// Enables use of Pipeline Statistics Queries. These queries tell the count of various operations
|
||||
/// performed between the start and stop call. Call [`RenderPassEncoder::begin_pipeline_statistics_query`] to start
|
||||
/// a query, then call [`RenderPassEncoder::end_pipeline_statistics_query`] to stop one.
|
||||
@@ -221,7 +230,7 @@ bitflags::bitflags! {
|
||||
/// - DX12 (works)
|
||||
///
|
||||
/// This is a web and native feature.
|
||||
const PIPELINE_STATISTICS_QUERY = 1 << 3;
|
||||
const PIPELINE_STATISTICS_QUERY = 1 << 4;
|
||||
/// Webgpu only allows the MAP_READ and MAP_WRITE buffer usage to be matched with
|
||||
/// COPY_DST and COPY_SRC respectively. This removes this requirement.
|
||||
///
|
||||
|
||||
@@ -2591,8 +2591,9 @@ impl<'a> RenderPass<'a> {
|
||||
/// struct DrawIndirect {
|
||||
/// vertex_count: u32, // The number of vertices to draw.
|
||||
/// instance_count: u32, // The number of instances to draw.
|
||||
/// base_vertex: u32, // The Index of the first vertex to draw.
|
||||
/// base_instance: u32, // The instance ID of the first instance to draw.
|
||||
/// first_vertex: u32, // The Index of the first vertex to draw.
|
||||
/// first_instance: u32, // The instance ID of the first instance to draw.
|
||||
/// // has to be 0, unless [`Features::INDIRECT_FIRST_INSTANCE`] is enabled.
|
||||
/// }
|
||||
/// ```
|
||||
pub fn draw_indirect(&mut self, indirect_buffer: &'a Buffer, indirect_offset: BufferAddress) {
|
||||
@@ -2612,9 +2613,10 @@ impl<'a> RenderPass<'a> {
|
||||
/// struct DrawIndexedIndirect {
|
||||
/// vertex_count: u32, // The number of vertices to draw.
|
||||
/// instance_count: u32, // The number of instances to draw.
|
||||
/// base_index: u32, // The base index within the index buffer.
|
||||
/// first_index: u32, // The base index within the index buffer.
|
||||
/// vertex_offset: i32, // The value added to the vertex index before indexing into the vertex buffer.
|
||||
/// base_instance: u32, // The instance ID of the first instance to draw.
|
||||
/// first_instance: u32, // The instance ID of the first instance to draw.
|
||||
/// // has to be 0, unless [`Features::INDIRECT_FIRST_INSTANCE`] is enabled.
|
||||
/// }
|
||||
/// ```
|
||||
pub fn draw_indexed_indirect(
|
||||
|
||||
Reference in New Issue
Block a user