diff options
author | Rob Clark <robdclark@chromium.org> | 2020-02-29 11:16:43 -0800 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2020-03-07 09:22:17 -0800 |
commit | 27d4de2bb9bfd9c425848c78d729ba27f9408041 (patch) | |
tree | a24b18a3e42fbddce55d9fbc91076a1c62443eec /kmscube.c | |
parent | f20dc5e295a8605bcbfacbbe487e5452a9e7e312 (diff) | |
download | kmscube-27d4de2bb9bfd9c425848c78d729ba27f9408041.tar.gz |
add shadertoy mode
Doesn't handle shadertoy shaders which use textures for inputs. That
probably wouldn't be straightforward without using the web API to fetch
and introspect the shader. But that sounds like a lot more work.
Diffstat (limited to 'kmscube.c')
-rw-r--r-- | kmscube.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -41,7 +41,7 @@ static const struct egl *egl; static const struct gbm *gbm; static const struct drm *drm; -static const char *shortopts = "AD:f:M:m:s:V:v:"; +static const char *shortopts = "AD:f:M:m:S:s:V:v:"; static const struct option longopts[] = { {"atomic", no_argument, 0, 'A'}, @@ -57,7 +57,7 @@ static const struct option longopts[] = { static void usage(const char *name) { - printf("Usage: %s [-ADfMmsVv]\n" + printf("Usage: %s [-ADfMmSsVv]\n" "\n" "options:\n" " -A, --atomic use atomic modesetting and fencing\n" @@ -69,6 +69,7 @@ static void usage(const char *name) " nv12-2img - yuv textured (color conversion in shader)\n" " nv12-1img - yuv textured (single nv12 texture)\n" " -m, --modifier=MODIFIER hardcode the selected modifier\n" + " -S, --shadertoy=FILE use specified shadertoy shader\n" " -s, --samples=N use MSAA\n" " -V, --video=FILE video textured cube\n" " -v, --vmode=VMODE specify the video mode in the format\n" @@ -80,6 +81,7 @@ int main(int argc, char *argv[]) { const char *device = NULL; const char *video = NULL; + const char *shadertoy = NULL; char mode_str[DRM_DISPLAY_MODE_LEN] = ""; char *p; enum mode mode = SMOOTH; @@ -137,6 +139,10 @@ int main(int argc, char *argv[]) case 'm': modifier = strtoull(optarg, NULL, 0); break; + case 'S': + mode = SHADERTOY; + shadertoy = optarg; + break; case 's': samples = strtoul(optarg, NULL, 0); break; @@ -183,6 +189,8 @@ int main(int argc, char *argv[]) egl = init_cube_smooth(gbm, samples); else if (mode == VIDEO) egl = init_cube_video(gbm, video, samples); + else if (mode == SHADERTOY) + egl = init_cube_shadertoy(gbm, shadertoy, samples); else egl = init_cube_tex(gbm, mode, samples); |