Skip to content

Commit

Permalink
Add VkApplicationInfo in Instance state object (#2756)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoeris committed May 21, 2019
1 parent bdf4c37 commit 304c2c4
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions gapis/api/vulkan/api/instance.api
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

@internal class ApplicationInfo {
@unused string ApplicationName
@unused u32 ApplicationVersion
@unused string EngineName
@unused u32 EngineVersion
@unused u32 ApiVersion // The api version the app requested when setting up the instance
}

// Internal struct for holding useful instance level information from VkInstanceCreateInfo.
@internal class InstanceObject {
@unused u32 ApiVersion // The api version the app requested when setting up the instance
@unused ref!ApplicationInfo ApplicationInfo
@unused map!(u32, string) EnabledExtensions // Map from enabled extension index to extension name
@unused map!(u32, string) EnabledLayers
@unused VkInstance VulkanHandle
Expand Down Expand Up @@ -105,10 +113,8 @@ sub ref!InstanceObject createInstanceObject(const VkInstanceCreateInfo* createIn
}
}

if (info.pApplicationInfo != null) {
object.ApiVersion = readVkApplicationInfo(info.pApplicationInfo)
} else {
object.ApiVersion = 0
if info.pApplicationInfo != null {
object.ApplicationInfo = readVkApplicationInfo(info.pApplicationInfo)
}

layerNames := info.ppEnabledLayerNames[0:info.enabledLayerCount]
Expand All @@ -131,7 +137,8 @@ sub ref!InstanceObject createInstanceObject(const VkInstanceCreateInfo* createIn
}

// Marks the fields that need to be observed in a VkApplicationInfo struct and returns the API version.
sub u32 readVkApplicationInfo(const VkApplicationInfo* applicationInfo) {
sub ref!ApplicationInfo readVkApplicationInfo(const VkApplicationInfo* applicationInfo) {
object := new!ApplicationInfo()
info := applicationInfo[0]

// handle pNext
Expand All @@ -146,11 +153,15 @@ sub u32 readVkApplicationInfo(const VkApplicationInfo* applicationInfo) {
}
}

if (info.pApplicationName != null) {
_ = as!string(info.pApplicationName)
object.ApplicationVersion = info.applicationVersion
object.EngineVersion = info.engineVersion
object.ApiVersion = info.apiVersion

if info.pApplicationName != null {
object.ApplicationName = as!string(info.pApplicationName)
}
if (info.pEngineName != null) {
_ = as!string(info.pEngineName)
if info.pEngineName != null {
object.EngineName = as!string(info.pEngineName)
}
return info.apiVersion
return object
}

0 comments on commit 304c2c4

Please sign in to comment.