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

View File

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