Migrate builtin macros to '__' prefix
This commit is contained in:
10
render.c
10
render.c
@@ -223,11 +223,11 @@ static GLuint shaderload(const char* rpath,
|
|||||||
|
|
||||||
static const GLchar* header_fmt =
|
static const GLchar* header_fmt =
|
||||||
"#version %d\n"
|
"#version %d\n"
|
||||||
"#define UNIFORM_LIMIT %d\n"
|
"#define __UNIFORM_LIMIT %d\n"
|
||||||
"#define PRE_SMOOTHED_AUDIO %d\n"
|
"#define __PRE_SMOOTHED_AUDIO %d\n"
|
||||||
"#define SMOOTH_FACTOR %.6f\n"
|
"#define __SMOOTH_FACTOR %.6f\n"
|
||||||
"#define USE_ALPHA %d\n"
|
"#define __USE_ALPHA %d\n"
|
||||||
"#define PREMULTIPLY_ALPHA %d\n"
|
"#define __PREMULTIPLY_ALPHA %d\n"
|
||||||
"#define USE_STDIN %d\n"
|
"#define USE_STDIN %d\n"
|
||||||
"#if USE_STDIN == 1\n"
|
"#if USE_STDIN == 1\n"
|
||||||
"uniform %s STDIN;\n"
|
"uniform %s STDIN;\n"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ out vec4 fragment; /* output */
|
|||||||
void main() {
|
void main() {
|
||||||
fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0);
|
fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0);
|
||||||
#if C_SMOOTH > 0
|
#if C_SMOOTH > 0
|
||||||
#if USE_ALPHA
|
#if __USE_ALPHA
|
||||||
vec4
|
vec4
|
||||||
a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0),
|
a0 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 0)), 0),
|
||||||
a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0),
|
a1 = texelFetch(tex, ivec2((gl_FragCoord.x + 1), (gl_FragCoord.y + 1)), 0),
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ out vec4 fragment;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
#if USE_ALPHA > 0
|
#if __USE_ALPHA > 0
|
||||||
#define APPLY_FRAG(f, c) f = vec4(f.rgb * f.a + c.rgb * (1 - clamp(f.a, 0, 1)), max(c.a, f.a))
|
#define APPLY_FRAG(f, c) f = vec4(f.rgb * f.a + c.rgb * (1 - clamp(f.a, 0, 1)), max(c.a, f.a))
|
||||||
fragment = #00000000;
|
fragment = #00000000;
|
||||||
#else
|
#else
|
||||||
@@ -48,7 +48,7 @@ void main() {
|
|||||||
float d = sqrt((dx * dx) + (dy * dy)); /* distance */
|
float d = sqrt((dx * dx) + (dy * dy)); /* distance */
|
||||||
if (d > C_RADIUS - (float(C_LINE) / 2.0F) && d < C_RADIUS + (float(C_LINE) / 2.0F)) {
|
if (d > C_RADIUS - (float(C_LINE) / 2.0F) && d < C_RADIUS + (float(C_LINE) / 2.0F)) {
|
||||||
APPLY_FRAG(fragment, OUTLINE);
|
APPLY_FRAG(fragment, OUTLINE);
|
||||||
#if USE_ALPHA > 0
|
#if __USE_ALPHA > 0
|
||||||
fragment.a *= clamp(((C_LINE / 2) - abs(C_RADIUS - d)) * C_ALIAS_FACTOR, 0, 1);
|
fragment.a *= clamp(((C_LINE / 2) - abs(C_RADIUS - d)) * C_ALIAS_FACTOR, 0, 1);
|
||||||
#else
|
#else
|
||||||
return; /* return immediately if there is no alpha blending available */
|
return; /* return immediately if there is no alpha blending available */
|
||||||
@@ -74,7 +74,7 @@ void main() {
|
|||||||
v *= AMPLIFY; /* amplify */
|
v *= AMPLIFY; /* amplify */
|
||||||
#undef smooth_f
|
#undef smooth_f
|
||||||
/* offset to fragment distance from inner circle */
|
/* offset to fragment distance from inner circle */
|
||||||
#if USE_ALPHA > 0
|
#if __USE_ALPHA > 0
|
||||||
#define ALIAS_FACTOR (((BAR_WIDTH / 2) - abs(ym)) * BAR_ALIAS_FACTOR)
|
#define ALIAS_FACTOR (((BAR_WIDTH / 2) - abs(ym)) * BAR_ALIAS_FACTOR)
|
||||||
d -= C_RADIUS; /* start bar overlapping the inner circle for blending */
|
d -= C_RADIUS; /* start bar overlapping the inner circle for blending */
|
||||||
#else
|
#else
|
||||||
@@ -91,7 +91,7 @@ void main() {
|
|||||||
#else
|
#else
|
||||||
r = COLOR;
|
r = COLOR;
|
||||||
#endif
|
#endif
|
||||||
#if USE_ALPHA > 0
|
#if __USE_ALPHA > 0
|
||||||
r.a *= ALIAS_FACTOR;
|
r.a *= ALIAS_FACTOR;
|
||||||
#endif
|
#endif
|
||||||
APPLY_FRAG(fragment, r);
|
APPLY_FRAG(fragment, r);
|
||||||
@@ -99,7 +99,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
#if BAR_OUTLINE_WIDTH > 0
|
#if BAR_OUTLINE_WIDTH > 0
|
||||||
if (d <= v) {
|
if (d <= v) {
|
||||||
#if USE_ALPHA > 0
|
#if __USE_ALPHA > 0
|
||||||
vec4 r = BAR_OUTLINE;
|
vec4 r = BAR_OUTLINE;
|
||||||
r.a *= ALIAS_FACTOR;
|
r.a *= ALIAS_FACTOR;
|
||||||
APPLY_FRAG(fragment, r);
|
APPLY_FRAG(fragment, r);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#if PREMULTIPLY_ALPHA == 0
|
#if __PREMULTIPLY_ALPHA == 0
|
||||||
#error __disablestage
|
#error __disablestage
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -11,7 +11,5 @@ in vec4 gl_FragCoord;
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0);
|
fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0);
|
||||||
#if PREMULTIPLY_ALPHA > 0
|
|
||||||
fragment.rgb *= fragment.a;
|
fragment.rgb *= fragment.a;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ float iscale_audio(float idx) {
|
|||||||
return -log((SAMPLE_RANGE) * idx) / (SAMPLE_SCALE);
|
return -log((SAMPLE_RANGE) * idx) / (SAMPLE_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: the SMOOTH_FACTOR macro is defined by GLava itself, from `#request setsmoothfactor`*/
|
/* Note: the __SMOOTH_FACTOR macro is defined by GLava itself, from `#request setsmoothfactor`*/
|
||||||
|
|
||||||
float smooth_audio(in sampler1D tex, int tex_sz, highp float idx) {
|
float smooth_audio(in sampler1D tex, int tex_sz, highp float idx) {
|
||||||
|
|
||||||
#if PRE_SMOOTHED_AUDIO < 1
|
#if __PRE_SMOOTHED_AUDIO < 1
|
||||||
float
|
float
|
||||||
smin = scale_audio(clamp(idx - SMOOTH_FACTOR, 0, 1)) * tex_sz,
|
smin = scale_audio(clamp(idx - __SMOOTH_FACTOR, 0, 1)) * tex_sz,
|
||||||
smax = scale_audio(clamp(idx + SMOOTH_FACTOR, 0, 1)) * tex_sz;
|
smax = scale_audio(clamp(idx + __SMOOTH_FACTOR, 0, 1)) * tex_sz;
|
||||||
float m = ((smax - smin) / 2.0F), s, w;
|
float m = ((smax - smin) / 2.0F), s, w;
|
||||||
float rm = smin + m; /* middle */
|
float rm = smin + m; /* middle */
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ uniform int w;
|
|||||||
out vec4 fragment;
|
out vec4 fragment;
|
||||||
in vec4 gl_FragCoord;
|
in vec4 gl_FragCoord;
|
||||||
|
|
||||||
#undef PRE_SMOOTHED_AUDIO
|
#undef __PRE_SMOOTHED_AUDIO
|
||||||
#define PRE_SMOOTHED_AUDIO 0
|
#define __PRE_SMOOTHED_AUDIO 0
|
||||||
|
|
||||||
#include ":util/smooth.glsl"
|
#include ":util/smooth.glsl"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user