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: Track the const pNext pointers for all supported cases #2354

Merged
merged 1 commit into from
Nov 8, 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
11 changes: 11 additions & 0 deletions gapis/api/vulkan/api/buffer.api
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ cmd VkResult vkCreateBufferView(
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pCreateInfo == null { vkErrorNullPointer("VkBufferViewCreateInfo") }
buffer_view_create_info := pCreateInfo[0]
// handle mapped memory range pNext
if buffer_view_create_info.pNext != null {
numPNext := numberOfPNext(buffer_view_create_info.pNext)
next := MutableVoidPtr(as!void*(buffer_view_create_info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkBufferViewCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

handle := ?
bufferViewObject := new!BufferViewObject(
Expand Down
47 changes: 45 additions & 2 deletions gapis/api/vulkan/api/command_buffer_control.api
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ cmd VkResult vkCreateCommandPool(
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pCreateInfo == null { vkErrorNullPointer("VkCommandPoolCreateInfo") }
create_info := pCreateInfo[0]
// handle pNext
if create_info.pNext != null {
numPNext := numberOfPNext(create_info.pNext)
next := MutableVoidPtr(as!void*(create_info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkCommandPoolCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

handle := ?
if pCommandPool == null { vkErrorNullPointer("VkCommandPool") }
Expand Down Expand Up @@ -289,6 +300,17 @@ cmd VkResult vkAllocateCommandBuffers(
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pAllocateInfo == null { vkErrorNullPointer("VkCommandBufferAllocateInfo") }
allocateInfo := pAllocateInfo[0]
// handle pNext
if allocateInfo.pNext != null {
numPNext := numberOfPNext(allocateInfo.pNext)
next := MutableVoidPtr(as!void*(allocateInfo.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkCommandBufferAllocateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
count := allocateInfo.commandBufferCount

fence
Expand Down Expand Up @@ -345,7 +367,18 @@ cmd VkResult vkBeginCommandBuffer(
info := pBeginInfo[0]
begin := new!CommandBufferBegin(Flags: info.flags,Inherited: false)

// TODO: pBeginInfo->pNext
// handle pNext
if info.pNext != null {
numPNext := numberOfPNext(info.pNext)
next := MutableVoidPtr(as!void*(info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkCommandBufferBeginInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

if info.pInheritanceInfo != null {
inheritanceInfo := info.pInheritanceInfo[0]
begin.Inherited = true
Expand All @@ -355,7 +388,17 @@ cmd VkResult vkBeginCommandBuffer(
begin.InheritedOcclusionQuery = inheritanceInfo.occlusionQueryEnable
begin.InheritedQueryFlags = inheritanceInfo.queryFlags
begin.InheritedPipelineStatsFlags = inheritanceInfo.pipelineStatistics
// TODO: pBeginInfo->pInheritanceInfo->pNext
// handle pBeginInfo->pInheritanceInfo->pNext
if inheritanceInfo.pNext != null {
numPNext := numberOfPNext(inheritanceInfo.pNext)
next := MutableVoidPtr(as!void*(inheritanceInfo.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkCommandBufferInheritanceInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}
buff := CommandBuffers[commandBuffer]
buff.BeginInfo = begin
Expand Down
68 changes: 65 additions & 3 deletions gapis/api/vulkan/api/descriptor.api
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@ cmd VkResult vkCreateDescriptorSetLayout(
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pCreateInfo == null { vkErrorNullPointer("VkDescriptorSetLayoutCreateInfo") }
info := pCreateInfo[0]
// TODO: info.pNext
// handle pNext
if info.pNext != null {
numPNext := numberOfPNext(info.pNext)
next := MutableVoidPtr(as!void*(info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkDescriptorSetLayoutCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
count := info.bindingCount
bindings := info.pBindings[0:count]
descriptorSetLayout := new!DescriptorSetLayoutObject()
Expand Down Expand Up @@ -137,6 +147,17 @@ cmd VkResult vkCreateDescriptorPool(
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pCreateInfo == null { vkErrorNullPointer("VkDescriptorPoolCreateInfo") }
info := pCreateInfo[0]
// handle pNext
if info.pNext != null {
numPNext := numberOfPNext(info.pNext)
next := MutableVoidPtr(as!void*(info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkDescriptorPoolCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
pool := new!DescriptorPoolObject(
Device: device,
Flags: info.flags,
Expand All @@ -146,7 +167,6 @@ cmd VkResult vkCreateDescriptorPool(
for i in (0 .. info.poolSizeCount) {
pool.Sizes[i] = sizes[i]
}
// TODO: info.pNext

handle := ?
if pDescriptorPool == null { vkErrorNullPointer("VkDescriptorPool") }
Expand Down Expand Up @@ -237,7 +257,17 @@ cmd VkResult vkAllocateDescriptorSets(
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pAllocateInfo == null { vkErrorNullPointer("VkDescriptorSetAllocateInfo") }
info := pAllocateInfo[0]
// TODO: info.pNext
// handle pNext
if info.pNext != null {
numPNext := numberOfPNext(info.pNext)
next := MutableVoidPtr(as!void*(info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkDescriptorSetAllocateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
count := info.descriptorSetCount

layouts := info.pSetLayouts[0:count]
Expand Down Expand Up @@ -530,6 +560,38 @@ cmd void vkUpdateDescriptorSets(
u32 descriptorCopyCount,
const VkCopyDescriptorSet* pDescriptorCopies) {
if !(device in Devices) { vkErrorInvalidDevice(device) }
ws := pDescriptorWrites[0:descriptorWriteCount]
for i in (0 .. descriptorWriteCount) {
w := ws[i]
// handle VkWriteDescriptorSet pNext
if w.pNext != null {
numPNext := numberOfPNext(w.pNext)
next := MutableVoidPtr(as!void*(w.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkWriteDescriptorSet
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
}

cs := pDescriptorCopies[0:descriptorCopyCount]
for i in (0 .. descriptorCopyCount) {
c := cs[i]
// handle VkCopyDescriptorSet pNext
if c.pNext != null {
numPNext := numberOfPNext(c.pNext)
next := MutableVoidPtr(as!void*(c.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkCopyDescriptorSet
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

}

writes := RewriteWriteDescriptorSets(
descriptorWriteCount,
Expand Down
26 changes: 25 additions & 1 deletion gapis/api/vulkan/api/device.api
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,34 @@ sub ref!DeviceObject createDeviceObject(const VkDeviceCreateInfo* data) {
if data == null { vkErrorNullPointer("VkDeviceCreateInfo") }
info := data[0]

// TODO: pNext
// handle pNext
if info.pNext != null {
numPNext := numberOfPNext(info.pNext)
next := MutableVoidPtr(as!void*(info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkDeviceCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

queueCreateInfos := info.pQueueCreateInfos[0:info.queueCreateInfoCount]
for i in (0 .. info.queueCreateInfoCount) {
queue_info := queueCreateInfos[i]

// handle pNext
if queue_info.pNext != null {
numPNext := numberOfPNext(queue_info.pNext)
next := MutableVoidPtr(as!void*(queue_info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkDeviceQueueCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

queue_priorities := queue_info.pQueuePriorities[0:queue_info.queueCount]
for j in (0 .. queue_info.queueCount) {
object.Queues[len(object.Queues)] =
Expand Down
22 changes: 22 additions & 0 deletions gapis/api/vulkan/api/image.api
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,17 @@ cmd VkResult vkCreateImageView(
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pCreateInfo == null { vkErrorNullPointer("VkImageViewCreateInfo") }
image_view_create_info := pCreateInfo[0]
// handle pNext
if image_view_create_info.pNext != null {
numPNext := numberOfPNext(image_view_create_info.pNext)
next := MutableVoidPtr(as!void*(image_view_create_info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkImageViewCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

handle := ?
if !(image_view_create_info.image in Images) { vkErrorInvalidImage(image_view_create_info.image) } else {
Expand Down Expand Up @@ -528,6 +539,17 @@ cmd VkResult vkCreateSampler(
if !(device in Devices) { vkErrorInvalidDevice(device) }
if pCreateInfo == null { vkErrorNullPointer("VkSamplerCreateInfo") }
create_info := pCreateInfo[0]
// handle pNext
if create_info.pNext != null {
numPNext := numberOfPNext(create_info.pNext)
next := MutableVoidPtr(as!void*(create_info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkSamplerCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}
sampler := new!SamplerObject(
Device: device,
MagFilter: create_info.magFilter,
Expand Down
26 changes: 24 additions & 2 deletions gapis/api/vulkan/api/instance.api
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,18 @@ sub ref!InstanceObject createInstanceObject(const VkInstanceCreateInfo* createIn
if createInfo == null { vkErrorNullPointer("VkInstanceCreateInfo") }
info := createInfo[0]

// TODO: handle pNext
// handle pNext
if info.pNext != null {
numPNext := numberOfPNext(info.pNext)
next := MutableVoidPtr(as!void*(info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkInstanceCreateInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

if (info.pApplicationInfo != null) {
object.ApiVersion = readVkApplicationInfo(info.pApplicationInfo)
} else {
Expand Down Expand Up @@ -120,7 +131,18 @@ sub ref!InstanceObject createInstanceObject(const VkInstanceCreateInfo* createIn
sub u32 readVkApplicationInfo(const VkApplicationInfo* applicationInfo) {
info := applicationInfo[0]

// TODO: handle pNext
// handle pNext
if info.pNext != null {
numPNext := numberOfPNext(info.pNext)
next := MutableVoidPtr(as!void*(info.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkApplicationInfo
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

if (info.pApplicationName != null) {
_ = as!string(info.pApplicationName)
}
Expand Down
12 changes: 12 additions & 0 deletions gapis/api/vulkan/api/memory.api
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,18 @@ cmd VkResult vkFlushMappedMemoryRanges(
memoryRanges := pMemoryRanges[0:memoryRangeCount]
for i in (0 .. memoryRangeCount) {
flushRange := memoryRanges[i]
// handle mapped memory range pNext
if flushRange.pNext != null {
numPNext := numberOfPNext(flushRange.pNext)
next := MutableVoidPtr(as!void*(flushRange.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
_ = sType
// TODO: handle extensions for VkMappedMemoryRange
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
}
}

if !(flushRange.memory in DeviceMemories) { vkErrorInvalidDeviceMemory(flushRange.memory) }
memoryObject := DeviceMemories[flushRange.memory]
mappedLocation := as!u8*(memoryObject.MappedLocation)
Expand Down
Loading