Skip to content

Commit

Permalink
Deploying to gh-pages from @ b114894 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleMayes committed Sep 23, 2023
1 parent 17fa0a7 commit 767fd7e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions model/depth_buffering.html
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ <h3 id="explicitly-transitioning-the-depth-image"><a class="header" href="#expli
)?;
</code></pre>
<p>The undefined layout can be used as initial layout, because there are no existing depth image contents that matter. We need to update some of the logic in <code>transition_image_layout</code> to use the right subresource aspect:</p>
<blockquote>
<p><strong>Note:</strong> The first usage of the <code>|</code> operator below describes a <a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html"><em>pattern</em></a> that matches either of the specified <a href="https://docs.rs/vulkanalia/0.22.0/vulkanalia/vk/struct.Format.html"><code class="hljs">vk::Format</code></a>s in the <code>match</code> arm. Meanwhile, the second usage of the <code>|</code> operator is the <a href="https://doc.rust-lang.org/std/ops/trait.BitOr.html"><em>bitwise OR operator</em></a> which combines the bits of the <a href="https://docs.rs/vulkanalia/0.22.0/vulkanalia/vk/struct.ImageAspectFlags.html"><code class="hljs">vk::ImageAspectFlags</code></a> we want to enable in this code path.</p>
</blockquote>
<pre><code class="language-rust noplaypen">let aspect_mask = if new_layout == vk::ImageLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL {
match format {
vk::Format::D32_SFLOAT_S8_UINT | vk::Format::D24_UNORM_S8_UINT =&gt;
Expand Down
8 changes: 7 additions & 1 deletion print.html
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ <h3 id="macos"><a class="header" href="#macos">macOS</a></h3>
<p>Next comes our <code>main</code> function (which returns an <code>anyhow::Result</code> type). This function starts by initializing <code>pretty_env_logger</code> which will print our logs to the console (as shown later).</p>
<p>Then we create an event loop and window to render to using <code>winit</code> using <code>LogicalSize</code> which will scale the window according to the DPI of your display. If you want to know more about UI scaling you can read the <a href="https://docs.rs/winit/latest/winit/dpi/index.html">relevant <code>winit</code> documentation</a>.</p>
<p>Next we create an instance of our Vulkan app (<code>App</code>) and enter into our rendering loop. This loop will continually render our scene to the window until you request the window to be closed at which point the app will be destroyed and the program will exit. The <code>destroying</code> flag is necessary to not keep attempting to render the scene while the app is being destroyed which would most likely result in the program crashing after attempting to access Vulkan resources that have been destroyed.</p>
<p>Lastly comes <code>App</code> and <code>AppData</code>. <code>App</code> will be used to implement the setup, rendering, and destruction logic required for the Vulkan program we will be building over the course of the following chapters. <code>AppData</code> will serve simply as a container for the large number of Vulkan resources we will need to create and initialize which will allow for them to be easily passed to functions to be read and/or modified.</p>
<p>Lastly comes <code>App</code> and <code>AppData</code>. <code>App</code> will be used to implement the setup, rendering, and destruction logic required for the Vulkan program we will be building over the course of the following chapters. <code>AppData</code> will serve simply as a container for the large number of Vulkan resources we will need to create and initialize which will allow for them to be easily passed to functions to be read and/or modified. <code>AppData</code> implements the <a href="https://doc.rust-lang.org/std/default/trait.Default.html"><code>Default</code> trait</a> so we can easily construct an instance of this struct with empty/default values.</p>
<p>This will come in handy because many of the following chapters consist of adding a function which takes a <code>&amp;mut AppData</code> and creates and initializes Vulkan resources. These functions will then be called from our <code>App::create</code> constructor method to set up our Vulkan app. Then, before our program exits, these Vulkan resources will be released by our <code>App::destroy</code> method.</p>
<h2 id="a-note-on-safety"><a class="header" href="#a-note-on-safety">A Note on Safety</a></h2>
<p>All Vulkan commands, both the raw commands and their command wrappers, are marked <code>unsafe</code> in <code>vulkanalia</code>. This is because most Vulkan commands have restrictions on how they can be called that cannot be enforced by Rust (unless a higher-level interface that hides the Vulkan API is provided like in <a href="https://vulkano.rs"><code>vulkano</code></a>).</p>
Expand Down Expand Up @@ -795,6 +795,9 @@ <h2 id="message-callback"><a class="header" href="#message-callback">Message cal
<p>Finally, the <code>user_callback</code> field specifies the callback function. You can optionally pass a mutable reference to the <code>user_data</code> field which will be passed along to the callback function via the final parameter. You could use this to pass a pointer to the <code>AppData</code> struct, for example.</p>
<p>Lastly we call <a href="https://docs.rs/vulkanalia/0.22.0/vulkanalia/vk/trait.ExtDebugUtilsExtension.html#method.create_debug_utils_messenger_ext"><code class="hljs">create_debug_utils_messenger_ext</code></a> to register our debug callback with the Vulkan instance.</p>
<p>Since our <code>create_instance</code> function takes an <code>AppData</code> reference now, we'll also need to update <code>App</code> and <code>App::create</code>:</p>
<blockquote>
<p><strong>Note:</strong> <code>AppData::default()</code> will use the implementation of the <a href="https://doc.rust-lang.org/std/default/trait.Default.html"><code>Default</code> trait</a> generated by the presence of <code>#[derive(Default)]</code> on the <code>AppData</code> struct. This will result in containers like <code>Vec</code> being initialized to empty lists and Vulkan handles like <a href="https://docs.rs/vulkanalia/0.22.0/vulkanalia/vk/struct.DebugUtilsMessengerEXT.html"><code class="hljs">vk::DebugUtilsMessengerEXT</code></a> being initialized to null handles. If Vulkan handles are not initialized properly before they are used, the validation layers we are enabling in this chapter should let us know exactly what we missed.</p>
</blockquote>
<pre><code class="language-rust noplaypen">struct App {
entry: Entry,
instance: Instance,
Expand Down Expand Up @@ -5207,6 +5210,9 @@ <h3 id="explicitly-transitioning-the-depth-image"><a class="header" href="#expli
)?;
</code></pre>
<p>The undefined layout can be used as initial layout, because there are no existing depth image contents that matter. We need to update some of the logic in <code>transition_image_layout</code> to use the right subresource aspect:</p>
<blockquote>
<p><strong>Note:</strong> The first usage of the <code>|</code> operator below describes a <a href="https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html"><em>pattern</em></a> that matches either of the specified <a href="https://docs.rs/vulkanalia/0.22.0/vulkanalia/vk/struct.Format.html"><code class="hljs">vk::Format</code></a>s in the <code>match</code> arm. Meanwhile, the second usage of the <code>|</code> operator is the <a href="https://doc.rust-lang.org/std/ops/trait.BitOr.html"><em>bitwise OR operator</em></a> which combines the bits of the <a href="https://docs.rs/vulkanalia/0.22.0/vulkanalia/vk/struct.ImageAspectFlags.html"><code class="hljs">vk::ImageAspectFlags</code></a> we want to enable in this code path.</p>
</blockquote>
<pre><code class="language-rust noplaypen">let aspect_mask = if new_layout == vk::ImageLayout::DEPTH_STENCIL_ATTACHMENT_OPTIMAL {
match format {
vk::Format::D32_SFLOAT_S8_UINT | vk::Format::D24_UNORM_S8_UINT =&gt;
Expand Down
2 changes: 1 addition & 1 deletion setup/base_code.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ <h1 id="base-code"><a class="header" href="#base-code">Base code</a></h1>
<p>Next comes our <code>main</code> function (which returns an <code>anyhow::Result</code> type). This function starts by initializing <code>pretty_env_logger</code> which will print our logs to the console (as shown later).</p>
<p>Then we create an event loop and window to render to using <code>winit</code> using <code>LogicalSize</code> which will scale the window according to the DPI of your display. If you want to know more about UI scaling you can read the <a href="https://docs.rs/winit/latest/winit/dpi/index.html">relevant <code>winit</code> documentation</a>.</p>
<p>Next we create an instance of our Vulkan app (<code>App</code>) and enter into our rendering loop. This loop will continually render our scene to the window until you request the window to be closed at which point the app will be destroyed and the program will exit. The <code>destroying</code> flag is necessary to not keep attempting to render the scene while the app is being destroyed which would most likely result in the program crashing after attempting to access Vulkan resources that have been destroyed.</p>
<p>Lastly comes <code>App</code> and <code>AppData</code>. <code>App</code> will be used to implement the setup, rendering, and destruction logic required for the Vulkan program we will be building over the course of the following chapters. <code>AppData</code> will serve simply as a container for the large number of Vulkan resources we will need to create and initialize which will allow for them to be easily passed to functions to be read and/or modified.</p>
<p>Lastly comes <code>App</code> and <code>AppData</code>. <code>App</code> will be used to implement the setup, rendering, and destruction logic required for the Vulkan program we will be building over the course of the following chapters. <code>AppData</code> will serve simply as a container for the large number of Vulkan resources we will need to create and initialize which will allow for them to be easily passed to functions to be read and/or modified. <code>AppData</code> implements the <a href="https://doc.rust-lang.org/std/default/trait.Default.html"><code>Default</code> trait</a> so we can easily construct an instance of this struct with empty/default values.</p>
<p>This will come in handy because many of the following chapters consist of adding a function which takes a <code>&amp;mut AppData</code> and creates and initializes Vulkan resources. These functions will then be called from our <code>App::create</code> constructor method to set up our Vulkan app. Then, before our program exits, these Vulkan resources will be released by our <code>App::destroy</code> method.</p>
<h2 id="a-note-on-safety"><a class="header" href="#a-note-on-safety">A Note on Safety</a></h2>
<p>All Vulkan commands, both the raw commands and their command wrappers, are marked <code>unsafe</code> in <code>vulkanalia</code>. This is because most Vulkan commands have restrictions on how they can be called that cannot be enforced by Rust (unless a higher-level interface that hides the Vulkan API is provided like in <a href="https://vulkano.rs"><code>vulkano</code></a>).</p>
Expand Down
3 changes: 3 additions & 0 deletions setup/validation_layers.html
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ <h2 id="message-callback"><a class="header" href="#message-callback">Message cal
<p>Finally, the <code>user_callback</code> field specifies the callback function. You can optionally pass a mutable reference to the <code>user_data</code> field which will be passed along to the callback function via the final parameter. You could use this to pass a pointer to the <code>AppData</code> struct, for example.</p>
<p>Lastly we call <a href="https://docs.rs/vulkanalia/0.22.0/vulkanalia/vk/trait.ExtDebugUtilsExtension.html#method.create_debug_utils_messenger_ext"><code class="hljs">create_debug_utils_messenger_ext</code></a> to register our debug callback with the Vulkan instance.</p>
<p>Since our <code>create_instance</code> function takes an <code>AppData</code> reference now, we'll also need to update <code>App</code> and <code>App::create</code>:</p>
<blockquote>
<p><strong>Note:</strong> <code>AppData::default()</code> will use the implementation of the <a href="https://doc.rust-lang.org/std/default/trait.Default.html"><code>Default</code> trait</a> generated by the presence of <code>#[derive(Default)]</code> on the <code>AppData</code> struct. This will result in containers like <code>Vec</code> being initialized to empty lists and Vulkan handles like <a href="https://docs.rs/vulkanalia/0.22.0/vulkanalia/vk/struct.DebugUtilsMessengerEXT.html"><code class="hljs">vk::DebugUtilsMessengerEXT</code></a> being initialized to null handles. If Vulkan handles are not initialized properly before they are used, the validation layers we are enabling in this chapter should let us know exactly what we missed.</p>
</blockquote>
<pre><code class="language-rust noplaypen">struct App {
entry: Entry,
instance: Instance,
Expand Down

0 comments on commit 767fd7e

Please sign in to comment.