mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[rs] Merge #503
503: Update for the wgpu grand refactor r=kvark a=kvark Depends on https://github.com/gfx-rs/wgpu/pull/873 Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
@@ -19,7 +19,6 @@ all-features = true
|
||||
default = []
|
||||
trace = ["serde", "wgc/trace"]
|
||||
replay = ["serde", "wgc/replay"]
|
||||
subscriber = ["wgc/subscriber"]
|
||||
# Make Vulkan backend available on platforms where it is by default not, e.g. macOS
|
||||
vulkan-portability = ["wgc/gfx-backend-vulkan"]
|
||||
|
||||
@@ -27,14 +26,14 @@ vulkan-portability = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "04f5cfd1c8e66612ed44ab371dac3d956235ffa7"
|
||||
rev = "6e3e88dd1058fdd0c9906ba672bbbba811422c56"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "04f5cfd1c8e66612ed44ab371dac3d956235ffa7"
|
||||
rev = "6e3e88dd1058fdd0c9906ba672bbbba811422c56"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
@@ -61,14 +60,21 @@ bytemuck = "1"
|
||||
noise = "0.6.0"
|
||||
ddsfile = "0.4.0"
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies.subscriber]
|
||||
package = "wgpu-subscriber"
|
||||
version = "0.5" #TODO: change to 0.1
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "6e3e88dd1058fdd0c9906ba672bbbba811422c56"
|
||||
|
||||
[[example]]
|
||||
name="hello-compute"
|
||||
path="examples/hello-compute/main.rs"
|
||||
test = true
|
||||
|
||||
[patch."https://github.com/gfx-rs/wgpu"]
|
||||
#wgpu-types = { version = "0.5.0", path = "../wgpu/wgpu-types" }
|
||||
#wgpu-core = { version = "0.5.0", path = "../wgpu/wgpu-core" }
|
||||
#wgpu-types = { version = "0.5", path = "../wgpu/wgpu-types" }
|
||||
#wgpu-core = { version = "0.5", path = "../wgpu/wgpu-core" }
|
||||
#wgpu-subscriber = { version = "0.5", path = "../wgpu/wgpu-subscriber" }
|
||||
|
||||
[patch."https://github.com/gfx-rs/naga"]
|
||||
#naga = { path = "../naga" }
|
||||
|
||||
@@ -61,37 +61,41 @@ impl framework::Example for Example {
|
||||
let compute_bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::COMPUTE,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::COMPUTE,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(sim_param_data.len() as _),
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
1,
|
||||
wgpu::ShaderStage::COMPUTE,
|
||||
wgpu::BindingType::StorageBuffer {
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 1,
|
||||
visibility: wgpu::ShaderStage::COMPUTE,
|
||||
ty: wgpu::BindingType::StorageBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new((NUM_PARTICLES * 16) as _),
|
||||
readonly: false,
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
2,
|
||||
wgpu::ShaderStage::COMPUTE,
|
||||
wgpu::BindingType::StorageBuffer {
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 2,
|
||||
visibility: wgpu::ShaderStage::COMPUTE,
|
||||
ty: wgpu::BindingType::StorageBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new((NUM_PARTICLES * 16) as _),
|
||||
readonly: false,
|
||||
},
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
});
|
||||
let compute_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("compute"),
|
||||
bind_group_layouts: &[&compute_bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -100,6 +104,7 @@ impl framework::Example for Example {
|
||||
|
||||
let render_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("render"),
|
||||
bind_group_layouts: &[],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -120,12 +125,7 @@ impl framework::Example for Example {
|
||||
..Default::default()
|
||||
}),
|
||||
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: sc_desc.format,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[sc_desc.format.into()],
|
||||
depth_stencil_state: None,
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
|
||||
@@ -84,7 +84,7 @@ async fn create_red_image_with_dimensions(
|
||||
device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
|
||||
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
|
||||
color_attachments: &[wgpu::RenderPassColorAttachmentDescriptor {
|
||||
attachment: &texture.create_default_view(),
|
||||
attachment: &texture.create_view(&wgpu::TextureViewDescriptor::default()),
|
||||
resolve_target: None,
|
||||
ops: wgpu::Operations {
|
||||
load: wgpu::LoadOp::Clear(wgpu::Color::RED),
|
||||
@@ -196,8 +196,7 @@ impl BufferDimensions {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
#[cfg(feature = "subscriber")]
|
||||
wgpu::util::initialize_default_subscriber(None);
|
||||
subscriber::initialize_default_subscriber(None);
|
||||
futures::executor::block_on(run("red.png"));
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
||||
@@ -140,31 +140,35 @@ impl framework::Example for Example {
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: None,
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::VERTEX,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(64),
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
1,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::SampledTexture {
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 1,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::SampledTexture {
|
||||
multisampled: false,
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
2,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 2,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
});
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -186,7 +190,7 @@ impl framework::Example for Example {
|
||||
format: wgpu::TextureFormat::Rgba8UnormSrgb,
|
||||
usage: wgpu::TextureUsage::SAMPLED | wgpu::TextureUsage::COPY_DST,
|
||||
});
|
||||
let texture_view = texture.create_default_view();
|
||||
let texture_view = texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||
queue.write_texture(
|
||||
wgpu::TextureCopyView {
|
||||
texture: &texture,
|
||||
|
||||
@@ -72,10 +72,10 @@ struct Setup {
|
||||
}
|
||||
|
||||
async fn setup<E: Example>(title: &str) -> Setup {
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "subscriber"))]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
let chrome_tracing_dir = std::env::var("WGPU_CHROME_TRACE");
|
||||
wgpu::util::initialize_default_subscriber(
|
||||
subscriber::initialize_default_subscriber(
|
||||
chrome_tracing_dir.as_ref().map(std::path::Path::new).ok(),
|
||||
);
|
||||
};
|
||||
|
||||
@@ -63,15 +63,16 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: None,
|
||||
entries: &[wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::COMPUTE,
|
||||
wgpu::BindingType::StorageBuffer {
|
||||
entries: &[wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::COMPUTE,
|
||||
ty: wgpu::BindingType::StorageBuffer {
|
||||
dynamic: false,
|
||||
readonly: false,
|
||||
min_binding_size: wgpu::BufferSize::new(4),
|
||||
},
|
||||
)],
|
||||
count: None,
|
||||
}],
|
||||
});
|
||||
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
@@ -84,6 +85,7 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
});
|
||||
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -138,9 +140,7 @@ async fn execute_gpu(numbers: Vec<u32>) -> Vec<u32> {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
#[cfg(feature = "subscriber")]
|
||||
wgpu::util::initialize_default_subscriber(None);
|
||||
|
||||
subscriber::initialize_default_subscriber(None);
|
||||
futures::executor::block_on(run());
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
||||
@@ -35,6 +35,7 @@ async fn run(event_loop: EventLoop<()>, window: Window, swapchain_format: wgpu::
|
||||
let fs_module = device.create_shader_module(wgpu::include_spirv!("shader.frag.spv"));
|
||||
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -52,12 +53,7 @@ async fn run(event_loop: EventLoop<()>, window: Window, swapchain_format: wgpu::
|
||||
// Use the default rasterizer state: no culling, no depth bias
|
||||
rasterization_state: None,
|
||||
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: swapchain_format,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[swapchain_format.into()],
|
||||
depth_stencil_state: None,
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
@@ -140,9 +136,7 @@ fn main() {
|
||||
let window = winit::window::Window::new(&event_loop).unwrap();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
#[cfg(feature = "subscriber")]
|
||||
wgpu::util::initialize_default_subscriber(None);
|
||||
|
||||
subscriber::initialize_default_subscriber(None);
|
||||
// Temporarily avoid srgb formats for the swapchain on the web
|
||||
futures::executor::block_on(run(event_loop, window, wgpu::TextureFormat::Bgra8UnormSrgb));
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ async fn run() {
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
#[cfg(feature = "subscriber")]
|
||||
wgpu::util::initialize_default_subscriber(None);
|
||||
subscriber::initialize_default_subscriber(None);
|
||||
futures::executor::block_on(run());
|
||||
}
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
||||
@@ -84,24 +84,27 @@ impl Example {
|
||||
) {
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::SampledTexture {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::SampledTexture {
|
||||
multisampled: false,
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
1,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 1,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
});
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("mipmap"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -125,12 +128,7 @@ impl Example {
|
||||
..Default::default()
|
||||
}),
|
||||
primitive_topology: wgpu::PrimitiveTopology::TriangleStrip,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: TEXTURE_FORMAT,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[TEXTURE_FORMAT.into()],
|
||||
depth_stencil_state: None,
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
@@ -156,8 +154,8 @@ impl Example {
|
||||
.map(|mip| {
|
||||
texture.create_view(&wgpu::TextureViewDescriptor {
|
||||
label: Some("mip"),
|
||||
format: TEXTURE_FORMAT,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
format: None,
|
||||
dimension: None,
|
||||
aspect: wgpu::TextureAspect::All,
|
||||
base_mip_level: mip,
|
||||
level_count: NonZeroU32::new(1),
|
||||
@@ -224,32 +222,36 @@ impl framework::Example for Example {
|
||||
// Create pipeline layout
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::VERTEX,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(64),
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
1,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::SampledTexture {
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 1,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::SampledTexture {
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
multisampled: false,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
2,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 2,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
});
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("main"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -274,7 +276,7 @@ impl framework::Example for Example {
|
||||
| wgpu::TextureUsage::COPY_DST,
|
||||
label: None,
|
||||
});
|
||||
let texture_view = texture.create_default_view();
|
||||
let texture_view = texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||
//Note: we could use queue.write_texture instead, and this is what other
|
||||
// examples do, but here we want to show another way to do this.
|
||||
let temp_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
@@ -358,12 +360,7 @@ impl framework::Example for Example {
|
||||
..Default::default()
|
||||
}),
|
||||
primitive_topology: wgpu::PrimitiveTopology::TriangleStrip,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: sc_desc.format,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[sc_desc.format.into()],
|
||||
depth_stencil_state: None,
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
|
||||
@@ -66,12 +66,7 @@ impl Example {
|
||||
..Default::default()
|
||||
}),
|
||||
primitive_topology: wgpu::PrimitiveTopology::LineList,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: sc_desc.format,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[sc_desc.format.into()],
|
||||
depth_stencil_state: None,
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
@@ -122,7 +117,7 @@ impl Example {
|
||||
|
||||
device
|
||||
.create_texture(multisampled_frame_descriptor)
|
||||
.create_default_view()
|
||||
.create_view(&wgpu::TextureViewDescriptor::default())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +134,7 @@ impl framework::Example for Example {
|
||||
let fs_module = device.create_shader_module(wgpu::include_spirv!("shader.frag.spv"));
|
||||
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
|
||||
@@ -255,16 +255,17 @@ impl framework::Example for Example {
|
||||
|
||||
let local_bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
entries: &[wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
entries: &[wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(
|
||||
mem::size_of::<EntityUniforms>() as _
|
||||
),
|
||||
},
|
||||
)],
|
||||
count: None,
|
||||
}],
|
||||
label: None,
|
||||
});
|
||||
|
||||
@@ -379,14 +380,14 @@ impl framework::Example for Example {
|
||||
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT | wgpu::TextureUsage::SAMPLED,
|
||||
label: None,
|
||||
});
|
||||
let shadow_view = shadow_texture.create_default_view();
|
||||
let shadow_view = shadow_texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||
|
||||
let mut shadow_target_views = (0..2)
|
||||
.map(|i| {
|
||||
Some(shadow_texture.create_view(&wgpu::TextureViewDescriptor {
|
||||
label: Some("shadow"),
|
||||
format: Self::SHADOW_FORMAT,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
format: None,
|
||||
dimension: Some(wgpu::TextureViewDimension::D2),
|
||||
aspect: wgpu::TextureAspect::All,
|
||||
base_mip_level: 0,
|
||||
level_count: None,
|
||||
@@ -444,17 +445,19 @@ impl framework::Example for Example {
|
||||
// Create pipeline layout
|
||||
let bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
entries: &[wgpu::BindGroupLayoutEntry::new(
|
||||
0, // global
|
||||
wgpu::ShaderStage::VERTEX,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
label: None,
|
||||
entries: &[wgpu::BindGroupLayoutEntry {
|
||||
binding: 0, // global
|
||||
visibility: wgpu::ShaderStage::VERTEX,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(uniform_size),
|
||||
},
|
||||
)],
|
||||
label: None,
|
||||
count: None,
|
||||
}],
|
||||
});
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("shadow"),
|
||||
bind_group_layouts: &[&bind_group_layout, &local_bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -504,10 +507,7 @@ impl framework::Example for Example {
|
||||
format: Self::SHADOW_FORMAT,
|
||||
depth_write_enabled: true,
|
||||
depth_compare: wgpu::CompareFunction::LessEqual,
|
||||
stencil_front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||
stencil_back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||
stencil_read_mask: 0,
|
||||
stencil_write_mask: 0,
|
||||
stencil: wgpu::StencilStateDescriptor::default(),
|
||||
}),
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
@@ -530,10 +530,10 @@ impl framework::Example for Example {
|
||||
let bind_group_layout =
|
||||
device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0, // global
|
||||
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 0, // global
|
||||
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(mem::size_of::<
|
||||
ForwardUniforms,
|
||||
@@ -541,33 +541,38 @@ impl framework::Example for Example {
|
||||
)
|
||||
as _),
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
1, // lights
|
||||
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 1, // lights
|
||||
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(light_uniform_size),
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
2,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::SampledTexture {
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 2,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::SampledTexture {
|
||||
multisampled: false,
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
dimension: wgpu::TextureViewDimension::D2Array,
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
3,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::Sampler { comparison: true },
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 3,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler { comparison: true },
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
});
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("main"),
|
||||
bind_group_layouts: &[&bind_group_layout, &local_bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -627,20 +632,12 @@ impl framework::Example for Example {
|
||||
..Default::default()
|
||||
}),
|
||||
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: sc_desc.format,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[sc_desc.format.into()],
|
||||
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||
format: Self::DEPTH_FORMAT,
|
||||
depth_write_enabled: true,
|
||||
depth_compare: wgpu::CompareFunction::Less,
|
||||
stencil_front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||
stencil_back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||
stencil_read_mask: 0,
|
||||
stencil_write_mask: 0,
|
||||
stencil: wgpu::StencilStateDescriptor::default(),
|
||||
}),
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
@@ -678,7 +675,7 @@ impl framework::Example for Example {
|
||||
lights_are_dirty: true,
|
||||
shadow_pass,
|
||||
forward_pass,
|
||||
forward_depth: depth_texture.create_default_view(),
|
||||
forward_depth: depth_texture.create_view(&wgpu::TextureViewDescriptor::default()),
|
||||
light_uniform_buf,
|
||||
}
|
||||
}
|
||||
@@ -715,7 +712,7 @@ impl framework::Example for Example {
|
||||
usage: wgpu::TextureUsage::OUTPUT_ATTACHMENT,
|
||||
label: None,
|
||||
});
|
||||
self.forward_depth = depth_texture.create_default_view();
|
||||
self.forward_depth = depth_texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||
}
|
||||
|
||||
fn render(
|
||||
|
||||
@@ -49,31 +49,34 @@ impl framework::Example for Skybox {
|
||||
queue: &wgpu::Queue,
|
||||
) -> Self {
|
||||
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||
label: None,
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: None,
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
1,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::SampledTexture {
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 1,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::SampledTexture {
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
multisampled: false,
|
||||
dimension: wgpu::TextureViewDimension::Cube,
|
||||
},
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
2,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 2,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
});
|
||||
|
||||
// Create the render pipeline
|
||||
@@ -89,6 +92,7 @@ impl framework::Example for Skybox {
|
||||
});
|
||||
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -110,12 +114,7 @@ impl framework::Example for Skybox {
|
||||
..Default::default()
|
||||
}),
|
||||
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: sc_desc.format,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[sc_desc.format.into()],
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
vertex_buffers: &[],
|
||||
@@ -249,13 +248,8 @@ impl framework::Example for Skybox {
|
||||
|
||||
let texture_view = texture.create_view(&wgpu::TextureViewDescriptor {
|
||||
label: None,
|
||||
format: skybox_format,
|
||||
dimension: wgpu::TextureViewDimension::Cube,
|
||||
aspect: wgpu::TextureAspect::default(),
|
||||
base_mip_level: 0,
|
||||
level_count: None,
|
||||
base_array_layer: 0,
|
||||
array_layer_count: None,
|
||||
dimension: Some(wgpu::TextureViewDimension::Cube),
|
||||
..wgpu::TextureViewDescriptor::default()
|
||||
});
|
||||
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: &bind_group_layout,
|
||||
|
||||
@@ -161,8 +161,8 @@ impl framework::Example for Example {
|
||||
..texture_descriptor
|
||||
});
|
||||
|
||||
let red_texture_view = red_texture.create_default_view();
|
||||
let green_texture_view = green_texture.create_default_view();
|
||||
let red_texture_view = red_texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||
let green_texture_view = green_texture.create_view(&wgpu::TextureViewDescriptor::default());
|
||||
|
||||
queue.write_texture(
|
||||
wgpu::TextureCopyView {
|
||||
@@ -207,22 +207,21 @@ impl framework::Example for Example {
|
||||
label: Some("bind group layout"),
|
||||
entries: &[
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
count: Some(2),
|
||||
..wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::SampledTexture {
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
multisampled: false,
|
||||
},
|
||||
)
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::SampledTexture {
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
multisampled: false,
|
||||
},
|
||||
count: std::num::NonZeroU32::new(2),
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 1,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||
count: None,
|
||||
},
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
1,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
),
|
||||
],
|
||||
});
|
||||
|
||||
@@ -244,20 +243,18 @@ impl framework::Example for Example {
|
||||
label: Some("bind group"),
|
||||
});
|
||||
|
||||
let pipeline_layout = if uniform_workaround {
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
push_constant_ranges: &[wgpu::PushConstantRange {
|
||||
let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("main"),
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
push_constant_ranges: if uniform_workaround {
|
||||
&[wgpu::PushConstantRange {
|
||||
stages: wgpu::ShaderStage::FRAGMENT,
|
||||
range: 0..4,
|
||||
}],
|
||||
})
|
||||
} else {
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
bind_group_layouts: &[&bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
})
|
||||
};
|
||||
}]
|
||||
} else {
|
||||
&[]
|
||||
},
|
||||
});
|
||||
|
||||
let pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
|
||||
layout: Some(&pipeline_layout),
|
||||
@@ -275,12 +272,7 @@ impl framework::Example for Example {
|
||||
..Default::default()
|
||||
}),
|
||||
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: sc_desc.format,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[sc_desc.format.into()],
|
||||
depth_stencil_state: None,
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
|
||||
@@ -230,7 +230,7 @@ impl Example {
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
let depth_view = draw_depth_buffer.create_default_view();
|
||||
let depth_view = draw_depth_buffer.create_view(&wgpu::TextureViewDescriptor::default());
|
||||
|
||||
let water_bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
|
||||
layout: water_bind_group_layout,
|
||||
@@ -242,7 +242,7 @@ impl Example {
|
||||
wgpu::BindGroupEntry {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(
|
||||
&reflection_texture.create_default_view(),
|
||||
&reflection_texture.create_view(&wgpu::TextureViewDescriptor::default()),
|
||||
),
|
||||
},
|
||||
wgpu::BindGroupEntry {
|
||||
@@ -258,7 +258,7 @@ impl Example {
|
||||
});
|
||||
|
||||
(
|
||||
reflection_texture.create_default_view(),
|
||||
reflection_texture.create_view(&wgpu::TextureViewDescriptor::default()),
|
||||
depth_view,
|
||||
water_bind_group,
|
||||
)
|
||||
@@ -356,42 +356,46 @@ impl framework::Example for Example {
|
||||
label: Some("Water Bind Group Layout"),
|
||||
entries: &[
|
||||
// Uniform variables such as projection/view.
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::VERTEX | wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(
|
||||
mem::size_of::<WaterUniforms>() as _,
|
||||
),
|
||||
},
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
// Reflection texture.
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
1,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::SampledTexture {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 1,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::SampledTexture {
|
||||
multisampled: false,
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
},
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
// Depth texture for terrain.
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
2,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::SampledTexture {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 2,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::SampledTexture {
|
||||
multisampled: false,
|
||||
component_type: wgpu::TextureComponentType::Float,
|
||||
dimension: wgpu::TextureViewDimension::D2,
|
||||
},
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
// Sampler to be able to sample the textures.
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
3,
|
||||
wgpu::ShaderStage::FRAGMENT,
|
||||
wgpu::BindingType::Sampler { comparison: false },
|
||||
),
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 3,
|
||||
visibility: wgpu::ShaderStage::FRAGMENT,
|
||||
ty: wgpu::BindingType::Sampler { comparison: false },
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -400,28 +404,31 @@ impl framework::Example for Example {
|
||||
label: Some("Terrain Bind Group Layout"),
|
||||
entries: &[
|
||||
// Regular uniform variables like view/projection.
|
||||
wgpu::BindGroupLayoutEntry::new(
|
||||
0,
|
||||
wgpu::ShaderStage::VERTEX,
|
||||
wgpu::BindingType::UniformBuffer {
|
||||
wgpu::BindGroupLayoutEntry {
|
||||
binding: 0,
|
||||
visibility: wgpu::ShaderStage::VERTEX,
|
||||
ty: wgpu::BindingType::UniformBuffer {
|
||||
dynamic: false,
|
||||
min_binding_size: wgpu::BufferSize::new(
|
||||
mem::size_of::<TerrainUniforms>() as _,
|
||||
),
|
||||
},
|
||||
),
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// Create our pipeline layouts.
|
||||
let water_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("water"),
|
||||
bind_group_layouts: &[&water_bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
|
||||
let terrain_pipeline_layout =
|
||||
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
|
||||
label: Some("terrain"),
|
||||
bind_group_layouts: &[&terrain_bind_group_layout],
|
||||
push_constant_ranges: &[],
|
||||
});
|
||||
@@ -538,10 +545,7 @@ impl framework::Example for Example {
|
||||
format: wgpu::TextureFormat::Depth32Float,
|
||||
depth_write_enabled: false,
|
||||
depth_compare: wgpu::CompareFunction::Less,
|
||||
stencil_front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||
stencil_back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||
stencil_read_mask: 0,
|
||||
stencil_write_mask: 0,
|
||||
stencil: wgpu::StencilStateDescriptor::default(),
|
||||
}),
|
||||
// Layout of our vertices. This should match the structs
|
||||
// which are uploaded to the GPU. This should also be
|
||||
@@ -581,20 +585,12 @@ impl framework::Example for Example {
|
||||
..Default::default()
|
||||
}),
|
||||
primitive_topology: wgpu::PrimitiveTopology::TriangleList,
|
||||
color_states: &[wgpu::ColorStateDescriptor {
|
||||
format: sc_desc.format,
|
||||
color_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
alpha_blend: wgpu::BlendDescriptor::REPLACE,
|
||||
write_mask: wgpu::ColorWrite::ALL,
|
||||
}],
|
||||
color_states: &[sc_desc.format.into()],
|
||||
depth_stencil_state: Some(wgpu::DepthStencilStateDescriptor {
|
||||
format: wgpu::TextureFormat::Depth32Float,
|
||||
depth_write_enabled: true,
|
||||
depth_compare: wgpu::CompareFunction::Less,
|
||||
stencil_front: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||
stencil_back: wgpu::StencilStateFaceDescriptor::IGNORE,
|
||||
stencil_read_mask: 0,
|
||||
stencil_write_mask: 0,
|
||||
stencil: wgpu::StencilStateDescriptor::default(),
|
||||
}),
|
||||
vertex_state: wgpu::VertexStateDescriptor {
|
||||
index_format: wgpu::IndexFormat::Uint16,
|
||||
|
||||
@@ -9,10 +9,7 @@ use crate::{
|
||||
use arrayvec::ArrayVec;
|
||||
use futures::future::{ready, Ready};
|
||||
use smallvec::SmallVec;
|
||||
use std::{
|
||||
borrow::Cow::Borrowed, error::Error, ffi::CString, fmt, marker::PhantomData, ops::Range, ptr,
|
||||
slice,
|
||||
};
|
||||
use std::{borrow::Cow::Borrowed, error::Error, fmt, marker::PhantomData, ops::Range, slice};
|
||||
use typed_arena::Arena;
|
||||
|
||||
pub struct Context(wgc::hub::Global<wgc::hub::IdentityManagerFactory>);
|
||||
@@ -610,7 +607,7 @@ impl crate::Context for Context {
|
||||
) -> Self::BindGroupLayoutId {
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(
|
||||
*device => global.device_create_bind_group_layout(*device, &wgt::BindGroupLayoutDescriptor {
|
||||
*device => global.device_create_bind_group_layout(*device, &wgc::binding_model::BindGroupLayoutDescriptor {
|
||||
label: desc.label.map(Borrowed),
|
||||
entries: Borrowed(desc.entries),
|
||||
}, PhantomData)
|
||||
@@ -694,7 +691,8 @@ impl crate::Context for Context {
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(*device => global.device_create_pipeline_layout(
|
||||
*device,
|
||||
&wgt::PipelineLayoutDescriptor {
|
||||
&wgc::binding_model::PipelineLayoutDescriptor {
|
||||
label: desc.label.map(Borrowed),
|
||||
bind_group_layouts: Borrowed(&temp_layouts),
|
||||
push_constant_ranges: Borrowed(&desc.push_constant_ranges),
|
||||
},
|
||||
@@ -726,13 +724,13 @@ impl crate::Context for Context {
|
||||
.vertex_state
|
||||
.vertex_buffers
|
||||
.iter()
|
||||
.map(|vertex_buffer| wgt::VertexBufferDescriptor {
|
||||
.map(|vertex_buffer| pipe::VertexBufferDescriptor {
|
||||
stride: vertex_buffer.stride,
|
||||
step_mode: vertex_buffer.step_mode,
|
||||
attributes: Borrowed(vertex_buffer.attributes),
|
||||
})
|
||||
.collect();
|
||||
let vertex_state = wgt::VertexStateDescriptor {
|
||||
let vertex_state = pipe::VertexStateDescriptor {
|
||||
index_format: desc.vertex_state.index_format,
|
||||
vertex_buffers: Borrowed(&vertex_buffers),
|
||||
};
|
||||
@@ -789,13 +787,11 @@ impl crate::Context for Context {
|
||||
device: &Self::DeviceId,
|
||||
desc: &crate::BufferDescriptor<'_>,
|
||||
) -> Self::BufferId {
|
||||
let owned_label = OwnedLabel::new(desc.label.as_deref());
|
||||
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(*device => global.device_create_buffer(
|
||||
*device,
|
||||
&wgt::BufferDescriptor {
|
||||
label: owned_label.as_ptr(),
|
||||
label: desc.label.map(Borrowed),
|
||||
mapped_at_creation: desc.mapped_at_creation,
|
||||
size: desc.size,
|
||||
usage: desc.usage,
|
||||
@@ -810,13 +806,11 @@ impl crate::Context for Context {
|
||||
device: &Self::DeviceId,
|
||||
desc: &TextureDescriptor,
|
||||
) -> Self::TextureId {
|
||||
let owned_label = OwnedLabel::new(desc.label.as_deref());
|
||||
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(*device => global.device_create_texture(
|
||||
*device,
|
||||
&wgt::TextureDescriptor {
|
||||
label: owned_label.as_ptr(),
|
||||
label: desc.label.map(Borrowed),
|
||||
size: desc.size,
|
||||
mip_level_count: desc.mip_level_count,
|
||||
sample_count: desc.sample_count,
|
||||
@@ -834,23 +828,19 @@ impl crate::Context for Context {
|
||||
device: &Self::DeviceId,
|
||||
desc: &SamplerDescriptor,
|
||||
) -> Self::SamplerId {
|
||||
let owned_label = OwnedLabel::new(desc.label.as_deref());
|
||||
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(*device => global.device_create_sampler(
|
||||
*device,
|
||||
&wgt::SamplerDescriptor {
|
||||
label: owned_label.as_ptr(),
|
||||
address_mode_u: desc.address_mode_u,
|
||||
address_mode_v: desc.address_mode_v,
|
||||
address_mode_w: desc.address_mode_w,
|
||||
&wgc::resource::SamplerDescriptor {
|
||||
label: desc.label.map(Borrowed),
|
||||
address_modes: [desc.address_mode_u, desc.address_mode_v, desc.address_mode_w],
|
||||
mag_filter: desc.mag_filter,
|
||||
min_filter: desc.min_filter,
|
||||
mipmap_filter: desc.mipmap_filter,
|
||||
lod_min_clamp: desc.lod_min_clamp,
|
||||
lod_max_clamp: desc.lod_max_clamp,
|
||||
compare: desc.compare,
|
||||
anisotropy_clamp: desc.anisotropy_clamp.map(|v| v.get()),
|
||||
anisotropy_clamp: desc.anisotropy_clamp,
|
||||
},
|
||||
PhantomData
|
||||
))
|
||||
@@ -862,13 +852,11 @@ impl crate::Context for Context {
|
||||
device: &Self::DeviceId,
|
||||
desc: &CommandEncoderDescriptor,
|
||||
) -> Self::CommandEncoderId {
|
||||
let owned_label = OwnedLabel::new(desc.label.as_deref());
|
||||
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(*device => global.device_create_command_encoder(
|
||||
*device,
|
||||
&wgt::CommandEncoderDescriptor {
|
||||
label: owned_label.as_ptr(),
|
||||
label: desc.label.map(Borrowed),
|
||||
},
|
||||
PhantomData
|
||||
))
|
||||
@@ -881,7 +869,7 @@ impl crate::Context for Context {
|
||||
desc: &RenderBundleEncoderDescriptor,
|
||||
) -> Self::RenderBundleEncoderId {
|
||||
wgc::command::RenderBundleEncoder::new(
|
||||
&wgt::RenderBundleEncoderDescriptor {
|
||||
&wgc::command::RenderBundleEncoderDescriptor {
|
||||
label: desc.label.map(Borrowed),
|
||||
color_formats: Borrowed(desc.color_formats),
|
||||
depth_stencil_format: desc.depth_stencil_format,
|
||||
@@ -1026,22 +1014,21 @@ impl crate::Context for Context {
|
||||
fn texture_create_view(
|
||||
&self,
|
||||
texture: &Self::TextureId,
|
||||
desc: Option<&TextureViewDescriptor>,
|
||||
desc: &TextureViewDescriptor,
|
||||
) -> Self::TextureViewId {
|
||||
let owned_label = OwnedLabel::new(desc.and_then(|d| d.label.as_deref()));
|
||||
let descriptor = desc.map(|d| wgt::TextureViewDescriptor {
|
||||
label: owned_label.as_ptr(),
|
||||
format: d.format,
|
||||
dimension: d.dimension,
|
||||
aspect: d.aspect,
|
||||
base_mip_level: d.base_mip_level,
|
||||
level_count: d.level_count,
|
||||
base_array_layer: d.base_array_layer,
|
||||
array_layer_count: d.array_layer_count,
|
||||
});
|
||||
let descriptor = wgc::resource::TextureViewDescriptor {
|
||||
label: desc.label.map(Borrowed),
|
||||
format: desc.format,
|
||||
dimension: desc.dimension,
|
||||
aspect: desc.aspect,
|
||||
base_mip_level: desc.base_mip_level,
|
||||
level_count: desc.level_count,
|
||||
base_array_layer: desc.base_array_layer,
|
||||
array_layer_count: desc.array_layer_count,
|
||||
};
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(
|
||||
*texture => global.texture_create_view(*texture, descriptor.as_ref(), PhantomData)
|
||||
*texture => global.texture_create_view(*texture, &descriptor, PhantomData)
|
||||
)
|
||||
.unwrap_pretty()
|
||||
}
|
||||
@@ -1257,12 +1244,11 @@ impl crate::Context for Context {
|
||||
encoder: Self::RenderBundleEncoderId,
|
||||
desc: &crate::RenderBundleDescriptor,
|
||||
) -> Self::RenderBundleId {
|
||||
let owned_label = OwnedLabel::new(desc.label.as_deref());
|
||||
let global = &self.0;
|
||||
wgc::gfx_select!(encoder.parent() => global.render_bundle_encoder_finish(
|
||||
encoder,
|
||||
&wgt::RenderBundleDescriptor {
|
||||
label: owned_label.as_ptr()
|
||||
label: desc.label.map(Borrowed)
|
||||
},
|
||||
PhantomData
|
||||
))
|
||||
@@ -1320,21 +1306,6 @@ pub(crate) struct SwapChainOutputDetail {
|
||||
swap_chain_id: wgc::id::SwapChainId,
|
||||
}
|
||||
|
||||
struct OwnedLabel(Option<CString>);
|
||||
|
||||
impl OwnedLabel {
|
||||
fn new(text: Option<&str>) -> Self {
|
||||
Self(text.map(|t| CString::new(t).expect("invalid label")))
|
||||
}
|
||||
|
||||
fn as_ptr(&self) -> *const std::os::raw::c_char {
|
||||
match self.0 {
|
||||
Some(ref c_string) => c_string.as_ptr(),
|
||||
None => ptr::null(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
trait PrettyResult<T> {
|
||||
fn unwrap_pretty(self) -> T;
|
||||
}
|
||||
|
||||
@@ -358,19 +358,18 @@ fn map_rasterization_state_descriptor(
|
||||
mapped
|
||||
}
|
||||
|
||||
fn map_compare_function(compare_fn: wgt::CompareFunction) -> Option<web_sys::GpuCompareFunction> {
|
||||
fn map_compare_function(compare_fn: wgt::CompareFunction) -> web_sys::GpuCompareFunction {
|
||||
use web_sys::GpuCompareFunction as cf;
|
||||
use wgt::CompareFunction;
|
||||
match compare_fn {
|
||||
CompareFunction::Undefined => None,
|
||||
CompareFunction::Never => Some(cf::Never),
|
||||
CompareFunction::Less => Some(cf::Less),
|
||||
CompareFunction::Equal => Some(cf::Equal),
|
||||
CompareFunction::LessEqual => Some(cf::LessEqual),
|
||||
CompareFunction::Greater => Some(cf::Greater),
|
||||
CompareFunction::NotEqual => Some(cf::NotEqual),
|
||||
CompareFunction::GreaterEqual => Some(cf::GreaterEqual),
|
||||
CompareFunction::Always => Some(cf::Always),
|
||||
CompareFunction::Never => cf::Never,
|
||||
CompareFunction::Less => cf::Less,
|
||||
CompareFunction::Equal => cf::Equal,
|
||||
CompareFunction::LessEqual => cf::LessEqual,
|
||||
CompareFunction::Greater => cf::Greater,
|
||||
CompareFunction::NotEqual => cf::NotEqual,
|
||||
CompareFunction::GreaterEqual => cf::GreaterEqual,
|
||||
CompareFunction::Always => cf::Always,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,9 +392,7 @@ fn map_stencil_state_face_descriptor(
|
||||
desc: &wgt::StencilStateFaceDescriptor,
|
||||
) -> web_sys::GpuStencilStateFaceDescriptor {
|
||||
let mut mapped = web_sys::GpuStencilStateFaceDescriptor::new();
|
||||
if let Some(compare) = map_compare_function(desc.compare) {
|
||||
mapped.compare(compare);
|
||||
}
|
||||
mapped.compare(map_compare_function(desc.compare));
|
||||
mapped.depth_fail_op(map_stencil_operation(desc.depth_fail_op));
|
||||
mapped.fail_op(map_stencil_operation(desc.fail_op));
|
||||
mapped.pass_op(map_stencil_operation(desc.pass_op));
|
||||
@@ -406,14 +403,12 @@ fn map_depth_stencil_state_descriptor(
|
||||
desc: &wgt::DepthStencilStateDescriptor,
|
||||
) -> web_sys::GpuDepthStencilStateDescriptor {
|
||||
let mut mapped = web_sys::GpuDepthStencilStateDescriptor::new(map_texture_format(desc.format));
|
||||
if let Some(depth_compare) = map_compare_function(desc.depth_compare) {
|
||||
mapped.depth_compare(depth_compare);
|
||||
}
|
||||
mapped.depth_compare(map_compare_function(desc.depth_compare));
|
||||
mapped.depth_write_enabled(desc.depth_write_enabled);
|
||||
mapped.stencil_back(&map_stencil_state_face_descriptor(&desc.stencil_back));
|
||||
mapped.stencil_front(&map_stencil_state_face_descriptor(&desc.stencil_front));
|
||||
mapped.stencil_read_mask(desc.stencil_read_mask);
|
||||
mapped.stencil_write_mask(desc.stencil_write_mask);
|
||||
mapped.stencil_back(&map_stencil_state_face_descriptor(&desc.stencil.back));
|
||||
mapped.stencil_front(&map_stencil_state_face_descriptor(&desc.stencil.front));
|
||||
mapped.stencil_read_mask(desc.stencil.read_mask);
|
||||
mapped.stencil_write_mask(desc.stencil.write_mask);
|
||||
mapped
|
||||
}
|
||||
|
||||
@@ -1091,8 +1086,8 @@ impl crate::Context for Context {
|
||||
mapped_desc.address_mode_u(map_address_mode(desc.address_mode_u));
|
||||
mapped_desc.address_mode_v(map_address_mode(desc.address_mode_v));
|
||||
mapped_desc.address_mode_w(map_address_mode(desc.address_mode_w));
|
||||
if let Some(compare) = desc.compare.and_then(map_compare_function) {
|
||||
mapped_desc.compare(compare);
|
||||
if let Some(compare) = desc.compare {
|
||||
mapped_desc.compare(map_compare_function(compare));
|
||||
}
|
||||
mapped_desc.lod_max_clamp(desc.lod_max_clamp);
|
||||
mapped_desc.lod_min_clamp(desc.lod_min_clamp);
|
||||
@@ -1194,27 +1189,26 @@ impl crate::Context for Context {
|
||||
fn texture_create_view(
|
||||
&self,
|
||||
texture: &Self::TextureId,
|
||||
desc: Option<&TextureViewDescriptor>,
|
||||
desc: &TextureViewDescriptor,
|
||||
) -> Self::TextureViewId {
|
||||
Sendable(match desc {
|
||||
Some(d) => {
|
||||
let mut mapped_desc = web_sys::GpuTextureViewDescriptor::new();
|
||||
mapped_desc.dimension(map_texture_view_dimension(d.dimension));
|
||||
mapped_desc.format(map_texture_format(d.format));
|
||||
mapped_desc.aspect(map_texture_aspect(d.aspect));
|
||||
mapped_desc.base_array_layer(d.base_array_layer);
|
||||
if let Some(count) = d.array_layer_count {
|
||||
mapped_desc.array_layer_count(count.get());
|
||||
}
|
||||
mapped_desc.base_mip_level(d.base_mip_level);
|
||||
if let Some(count) = d.level_count {
|
||||
mapped_desc.mip_level_count(count.get());
|
||||
}
|
||||
// TODO: label
|
||||
texture.0.create_view_with_descriptor(&mapped_desc)
|
||||
}
|
||||
None => texture.0.create_view(),
|
||||
})
|
||||
let mut mapped = web_sys::GpuTextureViewDescriptor::new();
|
||||
if let Some(dim) = desc.dimension {
|
||||
mapped.dimension(map_texture_view_dimension(dim));
|
||||
}
|
||||
if let Some(format) = desc.format {
|
||||
mapped.format(map_texture_format(format));
|
||||
}
|
||||
mapped.aspect(map_texture_aspect(desc.aspect));
|
||||
mapped.base_array_layer(desc.base_array_layer);
|
||||
if let Some(count) = desc.array_layer_count {
|
||||
mapped.array_layer_count(count.get());
|
||||
}
|
||||
mapped.base_mip_level(desc.base_mip_level);
|
||||
if let Some(count) = desc.level_count {
|
||||
mapped.mip_level_count(count.get());
|
||||
}
|
||||
// TODO: label
|
||||
Sendable(texture.0.create_view_with_descriptor(&mapped))
|
||||
}
|
||||
|
||||
fn texture_drop(&self, _texture: &Self::TextureId) {
|
||||
|
||||
@@ -38,10 +38,10 @@ pub use wgt::{
|
||||
DepthStencilStateDescriptor, DeviceDescriptor, DynamicOffset, Extent3d, Features, FilterMode,
|
||||
FrontFace, IndexFormat, InputStepMode, Limits, Origin3d, PowerPreference, PresentMode,
|
||||
PrimitiveTopology, PushConstantRange, RasterizationStateDescriptor, ShaderLocation,
|
||||
ShaderStage, StencilOperation, StencilStateFaceDescriptor, SwapChainDescriptor,
|
||||
SwapChainStatus, TextureAspect, TextureComponentType, TextureDataLayout, TextureDimension,
|
||||
TextureFormat, TextureUsage, TextureViewDimension, VertexAttributeDescriptor, VertexFormat,
|
||||
BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT,
|
||||
ShaderStage, StencilOperation, StencilStateDescriptor, StencilStateFaceDescriptor,
|
||||
SwapChainDescriptor, SwapChainStatus, TextureAspect, TextureComponentType, TextureDataLayout,
|
||||
TextureDimension, TextureFormat, TextureUsage, TextureViewDimension, VertexAttributeDescriptor,
|
||||
VertexFormat, BIND_BUFFER_ALIGNMENT, COPY_BUFFER_ALIGNMENT, COPY_BYTES_PER_ROW_ALIGNMENT,
|
||||
PUSH_CONSTANT_ALIGNMENT,
|
||||
};
|
||||
|
||||
@@ -291,7 +291,7 @@ trait Context: Debug + Send + Sized + Sync {
|
||||
fn texture_create_view(
|
||||
&self,
|
||||
texture: &Self::TextureId,
|
||||
desc: Option<&TextureViewDescriptor>,
|
||||
desc: &TextureViewDescriptor,
|
||||
) -> Self::TextureViewId;
|
||||
fn texture_drop(&self, texture: &Self::TextureId);
|
||||
fn texture_view_drop(&self, texture_view: &Self::TextureViewId);
|
||||
@@ -836,7 +836,7 @@ pub struct Queue {
|
||||
|
||||
/// Resource that can be bound to a pipeline.
|
||||
#[non_exhaustive]
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum BindingResource<'a> {
|
||||
/// Binding is backed by a buffer.
|
||||
///
|
||||
@@ -976,15 +976,15 @@ pub struct TextureDescriptor<'a> {
|
||||
}
|
||||
|
||||
/// Describes a [`TextureView`].
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
pub struct TextureViewDescriptor<'a> {
|
||||
/// Debug label of the texture view. This will show up in graphics debuggers for easy identification.
|
||||
pub label: Option<&'a str>,
|
||||
/// Format of the texture view. At this time, it must be the same as the underlying format of the texture.
|
||||
pub format: TextureFormat,
|
||||
pub format: Option<TextureFormat>,
|
||||
/// The dimension of the texture view. For 1D textures, this must be `1D`. For 2D textures it must be one of
|
||||
/// `D2`, `D2Array`, `Cube`, and `CubeArray`. For 3D textures it must be `3D`
|
||||
pub dimension: TextureViewDimension,
|
||||
pub dimension: Option<TextureViewDimension>,
|
||||
/// Aspect of the texture. Color textures must be [`TextureAspect::All`].
|
||||
pub aspect: TextureAspect,
|
||||
/// Base mip level.
|
||||
@@ -1006,6 +1006,8 @@ pub struct TextureViewDescriptor<'a> {
|
||||
/// A `PipelineLayoutDescriptor` can be used to create a pipeline layout.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct PipelineLayoutDescriptor<'a> {
|
||||
/// Debug label of the pipeline layout. This will show up in graphics debuggers for easy identification.
|
||||
pub label: Option<&'a str>,
|
||||
/// Bind groups that this pipeline uses. The first entry will provide all the bindings for
|
||||
/// "set = 0", second entry will provide all the bindings for "set = 1" etc.
|
||||
pub bind_group_layouts: &'a [&'a BindGroupLayout],
|
||||
@@ -1047,7 +1049,7 @@ pub struct SamplerDescriptor<'a> {
|
||||
impl Default for SamplerDescriptor<'_> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
label: Default::default(),
|
||||
label: None,
|
||||
address_mode_u: Default::default(),
|
||||
address_mode_v: Default::default(),
|
||||
address_mode_w: Default::default(),
|
||||
@@ -1056,18 +1058,24 @@ impl Default for SamplerDescriptor<'_> {
|
||||
mipmap_filter: Default::default(),
|
||||
lod_min_clamp: 0.0,
|
||||
lod_max_clamp: std::f32::MAX,
|
||||
compare: Default::default(),
|
||||
anisotropy_clamp: Default::default(),
|
||||
compare: None,
|
||||
anisotropy_clamp: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub use wgt::BindGroupEntry as BindGroupEntryBase;
|
||||
/// Bindable resource and the slot to bind it to.
|
||||
pub type BindGroupEntry<'a> = BindGroupEntryBase<BindingResource<'a>>;
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BindGroupEntry<'a> {
|
||||
/// Slot for which binding provides resource. Corresponds to an entry of the same
|
||||
/// binding index in the [`BindGroupLayoutDescriptor`].
|
||||
pub binding: u32,
|
||||
/// Resource to attach to the binding
|
||||
pub resource: BindingResource<'a>,
|
||||
}
|
||||
|
||||
/// Describes a group of bindings and the resources to be bound.
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct BindGroupDescriptor<'a> {
|
||||
/// Debug label of the bind group. This will show up in graphics debuggers for easy identification.
|
||||
pub label: Option<&'a str>,
|
||||
@@ -1732,16 +1740,7 @@ impl Texture {
|
||||
pub fn create_view(&self, desc: &TextureViewDescriptor) -> TextureView {
|
||||
TextureView {
|
||||
context: Arc::clone(&self.context),
|
||||
id: Context::texture_create_view(&*self.context, &self.id, Some(desc)),
|
||||
owned: true,
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates the default view of this whole texture. This is likely what you want.
|
||||
pub fn create_default_view(&self) -> TextureView {
|
||||
TextureView {
|
||||
context: Arc::clone(&self.context),
|
||||
id: Context::texture_create_view(&*self.context, &self.id, None),
|
||||
id: Context::texture_create_view(&*self.context, &self.id, desc),
|
||||
owned: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,6 @@ use std::{
|
||||
ptr::copy_nonoverlapping,
|
||||
};
|
||||
|
||||
#[cfg(all(not(target_arch = "wasm32"), feature = "subscriber"))]
|
||||
pub use wgc::logging::subscriber::{initialize_default_subscriber, ChromeTracingLayer};
|
||||
|
||||
pub use belt::StagingBelt;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user