mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Rename InputStepMode to VertexStepMode
This commit is contained in:
parent
d1068e915c
commit
1a9a855ea9
@ -7,7 +7,8 @@
|
||||
- `cross` feature is removed entirely. Only Rust code from now on.
|
||||
- processing SPIR-V inputs for later translation now requires `spirv` compile feature enabled
|
||||
- new `Features::SPIRV_SHADER_PASSTHROUGH` run-time feature allows providing pass-through SPIR-V (orthogonal to the compile feature)
|
||||
- Several bitflag names are renamed to plural: `TextureUsage`, `BufferUsage`, `ColorWrite`.
|
||||
- several bitflag names are renamed to plural: `TextureUsage`, `BufferUsage`, `ColorWrite`.
|
||||
- renamed `InputStepMode` to `VertexStepMode`
|
||||
- Fixed:
|
||||
- `Device::create_query_set` would return an error when creating exactly `QUERY_SET_MAX_QUERIES` (8192) queries. Now it only returns an error when trying to create *more* than `QUERY_SET_MAX_QUERIES` queries.
|
||||
|
||||
|
@ -833,7 +833,7 @@ struct VertexState {
|
||||
buffer: Option<id::BufferId>,
|
||||
range: Range<wgt::BufferAddress>,
|
||||
stride: wgt::BufferAddress,
|
||||
rate: wgt::InputStepMode,
|
||||
rate: wgt::VertexStepMode,
|
||||
is_dirty: bool,
|
||||
}
|
||||
|
||||
@ -843,7 +843,7 @@ impl VertexState {
|
||||
buffer: None,
|
||||
range: 0..0,
|
||||
stride: 0,
|
||||
rate: wgt::InputStepMode::Vertex,
|
||||
rate: wgt::VertexStepMode::Vertex,
|
||||
is_dirty: false,
|
||||
}
|
||||
}
|
||||
@ -967,13 +967,13 @@ impl State {
|
||||
}
|
||||
let limit = ((vbs.range.end - vbs.range.start) / vbs.stride) as u32;
|
||||
match vbs.rate {
|
||||
wgt::InputStepMode::Vertex => {
|
||||
wgt::VertexStepMode::Vertex => {
|
||||
if limit < vert_state.vertex_limit {
|
||||
vert_state.vertex_limit = limit;
|
||||
vert_state.vertex_limit_slot = idx as _;
|
||||
}
|
||||
}
|
||||
wgt::InputStepMode::Instance => {
|
||||
wgt::VertexStepMode::Instance => {
|
||||
if limit < vert_state.instance_limit {
|
||||
vert_state.instance_limit = limit;
|
||||
vert_state.instance_limit_slot = idx as _;
|
||||
@ -1013,7 +1013,7 @@ impl State {
|
||||
fn set_pipeline(
|
||||
&mut self,
|
||||
index_format: Option<wgt::IndexFormat>,
|
||||
vertex_strides: &[(wgt::BufferAddress, wgt::InputStepMode)],
|
||||
vertex_strides: &[(wgt::BufferAddress, wgt::VertexStepMode)],
|
||||
layout_ids: &[id::Valid<id::BindGroupLayoutId>],
|
||||
push_constant_layouts: &[wgt::PushConstantRange],
|
||||
) {
|
||||
|
@ -27,7 +27,7 @@ use arrayvec::ArrayVec;
|
||||
use hal::CommandEncoder as _;
|
||||
use thiserror::Error;
|
||||
use wgt::{
|
||||
BufferAddress, BufferSize, BufferUsages, Color, IndexFormat, InputStepMode, TextureUsages,
|
||||
BufferAddress, BufferSize, BufferUsages, Color, IndexFormat, TextureUsages, VertexStepMode,
|
||||
};
|
||||
|
||||
#[cfg(any(feature = "serial-pass", feature = "replay"))]
|
||||
@ -263,7 +263,7 @@ impl IndexState {
|
||||
struct VertexBufferState {
|
||||
total_size: BufferAddress,
|
||||
stride: BufferAddress,
|
||||
rate: InputStepMode,
|
||||
rate: VertexStepMode,
|
||||
bound: bool,
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ impl VertexBufferState {
|
||||
const EMPTY: Self = VertexBufferState {
|
||||
total_size: 0,
|
||||
stride: 0,
|
||||
rate: InputStepMode::Vertex,
|
||||
rate: VertexStepMode::Vertex,
|
||||
bound: false,
|
||||
};
|
||||
}
|
||||
@ -301,13 +301,13 @@ impl VertexState {
|
||||
}
|
||||
let limit = (vbs.total_size / vbs.stride) as u32;
|
||||
match vbs.rate {
|
||||
InputStepMode::Vertex => {
|
||||
VertexStepMode::Vertex => {
|
||||
if limit < self.vertex_limit {
|
||||
self.vertex_limit = limit;
|
||||
self.vertex_limit_slot = idx as _;
|
||||
}
|
||||
}
|
||||
InputStepMode::Instance => {
|
||||
VertexStepMode::Instance => {
|
||||
if limit < self.instance_limit {
|
||||
self.instance_limit = limit;
|
||||
self.instance_limit_slot = idx as _;
|
||||
@ -1084,7 +1084,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
||||
}
|
||||
for vbs in state.vertex.inputs.iter_mut().skip(vertex_strides_len) {
|
||||
vbs.stride = 0;
|
||||
vbs.rate = InputStepMode::Vertex;
|
||||
vbs.rate = VertexStepMode::Vertex;
|
||||
}
|
||||
state.vertex.update_limits();
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ pub struct VertexBufferLayout<'a> {
|
||||
/// The stride, in bytes, between elements of this buffer.
|
||||
pub array_stride: wgt::BufferAddress,
|
||||
/// How often this vertex buffer is "stepped" forward.
|
||||
pub step_mode: wgt::InputStepMode,
|
||||
pub step_mode: wgt::VertexStepMode,
|
||||
/// The list of attributes which comprise a single vertex.
|
||||
pub attributes: Cow<'a, [wgt::VertexAttribute]>,
|
||||
}
|
||||
@ -287,7 +287,7 @@ pub struct RenderPipeline<A: hal::Api> {
|
||||
pub(crate) pass_context: RenderPassContext,
|
||||
pub(crate) flags: PipelineFlags,
|
||||
pub(crate) strip_index_format: Option<wgt::IndexFormat>,
|
||||
pub(crate) vertex_strides: Vec<(wgt::BufferAddress, wgt::InputStepMode)>,
|
||||
pub(crate) vertex_strides: Vec<(wgt::BufferAddress, wgt::VertexStepMode)>,
|
||||
pub(crate) life_guard: LifeGuard,
|
||||
}
|
||||
|
||||
|
@ -1431,10 +1431,10 @@ impl crate::Device<super::Api> for super::Device {
|
||||
{
|
||||
*stride = NonZeroU32::new(vbuf.array_stride as u32);
|
||||
let (slot_class, step_rate) = match vbuf.step_mode {
|
||||
wgt::InputStepMode::Vertex => {
|
||||
wgt::VertexStepMode::Vertex => {
|
||||
(d3d12::D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0)
|
||||
}
|
||||
wgt::InputStepMode::Instance => {
|
||||
wgt::VertexStepMode::Instance => {
|
||||
(d3d12::D3D12_INPUT_CLASSIFICATION_PER_INSTANCE_DATA, 1)
|
||||
}
|
||||
};
|
||||
|
@ -79,8 +79,8 @@ impl super::CommandEncoder {
|
||||
continue;
|
||||
}
|
||||
let instance_offset = match vb_desc.step {
|
||||
wgt::InputStepMode::Vertex => 0,
|
||||
wgt::InputStepMode::Instance => first_instance * vb_desc.stride,
|
||||
wgt::VertexStepMode::Vertex => 0,
|
||||
wgt::VertexStepMode::Instance => first_instance * vb_desc.stride,
|
||||
};
|
||||
self.cmd_buffer.commands.push(C::SetVertexBuffer {
|
||||
index: index as u32,
|
||||
@ -101,7 +101,7 @@ impl super::CommandEncoder {
|
||||
|
||||
let mut attribute_desc = attribute.clone();
|
||||
attribute_desc.offset += buffer.offset as u32;
|
||||
if buffer_desc.step == wgt::InputStepMode::Instance {
|
||||
if buffer_desc.step == wgt::VertexStepMode::Instance {
|
||||
attribute_desc.offset += buffer_desc.stride * first_instance;
|
||||
}
|
||||
|
||||
@ -634,7 +634,7 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
|
||||
.zip(pipeline.vertex_buffers.iter())
|
||||
.enumerate()
|
||||
{
|
||||
if pipe_desc.step == wgt::InputStepMode::Instance {
|
||||
if pipe_desc.step == wgt::VertexStepMode::Instance {
|
||||
self.state.instance_vbuf_mask |= 1 << index;
|
||||
}
|
||||
if state_desc != pipe_desc {
|
||||
|
@ -318,7 +318,7 @@ struct ImageBinding {
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
struct VertexBufferDesc {
|
||||
step: wgt::InputStepMode,
|
||||
step: wgt::VertexStepMode,
|
||||
stride: u32,
|
||||
}
|
||||
|
||||
|
@ -916,7 +916,7 @@ pub struct VertexBufferLayout<'a> {
|
||||
/// The stride, in bytes, between elements of this buffer.
|
||||
pub array_stride: wgt::BufferAddress,
|
||||
/// How often this vertex buffer is "stepped" forward.
|
||||
pub step_mode: wgt::InputStepMode,
|
||||
pub step_mode: wgt::VertexStepMode,
|
||||
/// The list of attributes which comprise a single vertex.
|
||||
pub attributes: &'a [wgt::VertexAttribute],
|
||||
}
|
||||
|
@ -216,10 +216,10 @@ pub fn map_vertex_format(format: wgt::VertexFormat) -> mtl::MTLVertexFormat {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn map_step_mode(mode: wgt::InputStepMode) -> mtl::MTLVertexStepFunction {
|
||||
pub fn map_step_mode(mode: wgt::VertexStepMode) -> mtl::MTLVertexStepFunction {
|
||||
match mode {
|
||||
wgt::InputStepMode::Vertex => mtl::MTLVertexStepFunction::PerVertex,
|
||||
wgt::InputStepMode::Instance => mtl::MTLVertexStepFunction::PerInstance,
|
||||
wgt::VertexStepMode::Vertex => mtl::MTLVertexStepFunction::PerVertex,
|
||||
wgt::VertexStepMode::Instance => mtl::MTLVertexStepFunction::PerInstance,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1143,8 +1143,8 @@ impl crate::Device<super::Api> for super::Device {
|
||||
binding: i as u32,
|
||||
stride: vb.array_stride as u32,
|
||||
input_rate: match vb.step_mode {
|
||||
wgt::InputStepMode::Vertex => vk::VertexInputRate::VERTEX,
|
||||
wgt::InputStepMode::Instance => vk::VertexInputRate::INSTANCE,
|
||||
wgt::VertexStepMode::Vertex => vk::VertexInputRate::VERTEX,
|
||||
wgt::VertexStepMode::Instance => vk::VertexInputRate::INSTANCE,
|
||||
},
|
||||
});
|
||||
for at in vb.attributes {
|
||||
|
@ -2045,16 +2045,16 @@ impl CompareFunction {
|
||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "trace", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
pub enum InputStepMode {
|
||||
/// Input data is advanced every vertex. This is the standard value for vertex data.
|
||||
pub enum VertexStepMode {
|
||||
/// Vertex data is advanced every vertex.
|
||||
Vertex = 0,
|
||||
/// Input data is advanced every instance.
|
||||
/// Vertex data is advanced every instance.
|
||||
Instance = 1,
|
||||
}
|
||||
|
||||
impl Default for InputStepMode {
|
||||
impl Default for VertexStepMode {
|
||||
fn default() -> Self {
|
||||
InputStepMode::Vertex
|
||||
VertexStepMode::Vertex
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,12 +130,12 @@ impl framework::Example for Example {
|
||||
buffers: &[
|
||||
wgpu::VertexBufferLayout {
|
||||
array_stride: 4 * 4,
|
||||
step_mode: wgpu::InputStepMode::Instance,
|
||||
step_mode: wgpu::VertexStepMode::Instance,
|
||||
attributes: &wgpu::vertex_attr_array![0 => Float32x2, 1 => Float32x2],
|
||||
},
|
||||
wgpu::VertexBufferLayout {
|
||||
array_stride: 2 * 4,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &wgpu::vertex_attr_array![2 => Float32x2],
|
||||
},
|
||||
],
|
||||
|
@ -226,7 +226,7 @@ impl framework::Example for Example {
|
||||
|
||||
let vertex_buffers = [wgpu::VertexBufferLayout {
|
||||
array_stride: vertex_size as wgpu::BufferAddress,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &[
|
||||
wgpu::VertexAttribute {
|
||||
format: wgpu::VertexFormat::Float32x4,
|
||||
|
@ -53,7 +53,7 @@ impl Example {
|
||||
entry_point: "vs_main",
|
||||
buffers: &[wgpu::VertexBufferLayout {
|
||||
array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &wgpu::vertex_attr_array![0 => Float32x2, 1 => Float32x4],
|
||||
}],
|
||||
},
|
||||
|
@ -436,7 +436,7 @@ impl framework::Example for Example {
|
||||
let vertex_attr = wgpu::vertex_attr_array![0 => Sint8x4, 1 => Sint8x4];
|
||||
let vb_desc = wgpu::VertexBufferLayout {
|
||||
array_stride: vertex_size as wgpu::BufferAddress,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &vertex_attr,
|
||||
};
|
||||
|
||||
|
@ -235,7 +235,7 @@ impl framework::Example for Skybox {
|
||||
entry_point: "vs_entity",
|
||||
buffers: &[wgpu::VertexBufferLayout {
|
||||
array_stride: std::mem::size_of::<Vertex>() as wgpu::BufferAddress,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &wgpu::vertex_attr_array![0 => Float32x3, 1 => Float32x3],
|
||||
}],
|
||||
},
|
||||
|
@ -235,7 +235,7 @@ impl framework::Example for Example {
|
||||
entry_point: "main",
|
||||
buffers: &[wgpu::VertexBufferLayout {
|
||||
array_stride: vertex_size as wgpu::BufferAddress,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &wgpu::vertex_attr_array![0 => Float32x2, 1 => Float32x2, 2 => Sint32],
|
||||
}],
|
||||
},
|
||||
|
@ -513,7 +513,7 @@ impl framework::Example for Example {
|
||||
// one item, which is itself `repr(C)`.
|
||||
buffers: &[wgpu::VertexBufferLayout {
|
||||
array_stride: water_vertex_size as wgpu::BufferAddress,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &wgpu::vertex_attr_array![0 => Sint16x2, 1 => Sint8x4],
|
||||
}],
|
||||
},
|
||||
@ -576,7 +576,7 @@ impl framework::Example for Example {
|
||||
entry_point: "vs_main",
|
||||
buffers: &[wgpu::VertexBufferLayout {
|
||||
array_stride: terrain_vertex_size as wgpu::BufferAddress,
|
||||
step_mode: wgpu::InputStepMode::Vertex,
|
||||
step_mode: wgpu::VertexStepMode::Vertex,
|
||||
attributes: &wgpu::vertex_attr_array![0 => Float32x3, 1 => Float32x3, 2 => Unorm8x4],
|
||||
}],
|
||||
},
|
||||
|
@ -754,12 +754,12 @@ fn map_vertex_format(format: wgt::VertexFormat) -> web_sys::GpuVertexFormat {
|
||||
}
|
||||
}
|
||||
|
||||
fn map_input_step_mode(mode: wgt::InputStepMode) -> web_sys::GpuInputStepMode {
|
||||
fn map_input_step_mode(mode: wgt::VertexStepMode) -> web_sys::GpuInputStepMode {
|
||||
use web_sys::GpuInputStepMode as sm;
|
||||
use wgt::InputStepMode;
|
||||
use wgt::VertexStepMode;
|
||||
match mode {
|
||||
InputStepMode::Vertex => sm::Vertex,
|
||||
InputStepMode::Instance => sm::Instance,
|
||||
VertexStepMode::Vertex => sm::Vertex,
|
||||
VertexStepMode::Instance => sm::Instance,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,15 +30,15 @@ pub use wgt::{
|
||||
BufferUsages, Color, ColorTargetState, ColorWrites, CommandBufferDescriptor, CompareFunction,
|
||||
DepthBiasState, DepthStencilState, DeviceType, DownlevelCapabilities, DownlevelFlags,
|
||||
DynamicOffset, Extent3d, Face, Features, FilterMode, FrontFace, ImageDataLayout, IndexFormat,
|
||||
InputStepMode, Limits, MultisampleState, Origin3d, PipelineStatisticsTypes, PolygonMode,
|
||||
PowerPreference, PresentMode, PrimitiveState, PrimitiveTopology, PushConstantRange, QueryType,
|
||||
Limits, MultisampleState, Origin3d, PipelineStatisticsTypes, PolygonMode, PowerPreference,
|
||||
PresentMode, PrimitiveState, PrimitiveTopology, PushConstantRange, QueryType,
|
||||
SamplerBorderColor, ShaderLocation, ShaderModel, ShaderStages, StencilFaceState,
|
||||
StencilOperation, StencilState, StorageTextureAccess, SwapChainDescriptor, SwapChainStatus,
|
||||
TextureAspect, TextureDimension, TextureFormat, TextureFormatFeatureFlags,
|
||||
TextureFormatFeatures, TextureSampleType, TextureUsages, TextureViewDimension, VertexAttribute,
|
||||
VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT,
|
||||
MAP_ALIGNMENT, PUSH_CONSTANT_ALIGNMENT, QUERY_SET_MAX_QUERIES, QUERY_SIZE,
|
||||
VERTEX_STRIDE_ALIGNMENT,
|
||||
VertexFormat, VertexStepMode, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT,
|
||||
COPY_BYTES_PER_ROW_ALIGNMENT, MAP_ALIGNMENT, PUSH_CONSTANT_ALIGNMENT, QUERY_SET_MAX_QUERIES,
|
||||
QUERY_SIZE, VERTEX_STRIDE_ALIGNMENT,
|
||||
};
|
||||
|
||||
use backend::{BufferMappedRange, Context as C};
|
||||
@ -1229,7 +1229,7 @@ pub struct VertexBufferLayout<'a> {
|
||||
/// The stride, in bytes, between elements of this buffer.
|
||||
pub array_stride: BufferAddress,
|
||||
/// How often this vertex buffer is "stepped" forward.
|
||||
pub step_mode: InputStepMode,
|
||||
pub step_mode: VertexStepMode,
|
||||
/// The list of attributes which comprise a single vertex.
|
||||
pub attributes: &'a [VertexAttribute],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user