gpu: add linear gradient

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
This commit is contained in:
Egon Elbre
2020-11-01 21:21:19 +02:00
committed by Elias Naur
parent 0641a34b24
commit f00f3a3359
10 changed files with 452 additions and 71 deletions
+5 -1
View File
@@ -70,7 +70,7 @@ func generate() error {
if ext := filepath.Ext(shader); ext != ".vert" && ext != ".frag" {
continue
}
const nvariants = 2
const nvariants = 3
var variants [nvariants]struct {
backend.ShaderSources
hlslSrc string
@@ -80,6 +80,10 @@ func generate() error {
FetchColorExpr: `_color`,
Header: `layout(binding=0) uniform Color { vec4 _color; };`,
},
{
FetchColorExpr: `mix(_color1, _color2, clamp(vUV.x, 0.0, 1.0))`,
Header: `layout(binding=0) uniform Gradient { vec4 _color1; vec4 _color2; };`,
},
{
FetchColorExpr: `texture(tex, vUV)`,
Header: `layout(binding=0) uniform sampler2D tex;`,