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 =
|
||||
"#version %d\n"
|
||||
"#define UNIFORM_LIMIT %d\n"
|
||||
"#define PRE_SMOOTHED_AUDIO %d\n"
|
||||
"#define SMOOTH_FACTOR %.6f\n"
|
||||
"#define USE_ALPHA %d\n"
|
||||
"#define PREMULTIPLY_ALPHA %d\n"
|
||||
"#define __UNIFORM_LIMIT %d\n"
|
||||
"#define __PRE_SMOOTHED_AUDIO %d\n"
|
||||
"#define __SMOOTH_FACTOR %.6f\n"
|
||||
"#define __USE_ALPHA %d\n"
|
||||
"#define __PREMULTIPLY_ALPHA %d\n"
|
||||
"#define USE_STDIN %d\n"
|
||||
"#if USE_STDIN == 1\n"
|
||||
"uniform %s STDIN;\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ out vec4 fragment; /* output */
|
||||
void main() {
|
||||
fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0);
|
||||
#if C_SMOOTH > 0
|
||||
#if USE_ALPHA
|
||||
#if __USE_ALPHA
|
||||
vec4
|
||||
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),
|
||||
|
||||
@@ -31,7 +31,7 @@ out vec4 fragment;
|
||||
|
||||
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))
|
||||
fragment = #00000000;
|
||||
#else
|
||||
@@ -48,7 +48,7 @@ void main() {
|
||||
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)) {
|
||||
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);
|
||||
#else
|
||||
return; /* return immediately if there is no alpha blending available */
|
||||
@@ -74,7 +74,7 @@ void main() {
|
||||
v *= AMPLIFY; /* amplify */
|
||||
#undef smooth_f
|
||||
/* 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)
|
||||
d -= C_RADIUS; /* start bar overlapping the inner circle for blending */
|
||||
#else
|
||||
@@ -91,7 +91,7 @@ void main() {
|
||||
#else
|
||||
r = COLOR;
|
||||
#endif
|
||||
#if USE_ALPHA > 0
|
||||
#if __USE_ALPHA > 0
|
||||
r.a *= ALIAS_FACTOR;
|
||||
#endif
|
||||
APPLY_FRAG(fragment, r);
|
||||
@@ -99,7 +99,7 @@ void main() {
|
||||
}
|
||||
#if BAR_OUTLINE_WIDTH > 0
|
||||
if (d <= v) {
|
||||
#if USE_ALPHA > 0
|
||||
#if __USE_ALPHA > 0
|
||||
vec4 r = BAR_OUTLINE;
|
||||
r.a *= ALIAS_FACTOR;
|
||||
APPLY_FRAG(fragment, r);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#if PREMULTIPLY_ALPHA == 0
|
||||
#if __PREMULTIPLY_ALPHA == 0
|
||||
#error __disablestage
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,5 @@ in vec4 gl_FragCoord;
|
||||
|
||||
void main() {
|
||||
fragment = texelFetch(tex, ivec2(gl_FragCoord.x, gl_FragCoord.y), 0);
|
||||
#if PREMULTIPLY_ALPHA > 0
|
||||
fragment.rgb *= fragment.a;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ float iscale_audio(float idx) {
|
||||
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) {
|
||||
|
||||
#if PRE_SMOOTHED_AUDIO < 1
|
||||
#if __PRE_SMOOTHED_AUDIO < 1
|
||||
float
|
||||
smin = scale_audio(clamp(idx - SMOOTH_FACTOR, 0, 1)) * tex_sz,
|
||||
smax = 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;
|
||||
float m = ((smax - smin) / 2.0F), s, w;
|
||||
float rm = smin + m; /* middle */
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ uniform int w;
|
||||
out vec4 fragment;
|
||||
in vec4 gl_FragCoord;
|
||||
|
||||
#undef PRE_SMOOTHED_AUDIO
|
||||
#define PRE_SMOOTHED_AUDIO 0
|
||||
#undef __PRE_SMOOTHED_AUDIO
|
||||
#define __PRE_SMOOTHED_AUDIO 0
|
||||
|
||||
#include ":util/smooth.glsl"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user