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 | |
| 5 | The Vulkan source code is distributed across several GitHub repositories. |
| 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 | |
| 18 | ### **How to Submit Fixes** |
| 19 | |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 20 | * **Ensure that the bug was not already reported or fixed** by searching on GitHub under Issues |
| 21 | and Pull Requests. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 22 | * Use the existing GitHub forking and pull request process. |
| 23 | This will involve [forking the repository](https://help.github.com/articles/fork-a-repo/), |
| 24 | creating a branch with your commits, and then [submitting a pull request](https://help.github.com/articles/using-pull-requests/). |
| 25 | * 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] | 26 | * Please include the GitHub Issue number near the beginning of the commit text if applicable. |
| 27 | * Example: "GitHub 123: Fix missing init" |
| 28 | * 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] | 29 | |
| 30 | |
| 31 | #### **Coding Conventions and Formatting** |
| 32 | * Try to follow any existing style in the file. "When in Rome..." |
| 33 | * Run clang-format on your changes to maintain formatting. |
| 34 | * There are `.clang-format files` throughout the repository to define clang-format settings |
| 35 | which are found and used automatically by clang-format. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 36 | * A sample git workflow may look like: |
| 37 | |
| 38 | > # Make changes to the source. |
| 39 | > $ git add . |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 40 | > $ clang-format -style=file -i < list of changed code files > |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 41 | > # Check to see if clang-format made any changes and if they are OK. |
| 42 | > $ git add . |
| 43 | > $ git commit |
| 44 | |
| 45 | #### **Testing** |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 46 | * Run the existing tests in the repository before and after your changes to check for any regressions. |
| 47 | There are some tests that appear in all repositories. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 48 | These tests can be found in the following folders inside of your target build directory: |
| 49 | (These instructions are for Linux) |
| 50 | * In the `demos` directory, run: |
| 51 | |
| 52 | > cube |
| 53 | > cube --validate |
| 54 | > tri |
| 55 | > tri --validate |
| 56 | > smoke |
| 57 | > smoke --validate |
| 58 | > vulkaninfo |
| 59 | |
| 60 | * In the `tests` directory, run: |
| 61 | |
| 62 | > run_all_tests.sh |
| 63 | |
| 64 | * Note that some tests may fail with known issues or driver-specific problems. |
| 65 | 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] | 66 | * Run tests that explicitly exercise your changes. |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 67 | * Feel free to subject your code changes to other tests as well! |
| 68 | |
Karl Schultz | 43f4e6d | 2016-04-28 13:55:42 -0600 | [diff] [blame^] | 69 | #### **Special Considerations for Validation Layers** |
| 70 | If you are submitting a change that adds a new validation check, you should also construct a "negative" test function. |
| 71 | The negative test function purposely violates the validation rule that the new validation check is looking for. |
| 72 | The test should cause your new validation check to identify the violation and issue a validation error report. |
| 73 | And finally, the test should check that the validation error report is generated and consider the test as "passing" |
| 74 | if the report is received. Otherwise, the test should indicate "failure". |
| 75 | This new test should be added to the validation layer test program in the `tests` directory and contributed |
| 76 | at the same time as the new validation check itself. |
| 77 | There are many existing validation tests in this directory that can be used as a starting point. |
| 78 | |
| 79 | |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 80 | ### **Contributor License Agreement (CLA)** |
| 81 | |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 82 | #### **Khronos Repository (Vulkan-LoaderAndValidationLayers)** |
| 83 | |
Karl Schultz | 2f21c0c | 2016-02-26 15:42:57 -0700 | [diff] [blame] | 84 | The Khronos Group is still finalizing the CLA process and documentation, |
| 85 | so the details about using or requiring a CLA are not available yet. |
| 86 | In the meantime, we suggest that you not submit any contributions unless you are comfortable doing so without a CLA. |
| 87 | |
Karl Schultz | b0b3cac | 2016-03-09 12:48:04 -0700 | [diff] [blame] | 88 | #### **LunarG Repositories** |
| 89 | |
| 90 | You'll be prompted with a "click-through" CLA as part of submitting your pull request in GitHub. |
| 91 | |
| 92 | ### **License and Copyrights** |
| 93 | |
| 94 | 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] | 95 | 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] | 96 | Please see an existing file in this repository for an example. |
| 97 | |
Jon Ashburn | 43b53e8 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 98 | 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] | 99 | and any new files need to include this license and any applicable copyrights. |
| 100 | |
| 101 | You can include your individual copyright after any existing copyrights. |