mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Update Repo MSRV to 1.91 (#8678)
This commit is contained in:
parent
40b2d3041b
commit
a356cb2026
@ -1,4 +1,4 @@
|
|||||||
use std::{borrow::Cow, future::Future, iter, mem, pin::Pin, task};
|
use std::{borrow::Cow, iter, mem};
|
||||||
|
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use glam::{Affine3A, Mat4, Quat, Vec3};
|
use glam::{Affine3A, Mat4, Quat, Vec3};
|
||||||
@ -98,28 +98,6 @@ fn affine_to_rows(mat: &Affine3A) -> [f32; 12] {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
|
|
||||||
///
|
|
||||||
/// Given a future `inner` of an `Option<E>` for some error type `E`,
|
|
||||||
/// wait for the future to be ready, and panic if its value is `Some`.
|
|
||||||
///
|
|
||||||
/// This can be done simpler with `FutureExt`, but we don't want to add
|
|
||||||
/// a dependency just for this small case.
|
|
||||||
struct ErrorFuture<F> {
|
|
||||||
inner: F,
|
|
||||||
}
|
|
||||||
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
|
|
||||||
type Output = ();
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
|
|
||||||
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
|
|
||||||
inner.poll(cx).map(|error| {
|
|
||||||
if let Some(e) = error {
|
|
||||||
panic!("Rendering {e}");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Example {
|
struct Example {
|
||||||
rt_target: wgpu::Texture,
|
rt_target: wgpu::Texture,
|
||||||
#[expect(dead_code)]
|
#[expect(dead_code)]
|
||||||
|
|||||||
@ -2,7 +2,7 @@ use crate::utils;
|
|||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use glam::{Mat4, Quat, Vec3};
|
use glam::{Mat4, Quat, Vec3};
|
||||||
use std::ops::IndexMut;
|
use std::ops::IndexMut;
|
||||||
use std::{borrow::Cow, future::Future, iter, mem, pin::Pin, task};
|
use std::{borrow::Cow, iter, mem};
|
||||||
use wgpu::util::DeviceExt;
|
use wgpu::util::DeviceExt;
|
||||||
|
|
||||||
// from cube
|
// from cube
|
||||||
@ -73,28 +73,6 @@ struct Uniforms {
|
|||||||
proj_inverse: Mat4,
|
proj_inverse: Mat4,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
|
|
||||||
///
|
|
||||||
/// Given a future `inner` of an `Option<E>` for some error type `E`,
|
|
||||||
/// wait for the future to be ready, and panic if its value is `Some`.
|
|
||||||
///
|
|
||||||
/// This can be done simpler with `FutureExt`, but we don't want to add
|
|
||||||
/// a dependency just for this small case.
|
|
||||||
struct ErrorFuture<F> {
|
|
||||||
inner: F,
|
|
||||||
}
|
|
||||||
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
|
|
||||||
type Output = ();
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
|
|
||||||
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
|
|
||||||
inner.poll(cx).map(|error| {
|
|
||||||
if let Some(e) = error {
|
|
||||||
panic!("Rendering {e}");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Example {
|
struct Example {
|
||||||
uniforms: Uniforms,
|
uniforms: Uniforms,
|
||||||
uniform_buf: wgpu::Buffer,
|
uniform_buf: wgpu::Buffer,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use std::{borrow::Cow, future::Future, iter, mem, pin::Pin, task};
|
use std::{borrow::Cow, iter, mem};
|
||||||
|
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use glam::{Affine3A, Mat4, Quat, Vec3};
|
use glam::{Affine3A, Mat4, Quat, Vec3};
|
||||||
@ -97,28 +97,6 @@ fn affine_to_rows(mat: &Affine3A) -> [f32; 12] {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
|
|
||||||
///
|
|
||||||
/// Given a future `inner` of an `Option<E>` for some error type `E`,
|
|
||||||
/// wait for the future to be ready, and panic if its value is `Some`.
|
|
||||||
///
|
|
||||||
/// This can be done simpler with `FutureExt`, but we don't want to add
|
|
||||||
/// a dependency just for this small case.
|
|
||||||
struct ErrorFuture<F> {
|
|
||||||
inner: F,
|
|
||||||
}
|
|
||||||
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
|
|
||||||
type Output = ();
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
|
|
||||||
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
|
|
||||||
inner.poll(cx).map(|error| {
|
|
||||||
if let Some(e) = error {
|
|
||||||
panic!("Rendering {e}");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Example {
|
struct Example {
|
||||||
rt_target: wgpu::Texture,
|
rt_target: wgpu::Texture,
|
||||||
tlas: wgpu::Tlas,
|
tlas: wgpu::Tlas,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use bytemuck::{Pod, Zeroable};
|
|||||||
use glam::{Mat4, Quat, Vec3};
|
use glam::{Mat4, Quat, Vec3};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use std::ops::IndexMut;
|
use std::ops::IndexMut;
|
||||||
use std::{borrow::Cow, future::Future, iter, mem, ops::Range, pin::Pin, task};
|
use std::{borrow::Cow, iter, mem, ops::Range};
|
||||||
use wgpu::util::DeviceExt;
|
use wgpu::util::DeviceExt;
|
||||||
|
|
||||||
// from cube
|
// from cube
|
||||||
@ -25,28 +25,6 @@ struct Uniforms {
|
|||||||
proj_inverse: Mat4,
|
proj_inverse: Mat4,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
|
|
||||||
///
|
|
||||||
/// Given a future `inner` of an `Option<E>` for some error type `E`,
|
|
||||||
/// wait for the future to be ready, and panic if its value is `Some`.
|
|
||||||
///
|
|
||||||
/// This can be done simpler with `FutureExt`, but we don't want to add
|
|
||||||
/// a dependency just for this small case.
|
|
||||||
struct ErrorFuture<F> {
|
|
||||||
inner: F,
|
|
||||||
}
|
|
||||||
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
|
|
||||||
type Output = ();
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
|
|
||||||
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
|
|
||||||
inner.poll(cx).map(|error| {
|
|
||||||
if let Some(e) = error {
|
|
||||||
panic!("Rendering {e}");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
struct RawSceneComponents {
|
struct RawSceneComponents {
|
||||||
vertices: Vec<Vertex>,
|
vertices: Vec<Vertex>,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
use std::{borrow::Cow, future::Future, iter, mem, pin::Pin, task};
|
use std::{borrow::Cow, iter, mem};
|
||||||
|
|
||||||
use bytemuck::{Pod, Zeroable};
|
use bytemuck::{Pod, Zeroable};
|
||||||
use glam::{Mat4, Vec3};
|
use glam::{Mat4, Vec3};
|
||||||
@ -52,28 +52,6 @@ struct Uniforms {
|
|||||||
vertex: Mat4,
|
vertex: Mat4,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A wrapper for `pop_error_scope` futures that panics if an error occurs.
|
|
||||||
///
|
|
||||||
/// Given a future `inner` of an `Option<E>` for some error type `E`,
|
|
||||||
/// wait for the future to be ready, and panic if its value is `Some`.
|
|
||||||
///
|
|
||||||
/// This can be done simpler with `FutureExt`, but we don't want to add
|
|
||||||
/// a dependency just for this small case.
|
|
||||||
struct ErrorFuture<F> {
|
|
||||||
inner: F,
|
|
||||||
}
|
|
||||||
impl<F: Future<Output = Option<wgpu::Error>>> Future for ErrorFuture<F> {
|
|
||||||
type Output = ();
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> task::Poll<()> {
|
|
||||||
let inner = unsafe { self.map_unchecked_mut(|me| &mut me.inner) };
|
|
||||||
inner.poll(cx).map(|error| {
|
|
||||||
if let Some(e) = error {
|
|
||||||
panic!("Rendering {e}");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Example {
|
struct Example {
|
||||||
uniforms: Uniforms,
|
uniforms: Uniforms,
|
||||||
uniform_buf: wgpu::Buffer,
|
uniform_buf: wgpu::Buffer,
|
||||||
|
|||||||
@ -494,7 +494,7 @@ impl crate::framework::Example for Example {
|
|||||||
module: &shader,
|
module: &shader,
|
||||||
entry_point: Some("vs_bake"),
|
entry_point: Some("vs_bake"),
|
||||||
compilation_options: Default::default(),
|
compilation_options: Default::default(),
|
||||||
buffers: &[vb_desc.clone()],
|
buffers: std::slice::from_ref(&vb_desc),
|
||||||
},
|
},
|
||||||
fragment: None,
|
fragment: None,
|
||||||
primitive: wgpu::PrimitiveState {
|
primitive: wgpu::PrimitiveState {
|
||||||
|
|||||||
@ -215,6 +215,10 @@ impl FunctionCtx<'_> {
|
|||||||
external_texture_key,
|
external_texture_key,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// This is a const function, which _sometimes_ gets called,
|
||||||
|
// so this lint is _sometimes_ triggered, depending on feature set.
|
||||||
|
#[expect(clippy::allow_attributes)]
|
||||||
|
#[allow(clippy::panic)]
|
||||||
FunctionType::EntryPoint(_) => {
|
FunctionType::EntryPoint(_) => {
|
||||||
panic!("External textures cannot be used as arguments to entry points")
|
panic!("External textures cannot be used as arguments to entry points")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,20 +5,15 @@ use serde::Deserialize;
|
|||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Default, Debug, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||||
pub enum Coord {
|
pub enum Coord {
|
||||||
|
#[default]
|
||||||
Normalized,
|
Normalized,
|
||||||
Pixel,
|
Pixel,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Coord {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Normalized
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Coord {
|
impl Coord {
|
||||||
pub const fn as_str(&self) -> &'static str {
|
pub const fn as_str(&self) -> &'static str {
|
||||||
match *self {
|
match *self {
|
||||||
@ -28,23 +23,18 @@ impl Coord {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||||
pub enum Address {
|
pub enum Address {
|
||||||
Repeat,
|
Repeat,
|
||||||
MirroredRepeat,
|
MirroredRepeat,
|
||||||
|
#[default]
|
||||||
ClampToEdge,
|
ClampToEdge,
|
||||||
ClampToZero,
|
ClampToZero,
|
||||||
ClampToBorder,
|
ClampToBorder,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Address {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::ClampToEdge
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Address {
|
impl Address {
|
||||||
pub const fn as_str(&self) -> &'static str {
|
pub const fn as_str(&self) -> &'static str {
|
||||||
match *self {
|
match *self {
|
||||||
@ -57,21 +47,16 @@ impl Address {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||||
pub enum BorderColor {
|
pub enum BorderColor {
|
||||||
|
#[default]
|
||||||
TransparentBlack,
|
TransparentBlack,
|
||||||
OpaqueBlack,
|
OpaqueBlack,
|
||||||
OpaqueWhite,
|
OpaqueWhite,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BorderColor {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::TransparentBlack
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BorderColor {
|
impl BorderColor {
|
||||||
pub const fn as_str(&self) -> &'static str {
|
pub const fn as_str(&self) -> &'static str {
|
||||||
match *self {
|
match *self {
|
||||||
@ -82,10 +67,11 @@ impl BorderColor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||||
pub enum Filter {
|
pub enum Filter {
|
||||||
|
#[default]
|
||||||
Nearest,
|
Nearest,
|
||||||
Linear,
|
Linear,
|
||||||
}
|
}
|
||||||
@ -99,16 +85,11 @@ impl Filter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Filter {
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
fn default() -> Self {
|
|
||||||
Self::Nearest
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
|
||||||
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
#[cfg_attr(feature = "serialize", derive(Serialize))]
|
||||||
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
#[cfg_attr(feature = "deserialize", derive(Deserialize))]
|
||||||
pub enum CompareFunc {
|
pub enum CompareFunc {
|
||||||
|
#[default]
|
||||||
Never,
|
Never,
|
||||||
Less,
|
Less,
|
||||||
LessEqual,
|
LessEqual,
|
||||||
@ -119,12 +100,6 @@ pub enum CompareFunc {
|
|||||||
Always,
|
Always,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CompareFunc {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Never
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CompareFunc {
|
impl CompareFunc {
|
||||||
pub const fn as_str(&self) -> &'static str {
|
pub const fn as_str(&self) -> &'static str {
|
||||||
match *self {
|
match *self {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ pub(super) fn string_to_byte_chunks(input: &str, limit: usize) -> Vec<&[u8]> {
|
|||||||
let mut start: usize = 0;
|
let mut start: usize = 0;
|
||||||
let mut words = vec![];
|
let mut words = vec![];
|
||||||
while offset < input.len() {
|
while offset < input.len() {
|
||||||
offset = input.floor_char_boundary(offset + limit);
|
offset = input.floor_char_boundary_polyfill(offset + limit);
|
||||||
// Clippy wants us to call as_bytes() first to avoid the UTF-8 check,
|
// Clippy wants us to call as_bytes() first to avoid the UTF-8 check,
|
||||||
// but we want to assert the output is valid UTF-8.
|
// but we want to assert the output is valid UTF-8.
|
||||||
#[allow(clippy::sliced_string_as_bytes)]
|
#[allow(clippy::sliced_string_as_bytes)]
|
||||||
@ -123,30 +123,31 @@ pub fn global_needs_wrapper(ir_module: &crate::Module, var: &crate::GlobalVariab
|
|||||||
}
|
}
|
||||||
|
|
||||||
///HACK: this is taken from std unstable, remove it when std's floor_char_boundary is stable
|
///HACK: this is taken from std unstable, remove it when std's floor_char_boundary is stable
|
||||||
|
/// and available in our msrv.
|
||||||
trait U8Internal {
|
trait U8Internal {
|
||||||
fn is_utf8_char_boundary(&self) -> bool;
|
fn is_utf8_char_boundary_polyfill(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl U8Internal for u8 {
|
impl U8Internal for u8 {
|
||||||
fn is_utf8_char_boundary(&self) -> bool {
|
fn is_utf8_char_boundary_polyfill(&self) -> bool {
|
||||||
// This is bit magic equivalent to: b < 128 || b >= 192
|
// This is bit magic equivalent to: b < 128 || b >= 192
|
||||||
(*self as i8) >= -0x40
|
(*self as i8) >= -0x40
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait StrUnstable {
|
trait StrUnstable {
|
||||||
fn floor_char_boundary(&self, index: usize) -> usize;
|
fn floor_char_boundary_polyfill(&self, index: usize) -> usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StrUnstable for str {
|
impl StrUnstable for str {
|
||||||
fn floor_char_boundary(&self, index: usize) -> usize {
|
fn floor_char_boundary_polyfill(&self, index: usize) -> usize {
|
||||||
if index >= self.len() {
|
if index >= self.len() {
|
||||||
self.len()
|
self.len()
|
||||||
} else {
|
} else {
|
||||||
let lower_bound = index.saturating_sub(3);
|
let lower_bound = index.saturating_sub(3);
|
||||||
let new_index = self.as_bytes()[lower_bound..=index]
|
let new_index = self.as_bytes()[lower_bound..=index]
|
||||||
.iter()
|
.iter()
|
||||||
.rposition(|b| b.is_utf8_char_boundary());
|
.rposition(|b| b.is_utf8_char_boundary_polyfill());
|
||||||
|
|
||||||
// SAFETY: we know that the character boundary will be within four bytes
|
// SAFETY: we know that the character boundary will be within four bytes
|
||||||
unsafe { lower_bound + new_index.unwrap_unchecked() }
|
unsafe { lower_bound + new_index.unwrap_unchecked() }
|
||||||
|
|||||||
@ -162,6 +162,10 @@ impl crate::proc::overloads::OverloadSet for List {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const fn len_to_full_mask(n: usize) -> u64 {
|
const fn len_to_full_mask(n: usize) -> u64 {
|
||||||
|
// This is a const function, which _sometimes_ gets called,
|
||||||
|
// so this lint is _sometimes_ triggered, depending on feature set.
|
||||||
|
#[expect(clippy::allow_attributes)]
|
||||||
|
#[allow(clippy::panic)]
|
||||||
if n >= 64 {
|
if n >= 64 {
|
||||||
panic!("List::rules can only hold up to 63 rules");
|
panic!("List::rules can only hold up to 63 rules");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -252,7 +252,7 @@ impl Player {
|
|||||||
let spirv = data.iter().find_map(|a| {
|
let spirv = data.iter().find_map(|a| {
|
||||||
if a.ends_with(".spv") {
|
if a.ends_with(".spv") {
|
||||||
let data = fs::read(dir.join(a)).unwrap();
|
let data = fs::read(dir.join(a)).unwrap();
|
||||||
assert!(data.len() % 4 == 0);
|
assert!(data.len().is_multiple_of(4));
|
||||||
|
|
||||||
Some(Cow::Owned(bytemuck::pod_collect_to_vec(&data)))
|
Some(Cow::Owned(bytemuck::pod_collect_to_vec(&data)))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1110,9 +1110,7 @@ impl Global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut bind_group = None;
|
let mut bind_group = None;
|
||||||
if bind_group_id.is_some() {
|
if let Some(bind_group_id) = bind_group_id {
|
||||||
let bind_group_id = bind_group_id.unwrap();
|
|
||||||
|
|
||||||
let hub = &self.hub;
|
let hub = &self.hub;
|
||||||
bind_group = Some(pass_try!(
|
bind_group = Some(pass_try!(
|
||||||
base,
|
base,
|
||||||
|
|||||||
@ -3158,9 +3158,7 @@ impl Global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut bind_group = None;
|
let mut bind_group = None;
|
||||||
if bind_group_id.is_some() {
|
if let Some(bind_group_id) = bind_group_id {
|
||||||
let bind_group_id = bind_group_id.unwrap();
|
|
||||||
|
|
||||||
let hub = &self.hub;
|
let hub = &self.hub;
|
||||||
bind_group = Some(pass_try!(
|
bind_group = Some(pass_try!(
|
||||||
base,
|
base,
|
||||||
|
|||||||
@ -253,19 +253,14 @@ bitflags::bitflags! {
|
|||||||
|
|
||||||
type BindTarget = u32;
|
type BindTarget = u32;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Default, Clone, Copy)]
|
||||||
enum VertexAttribKind {
|
enum VertexAttribKind {
|
||||||
|
#[default]
|
||||||
Float, // glVertexAttribPointer
|
Float, // glVertexAttribPointer
|
||||||
Integer, // glVertexAttribIPointer
|
Integer, // glVertexAttribIPointer
|
||||||
//Double, // glVertexAttribLPointer
|
//Double, // glVertexAttribLPointer
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for VertexAttribKind {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Float
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct TextureFormatDesc {
|
pub struct TextureFormatDesc {
|
||||||
pub internal: u32,
|
pub internal: u32,
|
||||||
|
|||||||
@ -101,12 +101,13 @@ pub enum PresentMode {
|
|||||||
/// Specifies how the alpha channel of the textures should be handled during
|
/// Specifies how the alpha channel of the textures should be handled during
|
||||||
/// compositing.
|
/// compositing.
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
|
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
|
||||||
pub enum CompositeAlphaMode {
|
pub enum CompositeAlphaMode {
|
||||||
/// Chooses either `Opaque` or `Inherit` automatically,depending on the
|
/// Chooses either `Opaque` or `Inherit` automatically,depending on the
|
||||||
/// `alpha_mode` that the current surface can support.
|
/// `alpha_mode` that the current surface can support.
|
||||||
|
#[default]
|
||||||
Auto = 0,
|
Auto = 0,
|
||||||
/// The alpha channel, if it exists, of the textures is ignored in the
|
/// The alpha channel, if it exists, of the textures is ignored in the
|
||||||
/// compositing process. Instead, the textures is treated as if it has a
|
/// compositing process. Instead, the textures is treated as if it has a
|
||||||
@ -130,12 +131,6 @@ pub enum CompositeAlphaMode {
|
|||||||
Inherit = 4,
|
Inherit = 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CompositeAlphaMode {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Auto
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Defines the capabilities of a given surface and adapter.
|
/// Defines the capabilities of a given surface and adapter.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SurfaceCapabilities {
|
pub struct SurfaceCapabilities {
|
||||||
|
|||||||
@ -2605,11 +2605,11 @@ impl dispatch::QueueInterface for WebQueue {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let write_size = u64::from(size);
|
let write_size = u64::from(size);
|
||||||
if write_size % wgt::COPY_BUFFER_ALIGNMENT != 0 {
|
if !write_size.is_multiple_of(wgt::COPY_BUFFER_ALIGNMENT) {
|
||||||
log::error!("Copy size {size} does not respect `COPY_BUFFER_ALIGNMENT`");
|
log::error!("Copy size {size} does not respect `COPY_BUFFER_ALIGNMENT`");
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
if offset % wgt::COPY_BUFFER_ALIGNMENT != 0 {
|
if !offset.is_multiple_of(wgt::COPY_BUFFER_ALIGNMENT) {
|
||||||
log::error!(
|
log::error!(
|
||||||
"Buffer offset {offset} is not aligned to block size or `COPY_BUFFER_ALIGNMENT`"
|
"Buffer offset {offset} is not aligned to block size or `COPY_BUFFER_ALIGNMENT`"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -60,7 +60,7 @@ const fn assert_has_spirv_magic_number_and_length(bytes: &[u8]) -> bool {
|
|||||||
Some(needs_byte_swap) => {
|
Some(needs_byte_swap) => {
|
||||||
// Note: this assertion is relied upon for the soundness of `make_spirv_const()`.
|
// Note: this assertion is relied upon for the soundness of `make_spirv_const()`.
|
||||||
assert!(
|
assert!(
|
||||||
bytes.len() % size_of::<u32>() == 0,
|
bytes.len().is_multiple_of(mem::size_of::<u32>()),
|
||||||
"SPIR-V data must be a multiple of 4 bytes long"
|
"SPIR-V data must be a multiple of 4 bytes long"
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -75,6 +75,7 @@ const fn assert_has_spirv_magic_number_and_length(bytes: &[u8]) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg_attr(not(feature = "spirv"), expect(rustdoc::broken_intra_doc_links))]
|
||||||
/// Version of [`make_spirv()`] intended for use with
|
/// Version of [`make_spirv()`] intended for use with
|
||||||
/// [`Device::create_shader_module_passthrough()`].
|
/// [`Device::create_shader_module_passthrough()`].
|
||||||
///
|
///
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user