chore(v2): vendor dependencies for offline/China builds

go mod vendor pins onnxruntime_go v1.12.1, Gio and the rest into v2/vendor
so go run/build work without hitting proxy.golang.org (blocked/slow in
China). Verified: CGO_ENABLED=1 go build -mod=vendor ./internal/spike and
GOOS=windows go build -mod=vendor ./internal/ui both pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ila
2026-07-23 16:35:01 +08:00
co-authored by Claude Opus 4.8
parent 97c1c4a974
commit f58728cddd
972 changed files with 597802 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
precision mediump float;
layout(location=0) in highp vec2 vUV;
layout(location=1) in highp float opacity;
{{.Header}}
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = opacity*{{.FetchColorExpr}};
}
+36
View File
@@ -0,0 +1,36 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include "common.h"
layout(push_constant) uniform Block {
vec4 transform;
vec4 uvTransformR1;
vec4 uvTransformR2;
float opacity;
// fbo is set if blitting to a FBO, otherwise the window.
float fbo;
} _block;
layout(location = 0) in vec2 pos;
layout(location = 1) in vec2 uv;
layout(location = 0) out vec2 vUV;
layout(location = 1) out float opacity;
void main() {
vec2 p = pos*_block.transform.xy + _block.transform.zw;
if (_block.fbo != 0.0) {
gl_Position = vec4(transform3x2(fboTransform, vec3(p, 0)), 1);
} else {
gl_Position = vec4(transform3x2(windowTransform, vec3(p, 0)), 1);
}
vUV = transform3x2(m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz), vec3(uv,1)).xy;
opacity = _block.opacity;
}
+35
View File
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: Unlicense OR MIT
struct m3x2 {
vec3 r0;
vec3 r1;
};
// fboTransform is the transformation that cancels the implied transformation
// between the clip space and the framebuffer. Only two rows are returned. The
// last is implied to be [0, 0, 1].
const m3x2 fboTransform = m3x2(
#if defined(LANG_HLSL) || defined(LANG_MSL) || defined(LANG_MSLIOS)
vec3(1.0, 0.0, 0.0),
vec3(0.0, -1.0, 0.0)
#else
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0)
#endif
);
// windowTransform is the transformation that cancels the implied transformation
// between framebuffer space and window system coordinates.
const m3x2 windowTransform = m3x2(
#if defined(LANG_VULKAN)
vec3(1.0, 0.0, 0.0),
vec3(0.0, 1.0, 0.0)
#else
vec3(1.0, 0.0, 0.0),
vec3(0.0, -1.0, 0.0)
#endif
);
vec3 transform3x2(m3x2 t, vec3 v) {
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
+24
View File
@@ -0,0 +1,24 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
precision mediump float;
layout(binding = 0) uniform sampler2D tex;
layout(location = 0) in highp vec2 vUV;
layout(location = 0) out vec4 fragColor;
vec3 sRGBtoRGB(vec3 rgb) {
bvec3 cutoff = greaterThanEqual(rgb, vec3(0.04045));
vec3 below = rgb/vec3(12.92);
vec3 above = pow((rgb + vec3(0.055))/vec3(1.055), vec3(2.4));
return mix(below, above, cutoff);
}
void main() {
vec4 texel = texture(tex, vUV);
texel.rgb = sRGBtoRGB(texel.rgb);
fragColor = texel;
}
+26
View File
@@ -0,0 +1,26 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include "common.h"
layout(push_constant) uniform Block {
vec2 scale;
vec2 pos;
vec2 uvScale;
} _block;
layout(location = 0) in vec2 pos;
layout(location = 1) in vec2 uv;
layout(location = 0) out vec2 vUV;
void main() {
vUV = vec2(uv*_block.uvScale);
vec2 p = vec2(pos*_block.scale + _block.pos);
gl_Position = vec4(transform3x2(windowTransform, vec3(p, 0)), 1);
}
+20
View File
@@ -0,0 +1,20 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
precision mediump float;
{{.Header}}
layout(location = 0) in highp vec2 vCoverUV;
layout(location = 1) in highp vec2 vUV;
layout(binding = 1) uniform sampler2D cover;
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = {{.FetchColorExpr}};
float c = min(abs(texture(cover, vCoverUV).r), 1.0);
fragColor *= c;
}
+37
View File
@@ -0,0 +1,37 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include "common.h"
layout(push_constant) uniform Block {
vec4 transform;
vec4 uvCoverTransform;
vec4 uvTransformR1;
vec4 uvTransformR2;
// fbo is set if blitting to a FBO, otherwise the window.
float fbo;
} _block;
layout(location = 0) in vec2 pos;
layout(location = 0) out vec2 vCoverUV;
layout(location = 1) in vec2 uv;
layout(location = 1) out vec2 vUV;
void main() {
vec2 p = vec2(pos*_block.transform.xy + _block.transform.zw);
if (_block.fbo != 0.0) {
gl_Position = vec4(transform3x2(fboTransform, vec3(p, 0)), 1);
} else {
gl_Position = vec4(transform3x2(windowTransform, vec3(p, 0)), 1);
}
vUV = transform3x2(m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz), vec3(uv,1)).xy;
vec3 uv3 = vec3(uv, 1.0);
vCoverUV = (uv3*vec3(_block.uvCoverTransform.xy, 1.0)+vec3(_block.uvCoverTransform.zw, 0.0)).xy;
}
+5
View File
@@ -0,0 +1,5 @@
// SPDX-License-Identifier: Unlicense OR MIT
package gio
//go:generate go run ../cmd/convertshaders -package gio -dir .
+15
View File
@@ -0,0 +1,15 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include "common.h"
layout(location=0) in vec4 position;
void main() {
gl_Position = vec4(transform3x2(windowTransform, position.xyz), position.w);
}
+15
View File
@@ -0,0 +1,15 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
precision mediump float;
layout(location = 0) in highp vec2 vUV;
layout(binding = 0) uniform sampler2D cover;
layout(location = 0) out vec4 fragColor;
void main() {
fragColor.r = abs(texture(cover, vUV).r);
}
+26
View File
@@ -0,0 +1,26 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include "common.h"
layout(location = 0) in vec2 pos;
layout(location = 1) in vec2 uv;
layout(push_constant) uniform Block {
vec4 uvTransform;
vec4 subUVTransform;
} _block;
layout(location = 0) out vec2 vUV;
void main() {
vec3 p = transform3x2(fboTransform, vec3(pos, 1.0));
gl_Position = vec4(p, 1);
vUV = uv.xy*_block.subUVTransform.xy + _block.subUVTransform.zw;
vUV = vUV*_block.uvTransform.xy + _block.uvTransform.zw;
}
+32
View File
@@ -0,0 +1,32 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
precision mediump float;
layout(binding = 0) uniform sampler2D tex;
layout(location = 0) in highp vec2 vUV;
layout(location = 0) out vec4 fragColor;
layout(push_constant) uniform Color {
// If emulateSRGB is set (!= 0), the input texels are sRGB encoded. We save the
// conversion step below, at the cost of texture filtering in sRGB space.
layout(offset=16) float emulateSRGB;
} _color;
vec3 RGBtosRGB(vec3 rgb) {
bvec3 cutoff = greaterThanEqual(rgb, vec3(0.0031308));
vec3 below = vec3(12.92)*rgb;
vec3 above = vec3(1.055)*pow(rgb, vec3(0.41666)) - vec3(0.055);
return mix(below, above, cutoff);
}
void main() {
vec4 texel = texture(tex, vUV);
if (_color.emulateSRGB == 0.0) {
texel.rgb = RGBtosRGB(texel.rgb);
}
fragColor = texel;
}
+25
View File
@@ -0,0 +1,25 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include "common.h"
layout(push_constant) uniform Block {
vec2 scale;
vec2 pos;
} _block;
layout(location = 0) in vec2 pos;
layout(location = 1) in vec2 uv;
layout(location = 0) out vec2 vUV;
void main() {
vUV = uv;
vec2 p = vec2(pos*_block.scale + _block.pos);
gl_Position = vec4(transform3x2(fboTransform, vec3(p, 0)), 1);
}
+796
View File
@@ -0,0 +1,796 @@
// Code generated by build.go. DO NOT EDIT.
package gio
import (
_ "embed"
"runtime"
"gioui.org/shader"
)
var (
Shader_blit_frag = [...]shader.Sources{
{
Name: "blit.frag",
Inputs: []shader.InputLocation{{Name: "vUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "opacity", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 1}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_color.color", Type: 0x0, Size: 4, Offset: 112}},
Size: 16,
},
},
{
Name: "blit.frag",
Inputs: []shader.InputLocation{{Name: "vUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "opacity", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 1}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_gradient.color1", Type: 0x0, Size: 4, Offset: 96}, {Name: "_gradient.color2", Type: 0x0, Size: 4, Offset: 112}},
Size: 32,
},
},
{
Name: "blit.frag",
Inputs: []shader.InputLocation{{Name: "vUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "opacity", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 1}},
Textures: []shader.TextureBinding{{Name: "tex", Binding: 0}},
},
}
//go:embed zblit.frag.0.spirv
zblit_frag_0_spirv string
//go:embed zblit.frag.0.glsl100es
zblit_frag_0_glsl100es string
//go:embed zblit.frag.0.glsl150
zblit_frag_0_glsl150 string
//go:embed zblit.frag.0.dxbc
zblit_frag_0_dxbc string
//go:embed zblit.frag.0.metallibmacos
zblit_frag_0_metallibmacos string
//go:embed zblit.frag.0.metallibios
zblit_frag_0_metallibios string
//go:embed zblit.frag.0.metallibiossimulator
zblit_frag_0_metallibiossimulator string
//go:embed zblit.frag.1.spirv
zblit_frag_1_spirv string
//go:embed zblit.frag.1.glsl100es
zblit_frag_1_glsl100es string
//go:embed zblit.frag.1.glsl150
zblit_frag_1_glsl150 string
//go:embed zblit.frag.1.dxbc
zblit_frag_1_dxbc string
//go:embed zblit.frag.1.metallibmacos
zblit_frag_1_metallibmacos string
//go:embed zblit.frag.1.metallibios
zblit_frag_1_metallibios string
//go:embed zblit.frag.1.metallibiossimulator
zblit_frag_1_metallibiossimulator string
//go:embed zblit.frag.2.spirv
zblit_frag_2_spirv string
//go:embed zblit.frag.2.glsl100es
zblit_frag_2_glsl100es string
//go:embed zblit.frag.2.glsl150
zblit_frag_2_glsl150 string
//go:embed zblit.frag.2.dxbc
zblit_frag_2_dxbc string
//go:embed zblit.frag.2.metallibmacos
zblit_frag_2_metallibmacos string
//go:embed zblit.frag.2.metallibios
zblit_frag_2_metallibios string
//go:embed zblit.frag.2.metallibiossimulator
zblit_frag_2_metallibiossimulator string
Shader_blit_vert = shader.Sources{
Name: "blit.vert",
Inputs: []shader.InputLocation{{Name: "pos", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "uv", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_block.transform", Type: 0x0, Size: 4, Offset: 0}, {Name: "_block.uvTransformR1", Type: 0x0, Size: 4, Offset: 16}, {Name: "_block.uvTransformR2", Type: 0x0, Size: 4, Offset: 32}, {Name: "_block.opacity", Type: 0x0, Size: 1, Offset: 48}, {Name: "_block.fbo", Type: 0x0, Size: 1, Offset: 52}},
Size: 56,
},
}
//go:embed zblit.vert.0.spirv
zblit_vert_0_spirv string
//go:embed zblit.vert.0.glsl100es
zblit_vert_0_glsl100es string
//go:embed zblit.vert.0.glsl150
zblit_vert_0_glsl150 string
//go:embed zblit.vert.0.dxbc
zblit_vert_0_dxbc string
//go:embed zblit.vert.0.metallibmacos
zblit_vert_0_metallibmacos string
//go:embed zblit.vert.0.metallibios
zblit_vert_0_metallibios string
//go:embed zblit.vert.0.metallibiossimulator
zblit_vert_0_metallibiossimulator string
Shader_copy_frag = shader.Sources{
Name: "copy.frag",
Inputs: []shader.InputLocation{{Name: "vUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}},
Textures: []shader.TextureBinding{{Name: "tex", Binding: 0}},
}
//go:embed zcopy.frag.0.spirv
zcopy_frag_0_spirv string
//go:embed zcopy.frag.0.glsl100es
zcopy_frag_0_glsl100es string
//go:embed zcopy.frag.0.glsl150
zcopy_frag_0_glsl150 string
//go:embed zcopy.frag.0.dxbc
zcopy_frag_0_dxbc string
//go:embed zcopy.frag.0.metallibmacos
zcopy_frag_0_metallibmacos string
//go:embed zcopy.frag.0.metallibios
zcopy_frag_0_metallibios string
//go:embed zcopy.frag.0.metallibiossimulator
zcopy_frag_0_metallibiossimulator string
Shader_copy_vert = shader.Sources{
Name: "copy.vert",
Inputs: []shader.InputLocation{{Name: "pos", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "uv", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_block.scale", Type: 0x0, Size: 2, Offset: 0}, {Name: "_block.pos", Type: 0x0, Size: 2, Offset: 8}, {Name: "_block.uvScale", Type: 0x0, Size: 2, Offset: 16}},
Size: 24,
},
}
//go:embed zcopy.vert.0.spirv
zcopy_vert_0_spirv string
//go:embed zcopy.vert.0.glsl100es
zcopy_vert_0_glsl100es string
//go:embed zcopy.vert.0.glsl150
zcopy_vert_0_glsl150 string
//go:embed zcopy.vert.0.dxbc
zcopy_vert_0_dxbc string
//go:embed zcopy.vert.0.metallibmacos
zcopy_vert_0_metallibmacos string
//go:embed zcopy.vert.0.metallibios
zcopy_vert_0_metallibios string
//go:embed zcopy.vert.0.metallibiossimulator
zcopy_vert_0_metallibiossimulator string
Shader_cover_frag = [...]shader.Sources{
{
Name: "cover.frag",
Inputs: []shader.InputLocation{{Name: "vCoverUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "vUV", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_color.color", Type: 0x0, Size: 4, Offset: 112}},
Size: 16,
},
Textures: []shader.TextureBinding{{Name: "cover", Binding: 1}},
},
{
Name: "cover.frag",
Inputs: []shader.InputLocation{{Name: "vCoverUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "vUV", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_gradient.color1", Type: 0x0, Size: 4, Offset: 96}, {Name: "_gradient.color2", Type: 0x0, Size: 4, Offset: 112}},
Size: 32,
},
Textures: []shader.TextureBinding{{Name: "cover", Binding: 1}},
},
{
Name: "cover.frag",
Inputs: []shader.InputLocation{{Name: "vCoverUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "vUV", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}},
Textures: []shader.TextureBinding{{Name: "tex", Binding: 0}, {Name: "cover", Binding: 1}},
},
}
//go:embed zcover.frag.0.spirv
zcover_frag_0_spirv string
//go:embed zcover.frag.0.glsl100es
zcover_frag_0_glsl100es string
//go:embed zcover.frag.0.glsl150
zcover_frag_0_glsl150 string
//go:embed zcover.frag.0.dxbc
zcover_frag_0_dxbc string
//go:embed zcover.frag.0.metallibmacos
zcover_frag_0_metallibmacos string
//go:embed zcover.frag.0.metallibios
zcover_frag_0_metallibios string
//go:embed zcover.frag.0.metallibiossimulator
zcover_frag_0_metallibiossimulator string
//go:embed zcover.frag.1.spirv
zcover_frag_1_spirv string
//go:embed zcover.frag.1.glsl100es
zcover_frag_1_glsl100es string
//go:embed zcover.frag.1.glsl150
zcover_frag_1_glsl150 string
//go:embed zcover.frag.1.dxbc
zcover_frag_1_dxbc string
//go:embed zcover.frag.1.metallibmacos
zcover_frag_1_metallibmacos string
//go:embed zcover.frag.1.metallibios
zcover_frag_1_metallibios string
//go:embed zcover.frag.1.metallibiossimulator
zcover_frag_1_metallibiossimulator string
//go:embed zcover.frag.2.spirv
zcover_frag_2_spirv string
//go:embed zcover.frag.2.glsl100es
zcover_frag_2_glsl100es string
//go:embed zcover.frag.2.glsl150
zcover_frag_2_glsl150 string
//go:embed zcover.frag.2.dxbc
zcover_frag_2_dxbc string
//go:embed zcover.frag.2.metallibmacos
zcover_frag_2_metallibmacos string
//go:embed zcover.frag.2.metallibios
zcover_frag_2_metallibios string
//go:embed zcover.frag.2.metallibiossimulator
zcover_frag_2_metallibiossimulator string
Shader_cover_vert = shader.Sources{
Name: "cover.vert",
Inputs: []shader.InputLocation{{Name: "pos", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "uv", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_block.transform", Type: 0x0, Size: 4, Offset: 0}, {Name: "_block.uvCoverTransform", Type: 0x0, Size: 4, Offset: 16}, {Name: "_block.uvTransformR1", Type: 0x0, Size: 4, Offset: 32}, {Name: "_block.uvTransformR2", Type: 0x0, Size: 4, Offset: 48}, {Name: "_block.fbo", Type: 0x0, Size: 1, Offset: 64}},
Size: 68,
},
}
//go:embed zcover.vert.0.spirv
zcover_vert_0_spirv string
//go:embed zcover.vert.0.glsl100es
zcover_vert_0_glsl100es string
//go:embed zcover.vert.0.glsl150
zcover_vert_0_glsl150 string
//go:embed zcover.vert.0.dxbc
zcover_vert_0_dxbc string
//go:embed zcover.vert.0.metallibmacos
zcover_vert_0_metallibmacos string
//go:embed zcover.vert.0.metallibios
zcover_vert_0_metallibios string
//go:embed zcover.vert.0.metallibiossimulator
zcover_vert_0_metallibiossimulator string
Shader_input_vert = shader.Sources{
Name: "input.vert",
Inputs: []shader.InputLocation{{Name: "position", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 4}},
}
//go:embed zinput.vert.0.spirv
zinput_vert_0_spirv string
//go:embed zinput.vert.0.glsl100es
zinput_vert_0_glsl100es string
//go:embed zinput.vert.0.glsl150
zinput_vert_0_glsl150 string
//go:embed zinput.vert.0.dxbc
zinput_vert_0_dxbc string
//go:embed zinput.vert.0.metallibmacos
zinput_vert_0_metallibmacos string
//go:embed zinput.vert.0.metallibios
zinput_vert_0_metallibios string
//go:embed zinput.vert.0.metallibiossimulator
zinput_vert_0_metallibiossimulator string
Shader_intersect_frag = shader.Sources{
Name: "intersect.frag",
Inputs: []shader.InputLocation{{Name: "vUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}},
Textures: []shader.TextureBinding{{Name: "cover", Binding: 0}},
}
//go:embed zintersect.frag.0.spirv
zintersect_frag_0_spirv string
//go:embed zintersect.frag.0.glsl100es
zintersect_frag_0_glsl100es string
//go:embed zintersect.frag.0.glsl150
zintersect_frag_0_glsl150 string
//go:embed zintersect.frag.0.dxbc
zintersect_frag_0_dxbc string
//go:embed zintersect.frag.0.metallibmacos
zintersect_frag_0_metallibmacos string
//go:embed zintersect.frag.0.metallibios
zintersect_frag_0_metallibios string
//go:embed zintersect.frag.0.metallibiossimulator
zintersect_frag_0_metallibiossimulator string
Shader_intersect_vert = shader.Sources{
Name: "intersect.vert",
Inputs: []shader.InputLocation{{Name: "pos", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "uv", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_block.uvTransform", Type: 0x0, Size: 4, Offset: 0}, {Name: "_block.subUVTransform", Type: 0x0, Size: 4, Offset: 16}},
Size: 32,
},
}
//go:embed zintersect.vert.0.spirv
zintersect_vert_0_spirv string
//go:embed zintersect.vert.0.glsl100es
zintersect_vert_0_glsl100es string
//go:embed zintersect.vert.0.glsl150
zintersect_vert_0_glsl150 string
//go:embed zintersect.vert.0.dxbc
zintersect_vert_0_dxbc string
//go:embed zintersect.vert.0.metallibmacos
zintersect_vert_0_metallibmacos string
//go:embed zintersect.vert.0.metallibios
zintersect_vert_0_metallibios string
//go:embed zintersect.vert.0.metallibiossimulator
zintersect_vert_0_metallibiossimulator string
Shader_material_frag = shader.Sources{
Name: "material.frag",
Inputs: []shader.InputLocation{{Name: "vUV", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_color.emulateSRGB", Type: 0x0, Size: 1, Offset: 16}},
Size: 4,
},
Textures: []shader.TextureBinding{{Name: "tex", Binding: 0}},
}
//go:embed zmaterial.frag.0.spirv
zmaterial_frag_0_spirv string
//go:embed zmaterial.frag.0.glsl100es
zmaterial_frag_0_glsl100es string
//go:embed zmaterial.frag.0.glsl150
zmaterial_frag_0_glsl150 string
//go:embed zmaterial.frag.0.dxbc
zmaterial_frag_0_dxbc string
//go:embed zmaterial.frag.0.metallibmacos
zmaterial_frag_0_metallibmacos string
//go:embed zmaterial.frag.0.metallibios
zmaterial_frag_0_metallibios string
//go:embed zmaterial.frag.0.metallibiossimulator
zmaterial_frag_0_metallibiossimulator string
Shader_material_vert = shader.Sources{
Name: "material.vert",
Inputs: []shader.InputLocation{{Name: "pos", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "uv", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_block.scale", Type: 0x0, Size: 2, Offset: 0}, {Name: "_block.pos", Type: 0x0, Size: 2, Offset: 8}},
Size: 16,
},
}
//go:embed zmaterial.vert.0.spirv
zmaterial_vert_0_spirv string
//go:embed zmaterial.vert.0.glsl100es
zmaterial_vert_0_glsl100es string
//go:embed zmaterial.vert.0.glsl150
zmaterial_vert_0_glsl150 string
//go:embed zmaterial.vert.0.dxbc
zmaterial_vert_0_dxbc string
//go:embed zmaterial.vert.0.metallibmacos
zmaterial_vert_0_metallibmacos string
//go:embed zmaterial.vert.0.metallibios
zmaterial_vert_0_metallibios string
//go:embed zmaterial.vert.0.metallibiossimulator
zmaterial_vert_0_metallibiossimulator string
Shader_simple_frag = shader.Sources{
Name: "simple.frag",
}
//go:embed zsimple.frag.0.spirv
zsimple_frag_0_spirv string
//go:embed zsimple.frag.0.glsl100es
zsimple_frag_0_glsl100es string
//go:embed zsimple.frag.0.glsl150
zsimple_frag_0_glsl150 string
//go:embed zsimple.frag.0.dxbc
zsimple_frag_0_dxbc string
//go:embed zsimple.frag.0.metallibmacos
zsimple_frag_0_metallibmacos string
//go:embed zsimple.frag.0.metallibios
zsimple_frag_0_metallibios string
//go:embed zsimple.frag.0.metallibiossimulator
zsimple_frag_0_metallibiossimulator string
Shader_stencil_frag = shader.Sources{
Name: "stencil.frag",
Inputs: []shader.InputLocation{{Name: "vFrom", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 2}, {Name: "vCtrl", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 2}, {Name: "vTo", Location: 2, Semantic: "TEXCOORD", SemanticIndex: 2, Type: 0x0, Size: 2}},
}
//go:embed zstencil.frag.0.spirv
zstencil_frag_0_spirv string
//go:embed zstencil.frag.0.glsl100es
zstencil_frag_0_glsl100es string
//go:embed zstencil.frag.0.glsl150
zstencil_frag_0_glsl150 string
//go:embed zstencil.frag.0.dxbc
zstencil_frag_0_dxbc string
//go:embed zstencil.frag.0.metallibmacos
zstencil_frag_0_metallibmacos string
//go:embed zstencil.frag.0.metallibios
zstencil_frag_0_metallibios string
//go:embed zstencil.frag.0.metallibiossimulator
zstencil_frag_0_metallibiossimulator string
Shader_stencil_vert = shader.Sources{
Name: "stencil.vert",
Inputs: []shader.InputLocation{{Name: "corner", Location: 0, Semantic: "TEXCOORD", SemanticIndex: 0, Type: 0x0, Size: 1}, {Name: "maxy", Location: 1, Semantic: "TEXCOORD", SemanticIndex: 1, Type: 0x0, Size: 1}, {Name: "from", Location: 2, Semantic: "TEXCOORD", SemanticIndex: 2, Type: 0x0, Size: 2}, {Name: "ctrl", Location: 3, Semantic: "TEXCOORD", SemanticIndex: 3, Type: 0x0, Size: 2}, {Name: "to", Location: 4, Semantic: "TEXCOORD", SemanticIndex: 4, Type: 0x0, Size: 2}},
Uniforms: shader.UniformsReflection{
Locations: []shader.UniformLocation{{Name: "_block.transform", Type: 0x0, Size: 4, Offset: 0}, {Name: "_block.pathOffset", Type: 0x0, Size: 2, Offset: 16}},
Size: 24,
},
}
//go:embed zstencil.vert.0.spirv
zstencil_vert_0_spirv string
//go:embed zstencil.vert.0.glsl100es
zstencil_vert_0_glsl100es string
//go:embed zstencil.vert.0.glsl150
zstencil_vert_0_glsl150 string
//go:embed zstencil.vert.0.dxbc
zstencil_vert_0_dxbc string
//go:embed zstencil.vert.0.metallibmacos
zstencil_vert_0_metallibmacos string
//go:embed zstencil.vert.0.metallibios
zstencil_vert_0_metallibios string
//go:embed zstencil.vert.0.metallibiossimulator
zstencil_vert_0_metallibiossimulator string
)
func init() {
const (
opengles = runtime.GOOS == "linux" || runtime.GOOS == "freebsd" || runtime.GOOS == "openbsd" || runtime.GOOS == "windows" || runtime.GOOS == "js" || runtime.GOOS == "android" || runtime.GOOS == "darwin" || runtime.GOOS == "ios"
opengl = runtime.GOOS == "darwin"
d3d11 = runtime.GOOS == "windows"
vulkan = runtime.GOOS == "linux" || runtime.GOOS == "android"
)
if vulkan {
Shader_blit_frag[0].SPIRV = zblit_frag_0_spirv
}
if opengles {
Shader_blit_frag[0].GLSL100ES = zblit_frag_0_glsl100es
}
if opengl {
Shader_blit_frag[0].GLSL150 = zblit_frag_0_glsl150
}
if d3d11 {
Shader_blit_frag[0].DXBC = zblit_frag_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_blit_frag[0].MetalLib = zblit_frag_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_blit_frag[0].MetalLib = zblit_frag_0_metallibiossimulator
} else {
Shader_blit_frag[0].MetalLib = zblit_frag_0_metallibios
}
}
if vulkan {
Shader_blit_frag[1].SPIRV = zblit_frag_1_spirv
}
if opengles {
Shader_blit_frag[1].GLSL100ES = zblit_frag_1_glsl100es
}
if opengl {
Shader_blit_frag[1].GLSL150 = zblit_frag_1_glsl150
}
if d3d11 {
Shader_blit_frag[1].DXBC = zblit_frag_1_dxbc
}
if runtime.GOOS == "darwin" {
Shader_blit_frag[1].MetalLib = zblit_frag_1_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_blit_frag[1].MetalLib = zblit_frag_1_metallibiossimulator
} else {
Shader_blit_frag[1].MetalLib = zblit_frag_1_metallibios
}
}
if vulkan {
Shader_blit_frag[2].SPIRV = zblit_frag_2_spirv
}
if opengles {
Shader_blit_frag[2].GLSL100ES = zblit_frag_2_glsl100es
}
if opengl {
Shader_blit_frag[2].GLSL150 = zblit_frag_2_glsl150
}
if d3d11 {
Shader_blit_frag[2].DXBC = zblit_frag_2_dxbc
}
if runtime.GOOS == "darwin" {
Shader_blit_frag[2].MetalLib = zblit_frag_2_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_blit_frag[2].MetalLib = zblit_frag_2_metallibiossimulator
} else {
Shader_blit_frag[2].MetalLib = zblit_frag_2_metallibios
}
}
if vulkan {
Shader_blit_vert.SPIRV = zblit_vert_0_spirv
}
if opengles {
Shader_blit_vert.GLSL100ES = zblit_vert_0_glsl100es
}
if opengl {
Shader_blit_vert.GLSL150 = zblit_vert_0_glsl150
}
if d3d11 {
Shader_blit_vert.DXBC = zblit_vert_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_blit_vert.MetalLib = zblit_vert_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_blit_vert.MetalLib = zblit_vert_0_metallibiossimulator
} else {
Shader_blit_vert.MetalLib = zblit_vert_0_metallibios
}
}
if vulkan {
Shader_copy_frag.SPIRV = zcopy_frag_0_spirv
}
if opengles {
Shader_copy_frag.GLSL100ES = zcopy_frag_0_glsl100es
}
if opengl {
Shader_copy_frag.GLSL150 = zcopy_frag_0_glsl150
}
if d3d11 {
Shader_copy_frag.DXBC = zcopy_frag_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_copy_frag.MetalLib = zcopy_frag_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_copy_frag.MetalLib = zcopy_frag_0_metallibiossimulator
} else {
Shader_copy_frag.MetalLib = zcopy_frag_0_metallibios
}
}
if vulkan {
Shader_copy_vert.SPIRV = zcopy_vert_0_spirv
}
if opengles {
Shader_copy_vert.GLSL100ES = zcopy_vert_0_glsl100es
}
if opengl {
Shader_copy_vert.GLSL150 = zcopy_vert_0_glsl150
}
if d3d11 {
Shader_copy_vert.DXBC = zcopy_vert_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_copy_vert.MetalLib = zcopy_vert_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_copy_vert.MetalLib = zcopy_vert_0_metallibiossimulator
} else {
Shader_copy_vert.MetalLib = zcopy_vert_0_metallibios
}
}
if vulkan {
Shader_cover_frag[0].SPIRV = zcover_frag_0_spirv
}
if opengles {
Shader_cover_frag[0].GLSL100ES = zcover_frag_0_glsl100es
}
if opengl {
Shader_cover_frag[0].GLSL150 = zcover_frag_0_glsl150
}
if d3d11 {
Shader_cover_frag[0].DXBC = zcover_frag_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_cover_frag[0].MetalLib = zcover_frag_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_cover_frag[0].MetalLib = zcover_frag_0_metallibiossimulator
} else {
Shader_cover_frag[0].MetalLib = zcover_frag_0_metallibios
}
}
if vulkan {
Shader_cover_frag[1].SPIRV = zcover_frag_1_spirv
}
if opengles {
Shader_cover_frag[1].GLSL100ES = zcover_frag_1_glsl100es
}
if opengl {
Shader_cover_frag[1].GLSL150 = zcover_frag_1_glsl150
}
if d3d11 {
Shader_cover_frag[1].DXBC = zcover_frag_1_dxbc
}
if runtime.GOOS == "darwin" {
Shader_cover_frag[1].MetalLib = zcover_frag_1_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_cover_frag[1].MetalLib = zcover_frag_1_metallibiossimulator
} else {
Shader_cover_frag[1].MetalLib = zcover_frag_1_metallibios
}
}
if vulkan {
Shader_cover_frag[2].SPIRV = zcover_frag_2_spirv
}
if opengles {
Shader_cover_frag[2].GLSL100ES = zcover_frag_2_glsl100es
}
if opengl {
Shader_cover_frag[2].GLSL150 = zcover_frag_2_glsl150
}
if d3d11 {
Shader_cover_frag[2].DXBC = zcover_frag_2_dxbc
}
if runtime.GOOS == "darwin" {
Shader_cover_frag[2].MetalLib = zcover_frag_2_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_cover_frag[2].MetalLib = zcover_frag_2_metallibiossimulator
} else {
Shader_cover_frag[2].MetalLib = zcover_frag_2_metallibios
}
}
if vulkan {
Shader_cover_vert.SPIRV = zcover_vert_0_spirv
}
if opengles {
Shader_cover_vert.GLSL100ES = zcover_vert_0_glsl100es
}
if opengl {
Shader_cover_vert.GLSL150 = zcover_vert_0_glsl150
}
if d3d11 {
Shader_cover_vert.DXBC = zcover_vert_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_cover_vert.MetalLib = zcover_vert_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_cover_vert.MetalLib = zcover_vert_0_metallibiossimulator
} else {
Shader_cover_vert.MetalLib = zcover_vert_0_metallibios
}
}
if vulkan {
Shader_input_vert.SPIRV = zinput_vert_0_spirv
}
if opengles {
Shader_input_vert.GLSL100ES = zinput_vert_0_glsl100es
}
if opengl {
Shader_input_vert.GLSL150 = zinput_vert_0_glsl150
}
if d3d11 {
Shader_input_vert.DXBC = zinput_vert_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_input_vert.MetalLib = zinput_vert_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_input_vert.MetalLib = zinput_vert_0_metallibiossimulator
} else {
Shader_input_vert.MetalLib = zinput_vert_0_metallibios
}
}
if vulkan {
Shader_intersect_frag.SPIRV = zintersect_frag_0_spirv
}
if opengles {
Shader_intersect_frag.GLSL100ES = zintersect_frag_0_glsl100es
}
if opengl {
Shader_intersect_frag.GLSL150 = zintersect_frag_0_glsl150
}
if d3d11 {
Shader_intersect_frag.DXBC = zintersect_frag_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_intersect_frag.MetalLib = zintersect_frag_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_intersect_frag.MetalLib = zintersect_frag_0_metallibiossimulator
} else {
Shader_intersect_frag.MetalLib = zintersect_frag_0_metallibios
}
}
if vulkan {
Shader_intersect_vert.SPIRV = zintersect_vert_0_spirv
}
if opengles {
Shader_intersect_vert.GLSL100ES = zintersect_vert_0_glsl100es
}
if opengl {
Shader_intersect_vert.GLSL150 = zintersect_vert_0_glsl150
}
if d3d11 {
Shader_intersect_vert.DXBC = zintersect_vert_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_intersect_vert.MetalLib = zintersect_vert_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_intersect_vert.MetalLib = zintersect_vert_0_metallibiossimulator
} else {
Shader_intersect_vert.MetalLib = zintersect_vert_0_metallibios
}
}
if vulkan {
Shader_material_frag.SPIRV = zmaterial_frag_0_spirv
}
if opengles {
Shader_material_frag.GLSL100ES = zmaterial_frag_0_glsl100es
}
if opengl {
Shader_material_frag.GLSL150 = zmaterial_frag_0_glsl150
}
if d3d11 {
Shader_material_frag.DXBC = zmaterial_frag_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_material_frag.MetalLib = zmaterial_frag_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_material_frag.MetalLib = zmaterial_frag_0_metallibiossimulator
} else {
Shader_material_frag.MetalLib = zmaterial_frag_0_metallibios
}
}
if vulkan {
Shader_material_vert.SPIRV = zmaterial_vert_0_spirv
}
if opengles {
Shader_material_vert.GLSL100ES = zmaterial_vert_0_glsl100es
}
if opengl {
Shader_material_vert.GLSL150 = zmaterial_vert_0_glsl150
}
if d3d11 {
Shader_material_vert.DXBC = zmaterial_vert_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_material_vert.MetalLib = zmaterial_vert_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_material_vert.MetalLib = zmaterial_vert_0_metallibiossimulator
} else {
Shader_material_vert.MetalLib = zmaterial_vert_0_metallibios
}
}
if vulkan {
Shader_simple_frag.SPIRV = zsimple_frag_0_spirv
}
if opengles {
Shader_simple_frag.GLSL100ES = zsimple_frag_0_glsl100es
}
if opengl {
Shader_simple_frag.GLSL150 = zsimple_frag_0_glsl150
}
if d3d11 {
Shader_simple_frag.DXBC = zsimple_frag_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_simple_frag.MetalLib = zsimple_frag_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_simple_frag.MetalLib = zsimple_frag_0_metallibiossimulator
} else {
Shader_simple_frag.MetalLib = zsimple_frag_0_metallibios
}
}
if vulkan {
Shader_stencil_frag.SPIRV = zstencil_frag_0_spirv
}
if opengles {
Shader_stencil_frag.GLSL100ES = zstencil_frag_0_glsl100es
}
if opengl {
Shader_stencil_frag.GLSL150 = zstencil_frag_0_glsl150
}
if d3d11 {
Shader_stencil_frag.DXBC = zstencil_frag_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_stencil_frag.MetalLib = zstencil_frag_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_stencil_frag.MetalLib = zstencil_frag_0_metallibiossimulator
} else {
Shader_stencil_frag.MetalLib = zstencil_frag_0_metallibios
}
}
if vulkan {
Shader_stencil_vert.SPIRV = zstencil_vert_0_spirv
}
if opengles {
Shader_stencil_vert.GLSL100ES = zstencil_vert_0_glsl100es
}
if opengl {
Shader_stencil_vert.GLSL150 = zstencil_vert_0_glsl150
}
if d3d11 {
Shader_stencil_vert.DXBC = zstencil_vert_0_dxbc
}
if runtime.GOOS == "darwin" {
Shader_stencil_vert.MetalLib = zstencil_vert_0_metallibmacos
}
if runtime.GOOS == "ios" {
if runtime.GOARCH == "amd64" {
Shader_stencil_vert.MetalLib = zstencil_vert_0_metallibiossimulator
} else {
Shader_stencil_vert.MetalLib = zstencil_vert_0_metallibios
}
}
}
+11
View File
@@ -0,0 +1,11 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
precision mediump float;
layout(location = 0) out vec4 fragColor;
void main() {
fragColor = vec4(.25, .55, .75, 1.0);
}
+81
View File
@@ -0,0 +1,81 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
precision mediump float;
layout(location=0) in highp vec2 vFrom;
layout(location=1) in highp vec2 vCtrl;
layout(location=2) in highp vec2 vTo;
layout(location = 0) out vec4 fragCover;
void main() {
float dx = vTo.x - vFrom.x;
// Sort from and to in increasing order so the root below
// is always the positive square root, if any.
// We need the direction of the curve below, so this can't be
// done from the vertex shader.
bool increasing = vTo.x >= vFrom.x;
vec2 left = increasing ? vFrom : vTo;
vec2 right = increasing ? vTo : vFrom;
// The signed horizontal extent of the fragment.
vec2 extent = clamp(vec2(vFrom.x, vTo.x), -0.5, 0.5);
// Find the t where the curve crosses the middle of the
// extent, x₀.
// Given the Bézier curve with x coordinates P₀, P₁, P₂
// where P₀ is at the origin, its x coordinate in t
// is given by:
//
// x(t) = 2(1-t)tP₁ + t²P₂
//
// Rearranging:
//
// x(t) = (P₂ - 2P₁)t² + 2P₁t
//
// Setting x(t) = x₀ and using Muller's quadratic formula ("Citardauq")
// for robustnesss,
//
// t = 2x₀/(2P₁±√(4P₁²+4(P₂-2P₁)x₀))
//
// which simplifies to
//
// t = x₀/(P₁±√(P₁²+(P₂-2P₁)x₀))
//
// Setting v = P₂-P₁,
//
// t = x₀/(P₁±√(P₁²+(v-P₁)x₀))
//
// t lie in [0; 1]; P₂ ≥ P₁ and P₁ ≥ 0 since we split curves where
// the control point lies before the start point or after the end point.
// It can then be shown that only the positive square root is valid.
float midx = mix(extent.x, extent.y, 0.5);
float x0 = midx - left.x;
vec2 p1 = vCtrl - left;
vec2 v = right - vCtrl;
float t = x0/(p1.x+sqrt(p1.x*p1.x+(v.x-p1.x)*x0));
// Find y(t) on the curve.
float y = mix(mix(left.y, vCtrl.y, t), mix(vCtrl.y, right.y, t), t);
// And the slope.
vec2 d_half = mix(p1, v, t);
float dy = d_half.y/d_half.x;
// Together, y and dy form a line approximation.
// Compute the fragment area above the line.
// The area is symmetric around dy = 0. Scale slope with extent width.
float width = extent.y - extent.x;
dy = abs(dy*width);
vec4 sides = vec4(dy*+0.5 + y, dy*-0.5 + y, (+0.5-y)/dy, (-0.5-y)/dy);
sides = clamp(sides+0.5, 0.0, 1.0);
float area = 0.5*(sides.z - sides.z*sides.y + 1.0 - sides.x+sides.x*sides.w);
area *= width;
// Work around issue #13.
if (width == 0.0)
area = 0.0;
fragCover.r = area;
}
+57
View File
@@ -0,0 +1,57 @@
#version 310 es
// SPDX-License-Identifier: Unlicense OR MIT
#extension GL_GOOGLE_include_directive : enable
precision highp float;
#include "common.h"
layout(push_constant) uniform Block {
vec4 transform;
vec2 pathOffset;
} _block;
layout(location=0) in float corner;
layout(location=1) in float maxy;
layout(location=2) in vec2 from;
layout(location=3) in vec2 ctrl;
layout(location=4) in vec2 to;
layout(location=0) out vec2 vFrom;
layout(location=1) out vec2 vCtrl;
layout(location=2) out vec2 vTo;
void main() {
// Add a one pixel overlap so curve quads cover their
// entire curves. Could use conservative rasterization
// if available.
vec2 from = from + _block.pathOffset;
vec2 ctrl = ctrl + _block.pathOffset;
vec2 to = to + _block.pathOffset;
float maxy = maxy + _block.pathOffset.y;
vec2 pos;
float c = corner;
if (c >= 0.375) {
// North.
c -= 0.5;
pos.y = maxy + 1.0;
} else {
// South.
pos.y = min(min(from.y, ctrl.y), to.y) - 1.0;
}
if (c >= 0.125) {
// East.
pos.x = max(max(from.x, ctrl.x), to.x)+1.0;
} else {
// West.
pos.x = min(min(from.x, ctrl.x), to.x)-1.0;
}
vFrom = from-pos;
vCtrl = ctrl-pos;
vTo = to-pos;
pos = pos*_block.transform.xy + _block.transform.zw;
gl_Position = vec4(transform3x2(fboTransform, vec3(pos, 0)), 1);
}
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
#version 100
precision mediump float;
precision highp int;
struct Color
{
vec4 color;
};
uniform Color _color;
varying highp float opacity;
varying highp vec2 vUV;
void main()
{
gl_FragData[0] = _color.color * opacity;
}
+18
View File
@@ -0,0 +1,18 @@
#version 150
struct Color
{
vec4 color;
};
uniform Color _color;
out vec4 fragColor;
in float opacity;
in vec2 vUV;
void main()
{
fragColor = _color.color * opacity;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
#version 100
precision mediump float;
precision highp int;
struct Gradient
{
vec4 color1;
vec4 color2;
};
uniform Gradient _gradient;
varying highp float opacity;
varying highp vec2 vUV;
void main()
{
gl_FragData[0] = mix(_gradient.color1, _gradient.color2, vec4(clamp(vUV.x, 0.0, 1.0))) * opacity;
}
+19
View File
@@ -0,0 +1,19 @@
#version 150
struct Gradient
{
vec4 color1;
vec4 color2;
};
uniform Gradient _gradient;
out vec4 fragColor;
in float opacity;
in vec2 vUV;
void main()
{
fragColor = mix(_gradient.color1, _gradient.color2, vec4(clamp(vUV.x, 0.0, 1.0))) * opacity;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
#version 100
precision mediump float;
precision highp int;
uniform mediump sampler2D tex;
varying highp float opacity;
varying highp vec2 vUV;
void main()
{
gl_FragData[0] = texture2D(tex, vUV) * opacity;
}
+13
View File
@@ -0,0 +1,13 @@
#version 150
uniform sampler2D tex;
out vec4 fragColor;
in float opacity;
in vec2 vUV;
void main()
{
fragColor = texture(tex, vUV) * opacity;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+50
View File
@@ -0,0 +1,50 @@
#version 100
struct m3x2
{
vec3 r0;
vec3 r1;
};
struct Block
{
vec4 transform;
vec4 uvTransformR1;
vec4 uvTransformR2;
float opacity;
float fbo;
};
uniform Block _block;
attribute vec2 pos;
varying vec2 vUV;
attribute vec2 uv;
varying float opacity;
vec3 transform3x2(m3x2 t, vec3 v)
{
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
void main()
{
vec2 p = (pos * _block.transform.xy) + _block.transform.zw;
if (_block.fbo != 0.0)
{
m3x2 param = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0));
vec3 param_1 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param, param_1), 1.0);
}
else
{
m3x2 param_2 = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0));
vec3 param_3 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param_2, param_3), 1.0);
}
m3x2 param_4 = m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz);
vec3 param_5 = vec3(uv, 1.0);
vUV = transform3x2(param_4, param_5).xy;
opacity = _block.opacity;
}
+50
View File
@@ -0,0 +1,50 @@
#version 150
struct m3x2
{
vec3 r0;
vec3 r1;
};
struct Block
{
vec4 transform;
vec4 uvTransformR1;
vec4 uvTransformR2;
float opacity;
float fbo;
};
uniform Block _block;
in vec2 pos;
out vec2 vUV;
in vec2 uv;
out float opacity;
vec3 transform3x2(m3x2 t, vec3 v)
{
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
void main()
{
vec2 p = (pos * _block.transform.xy) + _block.transform.zw;
if (_block.fbo != 0.0)
{
m3x2 param = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0));
vec3 param_1 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param, param_1), 1.0);
}
else
{
m3x2 param_2 = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0));
vec3 param_3 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param_2, param_3), 1.0);
}
m3x2 param_4 = m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz);
vec3 param_5 = vec3(uv, 1.0);
vUV = transform3x2(param_4, param_5).xy;
opacity = _block.opacity;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
#version 100
precision mediump float;
precision highp int;
uniform mediump sampler2D tex;
varying highp vec2 vUV;
vec3 sRGBtoRGB(vec3 rgb)
{
bvec3 cutoff = greaterThanEqual(rgb, vec3(0.040449999272823333740234375));
vec3 below = rgb / vec3(12.9200000762939453125);
vec3 above = pow((rgb + vec3(0.054999999701976776123046875)) / vec3(1.05499994754791259765625), vec3(2.400000095367431640625));
return vec3(cutoff.x ? above.x : below.x, cutoff.y ? above.y : below.y, cutoff.z ? above.z : below.z);
}
void main()
{
vec4 texel = texture2D(tex, vUV);
vec3 param = texel.xyz;
vec3 _59 = sRGBtoRGB(param);
texel.x = _59.x;
texel.y = _59.y;
texel.z = _59.z;
gl_FragData[0] = texel;
}
+26
View File
@@ -0,0 +1,26 @@
#version 150
uniform sampler2D tex;
in vec2 vUV;
out vec4 fragColor;
vec3 sRGBtoRGB(vec3 rgb)
{
bvec3 cutoff = greaterThanEqual(rgb, vec3(0.040449999272823333740234375));
vec3 below = rgb / vec3(12.9200000762939453125);
vec3 above = pow((rgb + vec3(0.054999999701976776123046875)) / vec3(1.05499994754791259765625), vec3(2.400000095367431640625));
return vec3(cutoff.x ? above.x : below.x, cutoff.y ? above.y : below.y, cutoff.z ? above.z : below.z);
}
void main()
{
vec4 texel = texture(tex, vUV);
vec3 param = texel.xyz;
vec3 _59 = sRGBtoRGB(param);
texel.x = _59.x;
texel.y = _59.y;
texel.z = _59.z;
fragColor = texel;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+35
View File
@@ -0,0 +1,35 @@
#version 100
struct m3x2
{
vec3 r0;
vec3 r1;
};
struct Block
{
vec2 scale;
vec2 pos;
vec2 uvScale;
};
uniform Block _block;
varying vec2 vUV;
attribute vec2 uv;
attribute vec2 pos;
vec3 transform3x2(m3x2 t, vec3 v)
{
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
void main()
{
vUV = vec2(uv * _block.uvScale);
vec2 p = vec2((pos * _block.scale) + _block.pos);
m3x2 param = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0));
vec3 param_1 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param, param_1), 1.0);
}
+35
View File
@@ -0,0 +1,35 @@
#version 150
struct m3x2
{
vec3 r0;
vec3 r1;
};
struct Block
{
vec2 scale;
vec2 pos;
vec2 uvScale;
};
uniform Block _block;
out vec2 vUV;
in vec2 uv;
in vec2 pos;
vec3 transform3x2(m3x2 t, vec3 v)
{
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
void main()
{
vUV = vec2(uv * _block.uvScale);
vec2 p = vec2((pos * _block.scale) + _block.pos);
m3x2 param = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0));
vec3 param_1 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param, param_1), 1.0);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
#version 100
precision mediump float;
precision highp int;
struct Color
{
vec4 color;
};
uniform Color _color;
uniform mediump sampler2D cover;
varying highp vec2 vCoverUV;
varying highp vec2 vUV;
void main()
{
gl_FragData[0] = _color.color;
float c = min(abs(texture2D(cover, vCoverUV).x), 1.0);
gl_FragData[0] *= c;
}
+22
View File
@@ -0,0 +1,22 @@
#version 150
struct Color
{
vec4 color;
};
uniform Color _color;
uniform sampler2D cover;
out vec4 fragColor;
in vec2 vCoverUV;
in vec2 vUV;
void main()
{
fragColor = _color.color;
float c = min(abs(texture(cover, vCoverUV).x), 1.0);
fragColor *= c;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
#version 100
precision mediump float;
precision highp int;
struct Gradient
{
vec4 color1;
vec4 color2;
};
uniform Gradient _gradient;
uniform mediump sampler2D cover;
varying highp vec2 vUV;
varying highp vec2 vCoverUV;
void main()
{
gl_FragData[0] = mix(_gradient.color1, _gradient.color2, vec4(clamp(vUV.x, 0.0, 1.0)));
float c = min(abs(texture2D(cover, vCoverUV).x), 1.0);
gl_FragData[0] *= c;
}
+23
View File
@@ -0,0 +1,23 @@
#version 150
struct Gradient
{
vec4 color1;
vec4 color2;
};
uniform Gradient _gradient;
uniform sampler2D cover;
out vec4 fragColor;
in vec2 vUV;
in vec2 vCoverUV;
void main()
{
fragColor = mix(_gradient.color1, _gradient.color2, vec4(clamp(vUV.x, 0.0, 1.0)));
float c = min(abs(texture(cover, vCoverUV).x), 1.0);
fragColor *= c;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+17
View File
@@ -0,0 +1,17 @@
#version 100
precision mediump float;
precision highp int;
uniform mediump sampler2D tex;
uniform mediump sampler2D cover;
varying highp vec2 vUV;
varying highp vec2 vCoverUV;
void main()
{
gl_FragData[0] = texture2D(tex, vUV);
float c = min(abs(texture2D(cover, vCoverUV).x), 1.0);
gl_FragData[0] *= c;
}
+16
View File
@@ -0,0 +1,16 @@
#version 150
uniform sampler2D tex;
uniform sampler2D cover;
out vec4 fragColor;
in vec2 vUV;
in vec2 vCoverUV;
void main()
{
fragColor = texture(tex, vUV);
float c = min(abs(texture(cover, vCoverUV).x), 1.0);
fragColor *= c;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+51
View File
@@ -0,0 +1,51 @@
#version 100
struct m3x2
{
vec3 r0;
vec3 r1;
};
struct Block
{
vec4 transform;
vec4 uvCoverTransform;
vec4 uvTransformR1;
vec4 uvTransformR2;
float fbo;
};
uniform Block _block;
attribute vec2 pos;
varying vec2 vUV;
attribute vec2 uv;
varying vec2 vCoverUV;
vec3 transform3x2(m3x2 t, vec3 v)
{
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
void main()
{
vec2 p = vec2((pos * _block.transform.xy) + _block.transform.zw);
if (_block.fbo != 0.0)
{
m3x2 param = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0));
vec3 param_1 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param, param_1), 1.0);
}
else
{
m3x2 param_2 = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0));
vec3 param_3 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param_2, param_3), 1.0);
}
m3x2 param_4 = m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz);
vec3 param_5 = vec3(uv, 1.0);
vUV = transform3x2(param_4, param_5).xy;
vec3 uv3 = vec3(uv, 1.0);
vCoverUV = ((uv3 * vec3(_block.uvCoverTransform.xy, 1.0)) + vec3(_block.uvCoverTransform.zw, 0.0)).xy;
}
+51
View File
@@ -0,0 +1,51 @@
#version 150
struct m3x2
{
vec3 r0;
vec3 r1;
};
struct Block
{
vec4 transform;
vec4 uvCoverTransform;
vec4 uvTransformR1;
vec4 uvTransformR2;
float fbo;
};
uniform Block _block;
in vec2 pos;
out vec2 vUV;
in vec2 uv;
out vec2 vCoverUV;
vec3 transform3x2(m3x2 t, vec3 v)
{
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
void main()
{
vec2 p = vec2((pos * _block.transform.xy) + _block.transform.zw);
if (_block.fbo != 0.0)
{
m3x2 param = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0));
vec3 param_1 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param, param_1), 1.0);
}
else
{
m3x2 param_2 = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0));
vec3 param_3 = vec3(p, 0.0);
gl_Position = vec4(transform3x2(param_2, param_3), 1.0);
}
m3x2 param_4 = m3x2(_block.uvTransformR1.xyz, _block.uvTransformR2.xyz);
vec3 param_5 = vec3(uv, 1.0);
vUV = transform3x2(param_4, param_5).xy;
vec3 uv3 = vec3(uv, 1.0);
vCoverUV = ((uv3 * vec3(_block.uvCoverTransform.xy, 1.0)) + vec3(_block.uvCoverTransform.zw, 0.0)).xy;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
#version 100
struct m3x2
{
vec3 r0;
vec3 r1;
};
attribute vec4 position;
vec3 transform3x2(m3x2 t, vec3 v)
{
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
void main()
{
m3x2 param = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0));
vec3 param_1 = position.xyz;
gl_Position = vec4(transform3x2(param, param_1), position.w);
}
+22
View File
@@ -0,0 +1,22 @@
#version 150
struct m3x2
{
vec3 r0;
vec3 r1;
};
in vec4 position;
vec3 transform3x2(m3x2 t, vec3 v)
{
return vec3(dot(t.r0, v), dot(t.r1, v), dot(vec3(0.0, 0.0, 1.0), v));
}
void main()
{
m3x2 param = m3x2(vec3(1.0, 0.0, 0.0), vec3(0.0, -1.0, 0.0));
vec3 param_1 = position.xyz;
gl_Position = vec4(transform3x2(param, param_1), position.w);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
#version 100
precision mediump float;
precision highp int;
uniform mediump sampler2D cover;
varying highp vec2 vUV;
void main()
{
gl_FragData[0].x = abs(texture2D(cover, vUV).x);
}
+12
View File
@@ -0,0 +1,12 @@
#version 150
uniform sampler2D cover;
out vec4 fragColor;
in vec2 vUV;
void main()
{
fragColor.x = abs(texture(cover, vUV).x);
}
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More