Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 1 | ## How to Contribute to Vulkan Source Repositories |
| 2 | |
| 3 | ### **The Repositories** |
| 4 | |
Karl Schultz | df03b95 | 2016-05-05 08:30:53 -0600 | [diff] [blame] | 5 | The source code for various Vulkan components is distributed across several GitHub repositories. |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 6 | The repositories sponsored by Khronos and LunarG are described here. |
| 7 | In general, the canonical Vulkan Loader and Validation Layers sources are in the Khronos repository, |
| 8 | while the LunarG repositories host sources for additional tools and sample programs. |
| 9 | |
| 10 | * [Khronos Vulkan-LoaderAndValidationLayers](https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers) |
| 11 | * [LunarG VulkanTools](https://github.com/LunarG/VulkanTools) |
| 12 | * [LunarG VulkanSamples](https://github.com/LunarG/VulkanSamples) |
| 13 | |
| 14 | As a convenience, the contents of the Vulkan-LoaderAndValidationLayers repository are downstreamed into the VulkanTools and VulkanSamples repositories via a branch named `trunk`. |
| 15 | This makes the VulkanTools and VulkanSamples easier to work with and avoids compatibility issues |
| 16 | that might arise with Vulkan-LoaderAndValidationLayers components if they were obtained from a separate repository. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 17 | |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 18 | ### **The Vulkan Ecosystem Needs Your Help** |
Karl Schultz | df03b95 | 2016-05-05 08:30:53 -0600 | [diff] [blame] | 19 | |
| 20 | The Vulkan validation layers are one of the larger and more important components in this repository. |
| 21 | While there are often active and organized development efforts underway to improve their coverage, |
| 22 | there are always opportunities for anyone to help by contributing additional validation layer checks |
| 23 | and tests for these validation checks. |
| 24 | If you desire to help in this area, please examine the |
| 25 | [issues list](https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues) |
| 26 | in this repository and look for any unassigned issues that are of interest to you. |
| 27 | Of course, if you have your own work in mind, please open an issue to describe it and assign it to yourself. |
| 28 | Finally, please feel free to contact any of the developers that are actively contributing should you |
| 29 | wish to coordinate further. |
| 30 | Please see the [section about Validation Layers](#special-considerations-for-validation-layers) |
| 31 | later on this page. |
| 32 | |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 33 | Repository Issue labels: |
| 34 | |
| 35 | * _Incomplete_: These issues refer to missing validation checks that users have encountered during application development that would have been directly useful, and are high priority. |
| 36 | * _Enhancement_: These issues refer to ideas for extending or improving the loader, demos, or validation layers. |
| 37 | * _Bug_: These issues refer to invalid or broken functionality and are the highest priority. |
| 38 | |
| 39 | If you choose to work on an issue that is already assigned, simply coordinate with the current assignee. |
| 40 | |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 41 | ### **How to Submit Fixes** |
| 42 | |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 43 | * **Ensure that the bug was not already reported or fixed** by searching on GitHub under Issues |
| 44 | and Pull Requests. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 45 | * Use the existing GitHub forking and pull request process. |
| 46 | This will involve [forking the repository](https://help.github.com/articles/fork-a-repo/), |
| 47 | creating a branch with your commits, and then [submitting a pull request](https://help.github.com/articles/using-pull-requests/). |
| 48 | * 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 Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 49 | * Please include the GitHub Issue number near the beginning of the commit text if applicable. |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 50 | * Example: "layers: GH123, Fix missing init" |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 51 | * If your changes are restricted only to files from the Vulkan-LoaderAndValidationLayers repository, please direct your pull request to that repository, instead of VulkanTools or VulkanSamples. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 52 | |
| 53 | |
| 54 | #### **Coding Conventions and Formatting** |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 55 | * Use the **[Google style guide](https://google.github.io/styleguide/cppguide.html)** for source code with the following exceptions: |
Jeremy Hayes | 46ec9f7 | 2017-01-19 14:10:18 -0700 | [diff] [blame] | 56 | * The column limit is 132 (as opposed to the default value 80). The clang-format tool will handle this. See below. |
Mark Lobodzinski | 9370489 | 2017-01-25 07:56:21 -0700 | [diff] [blame] | 57 | * The indent is 4 spaces instead of the default 2 spaces. Again, the clang-format tool will handle this. |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 58 | * 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 decision during code review. This should be used responsibly. An example of a bad reason is "I don't like that rule." An example of a good reason is "This violates the style guide, but it improves type safety." |
Jeremy Hayes | 46ec9f7 | 2017-01-19 14:10:18 -0700 | [diff] [blame] | 59 | |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 60 | * Run **clang-format** on your changes to maintain formatting |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 61 | * There are `.clang-format files` throughout the repository to define clang-format settings |
| 62 | which are found and used automatically by clang-format. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 63 | * A sample git workflow may look like: |
| 64 | |
| 65 | > # Make changes to the source. |
Karl Schultz | 41ee1a0 | 2016-04-28 14:20:13 -0600 | [diff] [blame] | 66 | > $ git add -u . |
| 67 | > $ git clang-format --style=file |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 68 | > # Check to see if clang-format made any changes and if they are OK. |
Karl Schultz | 41ee1a0 | 2016-04-28 14:20:13 -0600 | [diff] [blame] | 69 | > $ git add -u . |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 70 | > $ git commit |
| 71 | |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 72 | * **Format your git commit messages** consistently with the repo |
Jeremy Hayes | 46ec9f7 | 2017-01-19 14:10:18 -0700 | [diff] [blame] | 73 | * Limit the subject line to 50 characters. Begin with a one-word component description followed by a colon (e.g. loader, layers, tests, etc.). |
| 74 | * Separate subject from body with a blank line. |
| 75 | * Wrap the body at 72 characters. |
| 76 | * Capitalize the subject line. |
| 77 | * Do not end the subject line with a period. |
| 78 | * Use the body to explain what and why vs. how. |
| 79 | * Use the imperative mood in the subject line. This just means to write it as a command (e.g. Fix the sprocket). |
| 80 | |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 81 | #### **Testing Your Changes** |
| 82 | * Run the existing tests in the repository before and after each if your commits to check for any regressions. |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 83 | There are some tests that appear in all repositories. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 84 | These tests can be found in the following folders inside of your target build directory: |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 85 | |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 86 | (These instructions are for Linux) |
| 87 | * In the `demos` directory, run: |
| 88 | |
| 89 | > cube |
| 90 | > cube --validate |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 91 | > smoke |
| 92 | > smoke --validate |
| 93 | > vulkaninfo |
| 94 | |
| 95 | * In the `tests` directory, run: |
| 96 | |
| 97 | > run_all_tests.sh |
| 98 | |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 99 | * On Windows, a quick sanity check can be run from inside Visual Studio -- just run the `vk_layer_validation_tests` project, or you can run `run_all_tests.ps1` from a PowerShell window |
| 100 | |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 101 | * Note that some tests may fail with known issues or driver-specific problems. |
| 102 | The idea here is that your changes shouldn't change the test results, unless that was the intent of your changes. |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 103 | * Run tests that explicitly exercise your changes. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 104 | * Feel free to subject your code changes to other tests as well! |
| 105 | |
Karl Schultz | 43f4e6d | 2016-04-28 13:55:42 -0600 | [diff] [blame] | 106 | #### **Special Considerations for Validation Layers** |
| 107 | If you are submitting a change that adds a new validation check, you should also construct a "negative" test function. |
| 108 | The negative test function purposely violates the validation rule that the new validation check is looking for. |
| 109 | The test should cause your new validation check to identify the violation and issue a validation error report. |
| 110 | And finally, the test should check that the validation error report is generated and consider the test as "passing" |
| 111 | if the report is received. Otherwise, the test should indicate "failure". |
| 112 | This new test should be added to the validation layer test program in the `tests` directory and contributed |
Mark Lobodzinski | 5ce91da | 2017-05-11 13:54:52 -0600 | [diff] [blame] | 113 | at the same time as the new validation check itself, along with appropriate updates to `layers\vk_validation_error_database.txt`. |
Karl Schultz | 43f4e6d | 2016-04-28 13:55:42 -0600 | [diff] [blame] | 114 | There are many existing validation tests in this directory that can be used as a starting point. |
| 115 | |
| 116 | |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 117 | ### **Contributor License Agreement (CLA)** |
| 118 | |
Karl Schultz | df03b95 | 2016-05-05 08:30:53 -0600 | [diff] [blame] | 119 | You'll be prompted with a one-time "click-through" CLA dialog as part of submitting your pull request |
| 120 | or other contribution to GitHub. |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 121 | |
| 122 | ### **License and Copyrights** |
| 123 | |
| 124 | All contributions made to the Vulkan-LoaderAndValidationLayers repository are Khronos branded and as such, |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 125 | any new files need to have the Khronos license (Apache 2.0 style) and copyright included. |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 126 | Please see an existing file in this repository for an example. |
| 127 | |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 128 | All contributions made to the LunarG repositories are to be made under the Apache 2.0 license |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 129 | and any new files need to include this license and any applicable copyrights. |
| 130 | |
| 131 | You can include your individual copyright after any existing copyrights. |