mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
Scissor test
This commit is contained in:
parent
1d26225d5c
commit
f59c6f9f2f
14
Cargo.lock
generated
14
Cargo.lock
generated
@ -320,8 +320,8 @@ name = "examples"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wgpu 0.2.2",
|
||||
"wgpu-native 0.2.6",
|
||||
"wgpu 0.2.3",
|
||||
"wgpu-native 0.2.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -498,7 +498,7 @@ dependencies = [
|
||||
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glsl-to-spirv 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wgpu 0.2.2",
|
||||
"wgpu 0.2.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1384,10 +1384,10 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wgpu-native 0.2.6",
|
||||
"wgpu-native 0.2.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1399,7 +1399,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-native"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
dependencies = [
|
||||
"arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1425,7 +1425,7 @@ dependencies = [
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wgpu-native 0.2.6",
|
||||
"wgpu-native 0.2.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -804,6 +804,12 @@ void wgpu_render_pass_set_index_buffer(WGPURenderPassId pass_id,
|
||||
|
||||
void wgpu_render_pass_set_pipeline(WGPURenderPassId pass_id, WGPURenderPipelineId pipeline_id);
|
||||
|
||||
void wgpu_render_pass_set_scissor_rect(WGPURenderPassId pass_id,
|
||||
uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t w,
|
||||
uint32_t h);
|
||||
|
||||
void wgpu_render_pass_set_vertex_buffers(WGPURenderPassId pass_id,
|
||||
const WGPUBufferId *buffer_ptr,
|
||||
const uint32_t *offset_ptr,
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wgpu-native"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
authors = [
|
||||
"Dzmitry Malyshau <kvark@mozilla.com>",
|
||||
"Joshua Groves <josh@joshgroves.com>",
|
||||
|
@ -303,3 +303,30 @@ pub extern "C" fn wgpu_render_pass_set_blend_color(
|
||||
pass.raw.set_blend_constants(conv::map_color(color));
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wgpu_render_pass_set_scissor_rect(
|
||||
pass_id: RenderPassId,
|
||||
x: u32,
|
||||
y: u32,
|
||||
w: u32,
|
||||
h: u32,
|
||||
) {
|
||||
let mut pass_guard = HUB.render_passes.write();
|
||||
let pass = &mut pass_guard[pass_id];
|
||||
|
||||
unsafe {
|
||||
use std::convert::TryFrom;
|
||||
use std::i16;
|
||||
|
||||
pass.raw.set_scissors(
|
||||
0,
|
||||
&[hal::pso::Rect {
|
||||
x: i16::try_from(x).unwrap_or(0),
|
||||
y: i16::try_from(y).unwrap_or(0),
|
||||
w: i16::try_from(w).unwrap_or(i16::MAX),
|
||||
h: i16::try_from(h).unwrap_or(i16::MAX),
|
||||
}],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wgpu"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
authors = [
|
||||
"Dzmitry Malyshau <kvark@mozilla.com>",
|
||||
"Joshua Groves <josh@joshgroves.com>",
|
||||
@ -23,5 +23,5 @@ dx12 = ["wgpu-native/gfx-backend-dx12"]
|
||||
vulkan = ["wgpu-native/gfx-backend-vulkan"]
|
||||
|
||||
[dependencies]
|
||||
wgpu-native = { version = "0.2.5", path = "../wgpu-native", features = ["local"] }
|
||||
wgpu-native = { version = "0.2.7", path = "../wgpu-native", features = ["local"] }
|
||||
arrayvec = "0.4"
|
||||
|
@ -807,6 +807,10 @@ impl<'a> RenderPass<'a> {
|
||||
);
|
||||
}
|
||||
|
||||
pub fn set_scissor_rect(&mut self, x: u32, y: u32, w: u32, h: u32) {
|
||||
wgn::wgpu_render_pass_set_scissor_rect(self.id, x, y, w, h)
|
||||
}
|
||||
|
||||
pub fn draw(&mut self, vertices: Range<u32>, instances: Range<u32>) {
|
||||
wgn::wgpu_render_pass_draw(
|
||||
self.id,
|
||||
|
Loading…
Reference in New Issue
Block a user