Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VkApplicationInfo in Instance state object (#2756) #2761

Merged
merged 1 commit into from
May 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}