You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/03_Drawing_a_triangle/00_Setup/00_Base_code.adoc
+25-24Lines changed: 25 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,11 @@
4
4
5
5
== Vulkan-hpp and designated initializers
6
6
7
-
NOTE: We are going to use designated initializers introduced with C++ 20. By default,
8
-
Vulkan-hpp uses a different way of initializing and we need to explicitly enable this
9
-
by using the `VULKAN_HPP_NO_STRUCT_CONSTRUCTORS` define.
7
+
NOTE: We are going to use designated initializers introduced with C++ 20.
8
+
By default, Vulkan-hpp uses a different way of initializing and we need to explicitly enable this by using the `VULKAN_HPP_NO_STRUCT_CONSTRUCTORS` define.
10
9
11
-
This provides a better meaning towards what each option relates to in the structures that we're depending upon. For this tutorial, said define is declared in the xref:../../02_Development_environment.adoc#cmake[CMake build setup].
10
+
This provides a better meaning towards what each option relates to in the structures that we're depending upon.
11
+
For this tutorial, said define is declared in the xref:../../02_Development_environment.adoc#cmake[CMake build setup].
12
12
13
13
If you use a different build setup or want to write code from scratch, you need to manually define this before including the Vulkan-hpp headers like this:
14
14
[,c++]
@@ -21,9 +21,8 @@ If you use a different build setup or want to write code from scratch, you need
21
21
22
22
== General structure
23
23
24
-
In the previous chapter, you've created a Vulkan project with all the proper
25
-
configurations and tested it with the sample code. In this chapter, we're starting
26
-
from scratch with the following code:
24
+
In the previous chapter, you've created a Vulkan project with all the proper configurations and tested it with the sample code.
25
+
In this chapter, we're starting from scratch with the following code:
27
26
28
27
[,c++]
29
28
----
@@ -60,12 +59,15 @@ private:
60
59
}
61
60
};
62
61
63
-
int main() {
64
-
HelloTriangleApplication app;
65
-
66
-
try {
62
+
int main()
63
+
{
64
+
try
65
+
{
66
+
HelloTriangleApplication app;
67
67
app.run();
68
-
} catch (const std::exception& e) {
68
+
}
69
+
catch (const std::exception& e)
70
+
{
69
71
std::cerr << e.what() << std::endl;
70
72
return EXIT_FAILURE;
71
73
}
@@ -108,11 +110,10 @@ we no longer need it. In c{pp} it is possible to perform automatic resource
108
110
management using https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization[RAII]
109
111
or smart pointers provided in the `<memory>` header. This tutorial is an attempt
110
112
to make Vulkan easier to work with, and demonstrate modern Vulkan
111
-
programming. This tutorial will not only use RAII with smart pointers, it
112
-
will endeavor to demonstrate the latest methods and extensions which should
113
-
hopefully make Vulkan a joy to use. Just because we enjoy working with
114
-
low level graphics APIs, we shouldn't make the bar too high to learn how
115
-
to do so. Where appropriate, we will discuss concerns for resource
113
+
programming. This tutorial will not only use RAII, it will endeavor to demonstrate the
114
+
latest methods and extensions which should hopefully make Vulkan a joy to use. Just
115
+
because we enjoy working with low level graphics APIs, we shouldn't make the bar too
116
+
high to learn how to do so. Where appropriate, we will discuss concerns for resource
116
117
management for freeing resources. However, for this tutorial, we'll
117
118
demonstrate that we can get pretty far with a basic destructor to clean up
0 commit comments