Build builds the replay payload for execution.
(env *executor.Env)
| 44 | |
| 45 | // Build builds the replay payload for execution. |
| 46 | func Build(env *executor.Env) (replaysrv.Payload, error) { |
| 47 | data, err := replayData(env) |
| 48 | if err != nil { |
| 49 | return replaysrv.Payload{}, err |
| 50 | } |
| 51 | |
| 52 | ctx := (*C.context)(env.CContext()) |
| 53 | C.gapil_replay_build(ctx, data) |
| 54 | |
| 55 | resources := slice.Cast( |
| 56 | slice.Bytes(unsafe.Pointer(data.resources.data), uint64(data.resources.size)), |
| 57 | reflect.TypeOf([]C.gapil_replay_resource_info_t{})).([]C.gapil_replay_resource_info_t) |
| 58 | |
| 59 | payload := replaysrv.Payload{ |
| 60 | Opcodes: slice.Bytes(unsafe.Pointer(data.stream.data), uint64(data.stream.size)), |
| 61 | Resources: make([]*replaysrv.ResourceInfo, len(resources)), |
| 62 | } |
| 63 | |
| 64 | for i, r := range resources { |
| 65 | id := slice.Bytes(unsafe.Pointer(&r.id[0]), 20) |
| 66 | payload.Resources[i] = &replaysrv.ResourceInfo{ |
| 67 | Id: string(id), |
| 68 | Size: uint32(r.size), |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | return payload, nil |
| 73 | } |
nothing calls this directly
no test coverage detected