mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
opengl: Unexport ProgramID
This commit is contained in:
parent
495d7ca0d1
commit
2bda89709f
@ -40,10 +40,10 @@ func (p Program) Equals(other Program) bool {
|
|||||||
type UniformLocation int32
|
type UniformLocation int32
|
||||||
type AttribLocation int32
|
type AttribLocation int32
|
||||||
|
|
||||||
type ProgramID uint32
|
type programID uint32
|
||||||
|
|
||||||
func (p Program) ID() ProgramID {
|
func (p Program) id() programID {
|
||||||
return ProgramID(p)
|
return programID(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
|
@ -56,10 +56,10 @@ type UniformLocation struct {
|
|||||||
|
|
||||||
type AttribLocation int
|
type AttribLocation int
|
||||||
|
|
||||||
type ProgramID int
|
type programID int
|
||||||
|
|
||||||
func (p Program) ID() ProgramID {
|
func (p Program) id() programID {
|
||||||
return ProgramID(p.Get("__ebiten_programId").Int())
|
return programID(p.Get("__ebiten_programId").Int())
|
||||||
}
|
}
|
||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
@ -264,7 +264,7 @@ func (c *Context) GlslHighpSupported() bool {
|
|||||||
return gl.Call("getShaderPrecisionFormat", gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).Get("precision").Int() != 0
|
return gl.Call("getShaderPrecisionFormat", gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).Get("precision").Int() != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastProgramID ProgramID = 0
|
var lastProgramID programID = 0
|
||||||
|
|
||||||
func (c *Context) NewProgram(shaders []Shader) (Program, error) {
|
func (c *Context) NewProgram(shaders []Shader) (Program, error) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
|
@ -41,10 +41,10 @@ func (p Program) Equals(other Program) bool {
|
|||||||
type UniformLocation mgl.Uniform
|
type UniformLocation mgl.Uniform
|
||||||
type AttribLocation mgl.Attrib
|
type AttribLocation mgl.Attrib
|
||||||
|
|
||||||
type ProgramID uint32
|
type programID uint32
|
||||||
|
|
||||||
func (p Program) ID() ProgramID {
|
func (p Program) id() programID {
|
||||||
return ProgramID(p.Value)
|
return programID(p.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
package opengl
|
package opengl
|
||||||
|
|
||||||
// Since js.Object (Program) can't be keys of a map, use integers (ProgramID) instead.
|
// Since js.Object (Program) can't be keys of a map, use integers (programID) instead.
|
||||||
|
|
||||||
var uniformLocationCache = map[ProgramID]map[string]UniformLocation{}
|
var uniformLocationCache = map[programID]map[string]UniformLocation{}
|
||||||
var attribLocationCache = map[ProgramID]map[string]AttribLocation{}
|
var attribLocationCache = map[programID]map[string]AttribLocation{}
|
||||||
|
|
||||||
type UniformLocationGetter interface {
|
type UniformLocationGetter interface {
|
||||||
getUniformLocation(p Program, location string) UniformLocation
|
getUniformLocation(p Program, location string) UniformLocation
|
||||||
@ -26,7 +26,7 @@ type UniformLocationGetter interface {
|
|||||||
// TODO: Rename these functions not to be confusing
|
// TODO: Rename these functions not to be confusing
|
||||||
|
|
||||||
func GetUniformLocation(g UniformLocationGetter, p Program, location string) UniformLocation {
|
func GetUniformLocation(g UniformLocationGetter, p Program, location string) UniformLocation {
|
||||||
id := p.ID()
|
id := p.id()
|
||||||
if _, ok := uniformLocationCache[id]; !ok {
|
if _, ok := uniformLocationCache[id]; !ok {
|
||||||
uniformLocationCache[id] = map[string]UniformLocation{}
|
uniformLocationCache[id] = map[string]UniformLocation{}
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ type AttribLocationGetter interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetAttribLocation(g AttribLocationGetter, p Program, location string) AttribLocation {
|
func GetAttribLocation(g AttribLocationGetter, p Program, location string) AttribLocation {
|
||||||
id := p.ID()
|
id := p.id()
|
||||||
if _, ok := attribLocationCache[id]; !ok {
|
if _, ok := attribLocationCache[id]; !ok {
|
||||||
attribLocationCache[id] = map[string]AttribLocation{}
|
attribLocationCache[id] = map[string]AttribLocation{}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user