Skip to content

Commit

Permalink
Vulkan: Rebuild pNext for VkDeviceCreateInfo (#2501)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qining authored Dec 27, 2018
1 parent f0beb10 commit d555df6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gapis/api/vulkan/api/device.api
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -208,7 +208,7 @@ sub ref!DeviceObject createDeviceObject(const VkDeviceCreateInfo* data) {
}

@internal class VariablePointerFeatures {
VkBool32 VariablePointerStorageBuffer
VkBool32 VariablePointersStorageBuffer
VkBool32 VariablePointers
}

Expand Down
26 changes: 25 additions & 1 deletion gapis/api/vulkan/state_rebuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d555df6

Please sign in to comment.