blob: 2417cd4d2334fa032fbd0c05cdd8158bed4afebc [file] [log] [blame] [view]
Karl Schultzb0b3cac2016-03-09 12:48:04 -07001## How to Contribute to Vulkan Source Repositories
2
Mark Lobodzinski437e1172018-01-04 14:55:26 -07003### **The Repository**
Karl Schultzb0b3cac2016-03-09 12:48:04 -07004
Mark Lobodzinski437e1172018-01-04 14:55:26 -07005The source code for The Vulkan-LoaderAndValidationLayer components is sponsored by Khronos and LunarG.
Karl Schultzb0b3cac2016-03-09 12:48:04 -07006* [Khronos Vulkan-LoaderAndValidationLayers](https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers)
Karl Schultzb0b3cac2016-03-09 12:48:04 -07007
Karl Schultz2f21c0c2016-02-26 15:42:57 -07008
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -06009### **The Vulkan Ecosystem Needs Your Help**
Karl Schultzdf03b952016-05-05 08:30:53 -060010
11The Vulkan validation layers are one of the larger and more important components in this repository.
12While there are often active and organized development efforts underway to improve their coverage,
13there are always opportunities for anyone to help by contributing additional validation layer checks
14and tests for these validation checks.
Mark Lobodzinski34cd2e62018-01-04 16:12:41 -070015
16There are a couple of methods to identify areas of need:
17* Examine the [issues list](https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues)
18in this repository and look for issues that are of interest
19* Alternatively, examine the [vk_validation_error_database.txt](layers/vk_validation_error_database.txt) file -- unimplemented validation checks are marked
20with an 'N' in the 'check_implemented' column and each of these needs coverage in the validation layers.
21
Karl Schultzdf03b952016-05-05 08:30:53 -060022Of course, if you have your own work in mind, please open an issue to describe it and assign it to yourself.
23Finally, please feel free to contact any of the developers that are actively contributing should you
24wish to coordinate further.
25Please see the [section about Validation Layers](#special-considerations-for-validation-layers)
26later on this page.
27
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -060028Repository Issue labels:
29
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -060030* _Bug_: These issues refer to invalid or broken functionality and are the highest priority.
Mark Lobodzinski437e1172018-01-04 14:55:26 -070031* _Incomplete_: These issues refer to missing validation checks that users have encountered during application
32development that would have been directly useful, and are high priority.
33* _Enhancement_: These issues refer to ideas for extending or improving the loader, demos, or validation layers.
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -060034
Mark Lobodzinski34cd2e62018-01-04 16:12:41 -070035It is the maintainers goal for all issues to be assigned within one business day of their submission. If you choose
Mark Lobodzinski437e1172018-01-04 14:55:26 -070036to work on an issue that is assigned, simply coordinate with the current assignee.
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -060037
Karl Schultz2f21c0c2016-02-26 15:42:57 -070038### **How to Submit Fixes**
39
Karl Schultzb0b3cac2016-03-09 12:48:04 -070040* **Ensure that the bug was not already reported or fixed** by searching on GitHub under Issues
41 and Pull Requests.
Karl Schultz2f21c0c2016-02-26 15:42:57 -070042* Use the existing GitHub forking and pull request process.
43 This will involve [forking the repository](https://help.github.com/articles/fork-a-repo/),
44 creating a branch with your commits, and then [submitting a pull request](https://help.github.com/articles/using-pull-requests/).
Mark Lobodzinski34cd2e62018-01-04 16:12:41 -070045* Please read and adhere to the style and process [guidelines ](#coding-conventions-and-formatting) enumerated below.
Karl Schultz2f21c0c2016-02-26 15:42:57 -070046* Please base your fixes on the master branch. SDK branches are generally not updated except for critical fixes needed to repair an SDK release.
Karl Schultz2f21c0c2016-02-26 15:42:57 -070047
48
49#### **Coding Conventions and Formatting**
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -060050* Use the **[Google style guide](https://google.github.io/styleguide/cppguide.html)** for source code with the following exceptions:
Jeremy Hayes46ec9f72017-01-19 14:10:18 -070051 * The column limit is 132 (as opposed to the default value 80). The clang-format tool will handle this. See below.
Mark Lobodzinski93704892017-01-25 07:56:21 -070052 * The indent is 4 spaces instead of the default 2 spaces. Again, the clang-format tool will handle this.
Mark Lobodzinski437e1172018-01-04 14:55:26 -070053 * If you can justify a reason for violating a rule in the guidelines, then you are free to do so. Be prepared to defend your
54decision during code review. This should be used responsibly. An example of a bad reason is "I don't like that rule." An example of
55a good reason is "This violates the style guide, but it improves type safety."
Jeremy Hayes46ec9f72017-01-19 14:10:18 -070056
Mark Lobodzinski437e1172018-01-04 14:55:26 -070057* Run **clang-format** on your changes to maintain consistent formatting
58 * There are `.clang-format files` present in the repository to define clang-format settings
Karl Schultz2f21c0c2016-02-26 15:42:57 -070059 which are found and used automatically by clang-format.
Dave Houlton068fdbb2018-02-06 17:49:16 -070060 * **clang-format** binaries are available from the LLVM orginization, here: https://clang.llvm.org/. Our CI system (Travis-CI)
61 currently uses clang-format version 5.0.0 to check that the lines of code you have changed are formatted properly. It is
62 recommended that you use the same version to format your code prior to submission.
Karl Schultz2f21c0c2016-02-26 15:42:57 -070063 * A sample git workflow may look like:
64
65> # Make changes to the source.
Karl Schultz41ee1a02016-04-28 14:20:13 -060066> $ git add -u .
67> $ git clang-format --style=file
Karl Schultz2f21c0c2016-02-26 15:42:57 -070068> # Check to see if clang-format made any changes and if they are OK.
Karl Schultz41ee1a02016-04-28 14:20:13 -060069> $ git add -u .
Karl Schultz2f21c0c2016-02-26 15:42:57 -070070> $ git commit
71
Mark Lobodzinski437e1172018-01-04 14:55:26 -070072* **Commit Messages**
73 * Limit the subject line to 50 characters -- this allows the information to display correctly in git/Github logs
74 * Begin subject line with a one-word component description followed by a colon (e.g. loader, layers, tests, etc.)
75 * Separate subject from body with a blank line
76 * Wrap the body at 72 characters
77 * Capitalize the subject line
78 * Do not end the subject line with a period
79 * Use the body to explain what and why vs. how
80 * Use the imperative mode in the subject line. This just means to write it as a command (e.g. Fix the sprocket)
81
82Strive for commits that implement a single or related set of functionality, using as many commits as is necessary (more is better).
83That said, please ensure that the repository compiles and passes tests without error for each commit in your pull request. Note
84that to be accepted into the repository, the pull request must [pass all tests](#testing your changes) on all supported platforms
85-- the automatic Github Travis and AppVeyor continuous integration features will assist in enforcing this requirement.
Jeremy Hayes46ec9f72017-01-19 14:10:18 -070086
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -060087#### **Testing Your Changes**
88* Run the existing tests in the repository before and after each if your commits to check for any regressions.
Karl Schultzb0b3cac2016-03-09 12:48:04 -070089 There are some tests that appear in all repositories.
Karl Schultz2f21c0c2016-02-26 15:42:57 -070090 These tests can be found in the following folders inside of your target build directory:
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -060091
Karl Schultz2f21c0c2016-02-26 15:42:57 -070092 (These instructions are for Linux)
93* In the `demos` directory, run:
94
95> cube
96> cube --validate
Karl Schultz2f21c0c2016-02-26 15:42:57 -070097> smoke
98> smoke --validate
99> vulkaninfo
100
101* In the `tests` directory, run:
102
103> run_all_tests.sh
104
Mark Lobodzinski437e1172018-01-04 14:55:26 -0700105* On Windows, a quick sanity check can be run from inside Visual Studio -- just run the `vk_layer_validation_tests` project,
106or you can run `run_all_tests.ps1` from a PowerShell window
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -0600107
Karl Schultz2f21c0c2016-02-26 15:42:57 -0700108* Note that some tests may fail with known issues or driver-specific problems.
Mark Lobodzinski34cd2e62018-01-04 16:12:41 -0700109 The idea here is that your changes should not change the test results, unless that was the intent of your changes.
Karl Schultzb0b3cac2016-03-09 12:48:04 -0700110* Run tests that explicitly exercise your changes.
Karl Schultz2f21c0c2016-02-26 15:42:57 -0700111* Feel free to subject your code changes to other tests as well!
112
Mark Lobodzinski437e1172018-01-04 14:55:26 -0700113
Karl Schultz43f4e6d2016-04-28 13:55:42 -0600114#### **Special Considerations for Validation Layers**
Mark Lobodzinski437e1172018-01-04 14:55:26 -0700115* **Validation Tests** If you are submitting a change that adds a new validation check, you should also construct a "negative" test function.
Karl Schultz43f4e6d2016-04-28 13:55:42 -0600116The negative test function purposely violates the validation rule that the new validation check is looking for.
117The test should cause your new validation check to identify the violation and issue a validation error report.
118And finally, the test should check that the validation error report is generated and consider the test as "passing"
119if the report is received. Otherwise, the test should indicate "failure".
120This new test should be added to the validation layer test program in the `tests` directory and contributed
Mark Lobodzinski5ce91da2017-05-11 13:54:52 -0600121at the same time as the new validation check itself, along with appropriate updates to `layers\vk_validation_error_database.txt`.
Karl Schultz43f4e6d2016-04-28 13:55:42 -0600122There are many existing validation tests in this directory that can be used as a starting point.
Mark Lobodzinski437e1172018-01-04 14:55:26 -0700123* **Validation Checks** The majority of validation checks are carried out by the Core Validation layer. In general, this layer
124contains checks that require some amount of application state to carry out. In contrast, the parameter validation layer contains
125checks that require (mostly) no state at all. Please inquire if you are unsure of the location for your contribution. The other
126layers (threading, object_tracker, unique_objects) are more special-purpose and are mostly code-generated from the specification.
Karl Schultz43f4e6d2016-04-28 13:55:42 -0600127
Karl Schultz2f21c0c2016-02-26 15:42:57 -0700128### **Contributor License Agreement (CLA)**
129
Mark Lobodzinski34cd2e62018-01-04 16:12:41 -0700130You will be prompted with a one-time "click-through" CLA dialog as part of submitting your pull request
Karl Schultzdf03b952016-05-05 08:30:53 -0600131or other contribution to GitHub.
Karl Schultzb0b3cac2016-03-09 12:48:04 -0700132
133### **License and Copyrights**
134
135All contributions made to the Vulkan-LoaderAndValidationLayers repository are Khronos branded and as such,
Jon Ashburn43b53e82016-04-19 11:30:31 -0600136any new files need to have the Khronos license (Apache 2.0 style) and copyright included.
Karl Schultzb0b3cac2016-03-09 12:48:04 -0700137Please see an existing file in this repository for an example.
138
Jon Ashburn43b53e82016-04-19 11:30:31 -0600139All contributions made to the LunarG repositories are to be made under the Apache 2.0 license
Karl Schultzb0b3cac2016-03-09 12:48:04 -0700140and any new files need to include this license and any applicable copyrights.
141
142You can include your individual copyright after any existing copyrights.