mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 08:13:27 +00:00
Merge #555
555: Use crates.io release of peek-poke r=kvark a=kvark Closes #549 Co-authored-by: Rukai <rubickent@gmail.com>
This commit is contained in:
commit
384606f2e2
30
Cargo.lock
generated
30
Cargo.lock
generated
@ -445,19 +445,21 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "peek-poke"
|
name = "peek-poke"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/kvark/peek-poke?rev=969bd7fe2be1a83f87916dc8b388c63cfd457075#969bd7fe2be1a83f87916dc8b388c63cfd457075"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"peek-poke-derive 0.2.0 (git+https://github.com/kvark/peek-poke?rev=969bd7fe2be1a83f87916dc8b388c63cfd457075)",
|
"peek-poke-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "peek-poke-derive"
|
name = "peek-poke-derive"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
source = "git+https://github.com/kvark/peek-poke?rev=969bd7fe2be1a83f87916dc8b388c63cfd457075#969bd7fe2be1a83f87916dc8b388c63cfd457075"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -560,6 +562,17 @@ dependencies = [
|
|||||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "synstructure"
|
||||||
|
version = "0.12.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.11.2"
|
version = "1.11.2"
|
||||||
@ -657,7 +670,7 @@ dependencies = [
|
|||||||
"gfx-memory 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gfx-memory 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"peek-poke 0.2.0 (git+https://github.com/kvark/peek-poke?rev=969bd7fe2be1a83f87916dc8b388c63cfd457075)",
|
"peek-poke 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -693,7 +706,7 @@ name = "wgpu-types"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"peek-poke 0.2.0 (git+https://github.com/kvark/peek-poke?rev=969bd7fe2be1a83f87916dc8b388c63cfd457075)",
|
"peek-poke 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -783,8 +796,8 @@ dependencies = [
|
|||||||
"checksum objc_exception 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
|
"checksum objc_exception 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
|
||||||
"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"
|
"checksum parking_lot 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"
|
||||||
"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
|
"checksum parking_lot_core 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"
|
||||||
"checksum peek-poke 0.2.0 (git+https://github.com/kvark/peek-poke?rev=969bd7fe2be1a83f87916dc8b388c63cfd457075)" = "<none>"
|
"checksum peek-poke 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d93fd6a575ebf1ac2668d08443c97a22872cfb463fd8b7ddd141e9f6be59af2f"
|
||||||
"checksum peek-poke-derive 0.2.0 (git+https://github.com/kvark/peek-poke?rev=969bd7fe2be1a83f87916dc8b388c63cfd457075)" = "<none>"
|
"checksum peek-poke-derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6fb44a25c5bba983be0fc8592dfaf3e6d0935ce8be0c6b15b2a39507af34a926"
|
||||||
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
||||||
"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
|
"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
|
||||||
"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
|
"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
|
||||||
@ -799,6 +812,7 @@ dependencies = [
|
|||||||
"checksum spirv_cross 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "946216f8793f7199e3ea5b995ee8dc20a0ace1fcf46293a0ef4c17e1d046dbde"
|
"checksum spirv_cross 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "946216f8793f7199e3ea5b995ee8dc20a0ace1fcf46293a0ef4c17e1d046dbde"
|
||||||
"checksum storage-map 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0a4829a5c591dc24a944a736d6b1e4053e51339a79fd5d4702c4c999a9c45e"
|
"checksum storage-map 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0a4829a5c591dc24a944a736d6b1e4053e51339a79fd5d4702c4c999a9c45e"
|
||||||
"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
|
"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03"
|
||||||
|
"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
|
||||||
"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
|
"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
|
||||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||||
"checksum uom 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4cec796ec5f7ac557631709079168286056205c51c60aac33f51764bdc7b8dc4"
|
"checksum uom 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4cec796ec5f7ac557631709079168286056205c51c60aac33f51764bdc7b8dc4"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/* Generated with cbindgen:0.13.2 */
|
/* Generated with cbindgen:0.14.0 */
|
||||||
|
|
||||||
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
/* DO NOT MODIFY THIS MANUALLY! This file was generated using cbindgen.
|
||||||
* To generate this file:
|
* To generate this file:
|
||||||
|
@ -32,7 +32,7 @@ gfx-backend-empty = "0.5"
|
|||||||
gfx-descriptor = "0.1"
|
gfx-descriptor = "0.1"
|
||||||
gfx-memory = "0.1"
|
gfx-memory = "0.1"
|
||||||
parking_lot = "0.10"
|
parking_lot = "0.10"
|
||||||
peek-poke = { git = "https://github.com/kvark/peek-poke", rev = "969bd7fe2be1a83f87916dc8b388c63cfd457075" }
|
peek-poke = "0.2"
|
||||||
smallvec = "1"
|
smallvec = "1"
|
||||||
vec_map = "0.8"
|
vec_map = "0.8"
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ use crate::{
|
|||||||
|
|
||||||
use wgt::{BufferAddress, BufferUsage, DynamicOffset, BIND_BUFFER_ALIGNMENT};
|
use wgt::{BufferAddress, BufferUsage, DynamicOffset, BIND_BUFFER_ALIGNMENT};
|
||||||
use hal::command::CommandBuffer as _;
|
use hal::command::CommandBuffer as _;
|
||||||
use peek_poke::{Peek, PeekCopy, Poke};
|
use peek_poke::{Peek, PeekPoke, Poke};
|
||||||
|
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ enum PipelineState {
|
|||||||
Set,
|
Set,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PeekCopy, Poke)]
|
#[derive(Clone, Copy, Debug, PeekPoke)]
|
||||||
enum ComputeCommand {
|
enum ComputeCommand {
|
||||||
SetBindGroup {
|
SetBindGroup {
|
||||||
index: u8,
|
index: u8,
|
||||||
@ -42,6 +42,12 @@ enum ComputeCommand {
|
|||||||
End,
|
End,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ComputeCommand {
|
||||||
|
fn default() -> Self {
|
||||||
|
ComputeCommand::End
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl super::RawPass {
|
impl super::RawPass {
|
||||||
pub unsafe fn new_compute(parent: id::CommandEncoderId) -> Self {
|
pub unsafe fn new_compute(parent: id::CommandEncoderId) -> Self {
|
||||||
Self::from_vec(Vec::<ComputeCommand>::with_capacity(1), parent)
|
Self::from_vec(Vec::<ComputeCommand>::with_capacity(1), parent)
|
||||||
@ -90,7 +96,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
let mut command = ComputeCommand::Dispatch([0; 3]); // dummy
|
let mut command = ComputeCommand::Dispatch([0; 3]); // dummy
|
||||||
loop {
|
loop {
|
||||||
assert!(unsafe { peeker.add(ComputeCommand::max_size()) } <= raw_data_end);
|
assert!(unsafe { peeker.add(ComputeCommand::max_size()) } <= raw_data_end);
|
||||||
peeker = unsafe { command.peek_from(peeker) };
|
peeker = unsafe { ComputeCommand::peek_from(peeker, &mut command) };
|
||||||
match command {
|
match command {
|
||||||
ComputeCommand::SetBindGroup { index, num_dynamic_offsets, bind_group_id, phantom_offsets } => {
|
ComputeCommand::SetBindGroup { index, num_dynamic_offsets, bind_group_id, phantom_offsets } => {
|
||||||
let (new_peeker, offsets) = unsafe {
|
let (new_peeker, offsets) = unsafe {
|
||||||
@ -256,7 +262,7 @@ use wgt::{BufferAddress, DynamicOffset};
|
|||||||
index: index.try_into().unwrap(),
|
index: index.try_into().unwrap(),
|
||||||
num_dynamic_offsets: offset_length.try_into().unwrap(),
|
num_dynamic_offsets: offset_length.try_into().unwrap(),
|
||||||
bind_group_id,
|
bind_group_id,
|
||||||
phantom_offsets: PhantomSlice::new(),
|
phantom_offsets: PhantomSlice::default(),
|
||||||
});
|
});
|
||||||
pass.encode_slice(
|
pass.encode_slice(
|
||||||
slice::from_raw_parts(offsets, offset_length),
|
slice::from_raw_parts(offsets, offset_length),
|
||||||
|
@ -28,6 +28,8 @@ use crate::{
|
|||||||
Stored,
|
Stored,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use peek_poke::PeekPoke;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
mem,
|
mem,
|
||||||
@ -37,14 +39,16 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, peek_poke::PeekCopy, peek_poke::Poke)]
|
#[derive(Clone, Copy, Debug, PeekPoke)]
|
||||||
struct PhantomSlice<T>(PhantomData<T>);
|
struct PhantomSlice<T>(PhantomData<T>);
|
||||||
|
|
||||||
impl<T> PhantomSlice<T> {
|
impl<T> Default for PhantomSlice<T> {
|
||||||
fn new() -> Self {
|
fn default() -> Self {
|
||||||
PhantomSlice(PhantomData)
|
PhantomSlice(PhantomData)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> PhantomSlice<T> {
|
||||||
unsafe fn decode_unaligned<'a>(
|
unsafe fn decode_unaligned<'a>(
|
||||||
self, pointer: *const u8, count: usize, bound: *const u8
|
self, pointer: *const u8, count: usize, bound: *const u8
|
||||||
) -> (*const u8, &'a [T]) {
|
) -> (*const u8, &'a [T]) {
|
||||||
@ -197,15 +201,26 @@ impl<B: GfxBackend> CommandBuffer<B> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(peek_poke::PeekCopy, peek_poke::Poke)]
|
#[derive(PeekPoke)]
|
||||||
struct PassComponent<T> {
|
struct PassComponent<T> {
|
||||||
load_op: wgt::LoadOp,
|
load_op: wgt::LoadOp,
|
||||||
store_op: wgt::StoreOp,
|
store_op: wgt::StoreOp,
|
||||||
clear_value: T,
|
clear_value: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// required for PeekPoke
|
||||||
|
impl<T: Default> Default for PassComponent<T> {
|
||||||
|
fn default() -> Self {
|
||||||
|
PassComponent {
|
||||||
|
load_op: wgt::LoadOp::Clear,
|
||||||
|
store_op: wgt::StoreOp::Clear,
|
||||||
|
clear_value: T::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(peek_poke::PeekCopy, peek_poke::Poke)]
|
#[derive(Default, PeekPoke)]
|
||||||
struct RawRenderPassColorAttachmentDescriptor {
|
struct RawRenderPassColorAttachmentDescriptor {
|
||||||
attachment: u64,
|
attachment: u64,
|
||||||
resolve_target: u64,
|
resolve_target: u64,
|
||||||
@ -213,7 +228,7 @@ struct RawRenderPassColorAttachmentDescriptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(peek_poke::PeekCopy, peek_poke::Poke)]
|
#[derive(Default, PeekPoke)]
|
||||||
struct RawRenderPassDepthStencilAttachmentDescriptor {
|
struct RawRenderPassDepthStencilAttachmentDescriptor {
|
||||||
attachment: u64,
|
attachment: u64,
|
||||||
depth: PassComponent<f32>,
|
depth: PassComponent<f32>,
|
||||||
@ -221,7 +236,7 @@ struct RawRenderPassDepthStencilAttachmentDescriptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(peek_poke::PeekCopy, peek_poke::Poke)]
|
#[derive(Default, PeekPoke)]
|
||||||
struct RawRenderTargets {
|
struct RawRenderTargets {
|
||||||
colors: [RawRenderPassColorAttachmentDescriptor; MAX_COLOR_TARGETS],
|
colors: [RawRenderPassColorAttachmentDescriptor; MAX_COLOR_TARGETS],
|
||||||
depth_stencil: RawRenderPassDepthStencilAttachmentDescriptor,
|
depth_stencil: RawRenderPassDepthStencilAttachmentDescriptor,
|
||||||
|
@ -42,7 +42,7 @@ use wgt::{
|
|||||||
};
|
};
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
use hal::command::CommandBuffer as _;
|
use hal::command::CommandBuffer as _;
|
||||||
use peek_poke::{Peek, PeekCopy, Poke};
|
use peek_poke::{Peek, PeekPoke, Poke};
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
borrow::Borrow,
|
borrow::Borrow,
|
||||||
@ -67,7 +67,7 @@ pub struct RenderPassDescriptor<'a> {
|
|||||||
pub depth_stencil_attachment: Option<&'a RenderPassDepthStencilAttachmentDescriptor>,
|
pub depth_stencil_attachment: Option<&'a RenderPassDepthStencilAttachmentDescriptor>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PeekCopy, Poke)]
|
#[derive(Clone, Copy, Debug, Default, PeekPoke)]
|
||||||
pub struct Rect<T> {
|
pub struct Rect<T> {
|
||||||
pub x: T,
|
pub x: T,
|
||||||
pub y: T,
|
pub y: T,
|
||||||
@ -75,7 +75,7 @@ pub struct Rect<T> {
|
|||||||
pub h: T,
|
pub h: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PeekCopy, Poke)]
|
#[derive(Clone, Copy, Debug, PeekPoke)]
|
||||||
enum RenderCommand {
|
enum RenderCommand {
|
||||||
SetBindGroup {
|
SetBindGroup {
|
||||||
index: u8,
|
index: u8,
|
||||||
@ -128,6 +128,13 @@ enum RenderCommand {
|
|||||||
End,
|
End,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// required for PeekPoke
|
||||||
|
impl Default for RenderCommand {
|
||||||
|
fn default() -> Self {
|
||||||
|
RenderCommand::End
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl super::RawPass {
|
impl super::RawPass {
|
||||||
pub unsafe fn new_render(parent_id: id::CommandEncoderId, desc: &RenderPassDescriptor) -> Self {
|
pub unsafe fn new_render(parent_id: id::CommandEncoderId, desc: &RenderPassDescriptor) -> Self {
|
||||||
let mut pass = Self::from_vec(Vec::<RenderCommand>::with_capacity(1), parent_id);
|
let mut pass = Self::from_vec(Vec::<RenderCommand>::with_capacity(1), parent_id);
|
||||||
@ -334,7 +341,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
|
|
||||||
let mut targets: RawRenderTargets = unsafe { mem::zeroed() };
|
let mut targets: RawRenderTargets = unsafe { mem::zeroed() };
|
||||||
assert!(unsafe { peeker.add(RawRenderTargets::max_size()) <= raw_data_end });
|
assert!(unsafe { peeker.add(RawRenderTargets::max_size()) <= raw_data_end });
|
||||||
peeker = unsafe { targets.peek_from(peeker) };
|
peeker = unsafe { RawRenderTargets::peek_from(peeker, &mut targets) };
|
||||||
|
|
||||||
let color_attachments = targets.colors
|
let color_attachments = targets.colors
|
||||||
.iter()
|
.iter()
|
||||||
@ -829,7 +836,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
};
|
};
|
||||||
loop {
|
loop {
|
||||||
assert!(unsafe { peeker.add(RenderCommand::max_size()) } <= raw_data_end);
|
assert!(unsafe { peeker.add(RenderCommand::max_size()) } <= raw_data_end);
|
||||||
peeker = unsafe { command.peek_from(peeker) };
|
peeker = unsafe { RenderCommand::peek_from(peeker, &mut command) };
|
||||||
match command {
|
match command {
|
||||||
RenderCommand::SetBindGroup { index, num_dynamic_offsets, bind_group_id, phantom_offsets } => {
|
RenderCommand::SetBindGroup { index, num_dynamic_offsets, bind_group_id, phantom_offsets } => {
|
||||||
let (new_peeker, offsets) = unsafe {
|
let (new_peeker, offsets) = unsafe {
|
||||||
@ -1190,7 +1197,7 @@ pub mod render_ffi {
|
|||||||
index: index.try_into().unwrap(),
|
index: index.try_into().unwrap(),
|
||||||
num_dynamic_offsets: offset_length.try_into().unwrap(),
|
num_dynamic_offsets: offset_length.try_into().unwrap(),
|
||||||
bind_group_id,
|
bind_group_id,
|
||||||
phantom_offsets: PhantomSlice::new(),
|
phantom_offsets: PhantomSlice::default(),
|
||||||
});
|
});
|
||||||
pass.encode_slice(
|
pass.encode_slice(
|
||||||
slice::from_raw_parts(offsets, offset_length),
|
slice::from_raw_parts(offsets, offset_length),
|
||||||
|
@ -663,6 +663,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
|
|||||||
let hub = B::hub(self);
|
let hub = B::hub(self);
|
||||||
let mut token = Token::root();
|
let mut token = Token::root();
|
||||||
|
|
||||||
|
log::info!("Buffer {:?} is dropped", buffer_id);
|
||||||
let device_id = {
|
let device_id = {
|
||||||
let (mut buffer_guard, _) = hub.buffers.write(&mut token);
|
let (mut buffer_guard, _) = hub.buffers.write(&mut token);
|
||||||
let buffer = &mut buffer_guard[buffer_id];
|
let buffer = &mut buffer_guard[buffer_id];
|
||||||
|
@ -16,6 +16,13 @@ type Dummy = crate::backend::Empty;
|
|||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate="serde_crate"))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize), serde(crate="serde_crate"))]
|
||||||
pub struct Id<T>(NonZeroU64, PhantomData<T>);
|
pub struct Id<T>(NonZeroU64, PhantomData<T>);
|
||||||
|
|
||||||
|
// required for PeekPoke
|
||||||
|
impl<T> Default for Id<T> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Id(unsafe { NonZeroU64::new_unchecked(!0) }, PhantomData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T> Id<T> {
|
impl<T> Id<T> {
|
||||||
pub fn backend(self) -> Backend {
|
pub fn backend(self) -> Backend {
|
||||||
match self.0.get() >> (64 - BACKEND_BITS) as u8 {
|
match self.0.get() >> (64 - BACKEND_BITS) as u8 {
|
||||||
@ -76,10 +83,10 @@ unsafe impl<T> peek_poke::Poke for Id<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T> peek_poke::Peek for Id<T> {
|
impl<T> peek_poke::Peek for Id<T> {
|
||||||
unsafe fn peek_from(&mut self, mut data: *const u8) -> *const u8 {
|
unsafe fn peek_from(mut data: *const u8, this: *mut Self) -> *const u8 {
|
||||||
let mut v = 0u64;
|
let mut v = 0u64;
|
||||||
data = v.peek_from(data);
|
data = u64::peek_from(data, &mut v);
|
||||||
self.0 = NonZeroU64::new(v).unwrap();
|
(*this).0 = NonZeroU64::new(v).unwrap();
|
||||||
data
|
data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,4 +17,4 @@ license = "MPL-2.0"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "1.0"
|
bitflags = "1.0"
|
||||||
serde = { version = "1.0", features = ["serde_derive"], optional = true }
|
serde = { version = "1.0", features = ["serde_derive"], optional = true }
|
||||||
peek-poke = { git = "https://github.com/kvark/peek-poke", rev = "969bd7fe2be1a83f87916dc8b388c63cfd457075", optional = true }
|
peek-poke = { version = "0.2", optional = true }
|
||||||
|
@ -6,7 +6,7 @@ use std::{io, slice, ptr};
|
|||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Serialize, Deserialize};
|
use serde::{Serialize, Deserialize};
|
||||||
#[cfg(feature = "peek-poke")]
|
#[cfg(feature = "peek-poke")]
|
||||||
use peek_poke::{PeekCopy, Poke};
|
use peek_poke::{PeekPoke};
|
||||||
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
@ -621,7 +621,7 @@ pub struct SwapChainDescriptor {
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "peek-poke", derive(PeekCopy, Poke))]
|
#[cfg_attr(feature = "peek-poke", derive(PeekPoke))]
|
||||||
pub enum LoadOp {
|
pub enum LoadOp {
|
||||||
Clear = 0,
|
Clear = 0,
|
||||||
Load = 1,
|
Load = 1,
|
||||||
@ -630,7 +630,7 @@ pub enum LoadOp {
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "peek-poke", derive(PeekCopy, Poke))]
|
#[cfg_attr(feature = "peek-poke", derive(PeekPoke))]
|
||||||
pub enum StoreOp {
|
pub enum StoreOp {
|
||||||
Clear = 0,
|
Clear = 0,
|
||||||
Store = 1,
|
Store = 1,
|
||||||
@ -639,6 +639,7 @@ pub enum StoreOp {
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[cfg_attr(feature = "peek-poke", derive(PeekPoke))]
|
||||||
pub struct RenderPassColorAttachmentDescriptorBase<T> {
|
pub struct RenderPassColorAttachmentDescriptorBase<T> {
|
||||||
pub attachment: T,
|
pub attachment: T,
|
||||||
pub resolve_target: Option<T>,
|
pub resolve_target: Option<T>,
|
||||||
@ -650,7 +651,7 @@ pub struct RenderPassColorAttachmentDescriptorBase<T> {
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "peek-poke", derive(PeekCopy, Poke))]
|
#[cfg_attr(feature = "peek-poke", derive(PeekPoke))]
|
||||||
pub struct RenderPassDepthStencilAttachmentDescriptorBase<T> {
|
pub struct RenderPassDepthStencilAttachmentDescriptorBase<T> {
|
||||||
pub attachment: T,
|
pub attachment: T,
|
||||||
pub depth_load_op: LoadOp,
|
pub depth_load_op: LoadOp,
|
||||||
@ -662,9 +663,9 @@ pub struct RenderPassDepthStencilAttachmentDescriptorBase<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "peek-poke", derive(PeekCopy, Poke))]
|
#[cfg_attr(feature = "peek-poke", derive(PeekPoke))]
|
||||||
pub struct Color {
|
pub struct Color {
|
||||||
pub r: f64,
|
pub r: f64,
|
||||||
pub g: f64,
|
pub g: f64,
|
||||||
|
Loading…
Reference in New Issue
Block a user