Skip to content

Commit

Permalink
Use vec.data() instead of &vec[0] when possibly empty. Closes #1169
Browse files Browse the repository at this point in the history
  • Loading branch information
baldurk committed Nov 12, 2018
1 parent 09fbe3d commit 29898d7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ bool WrappedVulkan::Serialise_vkCmdNextSubpass(SerialiserType &ser, VkCommandBuf

ResourceId cmd = GetResID(commandBuffer);
GetResourceManager()->RecordBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts,
(uint32_t)imgBarriers.size(), &imgBarriers[0]);
(uint32_t)imgBarriers.size(), imgBarriers.data());

AddEvent();
DrawcallDescription draw;
Expand Down Expand Up @@ -1307,7 +1307,7 @@ bool WrappedVulkan::Serialise_vkCmdEndRenderPass(SerialiserType &ser, VkCommandB

ResourceId cmd = GetResID(commandBuffer);
GetResourceManager()->RecordBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts,
(uint32_t)imgBarriers.size(), &imgBarriers[0]);
(uint32_t)imgBarriers.size(), imgBarriers.data());

AddEvent();
DrawcallDescription draw;
Expand Down Expand Up @@ -1359,7 +1359,8 @@ void WrappedVulkan::vkCmdEndRenderPass(VkCommandBuffer commandBuffer)
{
SCOPED_LOCK(m_ImageLayoutsLock);
GetResourceManager()->RecordBarriers(GetRecord(commandBuffer)->cmdInfo->imgbarriers,
m_ImageLayouts, (uint32_t)barriers.size(), &barriers[0]);
m_ImageLayouts, (uint32_t)barriers.size(),
barriers.data());
}
}
}
Expand Down Expand Up @@ -1579,7 +1580,7 @@ bool WrappedVulkan::Serialise_vkCmdNextSubpass2KHR(SerialiserType &ser, VkComman

ResourceId cmd = GetResID(commandBuffer);
GetResourceManager()->RecordBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts,
(uint32_t)imgBarriers.size(), &imgBarriers[0]);
(uint32_t)imgBarriers.size(), imgBarriers.data());

AddEvent();
DrawcallDescription draw;
Expand Down Expand Up @@ -1681,7 +1682,7 @@ bool WrappedVulkan::Serialise_vkCmdEndRenderPass2KHR(SerialiserType &ser,

ResourceId cmd = GetResID(commandBuffer);
GetResourceManager()->RecordBarriers(m_BakedCmdBufferInfo[cmd].imgbarriers, m_ImageLayouts,
(uint32_t)imgBarriers.size(), &imgBarriers[0]);
(uint32_t)imgBarriers.size(), imgBarriers.data());

AddEvent();
DrawcallDescription draw;
Expand Down Expand Up @@ -1742,7 +1743,7 @@ void WrappedVulkan::vkCmdEndRenderPass2KHR(VkCommandBuffer commandBuffer,
{
SCOPED_LOCK(m_ImageLayoutsLock);
GetResourceManager()->RecordBarriers(GetRecord(commandBuffer)->cmdInfo->imgbarriers,
m_ImageLayouts, (uint32_t)barriers.size(), &barriers[0]);
m_ImageLayouts, (uint32_t)barriers.size(), barriers.data(0);
}
}
}
Expand Down Expand Up @@ -3127,7 +3128,7 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(SerialiserType &ser, VkComman
if(!rerecordedCmds.empty())
ObjDisp(commandBuffer)
->CmdExecuteCommands(Unwrap(commandBuffer), (uint32_t)rerecordedCmds.size(),
&rerecordedCmds[0]);
rerecordedCmds.data());
}
}
}
Expand Down

0 comments on commit 29898d7

Please sign in to comment.