Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

Add Custom Shader Example #1904

Merged
merged 36 commits into from
Oct 8, 2019
Merged

Add Custom Shader Example #1904

merged 36 commits into from
Oct 8, 2019

Conversation

mrhatman
Copy link
Contributor

Description

Adds an example that uses a custom shader and render.

Any suggestions for code readability and clarity would be greatly appreciated as think is the first renderer I have written.

Fixes #1702

Additions

  • Custom Shader Example

PR Checklist

By placing an x in the boxes I certify that I have:

  • [N/A ] Updated the content of the book if this PR would make the book outdated.
  • [N/A ] Added a changelog entry if this will impact users, or modified more than 5 lines of Rust that wasn't a doc comment.
  • [N/A] Added unit tests for new code added in this PR.
  • Acknowledged that by making this pull request I release this code under an MIT/Apache 2.0 dual licensing scheme.

If this modified or created any rs files:

  • Ran cargo +stable fmt --all
  • Ran cargo clippy --all --features "empty"
  • Ran cargo test --all --features "empty"

First compiling version with technicailly a custom shader
Moved to use shader compiler. This requires Ninja on windows.
Does not display yet
updated with discord suggestions
Thanks to the great help on discord to fix this.
Removed println and profiling
Added color and scale to the shaders and the pass
The triangles can now be scaled with the mouse wheel.
Removed all the warnings from the project
Replaced docs in the custom pass with the correct ones.
Ran the formatter.
Cleaning code with clippy and updated more docs.
Tried to explain what the code in prepare and draw inline do.
Kind of  documented the pipeline
Since I am not using precompiled shaders. Remove the directory.
Merge for custom shader example
I forgot to commit this.
Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
Moved from using compiler-shader to precompiled shader. Also updated some comments.
@codecov
Copy link

codecov bot commented Aug 27, 2019

Codecov Report

Merging #1904 into master will decrease coverage by 0.8%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1904      +/-   ##
==========================================
- Coverage    83.2%   82.39%   -0.81%     
==========================================
  Files          77       79       +2     
  Lines        5627     5903     +276     
==========================================
+ Hits         4682     4864     +182     
- Misses        945     1039      +94
Impacted Files Coverage Δ
src/lib.rs 89.7% <0%> (-5.04%) ⬇️
amethyst_network/src/simulation/timing.rs
amethyst_network/src/simulation/message.rs
amethyst_network/src/simulation/requirements.rs
amethyst_network/src/simulation/transport.rs
amethyst_network/src/connection.rs 98.07% <0%> (ø)
amethyst_network/src/server/host.rs 100% <0%> (ø)
amethyst_network/src/test.rs 60.6% <0%> (ø)
amethyst_network/src/error.rs 0% <0%> (ø)
amethyst_network/src/net_event.rs 91.04% <0%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e996cf...dcbb0b3. Read the comment docs.

Add this example to the examples readme.
Cargo.toml Show resolved Hide resolved
examples/custom_shader/custom_pass.rs Outdated Show resolved Hide resolved
examples/custom_shader/custom_pass.rs Outdated Show resolved Hide resolved
Moved to using rust iterators over loops
I always forget this
Moved the code to a doc comment
@Frizi
Copy link
Member

Frizi commented Sep 20, 2019

Is this intended to be a custom render pass, or indeed just a custom shader used with builtin 3d passes? Because it is possible to define those without copying the whole pass.

I'm going to review it assuming first, but maybe that wasn't the intention.

examples/custom_shader/custom_pass.rs Outdated Show resolved Hide resolved
examples/custom_shader/custom_pass.rs Outdated Show resolved Hide resolved
examples/custom_shader/custom_pass.rs Outdated Show resolved Hide resolved
@mrhatman
Copy link
Contributor Author

Is this intended to be a custom render pass, or indeed just a custom shader used with builtin 3d passes? Because it is possible to define those without copying the whole pass.

I'm going to review it assuming first, but maybe that wasn't the intention.

The issue linked to https://github.com/amethyst/amethyst-imgui/blob/master/src/pass.rs

I based mine on this. It is a custom render pass mostly to show off all of the steps.

@Frizi
Copy link
Member

Frizi commented Sep 23, 2019

I based mine on this. It is a custom render pass mostly to show off all of the steps.

Okay, but then the example is about custom render pass. Naming it as "custom shader" example can be confusing. You don't need to write a whole render pass if you want to just change a shader, because our builtin render passes are generic over shaders and their parameters.

@mrhatman
Copy link
Contributor Author

I will change the example name to Custom Render Pass

Used ChangeDetection based on suggestions in review
examples/custom_render_pass/custom_pass.rs Outdated Show resolved Hide resolved
examples/custom_render_pass/custom_pass.rs Outdated Show resolved Hide resolved
@Frizi
Copy link
Member

Frizi commented Oct 8, 2019

bors r=frizi,jaynus

@bors
Copy link
Contributor

bors bot commented Oct 8, 2019

Merge conflict

@Frizi
Copy link
Member

Frizi commented Oct 8, 2019

bors retry

bors bot added a commit that referenced this pull request Oct 8, 2019
1904: Add Custom Shader Example r=frizi,jaynus a=mrhatman

## Description

Adds an example that uses a custom shader and render.

Any suggestions for code readability and clarity would be greatly appreciated as think is the first renderer I have written. 

Fixes #1702 

## Additions
- Custom Shader Example

## PR Checklist

By placing an x in the boxes I certify that I have:

- [N/A ] Updated the content of the book if this PR would make the book outdated.
- [N/A ] Added a changelog entry if this will impact users, or modified more than 5 lines of Rust that wasn't a doc comment.
- [N/A] Added unit tests for new code added in this PR.
- [x] Acknowledged that by making this pull request I release this code under an MIT/Apache 2.0 dual licensing scheme.

If this modified or created any rs files:

- [x] Ran `cargo +stable fmt --all`
- [x] Ran `cargo clippy --all --features "empty"`
- [x] Ran `cargo test --all --features "empty"`


Co-authored-by: mrhatman <lucasince@gmail.com>
@bors
Copy link
Contributor

bors bot commented Oct 8, 2019

Build succeeded

@bors bors bot merged commit dcbb0b3 into amethyst:master Oct 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MAINTENANCE] Add rendy basic custom shader example
7 participants