Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the point of VkApplicationInfo?

In the new Vulkan API, there is a struct which is needed to create a VkInstance: VkApplicationInfo. Here's the definition:

typedef struct VkApplicationInfo {
    VkStructureType    sType;
    const void*        pNext;
    const char*        pApplicationName;
    uint32_t           applicationVersion;
    const char*        pEngineName;
    uint32_t           engineVersion;
    uint32_t           apiVersion;
} VkApplicationInfo;

I see no use for having to pass in the application name, application version, engine name, or engine version. Maybe the implementation could use the pNext member for whatever or maybe check if the implementation supports the apiVersion specified. Outside of that though, I don't understand why the the other members are specified. The Vulkan specs say that you can even use NULL instead of using an actual VkApplicationInfo, which makes it even MORE useless. Can the info from this struct be retrieved later in the app by using (for example) a vkGetAppInfo(instance) or such? Is there an evil master plan behind this struct? Or is just a bad design? Anyways, I'm curious at to why it exists and why I should use it.

like image 595
Jerfov2 Avatar asked Jul 07 '16 23:07

Jerfov2


1 Answers

From the specification:

If not NULL, [pApplicationInfo] helps implementations recognize behavior inherent to classes of applications.

So that's what it is for.

IHVs (independent hardware vendors) are going to provide application-specific optimizations for any program that's popular enough to attract that kind of interest. That's inevitable.

So Vulkan has two choices: it can either pretend that the inevitable is somehow not going to happen, which means IHVs will do it anyway, using various heuristics to detect your application. Or your application can just introduce itself and cut out the middle-man.

Vulkan permits you to do the latter. And well-behaved engines will likely do likewise on your program's behalf.

like image 70
Nicol Bolas Avatar answered Nov 20 '22 16:11

Nicol Bolas