github.com/acrespo/mobile@v0.0.0-20190107162257-dc0771356504/gl/types_debug.go (about)

     1  // Copyright 2014 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build linux darwin windows openbsd
     6  // +build gldebug
     7  
     8  package gl
     9  
    10  // Alternate versions of the types defined in types.go with extra
    11  // debugging information attached. For documentation, see types.go.
    12  
    13  import "fmt"
    14  
    15  type Enum uint32
    16  
    17  type Attrib struct {
    18  	Value uint
    19  	name  string
    20  }
    21  
    22  type Program struct {
    23  	Init  bool
    24  	Value uint32
    25  }
    26  
    27  type Shader struct {
    28  	Value uint32
    29  }
    30  
    31  type Buffer struct {
    32  	Value uint32
    33  }
    34  
    35  type Framebuffer struct {
    36  	Value uint32
    37  }
    38  
    39  type Renderbuffer struct {
    40  	Value uint32
    41  }
    42  
    43  type Texture struct {
    44  	Value uint32
    45  }
    46  
    47  type Uniform struct {
    48  	Value int32
    49  	name  string
    50  }
    51  
    52  type VertexArray struct {
    53  	Value uint32
    54  }
    55  
    56  func (v Attrib) c() uintptr { return uintptr(v.Value) }
    57  func (v Enum) c() uintptr   { return uintptr(v) }
    58  func (v Program) c() uintptr {
    59  	if !v.Init {
    60  		ret := uintptr(0)
    61  		ret--
    62  		return ret
    63  	}
    64  	return uintptr(v.Value)
    65  }
    66  func (v Shader) c() uintptr       { return uintptr(v.Value) }
    67  func (v Buffer) c() uintptr       { return uintptr(v.Value) }
    68  func (v Framebuffer) c() uintptr  { return uintptr(v.Value) }
    69  func (v Renderbuffer) c() uintptr { return uintptr(v.Value) }
    70  func (v Texture) c() uintptr      { return uintptr(v.Value) }
    71  func (v Uniform) c() uintptr      { return uintptr(v.Value) }
    72  func (v VertexArray) c() uintptr  { return uintptr(v.Value) }
    73  
    74  func (v Attrib) String() string       { return fmt.Sprintf("Attrib(%d:%s)", v.Value, v.name) }
    75  func (v Program) String() string      { return fmt.Sprintf("Program(%d)", v.Value) }
    76  func (v Shader) String() string       { return fmt.Sprintf("Shader(%d)", v.Value) }
    77  func (v Buffer) String() string       { return fmt.Sprintf("Buffer(%d)", v.Value) }
    78  func (v Framebuffer) String() string  { return fmt.Sprintf("Framebuffer(%d)", v.Value) }
    79  func (v Renderbuffer) String() string { return fmt.Sprintf("Renderbuffer(%d)", v.Value) }
    80  func (v Texture) String() string      { return fmt.Sprintf("Texture(%d)", v.Value) }
    81  func (v Uniform) String() string      { return fmt.Sprintf("Uniform(%d:%s)", v.Value, v.name) }
    82  func (v VertexArray) String() string  { return fmt.Sprintf("VertexArray(%d)", v.Value) }