mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
shaderir: Add (*Type).serialize again
This commit is contained in:
parent
255da0367f
commit
28948a9976
@ -60,7 +60,7 @@ func (p *Program) structName(t *Type) string {
|
|||||||
if t.Main != Struct {
|
if t.Main != Struct {
|
||||||
panic("shaderir: the given type at structName must be a struct")
|
panic("shaderir: the given type at structName must be a struct")
|
||||||
}
|
}
|
||||||
s := t.String()
|
s := t.serialize()
|
||||||
if n, ok := p.structNames[s]; ok {
|
if n, ok := p.structNames[s]; ok {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ func (t *Type) String() string {
|
|||||||
case Mat4:
|
case Mat4:
|
||||||
return "mat4"
|
return "mat4"
|
||||||
case Texture2D:
|
case Texture2D:
|
||||||
return "sampler2D"
|
return "texture2D"
|
||||||
case Array:
|
case Array:
|
||||||
return fmt.Sprintf("%s[%d]", t.Sub[0].String(), t.Length)
|
return fmt.Sprintf("%s[%d]", t.Sub[0].String(), t.Length)
|
||||||
case Struct:
|
case Struct:
|
||||||
@ -83,6 +83,10 @@ func (t *Type) String() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Type) serialize() string {
|
||||||
|
return t.String()
|
||||||
|
}
|
||||||
|
|
||||||
type BasicType int
|
type BasicType int
|
||||||
|
|
||||||
// For a texture, a name Texture2D is used instead of Sampler2D. A sampler is a combination of a texture and how to
|
// For a texture, a name Texture2D is used instead of Sampler2D. A sampler is a combination of a texture and how to
|
||||||
|
Loading…
Reference in New Issue
Block a user