Skip to content

Commit c485d80

Browse files
committed
Deprecate 'nativeonly', fix passing garbage data for vec4 stdin
1 parent b37ab5b commit c485d80

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

render.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ struct renderer* rd_new(const char** paths, const char* entry,
922922
{
923923
.name = "nativeonly", .fmt = "b",
924924
.handler = RHANDLER(name, args, {
925+
fprintf(stderr, "WARNING: `nativeonly` is deprecated, use `#if PREMULTIPLY_ALPHA == 1`!\n");
925926
if (current)
926927
current->nativeonly = *(bool*) args[0];
927928
else {
@@ -1698,7 +1699,7 @@ bool rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modifi
16981699
case STDIN_TYPE_VEC4:
16991700
glUniform4f(current->stdin_uniform,
17001701
stdin_parsed.f[0], stdin_parsed.f[1],
1701-
stdin_parsed.f[2], stdin_parsed.f[4]);
1702+
stdin_parsed.f[2], stdin_parsed.f[3]);
17021703
break;
17031704
default: break;
17041705
}

shaders/bars.glsl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
#define BAR_OUTLINE_WIDTH 0
1212
/* Amplify magnitude of the results each bar displays */
1313
#define AMPLIFY 300
14-
/* Alpha channel for bars color */
15-
#define ALPHA 0.7
14+
/* Whether the current settings use the alpha channel;
15+
enabling this is required for alpha to function
16+
correctly on X11 with `"native"` transparency. */
17+
#define USE_ALPHA 0
1618
/* How strong the gradient changes */
1719
#define GRADIENT_POWER 60
1820
/* Bar color changes with height */
1921
#define GRADIENT (d / GRADIENT_POWER + 1)
2022
/* Bar color */
21-
#define COLOR (#3366b2 * GRADIENT * ALPHA)
23+
#define COLOR (#3366b2 * GRADIENT)
2224
/* Direction that the bars are facing, 0 for inward, 1 for outward */
2325
#define DIRECTION 0
2426
/* Whether to switch left/right audio buffers */

shaders/util/premultiply.frag

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
#request nativeonly true
2+
#if PREMULTIPLY_ALPHA == 0
3+
#error __distablestage
4+
#endif
35

46
#request uniform "prev" tex
57
uniform sampler2D tex;

0 commit comments

Comments
 (0)