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

Function buildStubProgram

gapis/api/gles/stub_program.go:33–55  ·  view source on GitHub ↗
(ctx context.Context, thread uint64, e *api.CmdExtras, s *api.GlobalState, programID ProgramId)

Source from the content-addressed store, hash-verified

31)
32
33func buildStubProgram(ctx context.Context, thread uint64, e *api.CmdExtras, s *api.GlobalState, programID ProgramId) []api.Cmd {
34 programInfo := FindLinkProgramExtra(s.Arena, e).Clone(s.Arena, api.CloneContext{})
35 vss, fss, err := stubShaderSource(programInfo)
36 if err != nil {
37 log.E(ctx, "Unable to build stub shader: %v", err)
38 }
39 c := GetContext(s, thread)
40 vertexShaderID := ShaderId(newUnusedID(ctx, 'S', func(x uint32) bool {
41 ok := c.Objects().Buffers().Contains(BufferId(x))
42 return ok
43 }))
44 fragmentShaderID := ShaderId(newUnusedID(ctx, 'S', func(x uint32) bool {
45 ok := c.Objects().Buffers().Contains(BufferId(x))
46 return ok || x == uint32(vertexShaderID)
47 }))
48 cb := CommandBuilder{Thread: thread, Arena: s.Arena}
49 glLinkProgram := cb.GlLinkProgram(programID)
50 glLinkProgram.Extras().Add(programInfo)
51 return append(
52 CompileProgram(ctx, s, cb, vertexShaderID, fragmentShaderID, programID, vss, fss),
53 glLinkProgram,
54 )
55}
56
57func stubShaderSource(pi LinkProgramExtraʳ) (vertexShaderSource, fragmentShaderSource string, err error) {
58 vsDecls, fsDecls := []string{}, []string{}

Callers 1

compatFunction · 0.85

Calls 11

FindLinkProgramExtraFunction · 0.85
stubShaderSourceFunction · 0.85
GetContextFunction · 0.85
CompileProgramFunction · 0.85
BuffersMethod · 0.80
newUnusedIDFunction · 0.70
CloneMethod · 0.65
ContainsMethod · 0.65
AddMethod · 0.65
ExtrasMethod · 0.65
EMethod · 0.45

Tested by

no test coverage detected