Skip to content

Commit

Permalink
Get rid of the terrible check of memory.Data length and format
Browse files Browse the repository at this point in the history
  • Loading branch information
Qining committed Jun 12, 2018
1 parent c0f86ad commit 2a680ed
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
18 changes: 18 additions & 0 deletions gapis/api/templates/api_spy.cpp.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@
{{ if IsReturn $}}{{Template "Return" $}}
{{else if IsFence $}}{{Template "Fence" $}}
{{else if IsCopy $}}{{Template "Copy" $}}
{{else if IsRead $}}{{Template "Read" $}}
{{else if IsAssign $}}{{Template "Assign" $}}
{{else }}{{Template "C++.Statement.Default" $}}
{{end}}
Expand Down Expand Up @@ -390,6 +391,23 @@
{{end}}


{{/*
-------------------------------------------------------------------------------
An override for the "C++.Read" macro.
-------------------------------------------------------------------------------
*/}}
{{define "Read"}}
{{AssertType $ "Read"}}
{{if (GetAnnotation ($.Slice | TargetField) "spy_disabled")}}
// @spy_disabled
{{else if GetAnnotation ($.Slice | TargetField) "spy_disabled"}}
{{Error "Attempting to read from a @spy_disabled slice"}}
{{else}}
{{Template "C++.Statement.Default" $}}
{{end}}
{{end}}


{{/*
-------------------------------------------------------------------------------
An override for the "C++.Assign" macro.
Expand Down
7 changes: 1 addition & 6 deletions gapis/api/vulkan/api/coherent_memory.api
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@ sub void readMemoryInBuffer(ref!BufferObject buffer, VkDeviceSize readOffset, Vk
memPieces := getBufferBoundMemoryPiecesInRange(buffer, readOffset, readSize)
for _, _, mp in memPieces {
readCoherentMemory(mp.DeviceMemory, mp.MemoryOffset, mp.Size)
// On the trace side, 'Data' pool won't actually be created, so its length
// will be zero. But on the server side, the pool will be created and the
// state block should contains the data in the buffer memory.
if len(mp.DeviceMemory.Data) != 0 {
read(mp.DeviceMemory.Data[mp.MemoryOffset:mp.MemoryOffset+mp.Size])
}
read(mp.DeviceMemory.Data[mp.MemoryOffset:mp.MemoryOffset+mp.Size])
}
}

Expand Down
18 changes: 12 additions & 6 deletions gapis/api/vulkan/api/copy_clear_commands.api
Original file line number Diff line number Diff line change
Expand Up @@ -772,12 +772,18 @@ cmd void vkCmdClearAttachments(

sub void dovkCmdResolveImage(ref!vkCmdResolveImageArgs args) {
for _ , _ , r in args.ResolveRegions {
srcRange := VkImageSubresourceRange( r.srcSubresource.aspectMask,
r.srcSubresource.mipLevel, 1,
r.srcSubresource.baseArrayLayer, r.srcSubresource.layerCount)
dstRange := VkImageSubresourceRange( r.dstSubresource.aspectMask,
r.dstSubresource.mipLevel, 1,
r.dstSubresource.baseArrayLayer, r.dstSubresource.layerCount)
srcRange := VkImageSubresourceRange(
r.srcSubresource.aspectMask,
r.srcSubresource.mipLevel,
1,
r.srcSubresource.baseArrayLayer,
r.srcSubresource.layerCount)
dstRange := VkImageSubresourceRange(
r.dstSubresource.aspectMask,
r.dstSubresource.mipLevel,
1,
r.dstSubresource.baseArrayLayer,
r.dstSubresource.layerCount)
readImageSubresource(Images[args.SrcImage], srcRange, args.SrcImageLayout)
writeImageSubresource(Images[args.DstImage], dstRange, args.DstImageLayout)
}
Expand Down

0 comments on commit 2a680ed

Please sign in to comment.