diff --git a/gapis/api/gles/compat.go b/gapis/api/gles/compat.go index 6447c53ef6..f6b5bddbdf 100644 --- a/gapis/api/gles/compat.go +++ b/gapis/api/gles/compat.go @@ -413,10 +413,10 @@ func compat(ctx context.Context, device *device.Instance) (transform.Transformer case *GlVertexAttrib4fv: if oldAttrib, ok := c.Vertex.Attributes[cmd.Location]; ok { - oldValue := oldAttrib.Value.Read(ctx, cmd, s, nil /* builder */) + oldValue := oldAttrib.Value.MustRead(ctx, cmd, s, nil /* builder */) cmd.Mutate(ctx, id, s, nil /* no builder, just mutate */) newAttrib := c.Vertex.Attributes[cmd.Location] - newValue := newAttrib.Value.Read(ctx, cmd, s, nil /* builder */) + newValue := newAttrib.Value.MustRead(ctx, cmd, s, nil /* builder */) if reflect.DeepEqual(oldValue, newValue) { // Ignore the call if it is redundant. // Some applications iterate over all arrays and explicitly initialize them. diff --git a/gapis/api/gles/compat_test.go b/gapis/api/gles/compat_test.go index e645532141..7872aba89f 100644 --- a/gapis/api/gles/compat_test.go +++ b/gapis/api/gles/compat_test.go @@ -126,8 +126,11 @@ func (c glShaderSourceCompatTest) run(t *testing.T) { s := newState(ctx) api.MutateCmds(ctx, s, nil, mw.Cmds...) - srcPtr := cmd.Source.Read(ctx, cmd, s, nil) // 0'th glShaderSource string pointer - got := strings.TrimRight(string(memory.CharToBytes(srcPtr.StringSlice(ctx, s).Read(ctx, cmd, s, nil))), "\x00") + srcPtr, err := cmd.Source.Read(ctx, cmd, s, nil) // 0'th glShaderSource string pointer + if err != nil { + t.Errorf("cmd.Source.Read returned: %v", err) + } + got := strings.TrimRight(string(memory.CharToBytes(srcPtr.StringSlice(ctx, s).MustRead(ctx, cmd, s, nil))), "\x00") expected, err := glslCompat(ctx, c.source, c.lang, nil, dev) if err != nil { diff --git a/gapis/api/gles/custom_replay.go b/gapis/api/gles/custom_replay.go index 4d5647192e..2fa8048d59 100644 --- a/gapis/api/gles/custom_replay.go +++ b/gapis/api/gles/custom_replay.go @@ -352,7 +352,7 @@ func (ω *CGLCreateContext) Mutate(ctx context.Context, id api.CmdID, s *api.Glo if b == nil || err != nil { return err } - ctxID := uint32(GetState(s).CGLContexts[ω.Ctx.Read(ctx, ω, s, b)].Identifier) + ctxID := uint32(GetState(s).CGLContexts[ω.Ctx.MustRead(ctx, ω, s, b)].Identifier) cb := CommandBuilder{Thread: ω.Thread()} return cb.ReplayCreateRenderer(ctxID).Mutate(ctx, id, s, b) } diff --git a/gapis/api/gles/dependency_graph_behaviour_provider.go b/gapis/api/gles/dependency_graph_behaviour_provider.go index 2a73e062ec..d4d764ca70 100644 --- a/gapis/api/gles/dependency_graph_behaviour_provider.go +++ b/gapis/api/gles/dependency_graph_behaviour_provider.go @@ -268,7 +268,7 @@ func getAllUsedTextureData(ctx context.Context, cmd api.Cmd, id api.CmdID, s *ap } for i := 0; i < int(activeUniform.ArraySize); i++ { uniform := prog.Uniforms[activeUniform.Location+UniformLocation(i)] - units := AsU32ˢ(uniform.Value, s.MemoryLayout).Read(ctx, cmd, s, nil) + units := AsU32ˢ(uniform.Value, s.MemoryLayout).MustRead(ctx, cmd, s, nil) if len(units) == 0 { units = []uint32{0} // The uniform was not set, so use default value. } diff --git a/gapis/api/gles/draw_call_mesh.go b/gapis/api/gles/draw_call_mesh.go index 94cda91cd6..98677edcc3 100644 --- a/gapis/api/gles/draw_call_mesh.go +++ b/gapis/api/gles/draw_call_mesh.go @@ -173,7 +173,10 @@ func vertexStreamData( // Only read as much data as we actually have. size := u64.Min(uint64(compactSize+ /* total size of gaps */ gap*(vectorCount-1)), slice.count-base) - data := slice.Slice(base, base+size, s.MemoryLayout).Read(ctx, nil, s, nil) + data, err := slice.Slice(base, base+size, s.MemoryLayout).Read(ctx, nil, s, nil) + if err != nil { + return nil, err + } if gap > 0 { // Adjust vectorCount to the number of complete vectors found in data. vectorCount := sint.Min((gap+len(data))/vectorStride, vectorCount) diff --git a/gapis/api/gles/markers.go b/gapis/api/gles/markers.go index d844a21030..3c2e92fc09 100644 --- a/gapis/api/gles/markers.go +++ b/gapis/api/gles/markers.go @@ -22,48 +22,52 @@ import ( "github.com/google/gapid/gapis/memory" ) +func readString(ϟctx context.Context, ϟa api.Cmd, ϟs *api.GlobalState, at memory.Pointer, length GLsizei) string { + ptr := NewCharᵖ(at) + if length > 0 { + chars, err := ptr.Slice(0, uint64(length), ϟs.MemoryLayout).Read(ϟctx, ϟa, ϟs, nil) + if err != nil { + return "" + } + return string(memory.CharToBytes(chars)) + } + chars, err := ptr.StringSlice(ϟctx, ϟs).Read(ϟctx, ϟa, ϟs, nil) + if err != nil { + return "" + } + return strings.TrimRight(string(memory.CharToBytes(chars)), "\x00") +} + // Label returns the user maker name. func (ϟa *GlPushGroupMarkerEXT) Label(ϟctx context.Context, ϟs *api.GlobalState) string { - ptr := Charᵖ(ϟa.Marker) - if ϟa.Length > 0 { - return string(memory.CharToBytes(ptr.Slice(0, uint64(ϟa.Length), ϟs.MemoryLayout).Read(ϟctx, ϟa, ϟs, nil))) - } - return strings.TrimRight(string(memory.CharToBytes(ptr.StringSlice(ϟctx, ϟs).Read(ϟctx, ϟa, ϟs, nil))), "\x00") + return readString(ϟctx, ϟa, ϟs, ϟa.Marker, ϟa.Length) } // Label returns the user maker name. func (ϟa *GlInsertEventMarkerEXT) Label(ϟctx context.Context, ϟs *api.GlobalState) string { - ptr := Charᵖ(ϟa.Marker) - if ϟa.Length > 0 { - return string(memory.CharToBytes(ptr.Slice(0, uint64(ϟa.Length), ϟs.MemoryLayout).Read(ϟctx, ϟa, ϟs, nil))) - } - return strings.TrimRight(string(memory.CharToBytes(ptr.StringSlice(ϟctx, ϟs).Read(ϟctx, ϟa, ϟs, nil))), "\x00") + return readString(ϟctx, ϟa, ϟs, ϟa.Marker, ϟa.Length) } // Label returns the user maker name. func (ϟa *GlPushDebugGroup) Label(ϟctx context.Context, ϟs *api.GlobalState) string { - ptr := Charᵖ(ϟa.Message) // This is incorrect, fudging for a bug in Unity which has been fixed but not // rolled out. // See https://github.com/google/gapid/issues/459 for reference. + // + // ϟa.Length should only be treated as null-terminated if ϟa.Length is < 0. + // // TODO: Consider removing once the fixed version is mainstream. - // if ϟa.Length >= 0 { - if ϟa.Length > 0 { - return string(memory.CharToBytes(ptr.Slice(0, uint64(ϟa.Length), ϟs.MemoryLayout).Read(ϟctx, ϟa, ϟs, nil))) - } - return strings.TrimRight(string(memory.CharToBytes(ptr.StringSlice(ϟctx, ϟs).Read(ϟctx, ϟa, ϟs, nil))), "\x00") + return readString(ϟctx, ϟa, ϟs, ϟa.Message, ϟa.Length) } // Label returns the user maker name. func (ϟa *GlPushDebugGroupKHR) Label(ϟctx context.Context, ϟs *api.GlobalState) string { - ptr := Charᵖ(ϟa.Message) // This is incorrect, fudging for a bug in Unity which has been fixed but not // rolled out. // See https://github.com/google/gapid/issues/459 for reference. + // + // ϟa.Length should only be treated as null-terminated if ϟa.Length is < 0. + // // TODO: Consider removing once the fixed version is mainstream. - // if ϟa.Length >= 0 { - if ϟa.Length > 0 { - return string(memory.CharToBytes(ptr.Slice(0, uint64(ϟa.Length), ϟs.MemoryLayout).Read(ϟctx, ϟa, ϟs, nil))) - } - return strings.TrimRight(string(memory.CharToBytes(ptr.StringSlice(ϟctx, ϟs).Read(ϟctx, ϟa, ϟs, nil))), "\x00") + return readString(ϟctx, ϟa, ϟs, ϟa.Message, ϟa.Length) } diff --git a/gapis/api/gvr/framebindings.go b/gapis/api/gvr/framebindings.go index e3aa69c188..a1f1570650 100644 --- a/gapis/api/gvr/framebindings.go +++ b/gapis/api/gvr/framebindings.go @@ -80,7 +80,10 @@ func (r *FrameBindingsResolvable) Resolve(ctx context.Context) (interface{}, err // just so it can be nullified before returning. To avoid another // state mutation just to get the pointer, cache them here. cmd.extras.Observations().ApplyReads(s.Memory.ApplicationPool()) - frame := cmd.Frame.Read(ctx, cmd, s, nil) + frame, err := cmd.Frame.Read(ctx, cmd, s, nil) + if err != nil { + return err + } out.submitBuffer[id] = frameToBuffer[frame] case *Gvr_frame_get_framebuffer_object: frameToBuffer[GvrFrameᵖ(cmd.Frame)] = gles.FramebufferId(cmd.Result) diff --git a/gapis/api/templates/api.go.tmpl b/gapis/api/templates/api.go.tmpl index 4b26019ae5..6f209313eb 100644 --- a/gapis/api/templates/api.go.tmpl +++ b/gapis/api/templates/api.go.tmpl @@ -213,7 +213,7 @@ // New{{$ptr_ty}} returns a {{$ptr_ty}} that points to addr in the application pool. func New{{$ptr_ty}}(p ϟmem.Pointer) {{$ptr_ty}} { if p == nil { - return {{$ptr_ty}}{ 0, ϟmem.ApplicationPool } + return {{$ptr_ty}}{ 0, ϟmem.ApplicationPool } } return {{$ptr_ty}}{ p.Address(), p.Pool() } } @@ -251,13 +251,30 @@ {{if not $el_is_void}} // Read reads and returns the {{$el_ty}} element at the pointer. - func (p {{$ptr_ty}}) Read(ϟctx context.Context, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) {{$el_ty}} { - return p.Slice(0, 1, ϟs.MemoryLayout).Read(ϟctx, ϟa, ϟs, ϟb)[0] + func (p {{$ptr_ty}}) Read(ϟctx context.Context, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) ({{$el_ty}}, error) { + vals, err := p.Slice(0, 1, ϟs.MemoryLayout).Read(ϟctx, ϟa, ϟs, ϟb) + if err != nil { + return {{Template "Go.Null" (TypeOf $p.To)}}, err + } + return vals[0], nil + } + + // MustRead calls and returns Read, panicing if there was an error. + func (p {{$ptr_ty}}) MustRead(ϟctx context.Context, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) {{$el_ty}} { + val, err := p.Read(ϟctx, ϟa, ϟs, ϟb) + panicOnError(err) + return val } // Write writes value to the {{$el_ty}} element at the pointer. - func (p {{$ptr_ty}}) Write(ϟctx context.Context, value {{$el_ty}}, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) { - p.Slice(0, 1, ϟs.MemoryLayout).Write(ϟctx, []{{$el_ty}}{value}, ϟa, ϟs, ϟb) + func (p {{$ptr_ty}}) Write(ϟctx context.Context, value {{$el_ty}}, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) error { + _, err := p.Slice(0, 1, ϟs.MemoryLayout).Write(ϟctx, []{{$el_ty}}{value}, ϟa, ϟs, ϟb) + return err + } + + // MustWrite calls Write, panicing if there was an error. + func (p {{$ptr_ty}}) MustWrite(ϟctx context.Context, value {{$el_ty}}, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) { + panicOnError(p.Write(ϟctx, value, ϟa, ϟs, ϟb)) } {{end}} @@ -499,23 +516,41 @@ } // Read reads and returns all the {{$el_ty}} elements in this {{$slice_ty}}. - func (s {{$slice_ty}}) Read(ϟctx context.Context, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) []{{$el_ty}} { + func (s {{$slice_ty}}) Read(ϟctx context.Context, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) ([]{{$el_ty}}, error) { s.OnRead(ϟctx, ϟa, ϟs, ϟb) res := make([]{{$el_ty}}, s.count) d := s.Decoder(ϟctx, ϟs) ϟmem.Read(d, &res) - panicOnError(d.Error()) - return res + if err := d.Error(); err != nil { + return nil, err + } + return res, nil + } + + // MustRead calls and returns Read, panicing if there was an error. + func (s {{$slice_ty}}) MustRead(ϟctx context.Context, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) []{{$el_ty}} { + vals, err := s.Read(ϟctx, ϟa, ϟs, ϟb) + panicOnError(err) + return vals } // Write copies elements from src to this slice. The number of elements copied is returned // which is the minimum of s.count and len(src). - func (s {{$slice_ty}}) Write(ϟctx context.Context, src []{{$el_ty}}, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) uint64 { + func (s {{$slice_ty}}) Write(ϟctx context.Context, src []{{$el_ty}}, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) (uint64, error) { count := u64.Min(s.count, uint64(len(src))) e := s.Slice(0, count, ϟs.MemoryLayout).Encoder(ϟs) ϟmem.Write(e, src[:count]) s.OnWrite(ϟctx, ϟa, ϟs, ϟb) - panicOnError(e.Error()) + if err := e.Error(); err != nil { + return 0, err + } + return count, nil + } + + // MustWrite calls and returns Write, panicing if there was an error. + func (s {{$slice_ty}}) MustWrite(ϟctx context.Context, src []{{$el_ty}}, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) uint64 { + count, err := s.Write(ϟctx, src, ϟa, ϟs, ϟb) + panicOnError(err) return count } @@ -527,7 +562,7 @@ dst, src = dst.Slice(0, count, ϟs.MemoryLayout), src.Slice(0, count, ϟs.MemoryLayout) {{if $el_is_ptr}} if (dst.pool == ϟmem.ApplicationPool) != (src.pool == ϟmem.ApplicationPool) { - dst.Write(ϟctx, src.Read(ϟctx, ϟa, ϟs, ϟb), ϟa, ϟs, ϟb) // Element-wise copy so we can convert u64 <-> {{$ptr_ty}} + dst.MustWrite(ϟctx, src.MustRead(ϟctx, ϟa, ϟs, ϟb), ϟa, ϟs, ϟb) // Element-wise copy so we can convert u64 <-> {{$ptr_ty}} } else { {{end}} src.OnRead(ϟctx, ϟa, ϟs, ϟb) @@ -539,7 +574,7 @@ // Contains returns true if the slice contains the specified value. func (s {{$slice_ty}}) Contains(ϟctx context.Context, val {{$el_ty}}, ϟa api.Cmd, ϟs *api.GlobalState, ϟb *builder.Builder) bool { - for _, e := range s.Read(ϟctx, ϟa, ϟs, ϟb) { + for _, e := range s.MustRead(ϟctx, ϟa, ϟs, ϟb) { if e == val { return true } diff --git a/gapis/api/templates/go_common.tmpl b/gapis/api/templates/go_common.tmpl index 71b02f817d..f781e82cab 100644 --- a/gapis/api/templates/go_common.tmpl +++ b/gapis/api/templates/go_common.tmpl @@ -534,9 +534,9 @@ observed memory which is undesirable, so instead just perform regular (non-replay-builder) read logic. */}} - Read(ϟctx, ϟa, ϟs, nil) + MustRead(ϟctx, ϟa, ϟs, nil) {{else}} - Read(ϟctx, ϟa, ϟs, ϟb) + MustRead(ϟctx, ϟa, ϟs, ϟb) {{end}} {{end}} diff --git a/gapis/api/templates/mutate.go.tmpl b/gapis/api/templates/mutate.go.tmpl index 5699bb28c1..8056119dc7 100644 --- a/gapis/api/templates/mutate.go.tmpl +++ b/gapis/api/templates/mutate.go.tmpl @@ -584,7 +584,7 @@ {{AssertType $ "SliceAssign"}} {{if ne $.Operator "="}}{{Error "Compound assignments to pointers are not supported (%s)" $.Operator}}{{end}} - {{Template "Go.Read" $.To.Slice}}.Index({{Template "Go.Read" $.To.Index}}, ϟl).Write(ϟctx, {{Template "Go.Read" $.Value}}, ϟa, ϟs, ϟb) + {{Template "Go.Read" $.To.Slice}}.Index({{Template "Go.Read" $.To.Index}}, ϟl).MustWrite(ϟctx, {{Template "Go.Read" $.Value}}, ϟa, ϟs, ϟb) {{end}} @@ -617,7 +617,7 @@ ϟdst, ϟsrc := {{Template "Go.Read" $.Statement.Dst}}, {{Template "Go.Read" $.Statement.Src}} ϟcount := u64.Min(ϟdst.Count(), ϟsrc.Count()) ϟdst, ϟsrc = ϟdst.Slice(0, ϟcount, ϟl), ϟsrc.Slice(0, ϟcount, ϟl) - ϟsrcElems := ϟsrc.Read(ϟctx, ϟa, ϟs, ϟb) + ϟsrcElems := ϟsrc.MustRead(ϟctx, ϟa, ϟs, ϟb) {{end}} {{/* Perform the call */}} @@ -625,7 +625,7 @@ {{if IsCopy $.Statement}} {{/* Apply the fenced-copy write */}} - ϟdst.Write(ϟctx, ϟsrcElems, ϟa, ϟs, ϟb) + ϟdst.MustWrite(ϟctx, ϟsrcElems, ϟa, ϟs, ϟb) {{end}} } {{if IsCopy $.Statement}} diff --git a/gapis/api/test/intrinsics_test.go b/gapis/api/test/intrinsics_test.go index 9b0770843f..996c8d84b5 100644 --- a/gapis/api/test/intrinsics_test.go +++ b/gapis/api/test/intrinsics_test.go @@ -39,8 +39,10 @@ func TestClone(t *testing.T) { cb.CmdClone(p(0x1234), 10). AddRead(memory.Store(ctx, s.MemoryLayout, p(0x1234), expected)), ) - got := GetState(s).U8s.Read(ctx, nil, s, nil) - assert.With(ctx).ThatSlice(got).Equals(expected) + got, err := GetState(s).U8s.Read(ctx, nil, s, nil) + if assert.For(ctx, "err").ThatError(err).Succeeded() { + assert.For(ctx, "got").ThatSlice(got).Equals(expected) + } } func TestMake(t *testing.T) { @@ -70,8 +72,10 @@ func TestCopy(t *testing.T) { cb.CmdCopy(p(0x1234), 10). AddRead(memory.Store(ctx, s.MemoryLayout, p(0x1234), expected)), ) - got := GetState(s).U8s.Read(ctx, nil, s, nil) - assert.With(ctx).ThatSlice(got).Equals(expected) + got, err := GetState(s).U8s.Read(ctx, nil, s, nil) + if assert.For(ctx, "err").ThatError(err).Succeeded() { + assert.For(ctx, "got").ThatSlice(got).Equals(expected) + } } func TestCharsliceToString(t *testing.T) { diff --git a/gapis/api/test/subroutines_test.go b/gapis/api/test/subroutines_test.go index 17146b9154..8478d33b70 100644 --- a/gapis/api/test/subroutines_test.go +++ b/gapis/api/test/subroutines_test.go @@ -31,7 +31,9 @@ func TestSubAdd(t *testing.T) { cb := CommandBuilder{Thread: 0} s := api.NewStateWithEmptyAllocator(device.Little32) api.MutateCmds(ctx, s, nil, cb.CmdAdd(10, 20)) - got := GetState(s).Ints.Read(ctx, nil, s, nil) + got, err := GetState(s).Ints.Read(ctx, nil, s, nil) expected := []memory.Int{30} - assert.With(ctx).ThatSlice(got).Equals(expected) + if assert.For(ctx, "err").ThatError(err).Succeeded() { + assert.For(ctx, "got").ThatSlice(got).Equals(expected) + } } diff --git a/gapis/api/vulkan/custom_replay.go b/gapis/api/vulkan/custom_replay.go index 2951cbadcf..41ccf7e1aa 100644 --- a/gapis/api/vulkan/custom_replay.go +++ b/gapis/api/vulkan/custom_replay.go @@ -252,7 +252,7 @@ func (a *VkCreateInstance) Mutate(ctx context.Context, id api.CmdID, s *api.Glob } // Call the replayRegisterVkInstance() synthetic API function. - instance := a.PInstance.Read(ctx, a, s, b) + instance := a.PInstance.MustRead(ctx, a, s, b) return cb.ReplayRegisterVkInstance(instance).Mutate(ctx, id, s, b) } @@ -319,7 +319,7 @@ func (a *RecreateDeviceMemory) Mutate(ctx context.Context, id api.CmdID, s *api. return err } if a.MappedSize > 0 { - memory := a.PMemory.Read(ctx, a, s, b) + memory := a.PMemory.MustRead(ctx, a, s, b) bind := cb.VkMapMemory(a.Device, memory, a.MappedOffset, a.MappedSize, VkMemoryMapFlags(0), a.PpData, VkResult(0)) bind.Extras().MustClone(a.Extras().All()...) @@ -339,7 +339,7 @@ func (a *RecreateAndBeginCommandBuffer) Mutate(ctx context.Context, id api.CmdID } if !a.PBeginInfo.IsNullptr() { - commandBuffer := a.PCommandBuffer.Read(ctx, a, s, b) + commandBuffer := a.PCommandBuffer.MustRead(ctx, a, s, b) begin := cb.VkBeginCommandBuffer(commandBuffer, a.PBeginInfo, VkResult(0)) begin.Extras().MustClone(a.Extras().All()...) err = begin.Mutate(ctx, id, s, b) @@ -385,7 +385,7 @@ func (a *RecreateSemaphore) Mutate(ctx context.Context, id api.CmdID, s *api.Glo } if a.Signaled != VkBool32(0) { queue := findGraphicsAndComputeQueueForDevice(a.Device, s) - semaphore := a.PSemaphore.Read(ctx, a, s, b) + semaphore := a.PSemaphore.MustRead(ctx, a, s, b) semaphores := s.AllocDataOrPanic(ctx, semaphore) defer semaphores.Free() @@ -441,7 +441,7 @@ func (a *RecreateEvent) Mutate(ctx context.Context, id api.CmdID, s *api.GlobalS return err } if a.Signaled != VkBool32(0) { - event := a.PEvent.Read(ctx, a, s, b) + event := a.PEvent.MustRead(ctx, a, s, b) err := cb.VkSetEvent( a.Device, event, @@ -649,7 +649,7 @@ func (a *VkCreateDevice) Mutate(ctx context.Context, id api.CmdID, s *api.Global allocated := []*api.AllocResult{} if b != nil { a.Extras().Observations().ApplyReads(s.Memory.ApplicationPool()) - createInfo := a.PCreateInfo.Read(ctx, a, s, nil) + createInfo := a.PCreateInfo.MustRead(ctx, a, s, nil) defer func() { for _, d := range allocated { d.Free() @@ -657,8 +657,8 @@ func (a *VkCreateDevice) Mutate(ctx context.Context, id api.CmdID, s *api.Global }() extensionCount := uint64(createInfo.EnabledExtensionCount) newExtensionNames := []memory.Pointer{} - for _, e := range createInfo.PpEnabledExtensionNames.Slice(0, extensionCount, s.MemoryLayout).Read(ctx, a, s, nil) { - extensionName := string(memory.CharToBytes(e.StringSlice(ctx, s).Read(ctx, a, s, nil))) + for _, e := range createInfo.PpEnabledExtensionNames.Slice(0, extensionCount, s.MemoryLayout).MustRead(ctx, a, s, nil) { + extensionName := string(memory.CharToBytes(e.StringSlice(ctx, s).MustRead(ctx, a, s, nil))) if !strings.Contains(extensionName, "VK_EXT_debug_marker") { nameSliceData := s.AllocDataOrPanic(ctx, extensionName) allocated = append(allocated, &nameSliceData) @@ -692,7 +692,7 @@ func (a *VkCreateDevice) Mutate(ctx context.Context, id api.CmdID, s *api.Global } // Call the replayRegisterVkDevice() synthetic API function. - device := a.PDevice.Read(ctx, a, s, b) + device := a.PDevice.MustRead(ctx, a, s, b) return cb.ReplayRegisterVkDevice(a.PhysicalDevice, device, a.PCreateInfo).Mutate(ctx, id, s, b) } @@ -715,7 +715,7 @@ func (a *VkAllocateCommandBuffers) Mutate(ctx context.Context, id api.CmdID, s * return err } // Call the replayRegisterVkCommandBuffers() synthetic API function to link these command buffers to the device. - count := a.PAllocateInfo.Read(ctx, a, s, b).CommandBufferCount + count := a.PAllocateInfo.MustRead(ctx, a, s, b).CommandBufferCount return cb.ReplayRegisterVkCommandBuffers(a.Device, count, a.PCommandBuffers).Mutate(ctx, id, s, b) } @@ -748,11 +748,11 @@ func (a *VkAcquireNextImageKHR) Mutate(ctx context.Context, id api.CmdID, s *api // Apply the write observation before having the replay device calling the vkAcquireNextImageKHR() command. // This is to pass the returned image index value captured in the trace, into the replay device to acquire for the specific image. o.ApplyWrites(s.Memory.ApplicationPool()) - _ = a.PImageIndex.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Read(ctx, a, s, b) + _ = a.PImageIndex.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).MustRead(ctx, a, s, b) if b != nil { a.Call(ctx, s, b) } - a.PImageIndex.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Write(ctx, a.PImageIndex.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Read(ctx, a, s, nil), a, s, b) + a.PImageIndex.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Write(ctx, a.PImageIndex.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).MustRead(ctx, a, s, nil), a, s, b) _ = a.Result return nil } @@ -789,7 +789,7 @@ func (a *VkGetEventStatus) Mutate(ctx context.Context, id api.CmdID, s *api.Glob func (a *RecreateDebugMarkerSetObjectNameEXT) Mutate(ctx context.Context, id api.CmdID, s *api.GlobalState, b *builder.Builder) error { o := a.Extras().Observations() o.ApplyReads(s.Memory.ApplicationPool()) - nameInfo := a.PNameInfo.Read(ctx, a, s, nil) + nameInfo := a.PNameInfo.MustRead(ctx, a, s, nil) err := subSetDebugMarkerObjectName(ctx, a, id, o, s, GetState(s), a.thread, nil, nameInfo) if err != nil { return err @@ -800,7 +800,7 @@ func (a *RecreateDebugMarkerSetObjectNameEXT) Mutate(ctx context.Context, id api func (a *RecreateDebugMarkerSetObjectTagEXT) Mutate(ctx context.Context, id api.CmdID, s *api.GlobalState, b *builder.Builder) error { o := a.Extras().Observations() o.ApplyReads(s.Memory.ApplicationPool()) - tagInfo := a.PTagInfo.Read(ctx, a, s, nil) + tagInfo := a.PTagInfo.MustRead(ctx, a, s, nil) err := subSetDebugMarkerObjectTag(ctx, a, id, o, s, GetState(s), a.thread, nil, tagInfo) if err != nil { return err @@ -814,7 +814,7 @@ func (a *ReplayAllocateImageMemory) Mutate(ctx context.Context, id api.CmdID, s } l := s.MemoryLayout c := GetState(s) - memory := a.PMemory.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Read(ctx, a, s, nil) + memory := a.PMemory.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).MustRead(ctx, a, s, nil) imageObject := c.Images.Get(a.Image) imageWidth := imageObject.Layers.Get(0).Levels.Get(0).Width imageHeight := imageObject.Layers.Get(0).Levels.Get(0).Height @@ -1054,7 +1054,7 @@ func mapBufferMemory(ctx context.Context, id api.CmdID, cb CommandBuilder, s *ap return NewVoidᵖ(memory.Nullptr), at, err } - return NewVoidᵖᵖ(mappedPointer.Ptr()).Read(ctx, cmd, s, b), at, err + return NewVoidᵖᵖ(mappedPointer.Ptr()).MustRead(ctx, cmd, s, b), at, err } func flushBufferMemory(ctx context.Context, id api.CmdID, cb CommandBuilder, s *api.GlobalState, b *builder.Builder, device VkDevice, size VkDeviceSize, mem VkDeviceMemory, mapped U8ᵖ) error { @@ -1309,7 +1309,7 @@ func (a *RecreateBuffer) Mutate(ctx context.Context, id api.CmdID, s *api.Global o := a.Extras().Observations() o.ApplyReads(s.Memory.ApplicationPool()) - createInfo := a.PCreateInfo.Read(ctx, a, s, b) + createInfo := a.PCreateInfo.MustRead(ctx, a, s, b) createInfo.Usage = createInfo.Usage | VkBufferUsageFlags(VkBufferUsageFlagBits_VK_BUFFER_USAGE_TRANSFER_DST_BIT) createInfoData := s.AllocDataOrPanic(ctx, createInfo) defer createInfoData.Free() @@ -1454,9 +1454,9 @@ func (a *RecreateQueryPool) Mutate(ctx context.Context, id api.CmdID, s *api.Glo return err } - createInfoObject := a.PCreateInfo.Read(ctx, a, s, b) - queryStates := a.PQueryStatuses.Slice(0, uint64(createInfoObject.QueryCount), l).Read(ctx, a, s, b) - pool := a.PPool.Read(ctx, a, s, b) + createInfoObject := a.PCreateInfo.MustRead(ctx, a, s, b) + queryStates := a.PQueryStatuses.Slice(0, uint64(createInfoObject.QueryCount), l).MustRead(ctx, a, s, b) + pool := a.PPool.MustRead(ctx, a, s, b) anyActive := false for i := uint32(0); i < createInfoObject.QueryCount; i++ { @@ -1520,8 +1520,8 @@ func (a *RecreateSwapchain) Mutate(ctx context.Context, id api.CmdID, s *api.Glo if err := hijack.Mutate(ctx, id, s, b); err != nil { return err } - swapchain := a.PSwapchain.Read(ctx, a, s, b) - createInfoData := a.PCreateInfo.Read(ctx, a, s, b) + swapchain := a.PSwapchain.MustRead(ctx, a, s, b) + createInfoData := a.PCreateInfo.MustRead(ctx, a, s, b) swapchainCountData := s.AllocDataOrPanic(ctx, createInfoData.MinImageCount) defer swapchainCountData.Free() @@ -1532,9 +1532,9 @@ func (a *RecreateSwapchain) Mutate(ctx context.Context, id api.CmdID, s *api.Glo return err } - images := a.PSwapchainImages.Slice(0, uint64(createInfoData.MinImageCount), l).Read(ctx, a, s, b) - imageLayouts := a.PSwapchainLayouts.Slice(0, uint64(createInfoData.MinImageCount), l).Read(ctx, a, s, b) - boundQueues := a.PInitialQueues.Slice(0, uint64(createInfoData.MinImageCount), l).Read(ctx, a, s, b) + images := a.PSwapchainImages.Slice(0, uint64(createInfoData.MinImageCount), l).MustRead(ctx, a, s, b) + imageLayouts := a.PSwapchainLayouts.Slice(0, uint64(createInfoData.MinImageCount), l).MustRead(ctx, a, s, b) + boundQueues := a.PInitialQueues.Slice(0, uint64(createInfoData.MinImageCount), l).MustRead(ctx, a, s, b) for i := 0; i < int(createInfoData.MinImageCount); i++ { imageObject := GetState(s).Images[images[i]] if boundQueues[i] != VkQueue(0) && imageLayouts[i] != VkImageLayout_VK_IMAGE_LAYOUT_UNDEFINED { diff --git a/gapis/api/vulkan/draw_call_mesh.go b/gapis/api/vulkan/draw_call_mesh.go index f2c75ede4c..219586e4cb 100644 --- a/gapis/api/vulkan/draw_call_mesh.go +++ b/gapis/api/vulkan/draw_call_mesh.go @@ -106,7 +106,10 @@ func drawCallMesh(ctx context.Context, dc *VkQueueSubmit, p *path.Mesh) (*api.Me if lastDrawInfo.BoundIndexBuffer.BoundBuffer.Buffer == nil { return nil, fmt.Errorf("Cannot found last used index buffer") } - indices := getIndicesData(ctx, s, lastDrawInfo.BoundIndexBuffer, p.IndexCount, p.FirstIndex, p.VertexOffset) + indices, err := getIndicesData(ctx, s, lastDrawInfo.BoundIndexBuffer, p.IndexCount, p.FirstIndex, p.VertexOffset) + if err != nil { + return nil, err + } // Calculate the vertex count and the first vertex maxIndex := uint32(0) @@ -160,31 +163,34 @@ func drawCallMesh(ctx context.Context, dc *VkQueueSubmit, p *path.Mesh) (*api.Me return mesh, nil } -func getIndicesData(ctx context.Context, s *api.GlobalState, boundIndexBuffer *BoundIndexBuffer, indexCount, firstIndex uint32, vertexOffset int32) []uint32 { +func getIndicesData(ctx context.Context, s *api.GlobalState, boundIndexBuffer *BoundIndexBuffer, indexCount, firstIndex uint32, vertexOffset int32) ([]uint32, error) { backingMem := boundIndexBuffer.BoundBuffer.Buffer.Memory if backingMem == nil { - return []uint32{} + return []uint32{}, nil } bufferMemoryOffset := uint64(boundIndexBuffer.BoundBuffer.Buffer.MemoryOffset) indexBindingOffset := uint64(boundIndexBuffer.BoundBuffer.Offset) // TODO(qining): Get the maximum size of the bound buffer here from BoundBuffer.Range. offset := bufferMemoryOffset + indexBindingOffset - extractIndices := func(sizeOfIndex uint64) []uint32 { + extractIndices := func(sizeOfIndex uint64) ([]uint32, error) { indices := []uint32{} start := offset + uint64(firstIndex)*sizeOfIndex size := uint64(indexCount) * sizeOfIndex end := start + size if start >= backingMem.Data.count || end > backingMem.Data.count { log.E(ctx, "Shadow memory of index buffer is not big enough") - return []uint32{} + return []uint32{}, nil } indicesSlice := backingMem.Data.Slice(start, end, s.MemoryLayout) for i := uint64(0); (i < size) && (i+sizeOfIndex-1 < size); i += sizeOfIndex { index := int32(0) for j := uint64(0); j < sizeOfIndex; j++ { - oneByte := int32(indicesSlice.Index(i+j, s.MemoryLayout).Read(ctx, nil, s, nil)) - index += oneByte << (8 * j) + oneByte, err := indicesSlice.Index(i+j, s.MemoryLayout).Read(ctx, nil, s, nil) + if err != nil { + return nil, err + } + index += int32(oneByte) << (8 * j) } index += vertexOffset if index < 0 { @@ -194,7 +200,7 @@ func getIndicesData(ctx context.Context, s *api.GlobalState, boundIndexBuffer *B } indices = append(indices, uint32(index)) } - return indices + return indices, nil } switch boundIndexBuffer.Type { @@ -203,7 +209,7 @@ func getIndicesData(ctx context.Context, s *api.GlobalState, boundIndexBuffer *B case VkIndexType_VK_INDEX_TYPE_UINT32: return extractIndices(4) } - return []uint32{} + return []uint32{}, nil } func getVertexBuffers(ctx context.Context, s *api.GlobalState, thread uint64, @@ -307,7 +313,10 @@ func getVerticesData(ctx context.Context, s *api.GlobalState, thread uint64, // our zero-initialized buffer. return out, fmt.Errorf("Vertex data is out of range") } - data := vertexSlice.Slice(offset, offset+fullSize, s.MemoryLayout).Read(ctx, nil, s, nil) + data, err := vertexSlice.Slice(offset, offset+fullSize, s.MemoryLayout).Read(ctx, nil, s, nil) + if err != nil { + return nil, err + } if stride > perVertexSize { // There are gaps between vertices. for i := uint64(0); i < uint64(vertexCount); i++ { diff --git a/gapis/api/vulkan/externs.go b/gapis/api/vulkan/externs.go index d0ce04ca79..dcdad0d962 100644 --- a/gapis/api/vulkan/externs.go +++ b/gapis/api/vulkan/externs.go @@ -40,8 +40,8 @@ func (e externs) hasDynamicProperty(info VkPipelineDynamicStateCreateInfoᶜᵖ, return false } l := e.s.MemoryLayout - dynamic_state_info := info.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Read(e.ctx, e.cmd, e.s, e.b) - states := dynamic_state_info.PDynamicStates.Slice(uint64(uint32(0)), uint64(dynamic_state_info.DynamicStateCount), l).Read(e.ctx, e.cmd, e.s, e.b) + dynamic_state_info := info.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).MustRead(e.ctx, e.cmd, e.s, e.b) + states := dynamic_state_info.PDynamicStates.Slice(uint64(uint32(0)), uint64(dynamic_state_info.DynamicStateCount), l).MustRead(e.ctx, e.cmd, e.s, e.b) for _, s := range states { if s == state { return true @@ -975,7 +975,7 @@ func (e externs) numberOfPNext(pNext Voidᶜᵖ) uint32 { counter := uint32(0) for (pNext) != (Voidᶜᵖ{}) { counter++ - pNext = Voidᶜᵖᵖ(pNext).Slice(uint64(0), uint64(2), l).Index(uint64(1), l).Read(e.ctx, e.cmd, e.s, e.b) + pNext = Voidᶜᵖᵖ(pNext).Slice(uint64(0), uint64(2), l).Index(uint64(1), l).MustRead(e.ctx, e.cmd, e.s, e.b) } return counter } diff --git a/gapis/api/vulkan/footprint_builder.go b/gapis/api/vulkan/footprint_builder.go index 74f2a3f3b2..051505f694 100644 --- a/gapis/api/vulkan/footprint_builder.go +++ b/gapis/api/vulkan/footprint_builder.go @@ -842,7 +842,7 @@ func (ds *descriptorSet) writeDescriptors(ctx context.Context, VkDescriptorType_VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VkDescriptorType_VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, VkDescriptorType_VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT: - for _, imageInfo := range write.PImageInfo.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, imageInfo := range write.PImageInfo.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { updateDstForOverflow() backingData := dependencygraph.DefUseVariable(vkNullHandle) sampler := vkNullHandle @@ -865,7 +865,7 @@ func (ds *descriptorSet) writeDescriptors(ctx context.Context, VkDescriptorType_VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VkDescriptorType_VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, VkDescriptorType_VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC: - for _, bufferInfo := range write.PBufferInfo.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, bufferInfo := range write.PBufferInfo.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { updateDstForOverflow() vkBuf := bufferInfo.Buffer bufData, _ := vb.getBufferData(ctx, bh, vkBuf).(memorySpan) @@ -877,7 +877,7 @@ func (ds *descriptorSet) writeDescriptors(ctx context.Context, } case VkDescriptorType_VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, VkDescriptorType_VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER: - for _, vkBufView := range write.PTexelBufferView.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, vkBufView := range write.PTexelBufferView.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { updateDstForOverflow() read(ctx, bh, vkHandle(vkBufView)) bufView := GetState(s).BufferViews.Get(vkBufView) @@ -1216,13 +1216,13 @@ func (vb *FootprintBuilder) recordBarriers(ctx context.Context, } } else { for _, barrier := range pBufferBarriers.Slice(0, - uint64(bufferBarrierCount), l).Read(ctx, cmd, s, nil) { + uint64(bufferBarrierCount), l).MustRead(ctx, cmd, s, nil) { bufData, _ := vb.getBufferData(ctx, bh, barrier.Buffer).(memorySpan) touchedData = append(touchedData, getSubBufferData( bufData, uint64(barrier.Offset), uint64(barrier.Size))) } for _, barrier := range pImageBarriers.Slice(0, - uint64(imageBarrierCount), l).Read(ctx, cmd, s, nil) { + uint64(imageBarrierCount), l).MustRead(ctx, cmd, s, nil) { touchedData = append(touchedData, vb.getImageLayoutAndData(ctx, bh, barrier.Image)...) } } @@ -1276,10 +1276,10 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, switch cmd := cmd.(type) { // device memory case *VkAllocateMemory: - vkMem := cmd.PMemory.Read(ctx, cmd, s, nil) + vkMem := cmd.PMemory.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkMem)) case *RecreateDeviceMemory: - vkMem := cmd.PMemory.Read(ctx, cmd, s, nil) + vkMem := cmd.PMemory.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkMem)) case *VkFreeMemory: vkMem := cmd.Memory @@ -1302,7 +1302,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } case *VkFlushMappedMemoryRanges: count := uint64(cmd.MemoryRangeCount) - for _, rng := range cmd.PMemoryRanges.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, rng := range cmd.PMemoryRanges.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(rng.Memory)) offset := uint64(rng.Offset) size := uint64(rng.Size) @@ -1314,7 +1314,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } case *VkInvalidateMappedMemoryRanges: count := uint64(cmd.MemoryRangeCount) - for _, rng := range cmd.PMemoryRanges.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, rng := range cmd.PMemoryRanges.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(rng.Memory)) offset := uint64(rng.Offset) size := uint64(rng.Size) @@ -1327,11 +1327,11 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, // image case *VkCreateImage: - vkImg := cmd.PImage.Read(ctx, cmd, s, nil) + vkImg := cmd.PImage.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkImg)) vb.images[vkImg] = newImageLayoutAndData(ctx, bh) case *RecreateImage: - vkImg := cmd.PImage.Read(ctx, cmd, s, nil) + vkImg := cmd.PImage.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkImg)) vb.images[vkImg] = newImageLayoutAndData(ctx, bh) case *VkDestroyImage: @@ -1377,19 +1377,19 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, write(ctx, bh, vb.getImageData(ctx, bh, cmd.Image)) case *VkCreateImageView: - write(ctx, bh, vkHandle(cmd.PView.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PView.MustRead(ctx, cmd, s, nil))) case *RecreateImageView: - write(ctx, bh, vkHandle(cmd.PImageView.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PImageView.MustRead(ctx, cmd, s, nil))) case *VkDestroyImageView: read(ctx, bh, vkHandle(cmd.ImageView)) bh.Alive = true // buffer case *VkCreateBuffer: - vkBuf := cmd.PBuffer.Read(ctx, cmd, s, nil) + vkBuf := cmd.PBuffer.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkBuf)) case *RecreateBuffer: - vkBuf := cmd.PBuffer.Read(ctx, cmd, s, nil) + vkBuf := cmd.PBuffer.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkBuf)) case *VkDestroyBuffer: vkBuf := cmd.Buffer @@ -1421,22 +1421,22 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, write(ctx, bh, vb.getBufferData(ctx, bh, cmd.Buffer)) case *VkCreateBufferView: - write(ctx, bh, vkHandle(cmd.PView.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PView.MustRead(ctx, cmd, s, nil))) case *RecreateBufferView: - write(ctx, bh, vkHandle(cmd.PBufferView.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PBufferView.MustRead(ctx, cmd, s, nil))) case *VkDestroyBufferView: read(ctx, bh, vkHandle(cmd.BufferView)) bh.Alive = true // swapchain case *VkCreateSwapchainKHR: - vkSw := cmd.PSwapchain.Read(ctx, cmd, s, nil) + vkSw := cmd.PSwapchain.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkSw)) case *RecreateSwapchain: - vkSw := cmd.PSwapchain.Read(ctx, cmd, s, nil) + vkSw := cmd.PSwapchain.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkSw)) - imageCount := uint64(cmd.PCreateInfo.Read(ctx, cmd, s, nil).MinImageCount) - for _, vkImg := range cmd.PSwapchainImages.Slice(0, imageCount, l).Read(ctx, cmd, s, nil) { + imageCount := uint64(cmd.PCreateInfo.MustRead(ctx, cmd, s, nil).MinImageCount) + for _, vkImg := range cmd.PSwapchainImages.Slice(0, imageCount, l).MustRead(ctx, cmd, s, nil) { write(ctx, bh, vkHandle(vkImg)) vb.images[vkImg] = newImageLayoutAndData(ctx, bh) vb.images[vkImg].data = newBoundData(ctx, bh, newLabel()) @@ -1450,8 +1450,8 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, if (cmd.PSwapchainImages == VkImageᵖ{}) { modify(ctx, bh, vkHandle(cmd.Swapchain)) } else { - count := uint64(cmd.PSwapchainImageCount.Read(ctx, cmd, s, nil)) - for _, vkImg := range cmd.PSwapchainImages.Slice(0, count, l).Read(ctx, cmd, s, nil) { + count := uint64(cmd.PSwapchainImageCount.MustRead(ctx, cmd, s, nil)) + for _, vkImg := range cmd.PSwapchainImages.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { write(ctx, bh, vkHandle(vkImg)) vb.images[vkImg] = newImageLayoutAndData(ctx, bh) vb.images[vkImg].data = newBoundData(ctx, bh, newLabel()) @@ -1472,7 +1472,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } read(ctx, bh, vkHandle(cmd.Swapchain)) // The value of this imgId should have been written by the driver. - imgID := cmd.PImageIndex.Read(ctx, cmd, s, nil) + imgID := cmd.PImageIndex.MustRead(ctx, cmd, s, nil) vkImg := GetState(s).Swapchains.Get(cmd.Swapchain).SwapchainImages.Get(imgID).VulkanHandle if read(ctx, bh, vkHandle(vkImg)) { writeMultiple(ctx, bh, vb.getImageLayoutAndData(ctx, bh, vkImg)) @@ -1482,18 +1482,18 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, case *VkQueuePresentKHR: read(ctx, bh, vkHandle(cmd.Queue)) - info := cmd.PPresentInfo.Read(ctx, cmd, s, nil) + info := cmd.PPresentInfo.MustRead(ctx, cmd, s, nil) spCount := uint64(info.WaitSemaphoreCount) - for _, vkSp := range info.PWaitSemaphores.Slice(0, spCount, l).Read(ctx, cmd, s, nil) { + for _, vkSp := range info.PWaitSemaphores.Slice(0, spCount, l).MustRead(ctx, cmd, s, nil) { if read(ctx, bh, vkHandle(vkSp)) { read(ctx, bh, vb.semaphoreSignals[vkSp]) } } swCount := uint64(info.SwapchainCount) imgIds := info.PImageIndices.Slice(0, swCount, l) - for swi, vkSw := range info.PSwapchains.Slice(0, swCount, l).Read(ctx, cmd, s, nil) { + for swi, vkSw := range info.PSwapchains.Slice(0, swCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(vkSw)) - imgID := imgIds.Index(uint64(swi), l).Read(ctx, cmd, s, nil) + imgID := imgIds.Index(uint64(swi), l).MustRead(ctx, cmd, s, nil) vkImg := GetState(s).Swapchains.Get(vkSw).SwapchainImages.Get(imgID).VulkanHandle readMultiple(ctx, bh, vb.getImageLayoutAndData(ctx, bh, vkImg)) @@ -1502,7 +1502,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, // engine. And this extra behavior must be kept alive to prevent the // presentation engine from hang. extraBh := dependencygraph.NewBehavior(api.SubCmdIdx{uint64(id)}, vb.machine) - for _, vkSp := range info.PWaitSemaphores.Slice(0, spCount, l).Read(ctx, cmd, s, nil) { + for _, vkSp := range info.PWaitSemaphores.Slice(0, spCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, extraBh, vkHandle(cmd.Queue)) if read(ctx, extraBh, vkHandle(vkSp)) { read(ctx, extraBh, vb.semaphoreSignals[vkSp]) @@ -1516,27 +1516,27 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, // sampler case *VkCreateSampler: - write(ctx, bh, vkHandle(cmd.PSampler.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PSampler.MustRead(ctx, cmd, s, nil))) case *RecreateSampler: - write(ctx, bh, vkHandle(cmd.PSampler.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PSampler.MustRead(ctx, cmd, s, nil))) case *VkDestroySampler: read(ctx, bh, vkHandle(cmd.Sampler)) bh.Alive = true // query pool case *VkCreateQueryPool: - vkQp := cmd.PQueryPool.Read(ctx, cmd, s, nil) + vkQp := cmd.PQueryPool.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkQp)) vb.querypools[vkQp] = &queryPool{} - count := uint64(cmd.PCreateInfo.Read(ctx, cmd, s, nil).QueryCount) + count := uint64(cmd.PCreateInfo.MustRead(ctx, cmd, s, nil).QueryCount) for i := uint64(0); i < count; i++ { vb.querypools[vkQp].queries = append(vb.querypools[vkQp].queries, newQuery()) } case *RecreateQueryPool: - vkQp := cmd.PPool.Read(ctx, cmd, s, nil) + vkQp := cmd.PPool.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkQp)) vb.querypools[vkQp] = &queryPool{} - count := uint64(cmd.PCreateInfo.Read(ctx, cmd, s, nil).QueryCount) + count := uint64(cmd.PCreateInfo.MustRead(ctx, cmd, s, nil).QueryCount) for i := uint64(0); i < count; i++ { vb.querypools[vkQp].queries = append(vb.querypools[vkQp].queries, newQuery()) } @@ -1554,18 +1554,18 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, // descriptor set case *VkCreateDescriptorSetLayout: - write(ctx, bh, vkHandle(cmd.PSetLayout.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PSetLayout.MustRead(ctx, cmd, s, nil))) case *RecreateDescriptorSetLayout: - write(ctx, bh, vkHandle(cmd.PSetLayout.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PSetLayout.MustRead(ctx, cmd, s, nil))) case *VkDestroyDescriptorSetLayout: read(ctx, bh, vkHandle(cmd.DescriptorSetLayout)) bh.Alive = true case *VkAllocateDescriptorSets: - info := cmd.PAllocateInfo.Read(ctx, cmd, s, nil) + info := cmd.PAllocateInfo.MustRead(ctx, cmd, s, nil) setCount := uint64(info.DescriptorSetCount) vkLayouts := info.PSetLayouts.Slice(0, setCount, l) - for i, vkSet := range cmd.PDescriptorSets.Slice(0, setCount, l).Read(ctx, cmd, s, nil) { - vkLayout := vkLayouts.Index(uint64(i), l).Read(ctx, cmd, s, nil) + for i, vkSet := range cmd.PDescriptorSets.Slice(0, setCount, l).MustRead(ctx, cmd, s, nil) { + vkLayout := vkLayouts.Index(uint64(i), l).MustRead(ctx, cmd, s, nil) read(ctx, bh, vkHandle(vkLayout)) layoutObj := GetState(s).DescriptorSetLayouts.Get(vkLayout) write(ctx, bh, vkHandle(vkSet)) @@ -1580,7 +1580,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, writeCount := cmd.DescriptorWriteCount if writeCount > 0 { for _, write := range cmd.PDescriptorWrites.Slice(0, uint64(writeCount), - l).Read(ctx, cmd, s, nil) { + l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(write.DstSet)) ds := vb.descriptorSets[write.DstSet] ds.writeDescriptors(ctx, cmd, s, vb, bh, write) @@ -1589,7 +1589,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, copyCount := cmd.DescriptorCopyCount if copyCount > 0 { for _, copy := range cmd.PDescriptorCopies.Slice(0, uint64(copyCount), - l).Read(ctx, cmd, s, nil) { + l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(copy.SrcSet)) read(ctx, bh, vkHandle(copy.DstSet)) vb.descriptorSets[copy.DstSet].copyDescriptors(ctx, cmd, s, bh, @@ -1597,9 +1597,9 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } } case *RecreateDescriptorSet: - info := cmd.PAllocateInfo.Read(ctx, cmd, s, nil) - vkLayout := info.PSetLayouts.Slice(0, 1, l).Index(0, l).Read(ctx, cmd, s, nil) - vkSet := cmd.PDescriptorSet.Read(ctx, cmd, s, nil) + info := cmd.PAllocateInfo.MustRead(ctx, cmd, s, nil) + vkLayout := info.PSetLayouts.Slice(0, 1, l).Index(0, l).MustRead(ctx, cmd, s, nil) + vkSet := cmd.PDescriptorSet.MustRead(ctx, cmd, s, nil) read(ctx, bh, vkHandle(vkLayout)) write(ctx, bh, vkHandle(vkSet)) layoutObj := GetState(s).DescriptorSetLayouts.Get(vkLayout) @@ -1612,14 +1612,14 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, writeCount := cmd.DescriptorWriteCount if writeCount > 0 { for _, write := range cmd.PDescriptorWrites.Slice(0, uint64(writeCount), - l).Read(ctx, cmd, s, nil) { + l).MustRead(ctx, cmd, s, nil) { vb.descriptorSets[vkSet].writeDescriptors(ctx, cmd, s, vb, bh, write) } } case *VkFreeDescriptorSets: count := uint64(cmd.DescriptorSetCount) - for _, vkSet := range cmd.PDescriptorSets.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, vkSet := range cmd.PDescriptorSets.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(vkSet)) delete(vb.descriptorSets, vkSet) } @@ -1627,17 +1627,17 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, // pipelines case *VkCreatePipelineLayout: - info := cmd.PCreateInfo.Read(ctx, cmd, s, nil) - write(ctx, bh, vkHandle(cmd.PPipelineLayout.Read(ctx, cmd, s, nil))) + info := cmd.PCreateInfo.MustRead(ctx, cmd, s, nil) + write(ctx, bh, vkHandle(cmd.PPipelineLayout.MustRead(ctx, cmd, s, nil))) setCount := uint64(info.SetLayoutCount) - for _, setLayout := range info.PSetLayouts.Slice(0, setCount, l).Read(ctx, cmd, s, nil) { + for _, setLayout := range info.PSetLayouts.Slice(0, setCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(setLayout)) } case *RecreatePipelineLayout: - info := cmd.PCreateInfo.Read(ctx, cmd, s, nil) - write(ctx, bh, vkHandle(cmd.PPipelineLayout.Read(ctx, cmd, s, nil))) + info := cmd.PCreateInfo.MustRead(ctx, cmd, s, nil) + write(ctx, bh, vkHandle(cmd.PPipelineLayout.MustRead(ctx, cmd, s, nil))) setCount := uint64(info.SetLayoutCount) - for _, setLayout := range info.PSetLayouts.Slice(0, setCount, l).Read(ctx, cmd, s, nil) { + for _, setLayout := range info.PSetLayouts.Slice(0, setCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(setLayout)) } case *VkDestroyPipelineLayout: @@ -1646,57 +1646,57 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, case *VkCreateGraphicsPipelines: read(ctx, bh, vkHandle(cmd.PipelineCache)) infoCount := uint64(cmd.CreateInfoCount) - for _, info := range cmd.PCreateInfos.Slice(0, infoCount, l).Read(ctx, cmd, s, nil) { + for _, info := range cmd.PCreateInfos.Slice(0, infoCount, l).MustRead(ctx, cmd, s, nil) { stageCount := uint64(info.StageCount) - for _, stage := range info.PStages.Slice(0, stageCount, l).Read(ctx, cmd, s, nil) { + for _, stage := range info.PStages.Slice(0, stageCount, l).MustRead(ctx, cmd, s, nil) { module := stage.Module read(ctx, bh, vkHandle(module)) } read(ctx, bh, vkHandle(info.Layout)) read(ctx, bh, vkHandle(info.RenderPass)) } - for _, vkPl := range cmd.PPipelines.Slice(0, infoCount, l).Read(ctx, cmd, s, nil) { + for _, vkPl := range cmd.PPipelines.Slice(0, infoCount, l).MustRead(ctx, cmd, s, nil) { write(ctx, bh, vkHandle(vkPl)) } case *RecreateGraphicsPipeline: read(ctx, bh, vkHandle(cmd.PipelineCache)) - info := cmd.PCreateInfo.Read(ctx, cmd, s, nil) + info := cmd.PCreateInfo.MustRead(ctx, cmd, s, nil) stageCount := uint64(info.StageCount) - for _, stage := range info.PStages.Slice(0, stageCount, l).Read(ctx, cmd, s, nil) { + for _, stage := range info.PStages.Slice(0, stageCount, l).MustRead(ctx, cmd, s, nil) { module := stage.Module read(ctx, bh, vkHandle(module)) } read(ctx, bh, vkHandle(info.Layout)) read(ctx, bh, vkHandle(info.RenderPass)) - write(ctx, bh, vkHandle(cmd.PPipeline.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PPipeline.MustRead(ctx, cmd, s, nil))) case *VkCreateComputePipelines: read(ctx, bh, vkHandle(cmd.PipelineCache)) infoCount := uint64(cmd.CreateInfoCount) - for _, info := range cmd.PCreateInfos.Slice(0, infoCount, l).Read(ctx, cmd, s, nil) { + for _, info := range cmd.PCreateInfos.Slice(0, infoCount, l).MustRead(ctx, cmd, s, nil) { stage := info.Stage module := stage.Module read(ctx, bh, vkHandle(module)) read(ctx, bh, vkHandle(info.Layout)) } - for _, vkPl := range cmd.PPipelines.Slice(0, infoCount, l).Read(ctx, cmd, s, nil) { + for _, vkPl := range cmd.PPipelines.Slice(0, infoCount, l).MustRead(ctx, cmd, s, nil) { write(ctx, bh, vkHandle(vkPl)) } case *RecreateComputePipeline: read(ctx, bh, vkHandle(cmd.PipelineCache)) - info := cmd.PCreateInfo.Read(ctx, cmd, s, nil) + info := cmd.PCreateInfo.MustRead(ctx, cmd, s, nil) stage := info.Stage module := stage.Module read(ctx, bh, vkHandle(module)) read(ctx, bh, vkHandle(info.Layout)) - write(ctx, bh, vkHandle(cmd.PPipeline.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PPipeline.MustRead(ctx, cmd, s, nil))) case *VkDestroyPipeline: read(ctx, bh, vkHandle(cmd.Pipeline)) bh.Alive = true case *VkCreatePipelineCache: - write(ctx, bh, vkHandle(cmd.PPipelineCache.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PPipelineCache.MustRead(ctx, cmd, s, nil))) case *RecreatePipelineCache: - write(ctx, bh, vkHandle(cmd.PPipelineCache.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PPipelineCache.MustRead(ctx, cmd, s, nil))) case *VkDestroyPipelineCache: read(ctx, bh, vkHandle(cmd.PipelineCache)) bh.Alive = true @@ -1705,15 +1705,15 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, case *VkMergePipelineCaches: modify(ctx, bh, vkHandle(cmd.DstCache)) srcCount := uint64(cmd.SrcCacheCount) - for _, src := range cmd.PSrcCaches.Slice(0, srcCount, l).Read(ctx, cmd, s, nil) { + for _, src := range cmd.PSrcCaches.Slice(0, srcCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(src)) } // Shader module case *VkCreateShaderModule: - write(ctx, bh, vkHandle(cmd.PShaderModule.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PShaderModule.MustRead(ctx, cmd, s, nil))) case *RecreateShaderModule: - write(ctx, bh, vkHandle(cmd.PShaderModule.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PShaderModule.MustRead(ctx, cmd, s, nil))) case *VkDestroyShaderModule: read(ctx, bh, vkHandle(cmd.ShaderModule)) bh.Alive = true @@ -1723,9 +1723,9 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, // create/destroy renderpass case *VkCreateRenderPass: - write(ctx, bh, vkHandle(cmd.PRenderPass.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PRenderPass.MustRead(ctx, cmd, s, nil))) case *RecreateRenderPass: - write(ctx, bh, vkHandle(cmd.PRenderPass.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PRenderPass.MustRead(ctx, cmd, s, nil))) case *VkDestroyRenderPass: read(ctx, bh, vkHandle(cmd.RenderPass)) bh.Alive = true @@ -1735,43 +1735,43 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, // create/destroy framebuffer case *VkCreateFramebuffer: - info := cmd.PCreateInfo.Read(ctx, cmd, s, nil) + info := cmd.PCreateInfo.MustRead(ctx, cmd, s, nil) read(ctx, bh, vkHandle(info.RenderPass)) attCount := uint64(info.AttachmentCount) - for _, att := range info.PAttachments.Slice(0, attCount, l).Read(ctx, cmd, s, nil) { + for _, att := range info.PAttachments.Slice(0, attCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(att)) } - write(ctx, bh, vkHandle(cmd.PFramebuffer.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PFramebuffer.MustRead(ctx, cmd, s, nil))) case *RecreateFramebuffer: - info := cmd.PCreateInfo.Read(ctx, cmd, s, nil) + info := cmd.PCreateInfo.MustRead(ctx, cmd, s, nil) read(ctx, bh, vkHandle(info.RenderPass)) attCount := uint64(info.AttachmentCount) - for _, att := range info.PAttachments.Slice(0, attCount, l).Read(ctx, cmd, s, nil) { + for _, att := range info.PAttachments.Slice(0, attCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(att)) } - write(ctx, bh, vkHandle(cmd.PFramebuffer.Read(ctx, cmd, s, nil))) + write(ctx, bh, vkHandle(cmd.PFramebuffer.MustRead(ctx, cmd, s, nil))) case *VkDestroyFramebuffer: read(ctx, bh, vkHandle(cmd.Framebuffer)) bh.Alive = true // debug marker name and tag setting commands. Always kept alive. case *VkDebugMarkerSetObjectTagEXT: - read(ctx, bh, vkHandle(cmd.PTagInfo.Read(ctx, cmd, s, nil).Object)) + read(ctx, bh, vkHandle(cmd.PTagInfo.MustRead(ctx, cmd, s, nil).Object)) bh.Alive = true case *RecreateDebugMarkerSetObjectTagEXT: - read(ctx, bh, vkHandle(cmd.PTagInfo.Read(ctx, cmd, s, nil).Object)) + read(ctx, bh, vkHandle(cmd.PTagInfo.MustRead(ctx, cmd, s, nil).Object)) bh.Alive = true case *VkDebugMarkerSetObjectNameEXT: - read(ctx, bh, vkHandle(cmd.PNameInfo.Read(ctx, cmd, s, nil).Object)) + read(ctx, bh, vkHandle(cmd.PNameInfo.MustRead(ctx, cmd, s, nil).Object)) bh.Alive = true case *RecreateDebugMarkerSetObjectNameEXT: - read(ctx, bh, vkHandle(cmd.PNameInfo.Read(ctx, cmd, s, nil).Object)) + read(ctx, bh, vkHandle(cmd.PNameInfo.MustRead(ctx, cmd, s, nil).Object)) bh.Alive = true // commandbuffer case *VkAllocateCommandBuffers: - count := uint64(cmd.PAllocateInfo.Read(ctx, cmd, s, nil).CommandBufferCount) - for _, vkCb := range cmd.PCommandBuffers.Slice(0, count, l).Read(ctx, cmd, s, nil) { + count := uint64(cmd.PAllocateInfo.MustRead(ctx, cmd, s, nil).CommandBufferCount) + for _, vkCb := range cmd.PCommandBuffers.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { write(ctx, bh, vkHandle(vkCb)) vb.commandBuffers[vkCb] = &commandBuffer{begin: newLabel(), end: newLabel(), renderPassBegin: newLabel()} @@ -1785,7 +1785,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, case *VkFreeCommandBuffers: count := uint64(cmd.CommandBufferCount) - for _, vkCb := range cmd.PCommandBuffers.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, vkCb := range cmd.PCommandBuffers.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { if read(ctx, bh, vkHandle(vkCb)) { write(ctx, bh, vb.commandBuffers[vkCb].begin) write(ctx, bh, vb.commandBuffers[vkCb].end) @@ -1800,7 +1800,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, write(ctx, bh, vb.commandBuffers[cmd.CommandBuffer].begin) vb.commands[cmd.CommandBuffer] = []*commandBufferCommand{} case *RecreateAndBeginCommandBuffer: - vkCb := cmd.PCommandBuffer.Read(ctx, cmd, s, nil) + vkCb := cmd.PCommandBuffer.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkCb)) vb.commandBuffers[vkCb] = &commandBuffer{begin: newLabel(), end: newLabel()} write(ctx, bh, vb.commandBuffers[vkCb].begin) @@ -1822,7 +1822,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, overwritten := false count := uint64(cmd.RegionCount) // TODO: check dst image coverage correctly - for _, region := range cmd.PRegions.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, region := range cmd.PRegions.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { overwritten = overwritten || subresourceLayersFullyCoverImage( GetState(s).Images.Get(cmd.DstImage), region.DstSubresource, region.DstOffset, region.Extent) @@ -1841,7 +1841,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, src := []dependencygraph.DefUseVariable{} dst := []dependencygraph.DefUseVariable{} count := uint64(cmd.RegionCount) - for _, region := range cmd.PRegions.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, region := range cmd.PRegions.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { srcOffset := srcBufferData.span.Start + uint64(region.SrcOffset) dstOffset := dstBufferData.span.Start + uint64(region.DstOffset) src = append(src, memorySpan{ @@ -1867,7 +1867,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, dst := []dependencygraph.DefUseVariable{vb.getImageData(ctx, bh, cmd.DstImage)} overwritten := false count := uint64(cmd.RegionCount) - for _, region := range cmd.PRegions.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, region := range cmd.PRegions.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { overwritten = overwritten || subresourceLayersFullyCoverImage( GetState(s).Images.Get(cmd.DstImage), region.ImageSubresource, region.ImageOffset, region.ImageExtent) @@ -1885,7 +1885,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, dst := []dependencygraph.DefUseVariable{vb.getImageData(ctx, bh, cmd.DstImage)} overwritten := false count := uint64(cmd.RegionCount) - for _, region := range cmd.PRegions.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, region := range cmd.PRegions.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { overwritten = overwritten || blitFullyCoverImage( GetState(s).Images.Get(cmd.DstImage), region.DstSubresource, @@ -1904,7 +1904,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, dst := []dependencygraph.DefUseVariable{vb.getImageData(ctx, bh, cmd.DstImage)} overwritten := false count := uint64(cmd.RegionCount) - for _, region := range cmd.PRegions.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, region := range cmd.PRegions.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { overwritten = overwritten || subresourceLayersFullyCoverImage( GetState(s).Images.Get(cmd.DstImage), region.DstSubresource, region.DstOffset, region.Extent) @@ -1938,7 +1938,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, dst := []dependencygraph.DefUseVariable{vb.getImageData(ctx, bh, cmd.Image)} count := uint64(cmd.RangeCount) overwritten := false - for _, rng := range cmd.PRanges.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, rng := range cmd.PRanges.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { if subresourceRangeFullyCoverImage(GetState(s).Images.Get(cmd.Image), rng) { overwritten = true } @@ -1955,7 +1955,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, dst := []dependencygraph.DefUseVariable{vb.getImageData(ctx, bh, cmd.Image)} count := uint64(cmd.RangeCount) overwritten := false - for _, rng := range cmd.PRanges.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, rng := range cmd.PRanges.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { if subresourceRangeFullyCoverImage(GetState(s).Images.Get(cmd.Image), rng) { overwritten = true } @@ -1970,9 +1970,9 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, // renderpass and subpass case *VkCmdBeginRenderPass: - vkRp := cmd.PRenderPassBegin.Read(ctx, cmd, s, nil).RenderPass + vkRp := cmd.PRenderPassBegin.MustRead(ctx, cmd, s, nil).RenderPass read(ctx, bh, vkHandle(vkRp)) - vkFb := cmd.PRenderPassBegin.Read(ctx, cmd, s, nil).Framebuffer + vkFb := cmd.PRenderPassBegin.MustRead(ctx, cmd, s, nil).Framebuffer read(ctx, bh, vkHandle(vkFb)) write(ctx, bh, vb.commandBuffers[cmd.CommandBuffer].renderPassBegin) rp := GetState(s).RenderPasses.Get(vkRp) @@ -2023,7 +2023,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, case *VkCmdBindVertexBuffers: count := uint64(cmd.BindingCount) res := []dependencygraph.DefUseVariable{} - for _, vkBuf := range cmd.PBuffers.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, vkBuf := range cmd.PBuffers.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { res = append(res, vb.getBufferData(ctx, bh, vkBuf)) } firstBinding := cmd.FirstBinding @@ -2065,7 +2065,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, read(ctx, bh, vkHandle(cmd.Layout)) count := uint64(cmd.DescriptorSetCount) dss := []*descriptorSet{} - for _, vkSet := range cmd.PDescriptorSets.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, vkSet := range cmd.PDescriptorSets.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(vkSet)) dss = append(dss, vb.descriptorSets[vkSet]) } @@ -2205,10 +2205,10 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, atts := []VkClearAttachment{} rectCount := uint64(cmd.RectCount) rects := []VkClearRect{} - for _, att := range cmd.PAttachments.Slice(0, attCount, l).Read(ctx, cmd, s, nil) { + for _, att := range cmd.PAttachments.Slice(0, attCount, l).MustRead(ctx, cmd, s, nil) { atts = append(atts, att) } - for _, rect := range cmd.PRects.Slice(0, rectCount, l).Read(ctx, cmd, s, nil) { + for _, rect := range cmd.PRects.Slice(0, rectCount, l).MustRead(ctx, cmd, s, nil) { rects = append(rects, rect) } cbc := vb.newCommand(ctx, bh, cmd.CommandBuffer) @@ -2292,7 +2292,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, case *VkCmdWaitEvents: eventLabels := []dependencygraph.DefUseVariable{} evCount := uint64(cmd.EventCount) - for _, vkEv := range cmd.PEvents.Slice(0, evCount, l).Read(ctx, cmd, s, nil) { + for _, vkEv := range cmd.PEvents.Slice(0, evCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(vkEv)) eventLabels = append(eventLabels, vb.events[vkEv].signal, vb.events[vkEv].unsignal) @@ -2312,7 +2312,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, cbc := vb.newCommand(ctx, bh, cmd.CommandBuffer) cbc.isCmdExecuteCommands = true count := uint64(cmd.CommandBufferCount) - for _, vkScb := range cmd.PCommandBuffers.Slice(0, count, l).Read(ctx, cmd, s, nil) { + for _, vkScb := range cmd.PCommandBuffers.Slice(0, count, l).MustRead(ctx, cmd, s, nil) { cbc.recordSecondaryCommandBuffer(vkScb) read(ctx, bh, vkHandle(vkScb)) } @@ -2332,9 +2332,9 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, queue: cmd.Queue, } submitCount := uint64(cmd.SubmitCount) - for i, submit := range cmd.PSubmits.Slice(0, submitCount, l).Read(ctx, cmd, s, nil) { + for i, submit := range cmd.PSubmits.Slice(0, submitCount, l).MustRead(ctx, cmd, s, nil) { commandBufferCount := uint64(submit.CommandBufferCount) - for j, vkCb := range submit.PCommandBuffers.Slice(0, commandBufferCount, l).Read(ctx, cmd, s, nil) { + for j, vkCb := range submit.PCommandBuffers.Slice(0, commandBufferCount, l).MustRead(ctx, cmd, s, nil) { read(ctx, bh, vkHandle(vkCb)) read(ctx, bh, vb.commandBuffers[vkCb].end) for k, cbc := range vb.commands[vkCb] { @@ -2354,12 +2354,12 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } } waitSemaphoreCount := uint64(submit.WaitSemaphoreCount) - for _, vkSp := range submit.PWaitSemaphores.Slice(0, waitSemaphoreCount, l).Read(ctx, cmd, s, nil) { + for _, vkSp := range submit.PWaitSemaphores.Slice(0, waitSemaphoreCount, l).MustRead(ctx, cmd, s, nil) { vb.submitInfos[id].waitSemaphores = append( vb.submitInfos[id].waitSemaphores, vkSp) } signalSemaphoreCount := uint64(submit.SignalSemaphoreCount) - for _, vkSp := range submit.PSignalSemaphores.Slice(0, signalSemaphoreCount, l).Read(ctx, cmd, s, nil) { + for _, vkSp := range submit.PSignalSemaphores.Slice(0, signalSemaphoreCount, l).MustRead(ctx, cmd, s, nil) { vb.submitInfos[id].signalSemaphores = append( vb.submitInfos[id].signalSemaphores, vkSp) } @@ -2397,11 +2397,11 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } case *VkCreateSemaphore: - vkSp := cmd.PSemaphore.Read(ctx, cmd, s, nil) + vkSp := cmd.PSemaphore.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkSp)) vb.semaphoreSignals[vkSp] = newLabel() case *RecreateSemaphore: - vkSp := cmd.PSemaphore.Read(ctx, cmd, s, nil) + vkSp := cmd.PSemaphore.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkSp)) vb.semaphoreSignals[vkSp] = newLabel() write(ctx, bh, vb.semaphoreSignals[vkSp]) @@ -2413,11 +2413,11 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } case *VkCreateEvent: - vkEv := cmd.PEvent.Read(ctx, cmd, s, nil) + vkEv := cmd.PEvent.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkEv)) vb.events[vkEv] = &event{signal: newLabel(), unsignal: newLabel()} case *RecreateEvent: - vkEv := cmd.PEvent.Read(ctx, cmd, s, nil) + vkEv := cmd.PEvent.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkEv)) vb.events[vkEv] = &event{signal: newLabel(), unsignal: newLabel()} if cmd.Signaled != VkBool32(0) { @@ -2438,11 +2438,11 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } case *VkCreateFence: - vkFe := cmd.PFence.Read(ctx, cmd, s, nil) + vkFe := cmd.PFence.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkFe)) vb.fences[vkFe] = &fence{signal: newLabel(), unsignal: newLabel()} case *RecreateFence: - vkFe := cmd.PFence.Read(ctx, cmd, s, nil) + vkFe := cmd.PFence.MustRead(ctx, cmd, s, nil) write(ctx, bh, vkHandle(vkFe)) vb.fences[vkFe] = &fence{signal: newLabel(), unsignal: newLabel()} case *VkGetFenceStatus: @@ -2454,7 +2454,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } case *VkWaitForFences: fenceCount := uint64(cmd.FenceCount) - for _, vkFe := range cmd.PFences.Slice(0, fenceCount, l).Read(ctx, cmd, s, nil) { + for _, vkFe := range cmd.PFences.Slice(0, fenceCount, l).MustRead(ctx, cmd, s, nil) { if read(ctx, bh, vkHandle(vkFe)) { read(ctx, bh, vb.fences[vkFe].signal) read(ctx, bh, vb.fences[vkFe].unsignal) @@ -2463,7 +2463,7 @@ func (vb *FootprintBuilder) BuildFootprint(ctx context.Context, } case *VkResetFences: fenceCount := uint64(cmd.FenceCount) - for _, vkFe := range cmd.PFences.Slice(0, fenceCount, l).Read(ctx, cmd, s, nil) { + for _, vkFe := range cmd.PFences.Slice(0, fenceCount, l).MustRead(ctx, cmd, s, nil) { if read(ctx, bh, vkHandle(vkFe)) { write(ctx, bh, vb.fences[vkFe].unsignal) bh.Alive = true diff --git a/gapis/api/vulkan/replay.go b/gapis/api/vulkan/replay.go index ee434af187..99e02636da 100644 --- a/gapis/api/vulkan/replay.go +++ b/gapis/api/vulkan/replay.go @@ -115,7 +115,7 @@ func (t *makeAttachementReadable) Transform(ctx context.Context, id api.CmdID, c cmd.Extras().Observations().ApplyReads(s.Memory.ApplicationPool()) if image, ok := cmd.(*VkCreateImage); ok { pinfo := image.PCreateInfo - info := pinfo.Read(ctx, image, s, nil) + info := pinfo.MustRead(ctx, image, s, nil) if newUsage, changed := patchImageUsage(info.Usage); changed { device := image.Device @@ -151,7 +151,7 @@ func (t *makeAttachementReadable) Transform(ctx context.Context, id api.CmdID, c } } else if recreateImage, ok := cmd.(*RecreateImage); ok { pinfo := recreateImage.PCreateInfo - info := pinfo.Read(ctx, image, s, nil) + info := pinfo.MustRead(ctx, image, s, nil) if newUsage, changed := patchImageUsage(info.Usage); changed { device := recreateImage.Device @@ -185,7 +185,7 @@ func (t *makeAttachementReadable) Transform(ctx context.Context, id api.CmdID, c } } else if swapchain, ok := cmd.(*VkCreateSwapchainKHR); ok { pinfo := swapchain.PCreateInfo - info := pinfo.Read(ctx, swapchain, s, nil) + info := pinfo.MustRead(ctx, swapchain, s, nil) if newUsage, changed := patchImageUsage(info.ImageUsage); changed { device := swapchain.Device @@ -216,7 +216,7 @@ func (t *makeAttachementReadable) Transform(ctx context.Context, id api.CmdID, c } } else if recreateSwapchain, ok := cmd.(*RecreateSwapchain); ok { pinfo := recreateSwapchain.PCreateInfo - info := pinfo.Read(ctx, recreateSwapchain, s, nil) + info := pinfo.MustRead(ctx, recreateSwapchain, s, nil) if newUsage, changed := patchImageUsage(info.ImageUsage); changed { device := recreateSwapchain.Device @@ -248,9 +248,9 @@ func (t *makeAttachementReadable) Transform(ctx context.Context, id api.CmdID, c } } else if createRenderPass, ok := cmd.(*VkCreateRenderPass); ok { pInfo := createRenderPass.PCreateInfo - info := pInfo.Read(ctx, createRenderPass, s, nil) + info := pInfo.MustRead(ctx, createRenderPass, s, nil) pAttachments := info.PAttachments - attachments := pAttachments.Slice(uint64(0), uint64(info.AttachmentCount), l).Read(ctx, createRenderPass, s, nil) + attachments := pAttachments.Slice(uint64(0), uint64(info.AttachmentCount), l).MustRead(ctx, createRenderPass, s, nil) changed := false for i := range attachments { if attachments[i].StoreOp == VkAttachmentStoreOp_VK_ATTACHMENT_STORE_OP_DONT_CARE { @@ -289,9 +289,9 @@ func (t *makeAttachementReadable) Transform(ctx context.Context, id api.CmdID, c return } else if recreateRenderPass, ok := cmd.(*RecreateRenderPass); ok { pInfo := recreateRenderPass.PCreateInfo - info := pInfo.Read(ctx, recreateRenderPass, s, nil) + info := pInfo.MustRead(ctx, recreateRenderPass, s, nil) pAttachments := info.PAttachments - attachments := pAttachments.Slice(uint64(0), uint64(info.AttachmentCount), l).Read(ctx, recreateRenderPass, s, nil) + attachments := pAttachments.Slice(uint64(0), uint64(info.AttachmentCount), l).MustRead(ctx, recreateRenderPass, s, nil) changed := false for i := range attachments { if attachments[i].StoreOp == VkAttachmentStoreOp_VK_ATTACHMENT_STORE_OP_DONT_CARE { @@ -333,16 +333,16 @@ func (t *makeAttachementReadable) Transform(ctx context.Context, id api.CmdID, c } l := s.MemoryLayout cmd.Extras().Observations().ApplyWrites(s.Memory.ApplicationPool()) - count := uint32(e.PPhysicalDeviceCount.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Read(ctx, cmd, s, nil)) - devices := e.PPhysicalDevices.Slice(uint64(uint32(0)), uint64(count), l).Read(ctx, cmd, s, nil) + count := uint32(e.PPhysicalDeviceCount.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).MustRead(ctx, cmd, s, nil)) + devices := e.PPhysicalDevices.Slice(uint64(uint32(0)), uint64(count), l).MustRead(ctx, cmd, s, nil) t.EnumeratedPhysicalDevices = append(t.EnumeratedPhysicalDevices, devices...) t.Instance = e.Instance return } else if e, ok := cmd.(*RecreatePhysicalDevices); ok { l := s.MemoryLayout - count := uint32(e.Count.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Read(ctx, cmd, s, nil)) + count := uint32(e.Count.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).MustRead(ctx, cmd, s, nil)) cmd.Extras().Observations().ApplyWrites(s.Memory.ApplicationPool()) - devices := e.PPhysicalDevices.Slice(uint64(uint32(0)), uint64(count), l).Read(ctx, cmd, s, nil) + devices := e.PPhysicalDevices.Slice(uint64(uint32(0)), uint64(count), l).MustRead(ctx, cmd, s, nil) t.EnumeratedPhysicalDevices = append(t.EnumeratedPhysicalDevices, devices...) t.Instance = e.Instance return @@ -352,7 +352,7 @@ func (t *makeAttachementReadable) Transform(ctx context.Context, id api.CmdID, c return } cmd.Extras().Observations().ApplyWrites(s.Memory.ApplicationPool()) - properties := e.PProperties.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).Read(ctx, cmd, s, nil) + properties := e.PProperties.Slice(uint64(0), uint64(1), l).Index(uint64(0), l).MustRead(ctx, cmd, s, nil) t.Properties[e.PhysicalDevice] = properties if len(t.Properties) == len(t.EnumeratedPhysicalDevices) { // We have enumerated all properties for all devices: diff --git a/gapis/api/vulkan/resources.go b/gapis/api/vulkan/resources.go index ff02ec46f8..013bc68e16 100644 --- a/gapis/api/vulkan/resources.go +++ b/gapis/api/vulkan/resources.go @@ -650,7 +650,7 @@ func (s *ShaderModuleObject) ResourceType(ctx context.Context) api.ResourceType // ResourceData returns the resource data given the current state. func (s *ShaderModuleObject) ResourceData(ctx context.Context, t *api.GlobalState) (*api.ResourceData, error) { ctx = log.Enter(ctx, "ShaderModuleObject.ResourceData()") - words := s.Words.Read(ctx, nil, t, nil) + words := s.Words.MustRead(ctx, nil, t, nil) source := shadertools.DisassembleSpirvBinary(words) return api.NewResourceData(&api.Shader{Type: api.ShaderType_Spirv, Source: source}), nil } @@ -717,7 +717,7 @@ func (cmd *VkCreateShaderModule) Replace(ctx context.Context, c *capture.Capture pAlloc := memory.Pointer(cmd.PAllocator) pShaderModule := memory.Pointer(cmd.PShaderModule) result := cmd.Result - createInfo := cmd.PCreateInfo.Read(ctx, cmd, state, nil) + createInfo := cmd.PCreateInfo.MustRead(ctx, cmd, state, nil) createInfo.PCode = NewU32ᶜᵖ(code.Ptr()) createInfo.CodeSize = memory.Size(len(codeSlice) * 4) @@ -765,7 +765,7 @@ func (cmd *RecreateShaderModule) Replace(ctx context.Context, c *capture.Capture code := state.AllocDataOrPanic(ctx, codeSlice) device := cmd.Device pShaderModule := memory.Pointer(cmd.PShaderModule) - createInfo := cmd.PCreateInfo.Read(ctx, cmd, state, nil) + createInfo := cmd.PCreateInfo.MustRead(ctx, cmd, state, nil) createInfo.PCode = NewU32ᶜᵖ(code.Ptr()) createInfo.CodeSize = memory.Size(len(codeSlice) * 4) diff --git a/gapis/api/vulkan/vulkan_terminator.go b/gapis/api/vulkan/vulkan_terminator.go index 2b4a63939e..4e3d8e04cd 100644 --- a/gapis/api/vulkan/vulkan_terminator.go +++ b/gapis/api/vulkan/vulkan_terminator.go @@ -156,10 +156,10 @@ func resolveCurrentRenderPass(ctx context.Context, s *api.GlobalState, submit *V submitInfo := submit.PSubmits.Slice(uint64(0), uint64(submit.SubmitCount), l) loopLevel := 0 for sub := 0; sub < int(idx[0])+getExtra(idx, loopLevel); sub++ { - info := submitInfo.Index(uint64(sub), l).Read(ctx, a, s, nil) + info := submitInfo.Index(uint64(sub), l).MustRead(ctx, a, s, nil) buffers := info.PCommandBuffers.Slice(uint64(0), uint64(info.CommandBufferCount), l) for cmd := 0; cmd < int(info.CommandBufferCount); cmd++ { - buffer := buffers.Index(uint64(cmd), l).Read(ctx, a, s, nil) + buffer := buffers.Index(uint64(cmd), l).MustRead(ctx, a, s, nil) bufferObject := c.CommandBuffers[buffer] walkCommands(c, &bufferObject.CommandReferences, f) } @@ -167,17 +167,17 @@ func resolveCurrentRenderPass(ctx context.Context, s *api.GlobalState, submit *V if !incrementLoopLevel(idx, &loopLevel) { return lrp, subpass } - lastInfo := submitInfo.Index(uint64(idx[0]), l).Read(ctx, a, s, nil) + lastInfo := submitInfo.Index(uint64(idx[0]), l).MustRead(ctx, a, s, nil) lastBuffers := lastInfo.PCommandBuffers.Slice(uint64(0), uint64(lastInfo.CommandBufferCount), l) for cmdbuffer := 0; cmdbuffer < int(idx[1])+getExtra(idx, loopLevel); cmdbuffer++ { - buffer := lastBuffers.Index(uint64(cmdbuffer), l).Read(ctx, a, s, nil) + buffer := lastBuffers.Index(uint64(cmdbuffer), l).MustRead(ctx, a, s, nil) bufferObject := c.CommandBuffers[buffer] walkCommands(c, &bufferObject.CommandReferences, f) } if !incrementLoopLevel(idx, &loopLevel) { return lrp, subpass } - lastBuffer := lastBuffers.Index(uint64(idx[1]), l).Read(ctx, a, s, nil) + lastBuffer := lastBuffers.Index(uint64(idx[1]), l).MustRead(ctx, a, s, nil) lastBufferObject := c.CommandBuffers[lastBuffer] for cmd := 0; cmd < int(idx[2])+getExtra(idx, loopLevel); cmd++ { f(lastBufferObject.CommandReferences[uint32(cmd)]) @@ -335,14 +335,14 @@ func cutCommandBuffer(ctx context.Context, id api.CmdID, submitCopy.SubmitCount = uint32(lastSubmit + 1) newSubmits := make([]VkSubmitInfo, lastSubmit+1) for i := 0; i < int(lastSubmit)+1; i++ { - newSubmits[i] = submitInfo.Index(uint64(i), l).Read(ctx, a, s, nil) + newSubmits[i] = submitInfo.Index(uint64(i), l).MustRead(ctx, a, s, nil) } newSubmits[lastSubmit].CommandBufferCount = uint32(lastCommandBuffer + 1) newCommandBuffers = make([]VkCommandBuffer, lastCommandBuffer+1) buffers := newSubmits[lastSubmit].PCommandBuffers.Slice(uint64(0), uint64(newSubmits[lastSubmit].CommandBufferCount), l) for i := 0; i < int(lastCommandBuffer)+1; i++ { - newCommandBuffers[i] = buffers.Index(uint64(i), l).Read(ctx, a, s, nil) + newCommandBuffers[i] = buffers.Index(uint64(i), l).MustRead(ctx, a, s, nil) } var lrp *RenderPassObject diff --git a/gapis/api/vulkan/wireframe.go b/gapis/api/vulkan/wireframe.go index ca3fc87f73..8c7588679b 100644 --- a/gapis/api/vulkan/wireframe.go +++ b/gapis/api/vulkan/wireframe.go @@ -39,8 +39,8 @@ func wireframe(ctx context.Context) transform.Transformer { newInfos := make([]VkGraphicsPipelineCreateInfo, count) newRasterStateDatas := make([]api.AllocResult, count) for i := uint64(0); i < count; i++ { - info := infos.Index(i, l).Read(ctx, cmd, s, nil) - rasterState := info.PRasterizationState.Read(ctx, cmd, s, nil) + info := infos.Index(i, l).MustRead(ctx, cmd, s, nil) + rasterState := info.PRasterizationState.MustRead(ctx, cmd, s, nil) rasterState.PolygonMode = VkPolygonMode_VK_POLYGON_MODE_LINE newRasterStateDatas[i] = s.AllocDataOrPanic(ctx, rasterState) info.PRasterizationState = NewVkPipelineRasterizationStateCreateInfoᶜᵖ(newRasterStateDatas[i].Ptr()) @@ -58,8 +58,8 @@ func wireframe(ctx context.Context) transform.Transformer { } out.MutateAndWrite(ctx, id, newCmd) case *RecreateGraphicsPipeline: - info := cmd.PCreateInfo.Read(ctx, cmd, s, nil) - rasterState := info.PRasterizationState.Read(ctx, cmd, s, nil) + info := cmd.PCreateInfo.MustRead(ctx, cmd, s, nil) + rasterState := info.PRasterizationState.MustRead(ctx, cmd, s, nil) rasterState.PolygonMode = VkPolygonMode_VK_POLYGON_MODE_LINE newRasterStateData := s.AllocDataOrPanic(ctx, rasterState) info.PRasterizationState = NewVkPipelineRasterizationStateCreateInfoᶜᵖ(newRasterStateData.Ptr())