mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
[rs] Framework and README update
This commit is contained in:
parent
f438f0b920
commit
e98f36245b
@ -12,41 +12,41 @@ All the examples use [WGSL](https://gpuweb.github.io/gpuweb/wgsl.html) shaders u
|
||||
All framework-based examples render to the window.
|
||||
|
||||
## Feature matrix
|
||||
| Feature | boids | cube | mipmap | msaa-line | shadow | skybox | texture-arrays | water | conservative-raster |
|
||||
| ---------------------------- | ------ | ------ | ------ | --------- | ------ | ------ | -------------- | ------ | ------------------- |
|
||||
| vertex attributes | :star: | :star: | | :star: | :star: | :star: | :star: | :star: | |
|
||||
| instancing | :star: | | | | | | | | |
|
||||
| lines and points | | | | :star: | | | | | :star: |
|
||||
| dynamic buffer offsets | | | | | :star: | | | | |
|
||||
| implicit layout | | | :star: | | | | | | |
|
||||
| sampled color textures | :star: | :star: | :star: | | | :star: | :star: | :star: | :star: |
|
||||
| storage textures | :star: | | | | | | | | |
|
||||
| binding array | | | | | | | :star: | | |
|
||||
| comparison samplers | | | | | :star: | | | | |
|
||||
| subresource views | | | :star: | | :star: | | | | |
|
||||
| cubemaps | | | | | | :star: | | | |
|
||||
| multisampling | | | | :star: | | | | | |
|
||||
| off-screen rendering | | | | | :star: | | | :star: | :star: |
|
||||
| stencil testing | | | | | | | | | |
|
||||
| depth testing | | | | | :star: | :star: | | :star: | |
|
||||
| depth biasing | | | | | :star: | | | | |
|
||||
| read-only depth | | | | | | | | :star: | |
|
||||
| blending | | :star: | | | | | | :star: | |
|
||||
| render bundles | | | | :star: | | | | :star: | |
|
||||
| compute passes | :star: | | | | | | | | |
|
||||
| *optional extensions* | | | | | | | :star: | | |
|
||||
| - SPIR-V shaders | | | | | | | :star: | | |
|
||||
| - binding indexing | | | | | | | :star: | | |
|
||||
| - push constants | | | | | | | :star: | | |
|
||||
| - depth clamping | | | | | :star: | | | | |
|
||||
| - compressed textures | | | | | | :star: | | | |
|
||||
| - polygon mode | | :star: | | | | | | | |
|
||||
| - queries | | | :star: | | | | | | |
|
||||
| - conservative rasterization | | | | | | | | | :star: |
|
||||
| *integrations* | | | | | | | | | |
|
||||
| - staging belt | | | | | | | | | |
|
||||
| - typed arena | | | | | | | | | |
|
||||
| - obj loading | | | | | | :star: | | | |
|
||||
| Feature | boids | bunnymark | cube | mipmap | msaa-line | shadow | skybox | texture-arrays | water | conservative-raster |
|
||||
| ---------------------------- | ------ | --------- | ------ | ------ | --------- | ------ | ------ | -------------- | ------ | ------------------- |
|
||||
| vertex attributes | :star: | | :star: | | :star: | :star: | :star: | :star: | :star: | |
|
||||
| instancing | :star: | | | | | | | | | |
|
||||
| lines and points | | | | | :star: | | | | | :star: |
|
||||
| dynamic buffer offsets | | :star: | | | | :star: | | | | |
|
||||
| implicit layout | | | | :star: | | | | | | |
|
||||
| sampled color textures | :star: | :star: | :star: | :star: | | | :star: | :star: | :star: | :star: |
|
||||
| storage textures | :star: | | | | | | | | | |
|
||||
| binding array | | | | | | | | :star: | | |
|
||||
| comparison samplers | | | | | | :star: | | | | |
|
||||
| subresource views | | | | :star: | | :star: | | | | |
|
||||
| cubemaps | | | | | | | :star: | | | |
|
||||
| multisampling | | | | | :star: | | | | | |
|
||||
| off-screen rendering | | | | | | :star: | | | :star: | :star: |
|
||||
| stencil testing | | | | | | | | | | |
|
||||
| depth testing | | | | | | :star: | :star: | | :star: | |
|
||||
| depth biasing | | | | | | :star: | | | | |
|
||||
| read-only depth | | | | | | | | | :star: | |
|
||||
| blending | | :star: | :star: | | | | | | :star: | |
|
||||
| render bundles | | | | | :star: | | | | :star: | |
|
||||
| compute passes | :star: | | | | | | | | | |
|
||||
| *optional extensions* | | | | | | | | :star: | | |
|
||||
| - SPIR-V shaders | | | | | | | | :star: | | |
|
||||
| - binding indexing | | | | | | | | :star: | | |
|
||||
| - push constants | | | | | | | | :star: | | |
|
||||
| - depth clamping | | | | | | :star: | | | | |
|
||||
| - compressed textures | | | | | | | :star: | | | |
|
||||
| - polygon mode | | | :star: | | | | | | | |
|
||||
| - queries | | | | :star: | | | | | | |
|
||||
| - conservative rasterization | | | | | | | | | | :star: |
|
||||
| *integrations* | | | | | | | | | | |
|
||||
| - staging belt | | | | | | | | | | |
|
||||
| - typed arena | | | | | | | | | | |
|
||||
| - obj loading | | | | | | | :star: | | | |
|
||||
|
||||
## Hacking
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 15 KiB |
@ -38,7 +38,6 @@ struct Example {
|
||||
}
|
||||
|
||||
impl framework::Example for Example {
|
||||
/// constructs initial instance of Example struct
|
||||
fn init(
|
||||
sc_desc: &wgpu::SwapChainDescriptor,
|
||||
_adapter: &wgpu::Adapter,
|
||||
@ -132,7 +131,7 @@ impl framework::Example for Example {
|
||||
});
|
||||
|
||||
let texture = {
|
||||
let img_data = include_bytes!("icon.png");
|
||||
let img_data = include_bytes!("../../logo.png");
|
||||
let decoder = png::Decoder::new(std::io::Cursor::new(img_data));
|
||||
let (info, mut reader) = decoder.read_info().unwrap();
|
||||
let mut buf = vec![0; info.buffer_size()];
|
||||
@ -247,7 +246,6 @@ impl framework::Example for Example {
|
||||
}
|
||||
}
|
||||
|
||||
/// update is called for any WindowEvent not handled by the framework
|
||||
fn update(&mut self, event: winit::event::WindowEvent) {
|
||||
if let winit::event::WindowEvent::KeyboardInput {
|
||||
input:
|
||||
@ -278,7 +276,6 @@ impl framework::Example for Example {
|
||||
}
|
||||
}
|
||||
|
||||
/// resize is called on WindowEvent::Resized events
|
||||
fn resize(
|
||||
&mut self,
|
||||
_sc_desc: &wgpu::SwapChainDescriptor,
|
||||
@ -288,8 +285,6 @@ impl framework::Example for Example {
|
||||
//empty
|
||||
}
|
||||
|
||||
/// render is called each frame, dispatching compute groups proportional
|
||||
/// a TriangleList draw call for all NUM_PARTICLES at 3 vertices each
|
||||
fn render(
|
||||
&mut self,
|
||||
frame: &wgpu::SwapChainTexture,
|
||||
|
@ -211,6 +211,10 @@ fn start<E: Example>(
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let mut last_update_inst = Instant::now();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let mut last_frame_inst = Instant::now();
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
let (mut frame_count, mut accum_time) = (0, 0.0);
|
||||
|
||||
log::info!("Entering render loop...");
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
@ -275,6 +279,21 @@ fn start<E: Example>(
|
||||
}
|
||||
},
|
||||
event::Event::RedrawRequested(_) => {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
accum_time += last_frame_inst.elapsed().as_secs_f32();
|
||||
last_frame_inst = Instant::now();
|
||||
frame_count += 1;
|
||||
if frame_count == 100 {
|
||||
println!(
|
||||
"Avg frame time {}ms",
|
||||
accum_time * 1000.0 / frame_count as f32
|
||||
);
|
||||
accum_time = 0.0;
|
||||
frame_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
let frame = match swap_chain.get_current_frame() {
|
||||
Ok(frame) => frame,
|
||||
Err(_) => {
|
||||
|
@ -1080,7 +1080,7 @@ impl crate::Context for Context {
|
||||
}
|
||||
}
|
||||
|
||||
fn adapter_downlevel_properties(&self, adapter: &Self::AdapterId) -> wgt::DownlevelProperties {
|
||||
fn adapter_downlevel_properties(&self, _adapter: &Self::AdapterId) -> wgt::DownlevelProperties {
|
||||
// WebGPU is assumed to be fully compliant
|
||||
wgt::DownlevelProperties::default()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user