Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up (and maybe extend) Hello Triangle sample #1168

Open
SaschaWillems opened this issue Sep 14, 2024 · 2 comments
Open

Clean up (and maybe extend) Hello Triangle sample #1168

SaschaWillems opened this issue Sep 14, 2024 · 2 comments

Comments

@SaschaWillems
Copy link
Collaborator

SaschaWillems commented Sep 14, 2024

I'm currently working on a hell triangle sample for Vulkan 1.3 and noticed that our existing hello triangle sample is in dire need of a code cleanup. While it works fine, there are several parts in the code that make it hard to follow. Other parts are unnecessary, variables are named badly and sometimes not even used at all. Also validation layers are not always properly enabled as only parts of the sample also use the debug define to enable them, others don't. Also some of the error messages are plainly wrong and may mislead readers.

@SaschaWillems
Copy link
Collaborator Author

The sample is also partially outdated and uses e.g. VK_EXT_debug_report which has long been deprecated in favor of VK_EXT_debug_utils .

@SaschaWillems SaschaWillems changed the title Clean up Hello Triangle sample Clean up (and maybe extend) Hello Triangle sample Sep 14, 2024
@SaschaWillems
Copy link
Collaborator Author

SaschaWillems commented Sep 14, 2024

I also feel the sample is lacking some crucial functionality to make it a good entry into Vulkan:

  • Vertices are hard-coded in the shader, the sample does not show how to actually pass vertices to Vulkan
  • No uniforms, the sample does not show how to use descriptors and how to pass data to shaders
  • Compiles shaders at runtime instead of loading from SPIR-V (which is our preferred way) and as such no HLSL support

SaschaWillems added a commit to SaschaWillems/Vulkan-Samples that referenced this issue Oct 19, 2024
Fix validation layers not being enabled in debug builds
Refs KhronosGroup#1168
marty-johnson59 pushed a commit that referenced this issue Nov 13, 2024
…x validation and clean up code (#1199)

* Replace deprecated debug reports extension with debug utils

Fix validation layers not being enabled in debug builds
Refs #1168

* Update comment

* Fix error messages

* Remove unnecessary per-frame properties

* Clean up instance and device creation code
Use extension name constants instead of strings
Remove unnecessary arguments

* Remove unnecessary passing of the context

* Move resource destruction into the sample class destrutor
The teardown function was only used for that anyway and was unnecessary

* Remove context parameter from function doc

* Doc cleanup

* Remove unnecessary function for frame buffer teardown, also remove duplicate queue idle wait
Add comments, throw if no device is found
Males code easier to follow

* Making clang format happy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant