Skip to content

Commit 9b7a399

Browse files
committed
wgpu: add api choice wgpu
1 parent cfe1300 commit 9b7a399

File tree

6 files changed

+102
-1
lines changed

6 files changed

+102
-1
lines changed

graphics/cargo-generate.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ ignore = ["target", "mygraphics/src/bin"]
33
exclude = ["target", "mygraphics/src/bin"]
44

55
[placeholders]
6-
api = { prompt = "What API?", choices = ["ash"], default = "ash", type = "string" }
6+
api = { prompt = "What API?", choices = ["wgpu", "ash"], default = "wgpu", type = "string" }
77
integration = { prompt = "How to integrate rust-gpu?", choices = ["cargo-gpu", "spirv-builder"], default = "cargo-gpu", type = "string" }
88

99
[conditional.'integration != "spirv-builder"']
1010
ignore = [ "rust-toolchain.toml" ]
11+
12+
[conditional.'api == "ash"']
13+
ignore = [ "mygraphics/src/wgpu_renderer" ]
14+
15+
[conditional.'api == "wgpu"']
16+
ignore = [ "mygraphics/src/ash_renderer" ]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub fn main() -> anyhow::Result<()> {
2+
mygraphics::wgpu_renderer::main()
3+
}

graphics/mygraphics/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@
7272

7373
pub mod ash_renderer;
7474
pub mod util;
75+
pub mod wgpu_renderer;
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// FIXME(eddyb) update/review these lints.
2+
//
3+
// BEGIN - Embark standard lints v0.4
4+
// do not change or add/remove here, but one can add exceptions after this section
5+
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
6+
//#![deny(unsafe_code)] // impractical in this crate dealing with unsafe `ash`
7+
#![warn(
8+
clippy::all,
9+
clippy::await_holding_lock,
10+
clippy::char_lit_as_u8,
11+
clippy::checked_conversions,
12+
clippy::dbg_macro,
13+
clippy::debug_assert_with_mut_call,
14+
clippy::doc_markdown,
15+
clippy::empty_enum,
16+
clippy::enum_glob_use,
17+
clippy::exit,
18+
clippy::expl_impl_clone_on_copy,
19+
clippy::explicit_deref_methods,
20+
clippy::explicit_into_iter_loop,
21+
clippy::fallible_impl_from,
22+
clippy::filter_map_next,
23+
clippy::float_cmp_const,
24+
clippy::fn_params_excessive_bools,
25+
clippy::if_let_mutex,
26+
clippy::implicit_clone,
27+
clippy::imprecise_flops,
28+
clippy::inefficient_to_string,
29+
clippy::invalid_upcast_comparisons,
30+
clippy::large_types_passed_by_value,
31+
clippy::let_unit_value,
32+
clippy::linkedlist,
33+
clippy::lossy_float_literal,
34+
clippy::macro_use_imports,
35+
clippy::manual_ok_or,
36+
clippy::map_err_ignore,
37+
clippy::map_flatten,
38+
clippy::map_unwrap_or,
39+
clippy::match_same_arms,
40+
clippy::match_wildcard_for_single_variants,
41+
clippy::mem_forget,
42+
clippy::mut_mut,
43+
clippy::mutex_integer,
44+
clippy::needless_borrow,
45+
clippy::needless_continue,
46+
clippy::option_option,
47+
clippy::path_buf_push_overwrite,
48+
clippy::ptr_as_ptr,
49+
clippy::ref_option_ref,
50+
clippy::rest_pat_in_fully_bound_structs,
51+
clippy::same_functions_in_if_condition,
52+
clippy::semicolon_if_nothing_returned,
53+
clippy::string_add_assign,
54+
clippy::string_add,
55+
clippy::string_lit_as_bytes,
56+
clippy::string_to_string,
57+
clippy::todo,
58+
clippy::trait_duplication_in_bounds,
59+
clippy::unimplemented,
60+
clippy::unnested_or_patterns,
61+
clippy::unused_self,
62+
clippy::useless_transmute,
63+
clippy::verbose_file_reads,
64+
clippy::zero_sized_map_values,
65+
future_incompatible,
66+
nonstandard_style,
67+
rust_2018_idioms
68+
)]
69+
// END - Embark standard lints v0.4
70+
// crate-specific exceptions:
71+
// #![allow()]
72+
73+
{% if api == "ash" -%}
74+
pub mod ash_renderer;
75+
{%- endif -%}
76+
{%- if api == "wgpu" -%}
77+
pub mod wgpu_renderer;
78+
{%- endif %}
79+
pub mod util;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pub fn main() -> anyhow::Result<()> {
2+
{%- if api == "ash" %}
3+
mygraphics::ash_renderer::main()
4+
{%- endif -%}
5+
{%- if api == "wgpu" %}
6+
mygraphics::wgpu_renderer::main()
7+
{%- endif %}
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pub fn main() -> anyhow::Result<()> {
2+
println!("wgpu renderer");
3+
Ok(())
4+
}

0 commit comments

Comments
 (0)