mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/shaderir: change the naming convention: Num -> Count
This commit is contained in:
parent
dce34d2306
commit
16ff5c5039
@ -282,7 +282,7 @@ func (g *Graphics) useProgram(program program, uniforms []uniformVariable, textu
|
||||
}
|
||||
|
||||
for _, u := range uniforms {
|
||||
if got, expected := len(u.value), u.typ.FloatNum(); got != expected {
|
||||
if got, expected := len(u.value), u.typ.FloatCount(); got != expected {
|
||||
// Copy a shaderir.Type value once. Do not pass u.typ directly to fmt.Errorf arguments, or
|
||||
// the value u would be allocated on heap.
|
||||
typ := u.typ
|
||||
|
@ -79,7 +79,7 @@ func calculateMemoryOffsets(uniforms []shaderir.Type) []int {
|
||||
// TODO: What if the array has 2 or more dimensions?
|
||||
head = align(head)
|
||||
offsets = append(offsets, head)
|
||||
n := u.Sub[0].FloatNum()
|
||||
n := u.Sub[0].FloatCount()
|
||||
switch u.Sub[0].Main {
|
||||
case shaderir.Mat2:
|
||||
n = 6
|
||||
|
@ -81,7 +81,7 @@ func (t *Type) String() string {
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Type) FloatNum() int {
|
||||
func (t *Type) FloatCount() int {
|
||||
switch t.Main {
|
||||
case Float:
|
||||
return 1
|
||||
@ -98,7 +98,7 @@ func (t *Type) FloatNum() int {
|
||||
case Mat4:
|
||||
return 16
|
||||
case Array:
|
||||
return t.Length * t.Sub[0].FloatNum()
|
||||
return t.Length * t.Sub[0].FloatCount()
|
||||
default: // TODO: Parse a struct correctly
|
||||
return -1
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user