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

Method createCommandBuffer

gapis/api/vulkan/state_rebuilder.go:2982–3058  ·  view source on GitHub ↗
(cb CommandBufferObjectʳ, level VkCommandBufferLevel)

Source from the content-addressed store, hash-verified

2980}
2981
2982func (sb *stateBuilder) createCommandBuffer(cb CommandBufferObjectʳ, level VkCommandBufferLevel) {
2983 if cb.Level() != level {
2984 return
2985 }
2986
2987 sb.write(sb.cb.VkAllocateCommandBuffers(
2988 cb.Device(),
2989 sb.MustAllocReadData(NewVkCommandBufferAllocateInfo(sb.ta,
2990 VkStructureType_VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO, // sType
2991 0, // pNext
2992 cb.Pool(), // commandPool
2993 cb.Level(), // level
2994 1, // commandBufferCount
2995 )).Ptr(),
2996 sb.MustAllocWriteData(cb.VulkanHandle()).Ptr(),
2997 VkResult_VK_SUCCESS,
2998 ))
2999
3000 if cb.Recording() == RecordingState_NOT_STARTED || cb.Recording() == RecordingState_TO_BE_RESET {
3001 return
3002 }
3003
3004 beginInfo := NewVkCommandBufferBeginInfo(sb.ta,
3005 VkStructureType_VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, // sType
3006 0, // pNext
3007 VkCommandBufferUsageFlags(cb.BeginInfo().Flags()), // flags
3008 0, // pInheritanceInfo
3009 )
3010 if cb.BeginInfo().Inherited() {
3011 if cb.BeginInfo().InheritedFramebuffer() != VkFramebuffer(0) &&
3012 !GetState(sb.newState).Framebuffers().Contains(cb.BeginInfo().InheritedFramebuffer()) {
3013 log.W(sb.ctx, "Command Buffer %v is invalid, it will not be recorded: - Inherited framebuffer does not exist", cb.VulkanHandle())
3014 return
3015 }
3016
3017 inheritanceInfo := sb.MustAllocReadData(NewVkCommandBufferInheritanceInfo(sb.ta,
3018 VkStructureType_VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO, // sType
3019 0, // pNext
3020 cb.BeginInfo().InheritedRenderPass(), // renderPass
3021 cb.BeginInfo().InheritedSubpass(), // subpass
3022 cb.BeginInfo().InheritedFramebuffer(), // framebuffer
3023 cb.BeginInfo().InheritedOcclusionQuery(), // occlusionQueryEnable
3024 cb.BeginInfo().InheritedQueryFlags(), // queryFlags
3025 cb.BeginInfo().InheritedPipelineStatsFlags(), // pipelineStatistics
3026 ))
3027 beginInfo.SetPInheritanceInfo(NewVkCommandBufferInheritanceInfoᶜᵖ(inheritanceInfo.Ptr()))
3028 }
3029
3030 sb.write(sb.cb.VkBeginCommandBuffer(
3031 cb.VulkanHandle(),
3032 sb.MustAllocReadData(beginInfo).Ptr(),
3033 VkResult_VK_SUCCESS,
3034 ))
3035
3036 hasError := false
3037 // fill command buffer
3038 for i, c := uint32(0), uint32(cb.CommandReferences().Len()); i < c; i++ {
3039 arg := GetCommandArgs(sb.ctx, cb.CommandReferences().Get(i), GetState(sb.oldState))

Callers 1

RebuildStateMethod · 0.45

Calls 14

writeMethod · 0.95
MustAllocReadDataMethod · 0.95
MustAllocWriteDataMethod · 0.95
GetCommandArgsFunction · 0.85
AddCommandFunction · 0.85
LevelMethod · 0.80
PtrMethod · 0.80
PoolMethod · 0.65
FlagsMethod · 0.65
ContainsMethod · 0.65
LenMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected