Hello community,

here is the log from the commit of package glava for openSUSE:Factory checked 
in at 2019-03-13 16:41:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/glava (Old)
 and      /work/SRC/openSUSE:Factory/.glava.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "glava"

Wed Mar 13 16:41:45 2019 rev:4 rq:684552 version:1.6.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/glava/glava.changes      2019-03-12 
09:54:39.907523105 +0100
+++ /work/SRC/openSUSE:Factory/.glava.new.28833/glava.changes   2019-03-13 
16:41:45.966667043 +0100
@@ -1,0 +2,18 @@
+Wed Mar 13 07:48:32 UTC 2019 - [email protected]
+
+- Update to 1.6.3:
+  * Fixed a spelling error in utils/premutliply.frag that broke
+    native transparency in most modules
+- Changes from 1.6.2:
+  * Fixed a critical issue with --stdin that caused the alpha
+    channel to be garbage data
+  * Added a premultiply step to bars to allow for proper handling
+    of the alpha channel on "native" transparency. This is disabled
+       by default, assign USE_ALPHA to 1 in bars.glsl to enable.
+- Changes from 1.6.1:
+  * A problem with artifacting in circle has been fixed, see #107
+  * --stdin has been added, which binds simple GLSL datatypes to
+    STDIN in shaders. This evaluates to a uniform, and thus can be
+       used to stream some data at runtime to GLava.
+
+-------------------------------------------------------------------

Old:
----
  v1.6.0.tar.gz

New:
----
  v1.6.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ glava.spec ++++++
--- /var/tmp/diff_new_pack.qf5pLU/_old  2019-03-13 16:41:46.622666558 +0100
+++ /var/tmp/diff_new_pack.qf5pLU/_new  2019-03-13 16:41:46.626666555 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           glava
-Version:        1.6.0
+Version:        1.6.3
 Release:        0
 Summary:        OpenGL audio spectrum visualizer
 License:        GPL-3.0-only

++++++ v1.6.0.tar.gz -> v1.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glava-1.6.0/glava.c new/glava-1.6.3/glava.c
--- old/glava-1.6.0/glava.c     2019-03-10 01:55:03.000000000 +0100
+++ new/glava-1.6.3/glava.c     2019-03-12 21:21:21.000000000 +0100
@@ -182,6 +182,10 @@
     "                          appropriate backend will be used for the 
underlying windowing\n"
     "                          system.\n"
     "-a, --audio=BACKEND     specifies an audio input backend to use.\n"
+    "-i, --stdin[=FORMAT]    specifies a format for input to be read from 
stdin. The input\n"
+    "                           may be read from the STDIN macro from within 
shader sources.\n"
+    "                           A stream of inputs (each overriding the 
previous) must be\n"
+    "                           separated by newline (\'\\n\') characters.\n"
     "-V, --version           print application version and exit\n"
     "\n"
     "The REQUEST argument is evaluated identically to the \'#request\' 
preprocessor directive\n"
@@ -196,9 +200,12 @@
     "The BACKEND argument may be any of the following strings (for this 
particular build):\n"
     "%s"
     "\n"
+    "The FORMAT argument must be a valid GLSL type. If `--stdin` is used 
without an argument,\n"
+    "the default type is `vec4` (type used for RGBA colors)\n"
+    "\n"
     GLAVA_VERSION_STRING "\n";
 
-static const char* opt_str = "dhvVe:Cm:b:r:a:";
+static const char* opt_str = "dhvVe:Cm:b:r:a:i::";
 static struct option p_opts[] = {
     {"help",        no_argument,       0, 'h'},
     {"verbose",     no_argument,       0, 'v'},
@@ -209,6 +216,7 @@
     {"force-mod",   required_argument, 0, 'm'},
     {"copy-config", no_argument,       0, 'C'},
     {"backend",     required_argument, 0, 'b'},
+    {"stdin",       optional_argument, 0, 'i'},
     {"version",     no_argument,       0, 'V'},
     {0,             0,                 0,  0 }
 };
@@ -231,13 +239,14 @@
 
     /* Evaluate these macros only once, since they allocate */
     const char
-        * install_path  = SHADER_INSTALL_PATH,
-        * user_path     = SHADER_USER_PATH,
-        * entry         = "rc.glsl",
-        * force         = NULL,
-        * backend       = NULL,
+        * install_path    = SHADER_INSTALL_PATH,
+        * user_path       = SHADER_USER_PATH,
+        * entry           = "rc.glsl",
+        * force           = NULL,
+        * backend         = NULL,
         * audio_impl_name = "pulseaudio";
     const char* system_shader_paths[] = { user_path, install_path, NULL };
+    int stdin_type = STDIN_TYPE_NONE;
     
     char** requests    = malloc(1);
     size_t requests_sz = 0;
@@ -271,6 +280,21 @@
                 exit(EXIT_SUCCESS);
                 break;
             }
+            case 'i': {
+                stdin_type = -1;
+                for (size_t t = 0 ; stdin_types[t].n != NULL; ++t) {
+                    if (optarg == NULL) {
+                        stdin_type = STDIN_TYPE_VEC4;
+                    } else if (!strcmp(stdin_types[t].n, optarg)) {
+                        stdin_type = stdin_types[t].i;
+                        break;
+                    }
+                }
+                if (stdin_type == -1) {
+                    fprintf(stderr, "Unsupported `--stdin` GLSL type: 
\"%s\"\n", optarg);
+                    exit(EXIT_FAILURE);
+                }
+            }
         }
     }
 
@@ -291,7 +315,7 @@
     append_buf(requests, &requests_sz, NULL);
 
     rd = rd_new(system_shader_paths, entry, (const char**) requests,
-                backend, desktop, verbose);
+                backend, stdin_type, desktop, verbose);
     
     struct sigaction action = { .sa_handler = handle_term };
     sigaction(SIGTERM, &action, NULL);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glava-1.6.0/render.c new/glava-1.6.3/render.c
--- old/glava-1.6.0/render.c    2019-03-10 01:55:03.000000000 +0100
+++ new/glava-1.6.3/render.c    2019-03-12 21:21:21.000000000 +0100
@@ -7,6 +7,7 @@
 #include <math.h>
 #include <time.h>
 
+#include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -19,6 +20,17 @@
 #include "xwin.h"
 #include "glsl_ext.h"
 
+typeof(stdin_types) stdin_types = {
+    [STDIN_TYPE_NONE]  = { .n = "NONE",  .i = STDIN_TYPE_NONE  },
+    [STDIN_TYPE_INT]   = { .n = "int",   .i = STDIN_TYPE_INT   },
+    [STDIN_TYPE_FLOAT] = { .n = "float", .i = STDIN_TYPE_FLOAT },
+    [STDIN_TYPE_BOOL]  = { .n = "bool",  .i = STDIN_TYPE_BOOL  },
+    [STDIN_TYPE_VEC2]  = { .n = "vec2",  .i = STDIN_TYPE_VEC2  },
+    [STDIN_TYPE_VEC3]  = { .n = "vec3",  .i = STDIN_TYPE_VEC3  },
+    [STDIN_TYPE_VEC4]  = { .n = "vec4",  .i = STDIN_TYPE_VEC4  },
+    {}
+};
+
 #define TWOPI 6.28318530718
 #define PI 3.14159265359
 #define swap(a, b) do { __auto_type tmp = a; a = b; b = tmp; } while (0)
@@ -90,7 +102,7 @@
 /* GL screen framebuffer object */
 
 struct gl_sfbo {
-    GLuint fbo, tex, shader;
+    GLuint fbo, tex, shader, stdin_uniform;
     bool indirect, nativeonly;
     const char* name;
     struct gl_bind* binds;
@@ -126,6 +138,7 @@
     } clear_color;
     float* interpolate_buf[6];
     int geometry[4];
+    int stdin_type;
 };
 
 
@@ -176,7 +189,11 @@
         "#define PRE_SMOOTHED_AUDIO %d\n"
         "#define SMOOTH_FACTOR %.6f\n"
         "#define USE_ALPHA %d\n"
-        "#define PREMULTIPLY_ALPHA %d\n";
+        "#define PREMULTIPLY_ALPHA %d\n"
+        "#define USE_STDIN %d\n"
+        "#if USE_STDIN == 1\n"
+        "uniform %s STDIN;\n"
+        "#endif\n";
     
     struct glsl_ext ext = {
         .source     = raw ? NULL : map,
@@ -196,7 +213,8 @@
     GLchar* buf = malloc((blen * sizeof(GLchar*)) + ext.p_len);
     int written = snprintf(buf, blen, header_fmt, (int) shader_version, (int) 
max_uniforms,
                            gl->smooth_pass ? 1 : 0, (double) gl->smooth_factor,
-                           1, gl->premultiply_alpha ? 1 : 0);
+                           1, gl->premultiply_alpha ? 1 : 0,
+                           gl->stdin_type != STDIN_TYPE_NONE, 
stdin_types[gl->stdin_type].n);
     if (written < 0) {
         fprintf(stderr, "snprintf() encoding error while prepending header to 
shader '%s'\n", path);
         return 0;
@@ -710,9 +728,10 @@
     return NULL;
 }
 
-struct renderer* rd_new(const char** paths,        const char* entry,
-                        const char** requests,     const char* force_backend,
-                        bool         auto_desktop, bool        verbose) {
+struct renderer* rd_new(const char** paths,      const char* entry,
+                        const char** requests,   const char* force_backend,
+                        int          stdin_type, bool        auto_desktop,
+                        bool         verbose) {
 
     xwin_wait_for_wm();
     
@@ -760,7 +779,8 @@
         .fft_cutoff        = 0.3F,
         .geometry          = { 0, 0, 500, 400 },
         .clear_color       = { 0.0F, 0.0F, 0.0F, 0.0F },
-        .clickthrough      = false
+        .clickthrough      = false,
+        .stdin_type        = stdin_type
     };
 
     bool forced = force_backend != NULL;
@@ -902,6 +922,7 @@
         {
             .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 {
@@ -1309,14 +1330,17 @@
                                     gl->wcb->get_fbsize(gl->w, &w, &h);
                                     setup_sfbo(&stages[idx - 1], w, h);
                                 }
-
+                                
                                 glUseProgram(id);
-                        
+                                
                                 /* Setup uniform bindings */
                                 size_t b;
                                 for (b = 0; b < s->binds_sz; ++b) {
                                     s->binds[b].uniform = 
glGetUniformLocation(id, s->binds[b].name);
                                 }
+                                if (gl->stdin_type != STDIN_TYPE_NONE) {
+                                    s->stdin_uniform = 
glGetUniformLocation(id, "STDIN");
+                                }
                                 glBindFragDataLocation(id, 1, "fragment");
                                 glUseProgram(0);
                             }
@@ -1493,6 +1517,101 @@
     gl->lwh = wh;
     
     glViewport(0, 0, ww, wh);
+    
+    static bool stdin_uniform_ready = false;
+    static union {
+        bool     b;
+        int      i;
+        float    f[4];
+    } stdin_parsed;
+    
+    /* Parse stdin data, if nessecary */
+    if (gl->stdin_type != STDIN_TYPE_NONE) {
+        static char stdin_buf[64] = {};
+        static size_t stdin_idx = 0;
+        int c, n, p;
+        setvbuf(stdin, NULL, _IOLBF, 64);
+        
+        fd_set fds;
+        FD_ZERO(&fds);
+        FD_SET(STDIN_FILENO, &fds);
+        struct timeval timeout = { 0, 0 };
+        n = select(1, &fds, NULL, NULL, &timeout);
+        
+        for (p = 0; n > 0; ++p) {
+            c = getchar();
+            if (stdin_idx >= (sizeof(stdin_buf) / sizeof(*stdin_buf)) - 1)
+                break;
+            if (c != EOF && c != '\n')
+                stdin_buf[stdin_idx++] = c;
+            else {
+                stdin_buf[stdin_idx] = '\0';
+                switch (gl->stdin_type) {
+                    case STDIN_TYPE_BOOL:
+                        if (!strcmp("true", stdin_buf) ||
+                            !strcmp("TRUE", stdin_buf) ||
+                            !strcmp("True", stdin_buf) ||
+                            !strcmp("1",    stdin_buf)) {
+                            stdin_parsed.b = true;
+                            stdin_uniform_ready = true;
+                        } else if (!strcmp("false", stdin_buf) ||
+                                   !strcmp("FALSE", stdin_buf) ||
+                                   !strcmp("False", stdin_buf) ||
+                                   !strcmp("0",    stdin_buf)) {
+                            stdin_parsed.b = false;
+                            stdin_uniform_ready = true;
+                        }
+                        break;
+                    case STDIN_TYPE_INT:
+                        errno = 0;
+                        stdin_parsed.i = (int) strtol(stdin_buf, NULL, 10);
+                        if (errno != ERANGE) stdin_uniform_ready = true;
+                        break;
+                    case STDIN_TYPE_FLOAT:
+                        errno = 0;
+                        stdin_parsed.f[0] = strtof(stdin_buf, NULL);
+                        if (errno != ERANGE) stdin_uniform_ready = true;
+                        break;
+                    case STDIN_TYPE_VEC2:
+                        if (EOF != sscanf(stdin_buf, "%f,%f",
+                                          &stdin_parsed.f[0], 
&stdin_parsed.f[1]))
+                            stdin_uniform_ready = true;
+                        break;
+                    case STDIN_TYPE_VEC3:
+                        if (EOF != sscanf(stdin_buf, "%f,%f,%f",
+                                          &stdin_parsed.f[0], 
&stdin_parsed.f[1],
+                                          &stdin_parsed.f[2]))
+                            stdin_uniform_ready = true;
+                        break;
+                    case STDIN_TYPE_VEC4:
+                        if (stdin_buf[0] == '#') {
+                            stdin_parsed.f[0] = 0.0F;
+                            stdin_parsed.f[1] = 0.0F;
+                            stdin_parsed.f[2] = 0.0F;
+                            stdin_parsed.f[3] = 1.0F;
+                            float* ptrs[] = {
+                                &stdin_parsed.f[0], &stdin_parsed.f[1],
+                                &stdin_parsed.f[2], &stdin_parsed.f[3]
+                            };
+                            ext_parse_color(stdin_buf + 1, 2, ptrs);
+                            stdin_uniform_ready = true;
+                        } else if (EOF != sscanf(stdin_buf, "%f,%f,%f,%f",
+                                                 &stdin_parsed.f[0], 
&stdin_parsed.f[1],
+                                                 &stdin_parsed.f[2], 
&stdin_parsed.f[3]))
+                            stdin_uniform_ready = true;
+                        break;
+                }
+                stdin_buf[0] = '\0';
+                stdin_idx = 0;
+                break;
+                
+                if (c == EOF) {
+                    gl->stdin_type = STDIN_TYPE_NONE;
+                    break;
+                }
+            };
+        }
+    }
         
     struct gl_sfbo* prev;
 
@@ -1556,6 +1675,37 @@
         /* Select the program associated with this pass */
         glUseProgram(current->shader);
 
+        /* Pass STDIN unfirom if one has been parsed */
+        if (stdin_uniform_ready) {
+            switch (gl->stdin_type) {
+                case STDIN_TYPE_BOOL:
+                    glUniform1i(current->stdin_uniform, (int) stdin_parsed.b);
+                    break;
+                case STDIN_TYPE_INT:
+                    glUniform1i(current->stdin_uniform, stdin_parsed.i);
+                    break;
+                case STDIN_TYPE_FLOAT:
+                    glUniform1f(current->stdin_uniform, stdin_parsed.f[0]);
+                    break;
+                case STDIN_TYPE_VEC2:
+                    glUniform2f(current->stdin_uniform,
+                                stdin_parsed.f[0], stdin_parsed.f[1]);
+                    break;
+                case STDIN_TYPE_VEC3:
+                    glUniform3f(current->stdin_uniform,
+                                stdin_parsed.f[0], stdin_parsed.f[1],
+                                stdin_parsed.f[2]);
+                    break;
+                case STDIN_TYPE_VEC4:
+                    glUniform4f(current->stdin_uniform,
+                                stdin_parsed.f[0], stdin_parsed.f[1],
+                                stdin_parsed.f[2], stdin_parsed.f[3]);
+                    break;
+                default: break;
+            }
+            stdin_uniform_ready = false;
+        }
+        
         bool prev_bound = false;
         
         /* Iterate through each uniform binding, transforming and passing the 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glava-1.6.0/render.h new/glava-1.6.3/render.h
--- old/glava-1.6.0/render.h    2019-03-10 01:55:03.000000000 +0100
+++ new/glava-1.6.3/render.h    2019-03-12 21:21:21.000000000 +0100
@@ -2,6 +2,19 @@
 #ifndef RENDER_H
 #define RENDER_H
 
+extern const struct {
+    const char* n;
+    int i;
+} stdin_types[];
+
+#define STDIN_TYPE_NONE  0
+#define STDIN_TYPE_INT   1
+#define STDIN_TYPE_FLOAT 2
+#define STDIN_TYPE_BOOL  3
+#define STDIN_TYPE_VEC2  4
+#define STDIN_TYPE_VEC3  5
+#define STDIN_TYPE_VEC4  6
+
 struct gl_data;
 
 typedef struct renderer {
@@ -11,9 +24,10 @@
     struct gl_data* gl;
 } renderer;
 
-struct renderer* rd_new            (const char** paths,        const char* 
entry,
-                                    const char** requests,     const char* 
force_backend,
-                                    bool         auto_desktop, bool        
verbose);
+struct renderer* rd_new            (const char** paths,      const char* entry,
+                                    const char** requests,   const char* 
force_backend,
+                                    int          stdin_type, bool        
auto_desktop,
+                                    bool         verbose);
 bool             rd_update         (struct renderer*, float* lb, float* rb,
                                     size_t bsz, bool modified);
 void             rd_destroy        (struct renderer*);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glava-1.6.0/shaders/bars.glsl 
new/glava-1.6.3/shaders/bars.glsl
--- old/glava-1.6.0/shaders/bars.glsl   2019-03-10 01:55:03.000000000 +0100
+++ new/glava-1.6.3/shaders/bars.glsl   2019-03-12 21:21:21.000000000 +0100
@@ -1,7 +1,6 @@
 
 /* Center line thickness (pixels) */
 #define C_LINE 1
-
 /* Width (in pixels) of each bar */
 #define BAR_WIDTH 4
 /* Width (in pixels) of each bar gap */
@@ -12,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 */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glava-1.6.0/shaders/circle/1.frag 
new/glava-1.6.3/shaders/circle/1.frag
--- old/glava-1.6.0/shaders/circle/1.frag       2019-03-10 01:55:03.000000000 
+0100
+++ new/glava-1.6.3/shaders/circle/1.frag       2019-03-12 21:21:21.000000000 
+0100
@@ -32,9 +32,6 @@
 /* This shader is based on radial.glsl, refer to it for more commentary */
 
 float apply_smooth(float theta) {
-
-    fragment = vec4(0, 0, 0, 0);
-    
     float idx = theta + ROTATE;
     float dir = mod(abs(idx), TWOPI);
     if (dir > PI)
@@ -53,6 +50,7 @@
 }
 
 void main() {
+    fragment = vec4(0, 0, 0, 0);
     float
         dx = gl_FragCoord.x - (screen.x / 2),
         dy = gl_FragCoord.y - (screen.y / 2);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glava-1.6.0/shaders/util/premultiply.frag 
new/glava-1.6.3/shaders/util/premultiply.frag
--- old/glava-1.6.0/shaders/util/premultiply.frag       2019-03-10 
01:55:03.000000000 +0100
+++ new/glava-1.6.3/shaders/util/premultiply.frag       2019-03-12 
21:21:21.000000000 +0100
@@ -1,5 +1,7 @@
 
-#request nativeonly true
+#if PREMULTIPLY_ALPHA == 0
+#error __disablestage
+#endif
 
 #request uniform "prev" tex
 uniform sampler2D tex;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/glava-1.6.0/shaders/util/smooth.glsl 
new/glava-1.6.3/shaders/util/smooth.glsl
--- old/glava-1.6.0/shaders/util/smooth.glsl    2019-03-10 01:55:03.000000000 
+0100
+++ new/glava-1.6.3/shaders/util/smooth.glsl    2019-03-12 21:21:21.000000000 
+0100
@@ -10,6 +10,7 @@
 #define PI 3.14159265359
 #endif
 
+#include "@smooth_parameters.glsl"
 #include ":smooth_parameters.glsl"
 
 /* window value t that resides in range [0, sz)*/
@@ -43,6 +44,7 @@
         smax = scale_audio(clamp(idx + SMOOTH_FACTOR, 0, 1)) * tex_sz;
     float m = ((smax - smin) / 2.0F), s, w;
     float rm = smin + m; /* middle */
+    
     #if SAMPLE_MODE == average
     float avg = 0, weight = 0;
     for (s = smin; s <= smax; s += 1.0F) {


Reply via email to