Skip to content

Commit 443de13

Browse files
committed
* Get rid of shared crate.
* Add lint rules. * Add `rustfmt.toml` for predictable formatting. * Update dependencies. * Add a shader prelude.
1 parent b1b7921 commit 443de13

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1246
-678
lines changed

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# From: https://docs.github.com/en/github/getting-started-with-github/configuring-git-to-handle-line-endings
2+
# Set the default behavior for line endings.
3+
* text=auto eol=lf
4+
5+
# Declare files that will always have CRLF line endings on checkout.
6+
*.sln text eol=crlf
7+
8+
# Denote all files that are truly binary and should not be modified.
9+
*.png binary
10+
*.jpg binary
11+
*.ttf binary

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
rustc-ice-*.txt

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"rust-analyzer.cargo.targetDir": true,
3+
//"rust-analyzer.check.command": "clippy",
4+
}

Cargo.lock

Lines changed: 4 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 73 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,22 @@ use-installed-tools = ["spirv-builder/use-installed-tools"]
1111
use-compiled-tools = ["spirv-builder/use-compiled-tools"]
1212

1313
[dependencies]
14-
shared = { path = "shared" }
14+
shadertoys-shaders = { path = "shaders" }
1515
futures = { version = "0.3", default-features = false, features = [
1616
"std",
17-
"executor"
18-
] }
19-
wgpu = { version = "25.0.0", features = [
20-
"spirv",
21-
"vulkan-portability"
17+
"executor",
2218
] }
19+
wgpu = { version = "25.0.0", features = ["spirv", "vulkan-portability"] }
2320
winit = { git = "https://github.com/rust-windowing/winit.git", rev = "cdbdd974fbf79b82b3fb1a4bc84ed717312a3bd2" }
24-
bytemuck = "1.20.0"
21+
bytemuck = "1.23.0"
2522
env_logger = "0.11.6"
2623
ouroboros = "0.18.5"
2724

2825
[build-dependencies]
2926
spirv-builder.workspace = true
3027

3128
[workspace]
32-
members = ["shaders", "shared"]
29+
members = ["shaders"]
3330

3431
[workspace.dependencies]
3532
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "0b37696e9f5edde8fa0c1363a88e6c8cb8e6ff68", default-features = false }
@@ -53,7 +50,74 @@ opt-level = 3
5350
[profile.release.package."shadertoys-shaders"]
5451
opt-level = 0
5552

53+
[workspace.lints.clippy]
54+
# disabled because shader code does this often
55+
cast_precision_loss = "allow"
56+
cast_possible_truncation = "allow"
57+
excessive_precision = "allow"
58+
missing_const_for_fn = "allow"
59+
many_single_char_names = "allow"
60+
similar_names = "allow"
61+
too_many_arguments = "allow"
62+
suboptimal_flops = "allow"
63+
too_many_lines = "allow"
64+
cognitive_complexity = "allow"
65+
# disabled because of rust gpu limitatoins
66+
manual_range_contains = "allow" # Rust gpu does not like the core range checks
67+
needless_range_loop = "allow" # Rust gpu does not like iterators very much
68+
manual_swap = "allow" # Rust gpu does not like the core swap function
69+
# temporarily disabled rules
70+
inline_always = "allow" # need some hard numbers for this
71+
unreadable_literal = "allow" # Maybe fix this?
72+
useless_let_if_seq = "allow" # Maybe fix this?
73+
used_underscore_items = "allow" # Maybe fix this?
74+
no_effect_underscore_binding = "allow" # Maybe fix this?
75+
76+
# standard rules for idiomatic Rust code
77+
let_and_return = "allow"
78+
needless_lifetimes = "allow"
79+
option_if_let_else = "allow"
80+
# see: https://github.com/bevyengine/bevy/pull/15375#issuecomment-2366966219
81+
too_long_first_doc_paragraph = "allow"
82+
missing_panics_doc = "allow"
83+
doc-markdown = "allow"
84+
85+
nursery = { priority = -1, level = "warn" }
86+
pedantic = { priority = -1, level = "warn" }
87+
doc_markdown = "warn"
88+
manual_let_else = "warn"
89+
match_same_arms = "warn"
90+
redundant_closure_for_method_calls = "warn"
91+
redundant_else = "warn"
92+
semicolon_if_nothing_returned = "warn"
93+
type_complexity = "allow"
94+
undocumented_unsafe_blocks = "warn"
95+
unwrap_or_default = "warn"
96+
97+
ptr_as_ptr = "warn"
98+
ptr_cast_constness = "warn"
99+
ref_as_ptr = "warn"
100+
101+
std_instead_of_core = "warn"
102+
std_instead_of_alloc = "warn"
103+
alloc_instead_of_core = "warn"
104+
56105
[workspace.lints.rust]
106+
nonstandard-style = "warn"
107+
future-incompatible = "warn"
108+
missing_docs = "allow" # TODO: warn
109+
unused = { priority = -1, level = "warn" }
110+
rust_2018_idioms = { priority = -1, level = "warn" }
111+
rust-2024-compatibility = "warn"
112+
array-into-iter = "warn"
113+
bare-trait-objects = "warn"
114+
ellipsis-inclusive-range-patterns = "warn"
115+
non-fmt-panics = "warn"
116+
explicit-outlives-requirements = "warn"
117+
unused-extern-crates = "warn"
118+
unsafe_code = "allow" # TODO: forbid
119+
unsafe_op_in_unsafe_fn = "warn"
120+
unused_qualifications = "warn"
57121
unexpected_cfgs = { level = "allow", check-cfg = [
58-
'cfg(target_arch, values("spirv"))'
122+
'cfg(target_arch, values("spirv"))',
59123
] }

clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
check-private-items = true

rustfmt.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
match_block_trailing_comma = true
2+
tab_spaces = 4
3+
condense_wildcard_suffixes = false
4+
newline_style = "Unix"
5+
6+
# The options below are unstable
7+
unstable_features = true
8+
imports_granularity = "Crate"
9+
normalize_comments = false # Often doesn't do what you want
10+
11+
# these options seem poorly implemented and cause churn, so, try to avoid them
12+
# wrap_comments = true
13+
# comment_width = 100

shaders/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ crate-type = ["dylib"]
99

1010
[dependencies]
1111
spirv-std.workspace = true
12-
shared = { path = "../shared" }
12+
bytemuck = { version = "1.23.0", features = ["derive"] }
1313

1414
[lints]
1515
workspace = true

0 commit comments

Comments
 (0)