Skip to content

Commit

Permalink
Deprecate 'nativeonly', fix passing garbage data for vec4 stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
jarcode-foss committed Mar 12, 2019
1 parent b37ab5b commit c485d80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion render.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ struct renderer* rd_new(const char** paths, const char* entry,
{
.name = "nativeonly", .fmt = "b",
.handler = RHANDLER(name, args, {
fprintf(stderr, "WARNING: `nativeonly` is deprecated, use `#if PREMULTIPLY_ALPHA == 1`!\n");
if (current)
current->nativeonly = *(bool*) args[0];
else {
Expand Down Expand Up @@ -1698,7 +1699,7 @@ bool rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modifi
case STDIN_TYPE_VEC4:
glUniform4f(current->stdin_uniform,
stdin_parsed.f[0], stdin_parsed.f[1],
stdin_parsed.f[2], stdin_parsed.f[4]);
stdin_parsed.f[2], stdin_parsed.f[3]);
break;
default: break;
}
Expand Down
8 changes: 5 additions & 3 deletions shaders/bars.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
#define BAR_OUTLINE_WIDTH 0
/* Amplify magnitude of the results each bar displays */
#define AMPLIFY 300
/* Alpha channel for bars color */
#define ALPHA 0.7
/* Whether the current settings use the alpha channel;
enabling this is required for alpha to function
correctly on X11 with `"native"` transparency. */
#define USE_ALPHA 0
/* How strong the gradient changes */
#define GRADIENT_POWER 60
/* Bar color changes with height */
#define GRADIENT (d / GRADIENT_POWER + 1)
/* Bar color */
#define COLOR (#3366b2 * GRADIENT * ALPHA)
#define COLOR (#3366b2 * GRADIENT)
/* Direction that the bars are facing, 0 for inward, 1 for outward */
#define DIRECTION 0
/* Whether to switch left/right audio buffers */
Expand Down
4 changes: 3 additions & 1 deletion shaders/util/premultiply.frag
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

#request nativeonly true
#if PREMULTIPLY_ALPHA == 0
#error __distablestage
#endif

#request uniform "prev" tex
uniform sampler2D tex;
Expand Down

0 comments on commit c485d80

Please sign in to comment.