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

Vulkan: Rebuild pNext for VkDeviceCreateInfo #2501

Merged
merged 1 commit into from
Dec 27, 2018
Merged
Show file tree
Hide file tree
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
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