remove DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW

This commit is contained in:
teoxoy authored and Teodor Tanasoaia committed 2025-04-15 17:56:17 +02:00
1 parent 597114052e
commit 45d78e2fb4
7 files changed
+6 -79

No files matched your search

+3 -23
View File
@@ -183,32 +183,12 @@ impl Test {
.contains(wgpu::Features::INDIRECT_FIRST_INSTANCE)
|| !is_indirect;
// If this is false, it won't be ignored, but it won't show up in the shader
//
// If the IdSource is buffers, this doesn't apply
let first_vert_instance_supported = ctx.adapter_downlevel_capabilities.flags.contains(
wgpu::DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW,
) || matches!(self.id_source, IdSource::Buffers)
|| !is_indirect;
match self.case {
TestCase::DrawBaseVertex => {
if !first_vert_instance_supported {
return &[0, 1, 2, 3, 4, 5];
}
&[0, 0, 0, 3, 4, 5, 6, 7, 8]
}
TestCase::DrawBaseVertex => &[0, 0, 0, 3, 4, 5, 6, 7, 8],
TestCase::Draw | TestCase::DrawInstanced => &[0, 1, 2, 3, 4, 5],
TestCase::DrawNonZeroFirstVertex => {
if !first_vert_instance_supported {
return &[0, 1, 2, 0, 0, 0];
}
&[0, 1, 2, 3, 4, 5]
}
TestCase::DrawNonZeroFirstVertex => &[0, 1, 2, 3, 4, 5],
TestCase::DrawNonZeroFirstInstance => {
if !first_vert_instance_supported || !non_zero_first_instance_supported {
if !non_zero_first_instance_supported {
return &[0, 1, 2, 0, 0, 0];
}
+1 -4
View File
@@ -500,10 +500,7 @@ impl super::Adapter {
let base = wgt::Limits::default();
let mut downlevel = wgt::DownlevelCapabilities::default();
// https://github.com/gfx-rs/wgpu/issues/2471
downlevel.flags -=
wgt::DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW;
let downlevel = wgt::DownlevelCapabilities::default();
// See https://learn.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels#feature-level-support
let max_color_attachments = 8;
+1 -2
View File
@@ -384,8 +384,7 @@ impl super::Adapter {
let mut downlevel_flags = wgt::DownlevelFlags::empty()
| wgt::DownlevelFlags::NON_POWER_OF_TWO_MIPMAPPED_TEXTURES
| wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES
| wgt::DownlevelFlags::COMPARISON_SAMPLERS
| wgt::DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW;
| wgt::DownlevelFlags::COMPARISON_SAMPLERS;
downlevel_flags.set(wgt::DownlevelFlags::COMPUTE_SHADERS, supports_compute);
downlevel_flags.set(
wgt::DownlevelFlags::FRAGMENT_WRITABLE_STORAGE,
-2
View File
@@ -62,8 +62,6 @@ in shaders, getting buffers and builtins to work correctly is a bit tricky.
We never emulate `base_vertex` and gl_VertexID behaves as `@builtin(vertex_index)` does, so we
never need to do anything about that.
We always advertise support for `VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW`.
### GL 4.2+ with ARB_shader_draw_parameters
- `@builtin(instance_index)` translates to `gl_InstanceID + gl_BaseInstance`
+1 -2
View File
@@ -559,8 +559,7 @@ impl PhysicalDeviceFeatures {
| Df::INDIRECT_EXECUTION
| Df::VIEW_FORMATS
| Df::UNRESTRICTED_EXTERNAL_TEXTURE_COPIES
| Df::NONBLOCKING_QUERY_RESOLVE
| Df::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW;
| Df::NONBLOCKING_QUERY_RESOLVE;
dl_flags.set(
Df::SURFACE_VIEW_FORMATS,
-28
View File
@@ -1079,34 +1079,6 @@ bitflags::bitflags! {
/// Not Supported by:
/// - GL ES / WebGL
const NONBLOCKING_QUERY_RESOLVE = 1 << 22;
/// If this is true, use of `@builtin(vertex_index)` and `@builtin(instance_index)` will properly take into consideration
/// the `first_vertex` and `first_instance` parameters of indirect draw calls.
///
/// If this is false, `@builtin(vertex_index)` and `@builtin(instance_index)` will start by counting from 0, ignoring the
/// `first_vertex` and `first_instance` parameters.
///
/// For example, if you had a draw call like this:
/// - `first_vertex: 4,`
/// - `vertex_count: 12,`
///
/// When this flag is present, `@builtin(vertex_index)` will start at 4 and go up to 15 (12 invocations).
///
/// When this flag is not present, `@builtin(vertex_index)` will start at 0 and go up to 11 (12 invocations).
///
/// This only affects the builtins in the shaders,
/// vertex buffers and instance rate vertex buffers will behave like expected with this flag disabled.
///
/// See also [`Features::`]
///
/// Supported By:
/// - Vulkan
/// - Metal
/// - OpenGL
///
/// Will be implemented in the future by:
/// - DX12 ([#2471](https://github.com/gfx-rs/wgpu/issues/2471))
const VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW = 1 << 23;
}
}
-18
View File
@@ -230,15 +230,6 @@ impl RenderPass<'_> {
///
/// This is like calling [`RenderPass::draw`] but the contents of the call are specified in the `indirect_buffer`.
/// The structure expected in `indirect_buffer` must conform to [`DrawIndirectArgs`](crate::util::DrawIndirectArgs).
///
/// Indirect drawing has some caveats depending on the features available. We are not currently able to validate
/// these and issue an error.
/// - If [`Features::INDIRECT_FIRST_INSTANCE`] is not present on the adapter,
/// [`DrawIndirectArgs::first_instance`](crate::util::DrawIndirectArgs::first_instance) will be ignored.
/// - If [`DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW`] is not present on the adapter,
/// any use of `@builtin(vertex_index)` or `@builtin(instance_index)` in the vertex shader will have different values.
///
/// See details on the individual flags for more information.
pub fn draw_indirect(&mut self, indirect_buffer: &Buffer, indirect_offset: BufferAddress) {
self.inner
.draw_indirect(&indirect_buffer.inner, indirect_offset);
@@ -249,15 +240,6 @@ impl RenderPass<'_> {
///
/// This is like calling [`RenderPass::draw_indexed`] but the contents of the call are specified in the `indirect_buffer`.
/// The structure expected in `indirect_buffer` must conform to [`DrawIndexedIndirectArgs`](crate::util::DrawIndexedIndirectArgs).
///
/// Indirect drawing has some caveats depending on the features available. We are not currently able to validate
/// these and issue an error.
/// - If [`Features::INDIRECT_FIRST_INSTANCE`] is not present on the adapter,
/// [`DrawIndexedIndirectArgs::first_instance`](crate::util::DrawIndexedIndirectArgs::first_instance) will be ignored.
/// - If [`DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW`] is not present on the adapter,
/// any use of `@builtin(vertex_index)` or `@builtin(instance_index)` in the vertex shader will have different values.
///
/// See details on the individual flags for more information.
pub fn draw_indexed_indirect(
&mut self,
indirect_buffer: &Buffer,