shaderir: Implement sampler2D

This commit is contained in:
Hajime Hoshi 2020-05-16 23:33:17 +09:00
parent 316e502f4b
commit 8f4e93338c
2 changed files with 5 additions and 9 deletions

View File

@ -86,8 +86,6 @@ func (p *Program) glslType(t *Type) string {
switch t.Main {
case None:
return "void"
case Image2D:
panic("not implemented")
case Array:
panic("not implemented")
case Struct:
@ -101,8 +99,6 @@ func (p *Program) glslVarDecl(t *Type, varname string) string {
switch t.Main {
case None:
return "?(none)"
case Image2D:
panic("not implemented")
case Array:
panic("not implemented")
case Struct:

View File

@ -47,8 +47,8 @@ func (t *Type) serialize() string {
return "mat3"
case Mat4:
return "mat4"
case Image2D:
return "image2d"
case Sampler2D:
return "sampler2D"
case Array:
return fmt.Sprintf("%s[%d]", t.Sub[0].serialize(), t.Length)
case Struct:
@ -78,7 +78,7 @@ const (
Mat2
Mat3
Mat4
Image2D
Sampler2D
Array
Struct
)
@ -105,8 +105,8 @@ func (t BasicType) Glsl() string {
return "mat3"
case Mat4:
return "mat4"
case Image2D:
return "?(image2d)"
case Sampler2D:
return "sampler2D"
case Array:
// First-class array is not available on GLSL ES 2.
return "?(array)"