opengl: GetProgramID() -> Program.ID()

This commit is contained in:
Hajime Hoshi 2016-02-27 02:27:39 +09:00
parent 7617a225f6
commit f432c15078
4 changed files with 5 additions and 6 deletions

View File

@ -42,8 +42,7 @@ type AttribLocation int32
type ProgramID uint32 type ProgramID uint32
// TODO: This should be a method? func (p Program) ID() ProgramID {
func GetProgramID(p Program) ProgramID {
return ProgramID(p) return ProgramID(p)
} }

View File

@ -58,7 +58,7 @@ type AttribLocation int
type ProgramID int type ProgramID int
func GetProgramID(p Program) ProgramID { func (p Program) ID() ProgramID {
return ProgramID(p.Get("__ebiten_programId").Int()) return ProgramID(p.Get("__ebiten_programId").Int())
} }

View File

@ -43,7 +43,7 @@ type AttribLocation mgl.Attrib
type ProgramID uint32 type ProgramID uint32
func GetProgramID(p Program) ProgramID { func (p Program) ID() ProgramID {
return ProgramID(p.Value) return ProgramID(p.Value)
} }

View File

@ -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 := GetProgramID(p) 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 := GetProgramID(p) id := p.ID()
if _, ok := attribLocationCache[id]; !ok { if _, ok := attribLocationCache[id]; !ok {
attribLocationCache[id] = map[string]AttribLocation{} attribLocationCache[id] = map[string]AttribLocation{}
} }