From a69a959d36a88f59cd2998af3e162af351d16262 Mon Sep 17 00:00:00 2001 From: Qining Lu Date: Thu, 20 Dec 2018 16:31:18 -0500 Subject: [PATCH] Vulkan: Rebuild pNext for VkDeviceCreateInfo --- gapis/api/vulkan/api/device.api | 4 ++-- gapis/api/vulkan/state_rebuilder.go | 26 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gapis/api/vulkan/api/device.api b/gapis/api/vulkan/api/device.api index 4e4833f678..e3ef50a7b7 100644 --- a/gapis/api/vulkan/api/device.api +++ b/gapis/api/vulkan/api/device.api @@ -143,7 +143,7 @@ sub ref!DeviceObject createDeviceObject(const VkDeviceCreateInfo* data) { case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: { ext := as!VkPhysicalDeviceVariablePointerFeatures*(next.Ptr)[0] object.VariablePointerFeatures = new!VariablePointerFeatures( - VariablePointerStorageBuffer: ext.variablePointersStorageBuffer, + VariablePointersStorageBuffer: ext.variablePointersStorageBuffer, VariablePointers: ext.variablePointers) } case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: { @@ -208,7 +208,7 @@ sub ref!DeviceObject createDeviceObject(const VkDeviceCreateInfo* data) { } @internal class VariablePointerFeatures { - VkBool32 VariablePointerStorageBuffer + VkBool32 VariablePointersStorageBuffer VkBool32 VariablePointers } diff --git a/gapis/api/vulkan/state_rebuilder.go b/gapis/api/vulkan/state_rebuilder.go index 63850556f4..3432dba346 100644 --- a/gapis/api/vulkan/state_rebuilder.go +++ b/gapis/api/vulkan/state_rebuilder.go @@ -664,11 +664,35 @@ func (sb *stateBuilder) createDevice(d DeviceObjectʳ) { i++ } + pNext := NewVoidᵖ(memory.Nullptr) + if !d.VariablePointerFeatures().IsNil() { + pNext = NewVoidᵖ(sb.MustAllocReadData( + NewVkPhysicalDeviceVariablePointerFeatures(sb.ta, + VkStructureType_VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES, // sType + pNext, // pNext + d.VariablePointerFeatures().VariablePointersStorageBuffer(), // variablePointersStorageBuffer + d.VariablePointerFeatures().VariablePointers(), // variablePointers + ), + ).Ptr()) + } + if !d.HalfPrecisionStorageFeatures().IsNil() { + pNext = NewVoidᵖ(sb.MustAllocReadData( + NewVkPhysicalDevice16BitStorageFeatures(sb.ta, + VkStructureType_VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES, // sType + pNext, // pNext + d.HalfPrecisionStorageFeatures().StorageBuffer16BitAccess(), // storageBuffer16BitAccess + d.HalfPrecisionStorageFeatures().UniformAndStorageBuffer16BitAccess(), // uniformAndStorageBuffer16BitAccess + d.HalfPrecisionStorageFeatures().StoragePushConstant16(), // storagePushConstant16 + d.HalfPrecisionStorageFeatures().StorageInputOutput16(), // storageInputOutput16 + ), + ).Ptr()) + } + sb.write(sb.cb.VkCreateDevice( d.PhysicalDevice(), sb.MustAllocReadData(NewVkDeviceCreateInfo(sb.ta, VkStructureType_VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, // sType - 0, // pNext + NewVoidᶜᵖ(pNext), // pNext 0, // flags uint32(len(reorderedQueueCreates)), // queueCreateInfoCount NewVkDeviceQueueCreateInfoᶜᵖ(sb.MustUnpackReadMap(reorderedQueueCreates).Ptr()), // pQueueCreateInfos