aboutsummaryrefslogtreecommitdiff
path: root/pacc
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-09-09 11:41:36 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-09-09 11:41:36 +0900
commitcb9c866e9f37dfd1e67cd4f8599391676d3d5150 (patch)
tree0c53d834e53b82c646c3f5671aa5e3b75b3ec995 /pacc
parent7809829bb0ce8b30ebdfb018034cab0e5f4b7632 (diff)
pacc: gl: use newer GLSL for GL3.2/GLES3.0
Diffstat (limited to 'pacc')
-rw-r--r--pacc/glsl/Makefile22
-rw-r--r--pacc/glsl/blit.vert4
-rw-r--r--pacc/glsl/blit.vert.inc22
-rw-r--r--pacc/glsl/color.frag7
-rw-r--r--pacc/glsl/color.frag.inc35
-rw-r--r--pacc/glsl/color_trans.frag7
-rw-r--r--pacc/glsl/color_trans.frag.inc29
-rw-r--r--pacc/glsl/copy.frag7
-rw-r--r--pacc/glsl/copy.frag.inc29
-rw-r--r--pacc/glsl/ds3header7
-rw-r--r--pacc/glsl/ds3header.inc19
-rw-r--r--pacc/glsl/dsheader7
-rw-r--r--pacc/glsl/dsheader.inc15
-rw-r--r--pacc/glsl/es3header7
-rw-r--r--pacc/glsl/es3header.inc18
-rw-r--r--pacc/glsl/esheader7
-rw-r--r--pacc/glsl/esheader.inc15
-rw-r--r--pacc/glsl/fill.frag5
-rw-r--r--pacc/glsl/fill.frag.inc15
-rw-r--r--pacc/glsl/font.frag15
-rw-r--r--pacc/glsl/font.frag.inc37
-rw-r--r--pacc/glsl/key.frag12
-rw-r--r--pacc/glsl/key.frag.inc32
-rw-r--r--pacc/pacc-gl.c31
24 files changed, 208 insertions, 196 deletions
diff --git a/pacc/glsl/Makefile b/pacc/glsl/Makefile
index 36aace4..a8c0bf9 100644
--- a/pacc/glsl/Makefile
+++ b/pacc/glsl/Makefile
@@ -1,12 +1,18 @@
VSHADERS:=blit.vert
-FSHADERS:=copy.frag color.frag color_trans.frag key.frag fill.frag font.frag
+FSHADERS:=copy.frag color.frag color_trans.frag
DSHEADER:=dsheader
+DS3HEADER:=ds3header
ESHEADER:=esheader
-INCS:=$(addsuffix .inc,$(VSHADERS) $(FSHADERS) $(DSHEADER) $(ESHEADER))
+ES3HEADER:=es3header
+INCS:=$(addsuffix .inc,$(VSHADERS) $(FSHADERS) $(DSHEADER) $(DS3HEADER) $(ESHEADER) $(ES3HEADER))
SHADERS2:=$(addsuffix .ds.vert,$(basename $(VSHADERS)))
+SHADERS2:=$(addsuffix .ds3.vert,$(basename $(VSHADERS)))
SHADERS2+=$(addsuffix .es.vert,$(basename $(VSHADERS)))
+SHADERS2+=$(addsuffix .es3.vert,$(basename $(VSHADERS)))
SHADERS2+=$(addsuffix .ds.frag,$(basename $(FSHADERS)))
+SHADERS2+=$(addsuffix .ds3.frag,$(basename $(FSHADERS)))
SHADERS2+=$(addsuffix .es.frag,$(basename $(FSHADERS)))
+SHADERS2+=$(addsuffix .es3.frag,$(basename $(FSHADERS)))
VALS:=$(addsuffix .vald,$(SHADERS2))
VALIDATOR:=glslangValidator
VFLAGS:=
@@ -21,12 +27,24 @@ val: $(VALS)
%.es.frag: %.frag
cat $(ESHEADER) $< > $@
+%.es3.vert: %.vert
+ cat $(ES3HEADER) $< > $@
+
+%.es3.frag: %.frag
+ cat $(ES3HEADER) $< > $@
+
%.ds.vert: %.vert
cat $(DSHEADER) $< > $@
%.ds.frag: %.frag
cat $(DSHEADER) $< > $@
+%.ds3.vert: %.vert
+ cat $(DS3HEADER) $< > $@
+
+%.ds3.frag: %.frag
+ cat $(DS3HEADER) $< > $@
+
%.vald: %
$(VALIDATOR) $(VFLAGS) $<
diff --git a/pacc/glsl/blit.vert b/pacc/glsl/blit.vert
index 4232a8d..15f0b6e 100644
--- a/pacc/glsl/blit.vert
+++ b/pacc/glsl/blit.vert
@@ -1,5 +1,5 @@
-attribute vec4 coord;
-varying vec2 texcoord;
+VERT_IN vec4 coord;
+VERT_OUT vec2 texcoord;
void main(void) {
gl_Position = vec4(coord.xy, 0.0, 1.0);
texcoord = coord.zw;
diff --git a/pacc/glsl/blit.vert.inc b/pacc/glsl/blit.vert.inc
index 34691a9..2406cc4 100644
--- a/pacc/glsl/blit.vert.inc
+++ b/pacc/glsl/blit.vert.inc
@@ -1,14 +1,14 @@
static const uint8_t blit_vert[] = {
- 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x76, 0x65,
- 0x63, 0x34, 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x76, 0x61,
- 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74,
- 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x76, 0x6f, 0x69,
- 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f, 0x69, 0x64, 0x29,
- 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69,
- 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28,
- 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2e, 0x78, 0x79, 0x2c, 0x20, 0x30, 0x2e,
- 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74,
- 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x20, 0x3d, 0x20, 0x63, 0x6f,
- 0x6f, 0x72, 0x64, 0x2e, 0x7a, 0x77, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00
+ 0x56, 0x45, 0x52, 0x54, 0x5f, 0x49, 0x4e, 0x20, 0x76, 0x65, 0x63, 0x34,
+ 0x20, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x56, 0x45, 0x52, 0x54,
+ 0x5f, 0x4f, 0x55, 0x54, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74, 0x65,
+ 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64,
+ 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f, 0x69, 0x64, 0x29, 0x20,
+ 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28, 0x63,
+ 0x6f, 0x6f, 0x72, 0x64, 0x2e, 0x78, 0x79, 0x2c, 0x20, 0x30, 0x2e, 0x30,
+ 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x65,
+ 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6f,
+ 0x72, 0x64, 0x2e, 0x7a, 0x77, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00
};
diff --git a/pacc/glsl/color.frag b/pacc/glsl/color.frag
index d03bee5..d4fd702 100644
--- a/pacc/glsl/color.frag
+++ b/pacc/glsl/color.frag
@@ -1,13 +1,14 @@
uniform sampler2D palette;
uniform sampler2D tex;
-varying mediump vec2 texcoord;
+FRAG_IN mediump vec2 texcoord;
uniform lowp float color;
+FRAGCOLOR_DECL
void main(void) {
- lowp float index = texture2D(tex, texcoord).x;
+ lowp float index = TEXTURE2D(tex, texcoord).x;
if (index > (0.5/255.0)) {
index = color;
} else {
index = 0.5 / 256.0;
}
- gl_FragColor = texture2D(palette, vec2(index, 0.0));
+ FRAGCOLOR = TEXTURE2D(palette, vec2(index, 0.0));
}
diff --git a/pacc/glsl/color.frag.inc b/pacc/glsl/color.frag.inc
index 8ea77ef..ee336b5 100644
--- a/pacc/glsl/color.frag.inc
+++ b/pacc/glsl/color.frag.inc
@@ -3,26 +3,27 @@ static const uint8_t color_frag[] = {
0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x70, 0x61, 0x6c, 0x65, 0x74, 0x74,
0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73,
0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x74, 0x65, 0x78,
- 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65,
+ 0x3b, 0x0a, 0x46, 0x52, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x20, 0x6d, 0x65,
0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74,
0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69,
0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c,
- 0x6f, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76,
- 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f, 0x69,
- 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20,
- 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20,
- 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28,
- 0x74, 0x65, 0x78, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72,
- 0x64, 0x29, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28,
- 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3e, 0x20, 0x28, 0x30, 0x2e, 0x35,
- 0x2f, 0x32, 0x35, 0x35, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20,
- 0x20, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x63,
- 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x20, 0x65, 0x6c,
- 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x64,
- 0x65, 0x78, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x35, 0x20, 0x2f, 0x20, 0x32,
- 0x35, 0x36, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20,
- 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72,
- 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44,
+ 0x6f, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x46,
+ 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x44, 0x45, 0x43,
+ 0x4c, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28,
+ 0x76, 0x6f, 0x69, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f,
+ 0x77, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x64,
+ 0x65, 0x78, 0x20, 0x3d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x55, 0x52, 0x45,
+ 0x32, 0x44, 0x28, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x63,
+ 0x6f, 0x6f, 0x72, 0x64, 0x29, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x69,
+ 0x66, 0x20, 0x28, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3e, 0x20, 0x28,
+ 0x30, 0x2e, 0x35, 0x2f, 0x32, 0x35, 0x35, 0x2e, 0x30, 0x29, 0x29, 0x20,
+ 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20,
+ 0x3d, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x20, 0x20, 0x7d,
+ 0x20, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20,
+ 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x35, 0x20,
+ 0x2f, 0x20, 0x32, 0x35, 0x36, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x7d,
+ 0x0a, 0x20, 0x20, 0x46, 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52,
+ 0x20, 0x3d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x55, 0x52, 0x45, 0x32, 0x44,
0x28, 0x70, 0x61, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x2c, 0x20, 0x76, 0x65,
0x63, 0x32, 0x28, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x30, 0x2e,
0x30, 0x29, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x00
diff --git a/pacc/glsl/color_trans.frag b/pacc/glsl/color_trans.frag
index ef742a4..1a2e28d 100644
--- a/pacc/glsl/color_trans.frag
+++ b/pacc/glsl/color_trans.frag
@@ -1,11 +1,12 @@
uniform sampler2D palette;
uniform sampler2D tex;
-varying mediump vec2 texcoord;
+FRAG_IN mediump vec2 texcoord;
uniform lowp float color;
+FRAGCOLOR_DECL
void main(void) {
- lowp float index = texture2D(tex, texcoord).x;
+ lowp float index = TEXTURE2D(tex, texcoord).x;
if (index < (0.5/255.0)) {
discard;
}
- gl_FragColor = texture2D(palette, vec2(color, 0.0));
+ FRAGCOLOR = TEXTURE2D(palette, vec2(color, 0.0));
}
diff --git a/pacc/glsl/color_trans.frag.inc b/pacc/glsl/color_trans.frag.inc
index f49404c..6d336bb 100644
--- a/pacc/glsl/color_trans.frag.inc
+++ b/pacc/glsl/color_trans.frag.inc
@@ -3,23 +3,24 @@ static const uint8_t color_trans_frag[] = {
0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x70, 0x61, 0x6c, 0x65, 0x74, 0x74,
0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73,
0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x74, 0x65, 0x78,
- 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65,
+ 0x3b, 0x0a, 0x46, 0x52, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x20, 0x6d, 0x65,
0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74,
0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69,
0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c,
- 0x6f, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76,
- 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f, 0x69,
- 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20,
- 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20,
- 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28,
- 0x74, 0x65, 0x78, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72,
- 0x64, 0x29, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28,
- 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3c, 0x20, 0x28, 0x30, 0x2e, 0x35,
- 0x2f, 0x32, 0x35, 0x35, 0x2e, 0x30, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20,
- 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x3b, 0x0a,
- 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61,
- 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78,
- 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x70, 0x61, 0x6c, 0x65, 0x74,
+ 0x6f, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x46,
+ 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x44, 0x45, 0x43,
+ 0x4c, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28,
+ 0x76, 0x6f, 0x69, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f,
+ 0x77, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x64,
+ 0x65, 0x78, 0x20, 0x3d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x55, 0x52, 0x45,
+ 0x32, 0x44, 0x28, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x63,
+ 0x6f, 0x6f, 0x72, 0x64, 0x29, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x69,
+ 0x66, 0x20, 0x28, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3c, 0x20, 0x28,
+ 0x30, 0x2e, 0x35, 0x2f, 0x32, 0x35, 0x35, 0x2e, 0x30, 0x29, 0x29, 0x20,
+ 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72,
+ 0x64, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x46, 0x52, 0x41,
+ 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x20, 0x3d, 0x20, 0x54, 0x45, 0x58,
+ 0x54, 0x55, 0x52, 0x45, 0x32, 0x44, 0x28, 0x70, 0x61, 0x6c, 0x65, 0x74,
0x74, 0x65, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x63, 0x6f, 0x6c,
0x6f, 0x72, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29, 0x3b, 0x0a, 0x7d,
0x0a, 0x00
diff --git a/pacc/glsl/copy.frag b/pacc/glsl/copy.frag
index a77ad91..21016ce 100644
--- a/pacc/glsl/copy.frag
+++ b/pacc/glsl/copy.frag
@@ -1,9 +1,10 @@
uniform sampler2D palette;
uniform sampler2D tex;
-varying mediump vec2 texcoord;
+FRAG_IN mediump vec2 texcoord;
+FRAGCOLOR_DECL
void main(void) {
- lowp float index = texture2D(tex, texcoord).x;
+ lowp float index = TEXTURE2D(tex, texcoord).x;
lowp float color = (index * 255.0 + 0.5) / 256.0;
- gl_FragColor = texture2D(palette, vec2(color, 0.0));
+ FRAGCOLOR = TEXTURE2D(palette, vec2(color, 0.0));
}
diff --git a/pacc/glsl/copy.frag.inc b/pacc/glsl/copy.frag.inc
index fa3f388..d42376d 100644
--- a/pacc/glsl/copy.frag.inc
+++ b/pacc/glsl/copy.frag.inc
@@ -3,21 +3,22 @@ static const uint8_t copy_frag[] = {
0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x70, 0x61, 0x6c, 0x65, 0x74, 0x74,
0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73,
0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x74, 0x65, 0x78,
- 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65,
+ 0x3b, 0x0a, 0x46, 0x52, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x20, 0x6d, 0x65,
0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74,
- 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x76, 0x6f, 0x69,
- 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f, 0x69, 0x64, 0x29,
- 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c,
- 0x6f, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20,
- 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x74, 0x65,
- 0x78, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x29,
- 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66,
- 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d,
- 0x20, 0x28, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x2a, 0x20, 0x32, 0x35,
- 0x35, 0x2e, 0x30, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x2f,
- 0x20, 0x32, 0x35, 0x36, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c,
- 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d,
- 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x70,
+ 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x46, 0x52, 0x41,
+ 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x44, 0x45, 0x43, 0x4c, 0x0a,
+ 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f,
+ 0x69, 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70,
+ 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78,
+ 0x20, 0x3d, 0x20, 0x54, 0x45, 0x58, 0x54, 0x55, 0x52, 0x45, 0x32, 0x44,
+ 0x28, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f,
+ 0x72, 0x64, 0x29, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77,
+ 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f,
+ 0x72, 0x20, 0x3d, 0x20, 0x28, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x2a,
+ 0x20, 0x32, 0x35, 0x35, 0x2e, 0x30, 0x20, 0x2b, 0x20, 0x30, 0x2e, 0x35,
+ 0x29, 0x20, 0x2f, 0x20, 0x32, 0x35, 0x36, 0x2e, 0x30, 0x3b, 0x0a, 0x20,
+ 0x20, 0x46, 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x20, 0x3d,
+ 0x20, 0x54, 0x45, 0x58, 0x54, 0x55, 0x52, 0x45, 0x32, 0x44, 0x28, 0x70,
0x61, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x32,
0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29,
0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00
diff --git a/pacc/glsl/ds3header b/pacc/glsl/ds3header
new file mode 100644
index 0000000..6c3571e
--- /dev/null
+++ b/pacc/glsl/ds3header
@@ -0,0 +1,7 @@
+#version 150 core
+#define VERT_IN in
+#define VERT_OUT out
+#define FRAG_IN in
+#define TEXTURE2D texture
+#define FRAGCOLOR_DECL out lowp vec4 _fragcolor;
+#define FRAGCOLOR _fragcolor
diff --git a/pacc/glsl/ds3header.inc b/pacc/glsl/ds3header.inc
new file mode 100644
index 0000000..32c5b16
--- /dev/null
+++ b/pacc/glsl/ds3header.inc
@@ -0,0 +1,19 @@
+static const uint8_t ds3header[] = {
+ 0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x35, 0x30,
+ 0x20, 0x63, 0x6f, 0x72, 0x65, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e,
+ 0x65, 0x20, 0x56, 0x45, 0x52, 0x54, 0x5f, 0x49, 0x4e, 0x20, 0x69, 0x6e,
+ 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x56, 0x45, 0x52,
+ 0x54, 0x5f, 0x4f, 0x55, 0x54, 0x20, 0x6f, 0x75, 0x74, 0x0a, 0x23, 0x64,
+ 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x46, 0x52, 0x41, 0x47, 0x5f, 0x49,
+ 0x4e, 0x20, 0x69, 0x6e, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65,
+ 0x20, 0x54, 0x45, 0x58, 0x54, 0x55, 0x52, 0x45, 0x32, 0x44, 0x20, 0x74,
+ 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69,
+ 0x6e, 0x65, 0x20, 0x46, 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52,
+ 0x5f, 0x44, 0x45, 0x43, 0x4c, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6c, 0x6f,
+ 0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x5f, 0x66, 0x72, 0x61,
+ 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x23, 0x64, 0x65, 0x66,
+ 0x69, 0x6e, 0x65, 0x20, 0x46, 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f,
+ 0x52, 0x20, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72,
+ 0x0a, 0x00
+};
+
diff --git a/pacc/glsl/dsheader b/pacc/glsl/dsheader
index 13e65b7..30494f2 100644
--- a/pacc/glsl/dsheader
+++ b/pacc/glsl/dsheader
@@ -2,4 +2,9 @@
#define lowp
#define mediump
#define highp
-
+#define VERT_IN attribute
+#define VERT_OUT varying
+#define FRAG_IN varying
+#define TEXTURE2D texture2D
+#define FRAGCOLOR_DECL
+#define FRAGCOLOR gl_FragColor
diff --git a/pacc/glsl/dsheader.inc b/pacc/glsl/dsheader.inc
index b742cec..d7b838d 100644
--- a/pacc/glsl/dsheader.inc
+++ b/pacc/glsl/dsheader.inc
@@ -3,6 +3,19 @@ static const uint8_t dsheader[] = {
0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6c, 0x6f, 0x77,
0x70, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6d, 0x65,
0x64, 0x69, 0x75, 0x6d, 0x70, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e,
- 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x0a, 0x0a, 0x00
+ 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x0a, 0x23, 0x64, 0x65, 0x66,
+ 0x69, 0x6e, 0x65, 0x20, 0x56, 0x45, 0x52, 0x54, 0x5f, 0x49, 0x4e, 0x20,
+ 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x0a, 0x23, 0x64,
+ 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x56, 0x45, 0x52, 0x54, 0x5f, 0x4f,
+ 0x55, 0x54, 0x20, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x0a, 0x23,
+ 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x46, 0x52, 0x41, 0x47, 0x5f,
+ 0x49, 0x4e, 0x20, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x0a, 0x23,
+ 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x45, 0x58, 0x54, 0x55,
+ 0x52, 0x45, 0x32, 0x44, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65,
+ 0x32, 0x44, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x46,
+ 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x44, 0x45, 0x43,
+ 0x4c, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x46, 0x52,
+ 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x20, 0x67, 0x6c, 0x5f, 0x46,
+ 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x0a, 0x00
};
diff --git a/pacc/glsl/es3header b/pacc/glsl/es3header
new file mode 100644
index 0000000..5bec980
--- /dev/null
+++ b/pacc/glsl/es3header
@@ -0,0 +1,7 @@
+#version 300 es
+#define VERT_IN in
+#define VERT_OUT out
+#define FRAG_IN in
+#define TEXTURE2D texture
+#define FRAGCOLOR_DECL out lowp vec4 _fragcolor;
+#define FRAGCOLOR _fragcolor
diff --git a/pacc/glsl/es3header.inc b/pacc/glsl/es3header.inc
new file mode 100644
index 0000000..42d8e00
--- /dev/null
+++ b/pacc/glsl/es3header.inc
@@ -0,0 +1,18 @@
+static const uint8_t es3header[] = {
+ 0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x33, 0x30, 0x30,
+ 0x20, 0x65, 0x73, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20,
+ 0x56, 0x45, 0x52, 0x54, 0x5f, 0x49, 0x4e, 0x20, 0x69, 0x6e, 0x0a, 0x23,
+ 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x56, 0x45, 0x52, 0x54, 0x5f,
+ 0x4f, 0x55, 0x54, 0x20, 0x6f, 0x75, 0x74, 0x0a, 0x23, 0x64, 0x65, 0x66,
+ 0x69, 0x6e, 0x65, 0x20, 0x46, 0x52, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x20,
+ 0x69, 0x6e, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54,
+ 0x45, 0x58, 0x54, 0x55, 0x52, 0x45, 0x32, 0x44, 0x20, 0x74, 0x65, 0x78,
+ 0x74, 0x75, 0x72, 0x65, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65,
+ 0x20, 0x46, 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x5f, 0x44,
+ 0x45, 0x43, 0x4c, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x6c, 0x6f, 0x77, 0x70,
+ 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x63,
+ 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e,
+ 0x65, 0x20, 0x46, 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x20,
+ 0x5f, 0x66, 0x72, 0x61, 0x67, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x0a, 0x00
+};
+
diff --git a/pacc/glsl/esheader b/pacc/glsl/esheader
index 43b26bc..76fdecb 100644
--- a/pacc/glsl/esheader
+++ b/pacc/glsl/esheader
@@ -1,2 +1,7 @@
#version 100
-
+#define VERT_IN attribute
+#define VERT_OUT varying
+#define FRAG_IN varying
+#define TEXTURE2D texture2D
+#define FRAGCOLOR_DECL
+#define FRAGCOLOR gl_FragColor
diff --git a/pacc/glsl/esheader.inc b/pacc/glsl/esheader.inc
index 3ca61f1..5e0c807 100644
--- a/pacc/glsl/esheader.inc
+++ b/pacc/glsl/esheader.inc
@@ -1,5 +1,18 @@
static const uint8_t esheader[] = {
0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x30, 0x30,
- 0x0a, 0x0a, 0x00
+ 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x56, 0x45, 0x52,
+ 0x54, 0x5f, 0x49, 0x4e, 0x20, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75,
+ 0x74, 0x65, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x56,
+ 0x45, 0x52, 0x54, 0x5f, 0x4f, 0x55, 0x54, 0x20, 0x76, 0x61, 0x72, 0x79,
+ 0x69, 0x6e, 0x67, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20,
+ 0x46, 0x52, 0x41, 0x47, 0x5f, 0x49, 0x4e, 0x20, 0x76, 0x61, 0x72, 0x79,
+ 0x69, 0x6e, 0x67, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20,
+ 0x54, 0x45, 0x58, 0x54, 0x55, 0x52, 0x45, 0x32, 0x44, 0x20, 0x74, 0x65,
+ 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x0a, 0x23, 0x64, 0x65, 0x66,
+ 0x69, 0x6e, 0x65, 0x20, 0x46, 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f,
+ 0x52, 0x5f, 0x44, 0x45, 0x43, 0x4c, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69,
+ 0x6e, 0x65, 0x20, 0x46, 0x52, 0x41, 0x47, 0x43, 0x4f, 0x4c, 0x4f, 0x52,
+ 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f,
+ 0x72, 0x0a, 0x00
};
diff --git a/pacc/glsl/fill.frag b/pacc/glsl/fill.frag
deleted file mode 100644
index 010b5dc..0000000
--- a/pacc/glsl/fill.frag
+++ /dev/null
@@ -1,5 +0,0 @@
-uniform sampler2D palette;
-varying mediump vec2 texcoord;
-void main(void) {
- gl_FragColor = texture2D(palette, vec2(texcoord.x, 0.0));
-}
diff --git a/pacc/glsl/fill.frag.inc b/pacc/glsl/fill.frag.inc
deleted file mode 100644
index 8065199..0000000
--- a/pacc/glsl/fill.frag.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-static const uint8_t fill_frag[] = {
- 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70,
- 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x70, 0x61, 0x6c, 0x65, 0x74, 0x74,
- 0x65, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d,
- 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20,
- 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x76, 0x6f,
- 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f, 0x69, 0x64,
- 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61,
- 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78,
- 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x70, 0x61, 0x6c, 0x65, 0x74,
- 0x74, 0x65, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x74, 0x65, 0x78,
- 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x2e, 0x78, 0x2c, 0x20, 0x30, 0x2e, 0x30,
- 0x29, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x00
-};
-
diff --git a/pacc/glsl/font.frag b/pacc/glsl/font.frag
deleted file mode 100644
index 8beb0a7..0000000
--- a/pacc/glsl/font.frag
+++ /dev/null
@@ -1,15 +0,0 @@
-uniform sampler2D palette;
-uniform sampler2D tex;
-varying mediump vec2 texcoord;
-uniform lowp float bg;
-uniform lowp float color;
-void main(void) {
- gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
- lowp float pixel = texture2D(tex, texcoord).x;
- lowp float index = color;
- if (pixel < 0.5) {
- if (bg < 0.5) discard;
- index = 0.5 / 256.0;
- }
- gl_FragColor = texture2D(palette, vec2(index, 0.0));
-}
diff --git a/pacc/glsl/font.frag.inc b/pacc/glsl/font.frag.inc
deleted file mode 100644
index 27d143d..0000000
--- a/pacc/glsl/font.frag.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-static const uint8_t font_frag[] = {
- 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70,
- 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x70, 0x61, 0x6c, 0x65, 0x74, 0x74,
- 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73,
- 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x74, 0x65, 0x78,
- 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65,
- 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74,
- 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69,
- 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c,
- 0x6f, 0x61, 0x74, 0x20, 0x62, 0x67, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66,
- 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c, 0x6f,
- 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f,
- 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f, 0x69, 0x64,
- 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61,
- 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63,
- 0x34, 0x28, 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x2c, 0x20,
- 0x31, 0x2e, 0x30, 0x2c, 0x20, 0x31, 0x2e, 0x30, 0x29, 0x3b, 0x0a, 0x20,
- 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20,
- 0x70, 0x69, 0x78, 0x65, 0x6c, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74,
- 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x74, 0x65, 0x78, 0x2c, 0x20, 0x74,
- 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x29, 0x2e, 0x78, 0x3b, 0x0a,
- 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74,
- 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3d, 0x20, 0x63, 0x6f, 0x6c,
- 0x6f, 0x72, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x70, 0x69,
- 0x78, 0x65, 0x6c, 0x20, 0x3c, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x7b,
- 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x62, 0x67, 0x20,
- 0x3c, 0x20, 0x30, 0x2e, 0x35, 0x29, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61,
- 0x72, 0x64, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x69, 0x6e, 0x64, 0x65,
- 0x78, 0x20, 0x3d, 0x20, 0x30, 0x2e, 0x35, 0x20, 0x2f, 0x20, 0x32, 0x35,
- 0x36, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x67,
- 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20,
- 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28,
- 0x70, 0x61, 0x6c, 0x65, 0x74, 0x74, 0x65, 0x2c, 0x20, 0x76, 0x65, 0x63,
- 0x32, 0x28, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2c, 0x20, 0x30, 0x2e, 0x30,
- 0x29, 0x29, 0x3b, 0x0a, 0x7d, 0x0a, 0x00
-};
-
diff --git a/pacc/glsl/key.frag b/pacc/glsl/key.frag
deleted file mode 100644
index d6bf7e1..0000000
--- a/pacc/glsl/key.frag
+++ /dev/null
@@ -1,12 +0,0 @@
-uniform sampler2D palette;
-uniform sampler2D tex;
-varying mediump vec2 texcoord;
-uniform lowp float key;
-uniform lowp float color;
-void main(void) {
- lowp float index = texture2D(tex, texcoord).x;
- if (index < (key + (0.5/255.0)) || (key + (1.5/255.0)) < index) {
- discard;
- }
- gl_FragColor = texture2D(palette, vec2(color, 0.0));
-}
diff --git a/pacc/glsl/key.frag.inc b/pacc/glsl/key.frag.inc
deleted file mode 100644
index 4a4a6c1..0000000
--- a/pacc/glsl/key.frag.inc
+++ /dev/null
@@ -1,32 +0,0 @@
-static const uint8_t key_frag[] = {
- 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70,
- 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x70, 0x61, 0x6c, 0x65, 0x74, 0x74,
- 0x65, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73,
- 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, 0x20, 0x74, 0x65, 0x78,
- 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65,
- 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x74,
- 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a, 0x75, 0x6e, 0x69,
- 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c,
- 0x6f, 0x61, 0x74, 0x20, 0x6b, 0x65, 0x79, 0x3b, 0x0a, 0x75, 0x6e, 0x69,
- 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20, 0x66, 0x6c,
- 0x6f, 0x61, 0x74, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76,
- 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x76, 0x6f, 0x69,
- 0x64, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x20,
- 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20,
- 0x3d, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28,
- 0x74, 0x65, 0x78, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72,
- 0x64, 0x29, 0x2e, 0x78, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28,
- 0x69, 0x6e, 0x64, 0x65, 0x78, 0x20, 0x3c, 0x20, 0x28, 0x6b, 0x65, 0x79,
- 0x20, 0x2b, 0x20, 0x28, 0x30, 0x2e, 0x35, 0x2f, 0x32, 0x35, 0x35, 0x2e,
- 0x30, 0x29, 0x29, 0x20, 0x7c, 0x7c, 0x20, 0x28, 0x6b, 0x65, 0x79, 0x20,
- 0x2b, 0x20, 0x28, 0x31, 0x2e, 0x35, 0x2f, 0x32, 0x35, 0x35, 0x2e, 0x30,
- 0x29, 0x29, 0x20, 0x3c, 0x20, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x29, 0x20,
- 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72,
- 0x64, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f,
- 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20,
- 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x70, 0x61,
- 0x6c, 0x65, 0x74, 0x74, 0x65, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28,
- 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x30, 0x2e, 0x30, 0x29, 0x29,
- 0x3b, 0x0a, 0x7d, 0x0a, 0x00
-};
-
diff --git a/pacc/pacc-gl.c b/pacc/pacc-gl.c
index e6ed0a1..71435de 100644
--- a/pacc/pacc-gl.c
+++ b/pacc/pacc-gl.c
@@ -13,21 +13,30 @@
/*
OpenGL versions:
- OpenGL 2.0
- OpenGL 3.2 core (#define PACC_GL_3)
- OpenGL ES 2.0 (#define PACC_GL_ES)
- OpenGL ES 3.0 (#define PACC_GL_ES, #define PACC_GL_3)
-
- Shader languages:
- GLSL 1.10 / GLSL ES 1.00
+ OpenGL 2.0 / GLSL 1.10
+ OpenGL 3.2 core / GLSL 1.50 core (#define PACC_GL_3)
+ OpenGL ES 2.0 / GLSL ES 1.00 (#define PACC_GL_ES)
+ OpenGL ES 3.0 / GLSL ES 3.00 (#define PACC_GL_ES, #define PACC_GL_3)
*/
#ifdef PACC_GL_ES
+
+#ifdef PACC_GL_3
+#include "glsl/es3header.inc"
+#else
#include "glsl/esheader.inc"
+#endif
+
+#else
+
+#ifdef PACC_GL_3
+#include "glsl/ds3header.inc"
#else
#include "glsl/dsheader.inc"
#endif
+#endif
+
#include "glsl/blit.vert.inc"
#include "glsl/copy.frag.inc"
#include "glsl/color.frag.inc"
@@ -89,10 +98,18 @@ static GLuint compile_shader(const uint8_t *ss, GLenum type) {
if (!s) goto err;
const char *sourcelist[2] = {
#ifdef PACC_GL_ES
+#ifdef PACC_GL_3
+ (const char *)es3header,
+#else
(const char *)esheader,
+#endif
+#else
+#ifdef PACC_GL_3
+ (const char *)ds3header,
#else
(const char *)dsheader,
#endif
+#endif
(const char *)ss
};
glShaderSource(s, 2, sourcelist, 0);