Commit Graph

52 Commits

Author SHA1 Message Date
Viktor Zoutman
2dd8dba3b0
Moved some functions to a shared crate (#255)
* Moved some functions to a shared crate

* fmt!

* fixed the cpu
2020-11-18 14:27:32 +00:00
XAMPPRocky
c1c72517c8
Update ash-molten to compile on macOS (#252) 2020-11-18 10:33:10 +00:00
Viktor Zoutman
ec89ddf446
Sky shader Improvements. (#245)
* Added some constants to the shader

* did something for a certain video i forgot to revert

* removed unused function

* cleanup

* cpu runner now works

* explicit naming

* removed paranthesis

* clippy

* CLIPPY
2020-11-16 15:17:09 +00:00
Viktor Zoutman
2d75e0473f
Merged wgpu runners (#241)
* Added clap to switch between shaders

* Merged wgpu runners

* tested something related to async which i forgot to udno

* clippy

* xamprocky suggestion
2020-11-16 11:21:33 +00:00
Viktor Zoutman
0f78bd3e6b
Added clap to switch between shaders (#240) 2020-11-13 18:37:30 +00:00
XAMPPRocky
45f2312947
Put shader modules at the top of the example runners (#229) 2020-11-13 11:19:23 +00:00
Marijn Suijten
e8aef14347
Add Android support to wgpu example (#215)
* examples/wgpu: Handle escape to exit (same as ash example)

* examples/wgpu: Set up for use on Android

* examples/wgpu: Convert #[cfg] blocks to cfg_if

* examples/wgpu: Wait for events instead of busy-looping

The image currently does not change and the OS will notify us when to
redraw (ie. after window resizes). This is going to save power
especially on mobile devices.

As soon as interactive or animating visuals are introduced to this
example redraws can be requested with `window.request_redraw()`.

* examples/wgpu: Create swapchain in ::Resume on Android

* docs: Add Android to supported operating systems

* ci: Build test cross-compilation for Android

* HACK: ci: Create Android symlink without spaces

* ci: Set legacy ANDROID_HOME because ndk-build prefers deprecated var
2020-11-11 16:32:02 +01:00
XAMPPRocky
c2ccdbe6ef
Update glam and re-export glam from spirv_std (#220) 2020-11-11 08:13:37 +00:00
Ashley Hauck
bfa0f50f9b
Update ash-molten to use version 0.7 (#218)
The moltenvk-1.1.0 branch no longer exists
2020-11-10 09:29:50 +00:00
XAMPPRocky
cf52d51199
Add changes to compile rust-gpu on the latest nightly (#212)
* Update DILocation and update trait impls for nightly

* rustc_codegen_spirv: Update mir Scalar handling to nightly 2020-11-04

3a7970848c
df4d717d0b

* More changes to compile on the latest nightly

* Remove unused import warnings

Co-authored-by: Marijn Suijten <marijns95@gmail.com>
2020-11-10 08:16:25 +00:00
charles-r-earp
32c2ea58bc
Compute Shaders + ExecutionMode's (#195)
* Created examples/ wgpu-example-compute-runner + wgpu-example-compute-shader.

* Working compute example, can compile and run, set local_size. Validated changes do not break rendering example.

* Added complete list of ExecutionMode's to be specified underneath ExecutionModel. Replaced SpirvAttribute::Entry ExecutionModel with an Entry struct, which includes a Vec of ExecutionMode, ExecutionModeExtra to be submitted in entry.rs. Compute example runs. Passes all tests.

* Changed Cargo license info for compute examples. Simplified compute runner to be more similar to other wgpu example. Split of entry logic in symbol.rs to separate function. Fixed issue in builder/mod.rs.

* Pulled in reorganization changes to crates + examples. In symbols.rs moved really_unsafe_ignore_bitcasts to its own Symbol match. In entry.rs, entry stubs now return the fn_id, so that entry_stub() can add the execution modes in one place. Passed all tests.

* cargo fmt

* Removed duplicate examples. Fixed cargo fmt bug in compute runner.
2020-11-10 08:10:21 +00:00
XAMPPRocky
ad610b57f5
Move top-level crates to crates/ directory (#200)
* Move top-level crates to crates/ directory

* Update docs

* Update test.sh

* Update docs.sh

* Update clippy.sh
2020-11-02 11:26:10 +01:00
Christofer Nolander
982dcfaa35
Make all example windows 720p by default (#184) 2020-11-01 17:31:04 -07:00
Johan Andersson
9af1e84e90 Fix glam no_std handling in new version 2020-10-31 00:52:17 +01:00
Johan Andersson
8bec12831a Upgrade to latest glam fork rev 2020-10-31 00:38:23 +01:00
Johan Andersson
e0595dc80c Consistent example window titles 2020-10-31 00:35:00 +01:00
Johan Andersson
26db9c140f Disable publishing of example crates 2020-10-31 00:00:41 +01:00
Gray Olson
b12a2f3f6a
Cleanup pass on example shader and vk example-runner (#109)
* get rid of vertex buffers in example

* get rid of unused attributes in example shader

* use negative viewport height to match wgpu

* remove depth buffer

* use SRGB surface

* improve tonemapping

remove 'gamma correction' in favor of hardware srgb support

* make clippy happy

* move tonemapping out of sky(), rename gl_pos to builtin_pos

* rename shaders and use sky shader in wgpu example runner

* apply srgb OETF and invert clip space for cpu example runner

* restructure example directory structure according to #170

* update winit in wgpu example runner

* fix deny.toml example crate refs

* fix ci example name on maOS

* example-shader -> sky-shader in docs

* update sky shader image

* re-enable clippy and make it happy
2020-10-30 11:38:47 -07:00
Johan Andersson
98eb8d369c
Convert to use glam for math types (#149)
* [spirv-std] Remove math types

* Temp implementation of copysign

https://github.com/EmbarkStudios/rust-gpu/issues/148

* Convert shader to use glam

* Rustfmt

* Fix wgpu-example-shader to use glam

* [spirv-std] Disable clippy::use_self

* Upgrade to latest glam branch

* Use latest glam fork

* Remove incorrect assert_uninit

After discussions with @khyperia

* Update lockfile

* Update to latest glam fork with fixes

* Use real copysign intrinsic

* Disable clippy on example-shader for now

Tracked in https://github.com/EmbarkStudios/rust-gpu/issues/186
2020-10-30 14:58:38 +01:00
Jake Shadle
307d0da66b
Add spirv-tools and spirv-tools-sys crates to wrap usage of spirv-tools (#179)
* Add spirv-headers and spirv-tools as submodules

* Add simple generator and the generated code needed for compilation

* Add first pass on spirv-tools-sys

* Add first pass on spirv-tools

* Replace invocation of spirv-opt with spirv-tools crate

* Use C++11

* Placate clippy

* Add validation, replacing spirv-val with the spirv-tools crate

* Fix MSVC warning

* Use patched spirv-tools

* Fixup metadata

* Add same compiler flags as "official" build scripts

* Update spirv-tools and generated files

* Fixup

* Add assembler and example

* Use assembler in tests

* Oops, fix macos TARGET_OS

* write -> write_all

* Start splitting spirv-tools into a compiled vs tool feature set

* Checkpointing

* Checkpoint

* Boop

* Get tests to work both with installed and compiled tools

* Cleanup CI config

* Splits steps to clearly show how long each part of a longer (eg test)
step actually takes
* Label all steps

* Explicitly disable submodule checkout

* Rustfmt

* Rename features for consistency and fix clippy warnings

* Split "core" crates from examples

* Add run_clippy bash script

* Add test script

* Remove x flag

* Newline

* Actually print out errors from running val/opt

* Revert drive-by import merging

* Change intro to take the changes this PR has into account

* Actually run tests on Windows

* Fetch only the host target to reduce fetch times

* Add more info when a spirv tool returns a non-zero exit code

* Rustfmt

* Switch tool assembler to use files to see if it fixes windows

* Use files for input and output for now until I can figure out Windows being dumb

* Fix API docs generation

* Compile and use C++ code to check Windows issue

* Return to use installed tools
2020-10-29 23:03:07 +01:00
Jake Shadle
5aa7453b19 Revert "Replace usage of spirv-* binaries with spirv-tools rust crate (#117)"
This reverts commit 0bfe303a64.
2020-10-29 22:34:26 +01:00
Jake Shadle
0bfe303a64
Replace usage of spirv-* binaries with spirv-tools rust crate (#117)
* Add spirv-headers and spirv-tools as submodules

* Add simple generator and the generated code needed for compilation

* Add first pass on spirv-tools-sys

* Add first pass on spirv-tools

* Replace invocation of spirv-opt with spirv-tools crate

* Use C++11

* Add validation, replacing spirv-val with the spirv-tools crate

* Use patched spirv-tools

* Fixup metadata

* Add same compiler flags as "official" build scripts

* Update spirv-tools and generated files

* Add assembler and example

* Use assembler in tests

* Start splitting spirv-tools into a compiled vs tool feature set

* Get tests to work both with installed and compiled tools

* Cleanup CI config

* Splits steps to clearly show how long each part of a longer (eg test)
step actually takes
* Label all steps

* Explicitly disable submodule checkout

* Rename features for consistency and fix clippy warnings

* Split "core" crates from examples

* Add run_clippy bash script

* Add test script

* Change intro to take the changes this PR has into account

* Fetch only the host target to reduce fetch times

* Add more info when a spirv tool returns a non-zero exit code

* Use files for input and output for now until I can figure out Windows being dumb
2020-10-29 21:54:25 +01:00
Ashley Hauck
ddd2526f6d
Include examples in test (#166)
I thought examples couldn't be included in test due to weird windows
reasons, but wgpu-example-runner is already included, and it works
2020-10-28 11:34:46 +01:00
Johan Andersson
de4436d2e0 Fix compiling wgpu-example-shader for CPU 2020-10-28 10:22:06 +01:00
Johan Andersson
e2be058015 Remove old lingering Cargo.lock files 2020-10-28 10:22:06 +01:00
Ashley Hauck
23819c7a2c
Add support for spir-v 1.0 (#165) 2020-10-28 09:08:01 +00:00
Ashley
1b99a9ce20
Fix compilation of wgpu runner on wasm (#159) 2020-10-27 14:34:02 +00:00
Viktor Zoutman
27df71f492
WGPU example (#92) 2020-10-27 02:39:56 +01:00
Ashley Hauck
b32c04b3fd
Refactor attributes and add descriptor_set/binding (#145)
* Move entry declarations to their own file

Also clean up attribute parsing (and make it allow multiple arguments in
the process)

* Add descriptor_set and binding attributes

* clippy fix

* Fix test

* Reserve descriptor_set 0 for future use

* Add book page on attributes
2020-10-26 15:23:21 +00:00
Johan Andersson
fe18434bff
Add example to evaluate sky shader on CPU (#141) 2020-10-26 15:49:01 +01:00
Johan Andersson
12b07dcc53
Add cargo-deny config & CI step (#125)
* Add cargo-deny config & CI step

* Add missing license to multiple workspace crates

* Fix author

* Switch to checkout@v2
2020-10-25 16:15:04 +01:00
Johan Andersson
035924734d
Fix Windows native compile of example-shader (#127)
Fix #119 based on the suggestion of @bjorn3, thx!
2020-10-23 21:41:44 +00:00
Ashley Hauck
8681464af7
Add framework for compiler tests (#118) 2020-10-23 18:22:36 +02:00
khyperia
8931f50c3c Revert "Move panic_handler and eh_personality to spirv-std (#95)"
This reverts commit 985ae7d494.
2020-10-22 21:36:09 +02:00
Ashley Hauck
985ae7d494
Move panic_handler and eh_personality to spirv-std (#95) 2020-10-22 19:25:50 +00:00
Jasper Bekkers
f4f1031976
If statement (#98) 2020-10-22 16:22:17 +02:00
Ashley Hauck
0710f9d4b5
Include example-shader in the workspace (#87)
* Include example-shader in the workspace

* Fix clippy warnings

* Fix up tests and clippy warnings

* Change clamp_ to saturate

Co-authored-by: Jasper Bekkers <bekkers@gmail.com>
2020-10-22 12:30:17 +02:00
Ashley Hauck
8516dc161d
Winit update to v0.23 (#86)
* Extremely hacky winit update

* Only render when redraw is requested

* cargo fmt

* Renamed smoothstep

Co-authored-by: Jasper Bekkers <bekkers@gmail.com>
2020-10-22 12:23:11 +02:00
Jasper Bekkers
77d7129547
Add back unused attributes (#85) 2020-10-22 11:51:49 +02:00
Johan Andersson
e8f33c97a5
Add sky shader example code and screenshot to README (#83)
* Add example sky shader to README

* Bigger screenshot

* Change order

* [example] Simplify & rustify sky shader further

* Make code slightly nicer

* Add back comment

* Newline

* Add Vec4::truncate

Co-authored-by: Jasper Bekkers <bekkers@gmail.com>
2020-10-21 21:42:49 +02:00
Maik Klein
7258a7c236
Don't panic when destroying debug utils (#79)
* Don't panic when destroying debug utils

* Use zip instead of two branches

Co-authored-by: Jasper Bekkers <Jasper-Bekkers@users.noreply.github.com>
Co-authored-by: Jasper Bekkers <bekkers@gmail.com>
2020-10-21 21:07:18 +02:00
Johan Andersson
bba88ccfad [example] Leak debug loader instead of panicking on shutdown 2020-10-21 20:44:09 +02:00
Johan Andersson
14352a79be [example] Remove unused image crate dependency 2020-10-21 20:43:46 +02:00
Jasper Bekkers
a06b2e49cf
Branchless sky shader (#71)
* Branchless sky shader

* Fullscreen quad

* Fixed naming of the fragment shader

* Add very stripped down version of glam-rs math routines to spirv-std

* Update example to use math routines in spirv-std

* Also use lerp from spirv-std

* Attribution, small cleanups

* Use extension trait for math, much nicer \o/

* Switch to repr(simd) for the Vec types

* Move clamp into MathExt, make MathExt take Self instead of f32

Co-authored-by: VZout <viktor.zoutman@embark-studios.com>
Co-authored-by: khyperia <github@khyperia.com>
2020-10-21 20:16:06 +02:00
Viktor Zoutman
5db68ec044
Update lib.rs 2020-10-21 13:16:03 +02:00
VZout
b4aebb4a36 Fixed naming of the fragment shader 2020-10-20 11:12:30 +02:00
Viktor Zoutman
b86ed60dab
Modified the examples to use rust-gpu for the vertex shader. (#70)
* The example now also uses the vertex shader
* Removed old vertex shader
* fmt
2020-10-19 18:54:02 +02:00
XAMPPRocky
16f7268edb
Add support for macos in example-runner (#60) 2020-10-14 18:33:37 +02:00
Ashley Hauck
d3af0552d3
Move to a builder struct for spirv-builder (#59)
This allows the print_metadata option
2020-10-14 15:48:21 +02:00
Johan Andersson
9d98620d24
Togglable Vulkan debug layer in example (#53)
Disabled it by default as it requires the Vulkan SDK to be installed.

Can be enabled with  `-d` / `--debug-layer`
2020-10-13 23:42:15 +02:00