added --disable-shaders arg

This commit is contained in:
itsmattkc
2019-01-12 01:46:42 +11:00
parent 462e7ba586
commit b1bb4b7808
4 changed files with 20 additions and 8 deletions
+7 -3
View File
@@ -2,6 +2,7 @@
#include <QApplication>
#include "debug.h"
#include "project/effect.h"
extern "C" {
#include <libavformat/avformat.h>
@@ -24,17 +25,20 @@ int main(int argc, char *argv[]) {
if (argc > 1) {
for (int i=1;i<argc;i++) {
if (argv[i][0] == '-') {
if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) {
#ifndef GITHASH
qWarning() << "No Git commit information found";
#endif
printf("%s\n", appName.toUtf8().constData());
return 0;
} else if (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) {
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
printf("Usage: %s [options] [filename]\n\n[filename] is the file to open on startup.\n\nOptions:\n\t-v, --version\tShow version information\n\t-h, --help\tShow this help\n\t-f, --fullscreen\tStart in full screen mode\n\n", argv[0]);
return 0;
} else if (!strcmp(argv[1], "--fullscreen") || !strcmp(argv[1], "-f")) {
} else if (!strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f")) {
launch_fullscreen = true;
} else if (!strcmp(argv[i], "--disable-shaders")) {
shaders_are_enabled = false;
} else {
printf("[ERROR] Unknown argument '%s'\n", argv[1]);
return 1;
+10 -3
View File
@@ -44,6 +44,7 @@
#include <QtMath>
#include <QMenu>
bool shaders_are_enabled = true;
QVector<EffectMeta> effects;
Effect* create_effect(Clip* c, const EffectMeta* em) {
@@ -85,6 +86,8 @@ const EffectMeta* get_internal_meta(int internal_id, int type) {
}
void load_internal_effects() {
qWarning() << "Shaders are disabled, some effects may be nonfunctional";
EffectMeta em;
// internal effects
@@ -785,8 +788,8 @@ void Effect::open() {
if (isOpen) {
qWarning() << "Tried to open an effect that was already open";
close();
}
if (enable_shader) {
}
if (shaders_are_enabled && enable_shader) {
if (QOpenGLContext::currentContext() == NULL) {
qWarning() << "No current context to create a shader program for - will retry next repaint";
} else {
@@ -848,7 +851,11 @@ void Effect::startEffect() {
open();
qWarning() << "Tried to start a closed effect - opening";
}
if (enable_shader && glslProgram->isLinked()) bound = glslProgram->bind();
if (shaders_are_enabled
&& enable_shader
&& glslProgram->isLinked()) {
bound = glslProgram->bind();
}
}
void Effect::endEffect() {
+1
View File
@@ -34,6 +34,7 @@ struct EffectMeta {
int subtype;
};
extern bool shaders_are_enabled;
extern QVector<EffectMeta> effects;
double log_volume(double linear);
+2 -2
View File
@@ -431,9 +431,9 @@ void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTexture
if (e->enable_coords) {
e->process_coords(timecode, coords, data);
}
if (e->enable_shader || e->enable_superimpose) {
if ((e->enable_shader && shaders_are_enabled) || e->enable_superimpose) {
e->startEffect();
if (e->enable_shader && e->is_glsl_linked()) {
if ((e->enable_shader && shaders_are_enabled) && e->is_glsl_linked()) {
e->process_shader(timecode, coords);
composite_texture = draw_clip(c->fbo[fbo_switcher], composite_texture, true);
fbo_switcher = !fbo_switcher;