Skip to content

Commit

Permalink
Show the current GL context in the state view.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuetschard authored and ben-clayton committed Aug 3, 2017
1 parent 91cbbde commit e311042
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gapis/api/gles/gles.api
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ class Context {
// Globals
ContextID NextContextID
map!(u64, ref!Context) Contexts
ref!Context CurrentContext

sub ref!Context GetContext() {
context := Contexts[$Thread]
Expand All @@ -632,6 +633,7 @@ sub ref!Context GetContext() {

sub void SetContext(ref!Context context) {
Contexts[$Thread] = context
CurrentContext = context
}

sub ref!Context CreateContext(ref!Context sharedContext) {
Expand Down
4 changes: 4 additions & 0 deletions gapis/api/gles/gles.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func (s *State) GetContext(thread uint64) *Context {
return s.Contexts[thread]
}

func (s *State) SetThread(thread uint64) {
s.CurrentContext = s.GetContext(thread)
}

func (b *Buffer) GetID() BufferId {
if b != nil {
return b.ID
Expand Down
3 changes: 2 additions & 1 deletion gapis/api/templates/mutate.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@
{{if not $r}}ϟb = nil // @no_replay{{end}}

ϟc, ϟt := GetState(ϟs), ϟa.thread
ϟc.SetThread(ϟt)
ϟl := ϟs.MemoryLayout
ϟo := ϟa.Extras().Observations()
_, _, _ = ϟc, ϟl, ϟt
_ = ϟl

{{Global "CurrentFunction" $}}

Expand Down
3 changes: 3 additions & 0 deletions gapis/api/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func (API) GetFramebufferAttachmentInfo(*api.State, uint64, api.FramebufferAttac

func (API) Context(*api.State, uint64) api.Context { return nil }

func (s *State) SetThread(thread uint64) {
}

func (i Remapped) remap(cmd api.Cmd, s *api.State) (interface{}, bool) {
return i, true
}
3 changes: 3 additions & 0 deletions gapis/api/vulkan/vulkan.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func (API) Context(s *api.State, thread uint64) api.Context {
return VulkanContext{}
}

func (s *State) SetThread(thread uint64) {
}

func (API) GetFramebufferAttachmentInfo(state *api.State, thread uint64, attachment api.FramebufferAttachment) (w, h uint32, a uint32, f *image.Format, err error) {
w, h, form, i, err := GetState(state).getFramebufferAttachmentInfo(attachment)
switch attachment {
Expand Down

0 comments on commit e311042

Please sign in to comment.