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

Fix for vkGet{Buffer,Image}MemoryRequirements2KHR #1819

Merged
merged 1 commit into from
Apr 19, 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
6 changes: 6 additions & 0 deletions gapil/resolver/inference.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ func lhsToObserved(rv *resolver, lhs semantic.Node) semantic.Expression {
return nil
}
return &semantic.MapIndex{Map: o, Index: lhs.Index, Type: lhs.Type}
case *semantic.Cast:
o := lhsToObserved(rv, lhs.Object)
if o == nil {
return nil
}
return &semantic.Cast{Object: lhs.Object, Type: lhs.Type}
case *semantic.Parameter:
if f := rv.scope.function; f != nil && f.Subroutine && lhs == f.Return {
rv.errorf(lhs, "unknowns cannot be used to infer return values in subroutines")
Expand Down
35 changes: 28 additions & 7 deletions gapis/api/vulkan/vulkan.api
Original file line number Diff line number Diff line change
Expand Up @@ -3191,8 +3191,17 @@ cmd void vkGetImageMemoryRequirements2KHR(
VkMemoryRequirements2KHR* pMemoryRequirements) {
if !(device in Devices) { vkErrorInvalidDevice(device) }
info := pInfo[0]
// TODO: handle pNext for 'info'
memReqs := pMemoryRequirements[0]
if memReqs.pNext != null {
nPNext := numberOfPNext(as!const void*(memReqs.pNext))
next := MutableVoidPtr(as!void*(memReqs.pNext))
for i in (0 .. nPNext) {
_ = as!const VkStructureType*(next.Ptr)[0]
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0].PNext
}
}

// TODO: handle pNext for 'info'
fence

if pMemoryRequirements == null { vkErrorNullPointer("VkMemoryRequirements2KHR") }
Expand All @@ -3208,17 +3217,18 @@ cmd void vkGetImageMemoryRequirements2KHR(
numPNext := numberOfPNext(as!const void*(memReq.pNext))
next := MutableVoidPtr(as!void*(memReq.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
sType := as!const VkStructureType*(next.Ptr)[0]
switch sType {
case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR: {
ext := as!VkMemoryDedicatedRequirementsKHR*(next.Ptr)[0:1][0]
ext := as!VkMemoryDedicatedRequirementsKHR(?)
Images[info.image].DedicatedRequirementsKHR = new!DedicatedRequirementsKHR(
PrefersDedicatedAllocation: ext.prefersDedicatedAllocation,
RequiresDedicatedAllocation: ext.requiresDedicatedAllocation,
)
as!VkMemoryDedicatedRequirementsKHR*(next.Ptr)[0] = ext
}
}
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0].PNext
}
}
}
Expand All @@ -3233,6 +3243,16 @@ cmd void vkGetBufferMemoryRequirements2KHR(
info := pInfo[0]
// TODO: handle pNext

memReqs := pMemoryRequirements[0]
if memReqs.pNext != null {
nPNext := numberOfPNext(as!const void*(memReqs.pNext))
next := MutableVoidPtr(as!void*(memReqs.pNext))
for i in (0 .. nPNext) {
_ = as!const VkStructureType*(next.Ptr)[0]
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0].PNext
}
}

fence

if pMemoryRequirements == null { vkErrorNullPointer("VkMemoryRequirements2KHR") }
Expand All @@ -3248,17 +3268,18 @@ cmd void vkGetBufferMemoryRequirements2KHR(
numPNext := numberOfPNext(as!const void*(memReq.pNext))
next := MutableVoidPtr(as!void*(memReq.pNext))
for i in (0 .. numPNext) {
sType := as!const VkStructureType*(next.Ptr)[0:1][0]
sType := as!const VkStructureType*(next.Ptr)[0]
switch sType {
case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR: {
ext := as!VkMemoryDedicatedRequirementsKHR*(next.Ptr)[0:1][0]
ext := as!VkMemoryDedicatedRequirementsKHR(?)
Buffers[info.buffer].DedicatedRequirementsKHR = new!DedicatedRequirementsKHR(
PrefersDedicatedAllocation: ext.prefersDedicatedAllocation,
RequiresDedicatedAllocation: ext.requiresDedicatedAllocation,
)
as!VkMemoryDedicatedRequirementsKHR*(next.Ptr)[0] = ext
}
}
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0:1][0].PNext
next.Ptr = as!VulkanStructHeader*(next.Ptr)[0].PNext
}
}
}
Expand Down