MCPcopy Create free account
hub / github.com/google/gapid / createDepthCopyBuffer

Method createDepthCopyBuffer

gapis/api/vulkan/overdraw.go:1313–1427  ·  view source on GitHub ↗
(ctx context.Context,
	cb CommandBuilder,
	gs *api.GlobalState,
	st *State,
	a arena.Arena,
	device VkDevice,
	format VkFormat,
	width uint32,
	height uint32,
	alloc func(v ...interface{}) api.AllocResult,
	addCleanup func(func()),
	out transform.Writer,
)

Source from the content-addressed store, hash-verified

1311}
1312
1313func (*stencilOverdraw) createDepthCopyBuffer(ctx context.Context,
1314 cb CommandBuilder,
1315 gs *api.GlobalState,
1316 st *State,
1317 a arena.Arena,
1318 device VkDevice,
1319 format VkFormat,
1320 width uint32,
1321 height uint32,
1322 alloc func(v ...interface{}) api.AllocResult,
1323 addCleanup func(func()),
1324 out transform.Writer,
1325) VkBuffer {
1326 elsize := VkDeviceSize(4)
1327 if format == VkFormat_VK_FORMAT_D16_UNORM ||
1328 format == VkFormat_VK_FORMAT_D16_UNORM_S8_UINT {
1329
1330 elsize = VkDeviceSize(2)
1331 }
1332
1333 bufferSize := elsize * VkDeviceSize(width*height)
1334
1335 buffer := VkBuffer(newUnusedID(false, func(id uint64) bool {
1336 return st.Buffers().Contains(VkBuffer(id))
1337 }))
1338 bufferData := alloc(buffer)
1339
1340 bufferInfo := NewVkBufferCreateInfo(a,
1341 VkStructureType_VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // sType
1342 0, // pNext
1343 0, // flags
1344 bufferSize, // size
1345 VkBufferUsageFlags(
1346 VkBufferUsageFlagBits_VK_BUFFER_USAGE_TRANSFER_SRC_BIT|
1347 VkBufferUsageFlagBits_VK_BUFFER_USAGE_TRANSFER_DST_BIT), // usage
1348 VkSharingMode_VK_SHARING_MODE_EXCLUSIVE, // sharingMode
1349 0, // queueFamilyIndexCount
1350 0, // pQueueFamilyIndices
1351 )
1352 bufferInfoData := alloc(bufferInfo)
1353
1354 bufferMemoryTypeIndex := uint32(0)
1355 physicalDevice := st.PhysicalDevices().Get(
1356 st.Devices().Get(device).PhysicalDevice(),
1357 )
1358 for i := uint32(0); i < physicalDevice.MemoryProperties().MemoryTypeCount(); i++ {
1359 t := physicalDevice.MemoryProperties().MemoryTypes().Get(int(i))
1360 if 0 != (t.PropertyFlags() & VkMemoryPropertyFlags(
1361 VkMemoryPropertyFlagBits_VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT)) {
1362 bufferMemoryTypeIndex = i
1363 break
1364 }
1365 }
1366
1367 deviceMemory := VkDeviceMemory(newUnusedID(false, func(id uint64) bool {
1368 return st.DeviceMemories().Contains(VkDeviceMemory(id))
1369 }))
1370 deviceMemoryData := alloc(deviceMemory)

Callers 1

copyImageAspectMethod · 0.95

Calls 10

writeEachFunction · 0.85
BuffersMethod · 0.80
PtrMethod · 0.80
newUnusedIDFunction · 0.70
ContainsMethod · 0.65
GetMethod · 0.65
DataMethod · 0.65
DevicesMethod · 0.45
AddWriteMethod · 0.45
AddReadMethod · 0.45

Tested by

no test coverage detected