From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- third_party/rust/wgpu-core/src/command/draw.rs | 120 ++++++++++++++++++++++++- 1 file changed, 118 insertions(+), 2 deletions(-) (limited to 'third_party/rust/wgpu-core/src/command/draw.rs') diff --git a/third_party/rust/wgpu-core/src/command/draw.rs b/third_party/rust/wgpu-core/src/command/draw.rs index e03a78ee93..98aa689b78 100644 --- a/third_party/rust/wgpu-core/src/command/draw.rs +++ b/third_party/rust/wgpu-core/src/command/draw.rs @@ -2,17 +2,22 @@ !*/ use crate::{ - binding_model::{LateMinBufferBindingSizeMismatch, PushConstantUploadError}, + binding_model::{BindGroup, LateMinBufferBindingSizeMismatch, PushConstantUploadError}, error::ErrorFormatter, + hal_api::HalApi, id, + pipeline::RenderPipeline, + resource::{Buffer, QuerySet}, track::UsageConflict, validation::{MissingBufferUsageError, MissingTextureUsageError}, }; use wgt::{BufferAddress, BufferSize, Color, VertexStepMode}; -use std::num::NonZeroU32; +use std::{num::NonZeroU32, sync::Arc}; use thiserror::Error; +use super::RenderBundle; + /// Error validating a draw call. #[derive(Clone, Debug, Error, Eq, PartialEq)] #[non_exhaustive] @@ -245,3 +250,114 @@ pub enum RenderCommand { EndPipelineStatisticsQuery, ExecuteBundle(id::RenderBundleId), } + +/// Equivalent to `RenderCommand` with the Ids resolved into resource Arcs. +#[doc(hidden)] +#[derive(Clone, Debug)] +pub enum ArcRenderCommand { + SetBindGroup { + index: u32, + num_dynamic_offsets: usize, + bind_group: Arc>, + }, + SetPipeline(Arc>), + SetIndexBuffer { + buffer: Arc>, + index_format: wgt::IndexFormat, + offset: BufferAddress, + size: Option, + }, + SetVertexBuffer { + slot: u32, + buffer: Arc>, + offset: BufferAddress, + size: Option, + }, + SetBlendConstant(Color), + SetStencilReference(u32), + SetViewport { + rect: Rect, + depth_min: f32, + depth_max: f32, + }, + SetScissor(Rect), + + /// Set a range of push constants to values stored in [`BasePass::push_constant_data`]. + /// + /// See [`wgpu::RenderPass::set_push_constants`] for a detailed explanation + /// of the restrictions these commands must satisfy. + SetPushConstant { + /// Which stages we are setting push constant values for. + stages: wgt::ShaderStages, + + /// The byte offset within the push constant storage to write to. This + /// must be a multiple of four. + offset: u32, + + /// The number of bytes to write. This must be a multiple of four. + size_bytes: u32, + + /// Index in [`BasePass::push_constant_data`] of the start of the data + /// to be written. + /// + /// Note: this is not a byte offset like `offset`. Rather, it is the + /// index of the first `u32` element in `push_constant_data` to read. + /// + /// `None` means zeros should be written to the destination range, and + /// there is no corresponding data in `push_constant_data`. This is used + /// by render bundles, which explicitly clear out any state that + /// post-bundle code might see. + values_offset: Option, + }, + Draw { + vertex_count: u32, + instance_count: u32, + first_vertex: u32, + first_instance: u32, + }, + DrawIndexed { + index_count: u32, + instance_count: u32, + first_index: u32, + base_vertex: i32, + first_instance: u32, + }, + MultiDrawIndirect { + buffer: Arc>, + offset: BufferAddress, + /// Count of `None` represents a non-multi call. + count: Option, + indexed: bool, + }, + MultiDrawIndirectCount { + buffer: Arc>, + offset: BufferAddress, + count_buffer: Arc>, + count_buffer_offset: BufferAddress, + max_count: u32, + indexed: bool, + }, + PushDebugGroup { + color: u32, + len: usize, + }, + PopDebugGroup, + InsertDebugMarker { + color: u32, + len: usize, + }, + WriteTimestamp { + query_set: Arc>, + query_index: u32, + }, + BeginOcclusionQuery { + query_index: u32, + }, + EndOcclusionQuery, + BeginPipelineStatisticsQuery { + query_set: Arc>, + query_index: u32, + }, + EndPipelineStatisticsQuery, + ExecuteBundle(Arc>), +} -- cgit v1.2.3