Resolve implements the database.Resolver interface.
(ctx context.Context)
| 62 | |
| 63 | // Resolve implements the database.Resolver interface. |
| 64 | func (r *FramebufferChangesResolvable) Resolve(ctx context.Context) (interface{}, error) { |
| 65 | ctx = SetupContext(ctx, r.Capture, r.Config) |
| 66 | |
| 67 | c, err := capture.ResolveGraphics(ctx) |
| 68 | if err != nil { |
| 69 | return nil, err |
| 70 | } |
| 71 | |
| 72 | out := &AttachmentFramebufferChanges{ |
| 73 | // TODO: Remove hardcoded upper limit |
| 74 | attachments: make([]framebufferAttachmentChanges, api.FramebufferAttachment_Color3+1), |
| 75 | } |
| 76 | |
| 77 | postCmdAndSubCmd := func(s *api.GlobalState, subcommandIndex api.SubCmdIdx, cmd api.Cmd) { |
| 78 | api := cmd.API() |
| 79 | idx := append([]uint64(nil), subcommandIndex...) |
| 80 | for _, att := range allFramebufferAttachments { |
| 81 | info := FramebufferAttachmentInfo{After: idx} |
| 82 | if api != nil { |
| 83 | if inf, err := api.GetFramebufferAttachmentInfo(ctx, idx, s, cmd.Thread(), att); err == nil && inf.Format != nil { |
| 84 | info.Width, info.Height, info.Index, info.Format, info.CanResize = inf.Width, inf.Height, inf.Index, inf.Format, inf.CanResize |
| 85 | } else { |
| 86 | info.Err = err |
| 87 | } |
| 88 | } else { |
| 89 | info.Err = errNoAPI |
| 90 | } |
| 91 | if last := out.attachments[att].last(); !last.equal(info) { |
| 92 | attachment := out.attachments[att] |
| 93 | attachment.changes = append(attachment.changes, info) |
| 94 | out.attachments[att] = attachment |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | sync.MutateWithSubcommands(ctx, r.Capture, c.Commands, postCmdAndSubCmd, nil, postCmdAndSubCmd) |
| 100 | return out, nil |
| 101 | } |
nothing calls this directly
no test coverage detected