mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-24 08:21:25 +01:00
Merge #370
370: API update for RODS2 r=cwfitzgerald a=kvark Reflects upstream changes in https://github.com/gfx-rs/wgpu/pull/716 I'm not too happy about the API just yet, has another idea that I'm going to discuss with the group on Monday, hopefully. But we need to get going and not block other wgpu-rs changes, so this should land in some way. Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
This commit is contained in:
commit
16054f2e41
9 files changed
+50
-27
No files matched your search
+3
-3
@@ -28,20 +28,20 @@ vulkan = ["wgc/gfx-backend-vulkan"]
|
||||
package = "wgpu-core"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "b0b99d89b71894cf01d8c938aae87b2348edeb5b"
|
||||
rev = "ad34c37127c8361bc2b07e8775816b2bbf8c0a73"
|
||||
features = ["raw-window-handle"]
|
||||
|
||||
[dependencies.wgt]
|
||||
package = "wgpu-types"
|
||||
version = "0.5"
|
||||
git = "https://github.com/gfx-rs/wgpu"
|
||||
rev = "b0b99d89b71894cf01d8c938aae87b2348edeb5b"
|
||||
rev = "ad34c37127c8361bc2b07e8775816b2bbf8c0a73"
|
||||
|
||||
[dependencies]
|
||||
arrayvec = "0.5"
|
||||
futures = "0.3"
|
||||
smallvec = "1"
|
||||
typed-arena = "2.0.1"
|
||||
typed-arena = "2"
|
||||
raw-window-handle = "0.3"
|
||||
parking_lot = "0.10"
|
||||
|
||||
|
||||
@@ -224,7 +224,10 @@ impl framework::Example for Example {
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(&texture_view),
|
||||
resource: wgpu::BindingResource::TextureView {
|
||||
view: &texture_view,
|
||||
read_only_depth_stencil: false,
|
||||
},
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 2,
|
||||
|
||||
@@ -180,7 +180,10 @@ impl Example {
|
||||
bindings: &[
|
||||
wgpu::Binding {
|
||||
binding: 0,
|
||||
resource: wgpu::BindingResource::TextureView(&views[target_mip - 1]),
|
||||
resource: wgpu::BindingResource::TextureView {
|
||||
view: &views[target_mip - 1],
|
||||
read_only_depth_stencil: false,
|
||||
},
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 1,
|
||||
@@ -328,7 +331,10 @@ impl framework::Example for Example {
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(&texture_view),
|
||||
resource: wgpu::BindingResource::TextureView {
|
||||
view: &texture_view,
|
||||
read_only_depth_stencil: false,
|
||||
},
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 2,
|
||||
|
||||
@@ -575,7 +575,10 @@ impl framework::Example for Example {
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 2,
|
||||
resource: wgpu::BindingResource::TextureView(&shadow_view),
|
||||
resource: wgpu::BindingResource::TextureView {
|
||||
view: &shadow_view,
|
||||
read_only_depth_stencil: false,
|
||||
},
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 3,
|
||||
|
||||
@@ -222,7 +222,10 @@ impl framework::Example for Skybox {
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 1,
|
||||
resource: wgpu::BindingResource::TextureView(&texture_view),
|
||||
resource: wgpu::BindingResource::TextureView {
|
||||
view: &texture_view,
|
||||
read_only_depth_stencil: false,
|
||||
},
|
||||
},
|
||||
wgpu::Binding {
|
||||
binding: 2,
|
||||
|
||||
@@ -71,7 +71,7 @@ struct Example {
|
||||
impl framework::Example for Example {
|
||||
fn needed_extensions() -> (wgpu::Extensions, wgpu::UnsafeExtensions) {
|
||||
(
|
||||
wgpu::Extensions::TEXTURE_BINDING_ARRAY,
|
||||
wgpu::Extensions::SAMPLED_TEXTURE_BINDING_ARRAY,
|
||||
wgpu::UnsafeExtensions::disallow(),
|
||||
)
|
||||
}
|
||||
@@ -83,8 +83,8 @@ impl framework::Example for Example {
|
||||
let device_extensions = device.extensions();
|
||||
|
||||
assert!(
|
||||
device_extensions.contains(wgpu::Extensions::TEXTURE_BINDING_ARRAY),
|
||||
"Graphics Device does not support TEXTURE_BINDING_ARRAY extension"
|
||||
device_extensions.contains(wgpu::Extensions::SAMPLED_TEXTURE_BINDING_ARRAY),
|
||||
"Graphics Device does not support SAMPLED_TEXTURE_BINDING_ARRAY extension"
|
||||
);
|
||||
|
||||
let vertex_size = std::mem::size_of::<Vertex>();
|
||||
|
||||
+16
-12
@@ -405,7 +405,7 @@ impl crate::Context for Context {
|
||||
) -> Self::BindGroupId {
|
||||
use wgc::binding_model as bm;
|
||||
|
||||
let texture_view_arena: Arena<wgc::id::TextureViewId> = Arena::new();
|
||||
let texture_view_arena: Arena<bm::TextureBinding> = Arena::new();
|
||||
let bindings = desc
|
||||
.bindings
|
||||
.iter()
|
||||
@@ -414,22 +414,26 @@ impl crate::Context for Context {
|
||||
resource: match binding.resource {
|
||||
BindingResource::Buffer(ref buffer_slice) => {
|
||||
bm::BindingResource::Buffer(bm::BufferBinding {
|
||||
buffer: buffer_slice.buffer.id,
|
||||
buffer_id: buffer_slice.buffer.id,
|
||||
offset: buffer_slice.offset,
|
||||
size: buffer_slice.size,
|
||||
})
|
||||
}
|
||||
BindingResource::Sampler(ref sampler) => {
|
||||
bm::BindingResource::Sampler(sampler.id)
|
||||
}
|
||||
BindingResource::TextureView(ref texture_view) => {
|
||||
bm::BindingResource::TextureView(texture_view.id)
|
||||
}
|
||||
BindingResource::Sampler(sampler) => bm::BindingResource::Sampler(sampler.id),
|
||||
BindingResource::TextureView {
|
||||
view,
|
||||
read_only_depth_stencil,
|
||||
} => bm::BindingResource::TextureView(bm::TextureBinding {
|
||||
view_id: view.id,
|
||||
read_only_depth_stencil,
|
||||
}),
|
||||
BindingResource::TextureViewArray(texture_view_array) => {
|
||||
bm::BindingResource::TextureViewArray(
|
||||
texture_view_arena
|
||||
.alloc_extend(texture_view_array.iter().map(|view| view.id)),
|
||||
)
|
||||
bm::BindingResource::TextureViewArray(texture_view_arena.alloc_extend(
|
||||
texture_view_array.iter().map(|view| bm::TextureBinding {
|
||||
view_id: view.id,
|
||||
read_only_depth_stencil: false, //TODO
|
||||
}),
|
||||
))
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
+4
-3
@@ -859,9 +859,10 @@ impl crate::Context for Context {
|
||||
JsValue::from(mapped_buffer_binding.clone())
|
||||
}
|
||||
BindingResource::Sampler(ref sampler) => JsValue::from(sampler.id.0.clone()),
|
||||
BindingResource::TextureView(ref texture_view) => {
|
||||
JsValue::from(texture_view.id.0.clone())
|
||||
}
|
||||
BindingResource::TextureView {
|
||||
view: ref texture_view,
|
||||
read_only_depth_stencil: _,
|
||||
} => JsValue::from(texture_view.id.0.clone()),
|
||||
BindingResource::TextureViewArray(..) => {
|
||||
panic!("Web backend does not support TEXTURE_BINDING_ARRAY extension")
|
||||
}
|
||||
|
||||
+4
-1
@@ -697,7 +697,10 @@ pub struct Queue {
|
||||
pub enum BindingResource<'a> {
|
||||
Buffer(BufferSlice<'a>),
|
||||
Sampler(&'a Sampler),
|
||||
TextureView(&'a TextureView),
|
||||
TextureView {
|
||||
view: &'a TextureView,
|
||||
read_only_depth_stencil: bool,
|
||||
},
|
||||
TextureViewArray(&'a [TextureView]),
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user