ashen-aetna

Ashen Aetna

— Rustily stumbling around on an ash-covered volcano

(A tutorial on/in/about/with 3D graphics, Rust, Vulkan, ash)

Looking back from the first program with visual output

It was a long way to the first drawn point on screen. It is quite easy to get lost in the details, there was a lot of setup involved. Let’s try to have a look back — without bothering with the details: What have we done, what were the important points?

We wanted to draw. Somewhere there is literally a “draw” command. Maybe we should start there:

            logical_device.cmd_draw(commandbuffer, 1, 1, 0, 0);

Two obvious questions spring to mind: 1. How do we get this command to the GPU? 2. What does “drawing” mean? Or more granularly: 2a. What do we want to draw? 2b. What, besides a description of what to draw, do we need so that it becomes visible on the screen?

What else was there? Of course, some further setup. Before queues and whatever else we needed exist and can be accessed, they have to be created. The creation begins by finding a Vulkan instance, a physical device, and setting up a logical device (the abstraction that almost all of our later Vulkan calls will pass through).

Despite our rather modest goal, we have already had to venture beyond Vulkan’s core functionality. Different ways of doing that were a) using additional “layers” (“between” the application and the driver), and b) using “extensions”. We came across a) with the validation layers; and b) with debug again and in the context of surfaces (because that’s platform specific) and with the swapchain (although this extension is an extension on the level of a single device — not that we’d be using several of those). Each extension comes with some loader carrying all related functions as its methods.

Continue