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

Method createCommandBuffer

gapis/api/vulkan/overdraw.go:1950–2091  ·  view source on GitHub ↗
(ctx context.Context,
	cb CommandBuilder,
	gs *api.GlobalState,
	st *State,
	a arena.Arena,
	queue VkQueue,
	cmdBuffer VkCommandBuffer,
	renderInfo renderInfo,
	rpStartIdx uint64,
	alloc func(v ...interface{}) api.AllocResult,
	addCleanup func(func()),
	out transform.Writer,
)

Source from the content-addressed store, hash-verified

1948}
1949
1950func (s *stencilOverdraw) createCommandBuffer(ctx context.Context,
1951 cb CommandBuilder,
1952 gs *api.GlobalState,
1953 st *State,
1954 a arena.Arena,
1955 queue VkQueue,
1956 cmdBuffer VkCommandBuffer,
1957 renderInfo renderInfo,
1958 rpStartIdx uint64,
1959 alloc func(v ...interface{}) api.AllocResult,
1960 addCleanup func(func()),
1961 out transform.Writer,
1962) (VkCommandBuffer, error) {
1963 bInfo, ok := st.CommandBuffers().Lookup(cmdBuffer)
1964 if !ok {
1965 return 0, fmt.Errorf("Invalid command buffer %v", cmdBuffer)
1966 }
1967 device := bInfo.Device()
1968
1969 newCmdBuffer, cmds, cleanup := allocateNewCmdBufFromExistingOneAndBegin(
1970 ctx, cb, cmdBuffer, gs)
1971 writeEach(ctx, out, cmds...)
1972 for _, f := range cleanup {
1973 f()
1974 }
1975
1976 pipelines := map[VkPipeline]VkPipeline{}
1977 secCmdBuffers := map[VkCommandBuffer]VkCommandBuffer{}
1978
1979 rpEnded := false
1980 for i := 0; i < bInfo.CommandReferences().Len(); i++ {
1981 cr := bInfo.CommandReferences().Get(uint32(i))
1982 args := GetCommandArgs(ctx, cr, st)
1983 if uint64(i) >= rpStartIdx && !rpEnded {
1984 switch ar := args.(type) {
1985 case VkCmdBeginRenderPassArgsʳ:
1986 // Transition the stencil image to the right layout
1987 s.transitionStencilImage(ctx, cb, gs, st, a,
1988 newCmdBuffer, renderInfo, alloc, out)
1989 // Add commands to handle copying the old depth
1990 // values if necessary
1991 if err := s.loadExistingDepthValues(ctx, cb,
1992 gs, st, a, device, queue, newCmdBuffer,
1993 renderInfo, alloc, addCleanup, out); err != nil {
1994 return 0, err
1995 }
1996
1997 newArgs := ar.Clone(a, api.CloneContext{})
1998 newArgs.SetRenderPass(renderInfo.renderPass)
1999 newArgs.SetFramebuffer(renderInfo.framebuffer)
2000
2001 rpInfo := st.RenderPasses().Get(renderInfo.renderPass)
2002 attachmentIdx := uint32(rpInfo.AttachmentDescriptions().Len()) - 1
2003 newClear := NewU32ː4ᵃ(a)
2004
2005 if renderInfo.depthIdx != ^uint32(0) &&
2006 rpInfo.AttachmentDescriptions().Get(renderInfo.depthIdx).LoadOp() ==
2007 VkAttachmentLoadOp_VK_ATTACHMENT_LOAD_OP_CLEAR {

Callers 1

rewriteQueueSubmitMethod · 0.95

Calls 15

storeNewDepthValuesMethod · 0.95
writeEachFunction · 0.85
fFunction · 0.85
GetCommandArgsFunction · 0.85
AddCommandFunction · 0.85
ColorMethod · 0.80
LookupMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected