2
0
mirror of synced 2025-02-22 14:28:14 +00:00
mobile/gl/types_debug.go
David Crawshaw 068a51c195 gl: batch calls onto a dedicated context thread
All GL function calls fill out a C.struct_fnargs and drop it on the
work queue. The Start function drains the work queue and hands
over a batch of calls to C.process which runs them. This allows
multiple GL calls to be executed in a single cgo call.

A GL call is marked as blocking if it returns a value, or if it
takes a Go pointer. In this case the call will not return until
C.process sends a value on the retvalue channel.

Change-Id: I4c76b2a8ad55f57b0c98d200d0fb708d4634e042
Reviewed-on: https://go-review.googlesource.com/10452
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-06-01 15:35:03 +00:00

71 lines
2.0 KiB
Go

// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux darwin
// +build gldebug
package gl
// Alternate versions of the types defined in types.go with extra
// debugging information attached. For documentation, see types.go.
// #include "work.h"
import "C"
import "fmt"
type Enum uint32
type Attrib struct {
Value uint
name string
}
type Program struct {
Value uint32
}
type Shader struct {
Value uint32
}
type Buffer struct {
Value uint32
}
type Framebuffer struct {
Value uint32
}
type Renderbuffer struct {
Value uint32
}
type Texture struct {
Value uint32
}
type Uniform struct {
Value int32
name string
}
func (v Attrib) c() C.uintptr_t { return C.uintptr_t(v.Value) }
func (v Enum) c() C.uintptr_t { return C.uintptr_t(v) }
func (v Program) c() C.uintptr_t { return C.uintptr_t(v.Value) }
func (v Shader) c() C.uintptr_t { return C.uintptr_t(v.Value) }
func (v Buffer) c() C.uintptr_t { return C.uintptr_t(v.Value) }
func (v Framebuffer) c() C.uintptr_t { return C.uintptr_t(v.Value) }
func (v Renderbuffer) c() C.uintptr_t { return C.uintptr_t(v.Value) }
func (v Texture) c() C.uintptr_t { return C.uintptr_t(v.Value) }
func (v Uniform) c() C.uintptr_t { return C.uintptr_t(v.Value) }
func (v Attrib) String() string { return fmt.Sprintf("Attrib(%d:%s)", v.Value, v.name) }
func (v Program) String() string { return fmt.Sprintf("Program(%d)", v.Value) }
func (v Shader) String() string { return fmt.Sprintf("Shader(%d)", v.Value) }
func (v Buffer) String() string { return fmt.Sprintf("Buffer(%d)", v.Value) }
func (v Framebuffer) String() string { return fmt.Sprintf("Framebuffer(%d)", v.Value) }
func (v Renderbuffer) String() string { return fmt.Sprintf("Renderbuffer(%d)", v.Value) }
func (v Texture) String() string { return fmt.Sprintf("Texture(%d)", v.Value) }
func (v Uniform) String() string { return fmt.Sprintf("Uniform(%d:%s)", v.Value, v.name) }