Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

glw: Add support for specifying GLSL shader to use directly from view…

… files

Currently only supported on OpenGL backend (ie. not PS3)
  • Loading branch information...
commit e78da5daede50529b78ca79b081eaf4d1366b0d1 1 parent b3d7351
@andoma authored
View
2  src/ui/glw/glw.c
@@ -321,6 +321,7 @@ glw_init(glw_root_t *gr, const char *instance)
gr->gr_framerate = 60;
gr->gr_frameduration = 1000000 / gr->gr_framerate;
+ gr->gr_ui_start = showtime_get_ts();
return 0;
}
@@ -548,6 +549,7 @@ glw_prepare_frame(glw_root_t *gr, int flags)
}
gr->gr_frame_start = showtime_get_ts();
+ gr->gr_time = (gr->gr_frame_start - gr->gr_ui_start) / 1000000.0;
if(!(flags & GLW_NO_FRAMERATE_UPDATE)) {
View
18 src/ui/glw/glw.h
@@ -548,6 +548,11 @@ typedef struct glw_class {
/**
*
*/
+ void (*gc_set_fs)(struct glw *w, rstr_t *str);
+
+ /**
+ *
+ */
void (*gc_bind_to_property)(struct glw *w,
prop_t *p,
const char **pname,
@@ -625,6 +630,7 @@ static void __attribute__((constructor)) widgetclassinit ## n(void) \
const glw_class_t *glw_class_find_by_name(const char *name);
+typedef struct glw_program glw_program_t;
/**
* GLW root context
@@ -672,10 +678,13 @@ typedef struct glw_root {
int gr_mouse_valid;
struct glw_video_list gr_video_decoders;
+ int64_t gr_ui_start; // Timestamp UI was initialized
int64_t gr_frame_start; // Timestamp when we started rendering frame
int64_t gr_hz_sample;
prop_t *gr_is_fullscreen; // Set if our window is in fullscreen
+ float gr_time;
+
/**
* Screensaver
*/
@@ -814,7 +823,9 @@ typedef struct glw_root {
int num_vertices,
const uint16_t *indices,
int num_triangles,
- int flags);
+ int flags,
+ glw_program_t *p,
+ const struct glw_rctx *rc);
#define GLW_RENDER_COLOR_ATTRIBUTES 0x1 /* set if the color attributes
are != [1,1,1,1] */
@@ -1354,6 +1365,11 @@ void glw_blendmode(struct glw_root *gr, int mode);
#define GLW_CCW 1
void glw_frontface(struct glw_root *gr, int how);
+struct glw_program *glw_make_program(struct glw_root *gr,
+ const char *vertex_shader,
+ const char *fragment_shader);
+
+void glw_destroy_program(struct glw_root *gr, struct glw_program *gp);
// text bitmap semi-private stuff
View
2  src/ui/glw/glw_bar.c
@@ -63,7 +63,7 @@ glw_bar_render(glw_t *w, const glw_rctx_t *rc)
}
if(a > 0.01) {
glw_renderer_draw(&gb->gb_gr, w->glw_root, rc,
- NULL, NULL, NULL, a, 0);
+ NULL, NULL, NULL, a, 0, NULL);
}
}
View
6 src/ui/glw/glw_bloom.c
@@ -119,17 +119,17 @@ glw_bloom_render(glw_t *w, const glw_rctx_t *rc)
glw_blendmode(w->glw_root, GLW_BLEND_ADDITIVE);
glw_renderer_draw(&b->b_render, w->glw_root, &rc0,
&glw_rtt_texture(&b->b_rtt[0]),
- NULL, NULL, a * 0.50, 0);
+ NULL, NULL, a * 0.50, 0, NULL);
glw_renderer_draw(&b->b_render, w->glw_root, &rc0,
&glw_rtt_texture(&b->b_rtt[1]),
- NULL, NULL, a * 0.44, 0);
+ NULL, NULL, a * 0.44, 0, NULL);
glw_renderer_draw(&b->b_render, w->glw_root, &rc0,
&glw_rtt_texture(&b->b_rtt[2]),
- NULL, NULL, a * 0.33, 0);
+ NULL, NULL, a * 0.33, 0, NULL);
glw_blendmode(w->glw_root, GLW_BLEND_NORMAL);
}
View
4 src/ui/glw/glw_flicker.c
@@ -56,12 +56,12 @@ glw_flicker_render(glw_t *w, const glw_rctx_t *rc)
glw_rgb_t rgb = {v,v,v};
glw_renderer_draw(&gf->gf_gr[0], w->glw_root, rc,
- NULL, &rgb, NULL, a, 0);
+ NULL, &rgb, NULL, a, 0, NULL);
v = 1.0 * !gf->gf_phase + 0.25;
glw_rgb_t rgb_ = {v,v,v};
glw_renderer_draw(&gf->gf_gr[1], w->glw_root, rc,
- NULL, &rgb_, NULL, a, 0);
+ NULL, &rgb_, NULL, a, 0, NULL);
}
}
View
4 src/ui/glw/glw_fx_texrot.c
@@ -88,7 +88,7 @@ glw_fx_texrot_render(glw_t *w, const glw_rctx_t *rc)
if(glt != NULL && glt->glt_state == GLT_STATE_VALID && a > 0.01) {
glw_renderer_draw(&fx->fx_render, w->glw_root, rc,
&glw_rtt_texture(&fx->fx_rtt),
- NULL, NULL, a, 0);
+ NULL, NULL, a, 0, NULL);
}
}
@@ -134,7 +134,7 @@ glw_fx_texrot_render_internal(glw_root_t *gr, glw_rctx_t *rc,
glw_Rotatef(&rc0, fx->fx_plates[i].angle, 0.0, 0.0, 1.0);
glw_renderer_draw(&fx->fx_source_render, gr, &rc0,
- &glt->glt_texture, NULL, NULL, 0.15, 0);
+ &glt->glt_texture, NULL, NULL, 0.15, 0, NULL);
}
glw_blendmode(gr, GLW_BLEND_NORMAL);
}
View
2  src/ui/glw/glw_gradient.c
@@ -81,7 +81,7 @@ glw_gradient_render(glw_t *w, const glw_rctx_t *rc)
int i;
for(i = 0; i < gg->gg_gr_initialized ; i++) {
glw_renderer_draw(&gg->gg_gr[i], w->glw_root, rc,
- &gg->gg_tex[i], NULL, NULL, a, 0);
+ &gg->gg_tex[i], NULL, NULL, a, 0, NULL);
}
}
}
View
8 src/ui/glw/glw_image.c
@@ -281,7 +281,7 @@ glw_image_render(glw_t *w, const glw_rctx_t *rc)
glw_renderer_draw(&gi->gi_gr, w->glw_root, &rc0,
&glt->glt_texture,
- &black, NULL, alpha_self * 0.75f, 1);
+ &black, NULL, alpha_self * 0.75f, 1, NULL);
glw_Translatef(&rc0, -xd, -yd, 0.0f);
}
@@ -290,7 +290,8 @@ glw_image_render(glw_t *w, const glw_rctx_t *rc)
glw_renderer_draw(&gi->gi_gr, w->glw_root, &rc0,
&glt->glt_texture,
- &gi->gi_col_mul, &gi->gi_col_off, alpha_self, blur);
+ &gi->gi_col_mul, &gi->gi_col_off, alpha_self, blur,
+ NULL);
if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE)
glw_blendmode(w->glw_root, GLW_BLEND_NORMAL);
@@ -314,7 +315,8 @@ glw_image_render(glw_t *w, const glw_rctx_t *rc)
glw_renderer_draw(&gi->gi_gr, w->glw_root, rc,
&glt->glt_texture,
- &gi->gi_col_mul, &gi->gi_col_off, alpha_self, blur);
+ &gi->gi_col_mul, &gi->gi_col_off, alpha_self, blur,
+ NULL);
if(gi->gi_bitmap_flags & GLW_IMAGE_ADDITIVE)
glw_blendmode(w->glw_root, GLW_BLEND_NORMAL);
View
16 src/ui/glw/glw_opengl.h
@@ -60,8 +60,8 @@ struct glw_backend_texture;
/**
* OpenGL shader program
*/
-typedef struct glw_program {
- const char *gp_title;
+struct glw_program {
+ char *gp_title;
GLuint gp_program;
// Attributes
@@ -76,10 +76,13 @@ typedef struct glw_program {
GLint gp_uniform_blend;
GLint gp_uniform_color_offset;
GLint gp_uniform_blur;
+ GLint gp_uniform_time;
+ GLint gp_uniform_resolution;
+
GLint gp_uniform_t[6];
-} glw_program_t;
+};
@@ -188,12 +191,7 @@ void glw_rtt_destroy(struct glw_root *gr, glw_rtt_t *grtt);
/**
*
*/
-GLuint glw_compile_shader(const char *url, int type);
-
-glw_program_t *glw_make_program(glw_backend_root_t *gbr,
- const char *title, GLuint vs, GLuint fs);
-
-int glw_load_program(glw_backend_root_t *gbr, glw_program_t *gp);
+int glw_load_program(glw_backend_root_t *gbr, struct glw_program *gp);
void glw_program_set_modelview(glw_backend_root_t *gbr,
const struct glw_rctx *rc);
View
4 src/ui/glw/glw_opengl_ff.c
@@ -73,7 +73,9 @@ ff_render(struct glw_root *gr,
int num_vertices,
const uint16_t *indices,
int num_triangles,
- int flags)
+ int flags,
+ glw_program_t *p,
+ const glw_rctx_t *rc)
{
glw_backend_root_t *gbr = &gr->gr_be;
float r,g,b;
View
133 src/ui/glw/glw_opengl_shaders.c
@@ -211,7 +211,9 @@ shader_render_delayed(struct glw_root *root,
int num_vertices,
const uint16_t *indices,
int num_triangles,
- int flags)
+ int flags,
+ glw_program_t *p,
+ const glw_rctx_t *rc)
{
glw_backend_root_t *gbr = &root->gr_be;
@@ -293,7 +295,6 @@ shader_render_delayed(struct glw_root *root,
}
-
/**
* Render function using OpenGL shaders
*/
@@ -309,10 +310,12 @@ shader_render(struct glw_root *root,
int num_vertices,
const uint16_t *indices,
int num_triangles,
- int flags)
+ int flags,
+ glw_program_t *p,
+ const glw_rctx_t *rc)
{
glw_backend_root_t *gbr = &root->gr_be;
- glw_program_t *gp = get_program(gbr, t0, t1, blur, flags);
+ glw_program_t *gp = p ?: get_program(gbr, t0, t1, blur, flags);
if(gp == NULL)
return;
@@ -339,6 +342,13 @@ shader_render(struct glw_root *root,
break;
}
+ if(gp->gp_uniform_time != -1)
+ glUniform1f(gp->gp_uniform_time, root->gr_time);
+
+ if(gp->gp_uniform_resolution != -1)
+ glUniform2f(gp->gp_uniform_resolution, rc->rc_width, rc->rc_height);
+
+
if(gp->gp_uniform_blur != -1 && t0 != NULL)
glUniform3f(gp->gp_uniform_blur, blur, 1.5 / t0->width, 1.5 / t0->height);
@@ -369,18 +379,15 @@ shader_render(struct glw_root *root,
/**
*
*/
-GLuint
-glw_compile_shader(const char *filename, int type)
+static GLuint
+glw_compile_shader(const char *path, int type, glw_root_t *gr)
{
char *src;
GLint v, len;
GLuint s;
- char path[PATH_MAX];
char log[4096];
- snprintf(path, sizeof(path), "%s/src/ui/glw/glsl/%s",
- showtime_dataroot(), filename);
- if((src = fa_load(path, NULL, NULL, log, sizeof(log), NULL, 0,
+ if((src = fa_load(path, NULL, gr->gr_vpaths, log, sizeof(log), NULL, 0,
NULL, NULL)) == NULL) {
TRACE(TRACE_ERROR, "glw", "Unable to load shader %s -- %s",
path, log);
@@ -408,8 +415,8 @@ glw_compile_shader(const char *filename, int type)
/**
*
*/
-glw_program_t *
-glw_make_program(glw_backend_root_t *gbr, const char *title,
+static glw_program_t *
+glw_link_program(glw_backend_root_t *gbr, const char *title,
GLuint vs, GLuint fs)
{
char log[4096];
@@ -457,7 +464,9 @@ glw_make_program(glw_backend_root_t *gbr, const char *title,
gp->gp_uniform_blend = glGetUniformLocation(p, "u_blend");
gp->gp_uniform_color_offset= glGetUniformLocation(p, "u_color_offset");
gp->gp_uniform_blur = glGetUniformLocation(p, "u_blur");
-
+ gp->gp_uniform_time = glGetUniformLocation(p, "time");
+ gp->gp_uniform_resolution = glGetUniformLocation(p, "resolution");
+
#ifdef DEBUG_SHADERS
printf("Loaded %s\n", title);
printf(" a_position = %d\n", gp->gp_attribute_position);
@@ -504,7 +513,6 @@ glw_load_program(glw_backend_root_t *gbr, glw_program_t *gp)
}
glUseProgram(gp->gp_program);
-
return 1;
}
@@ -531,6 +539,55 @@ glw_program_set_uniform_color(glw_backend_root_t *gbr,
}
+#define SHADERPATH(FILENAME) \
+ snprintf(path, sizeof(path), "%s/src/ui/glw/glsl/%s", \
+ showtime_dataroot(), FILENAME);
+
+/**
+ *
+ */
+glw_program_t *
+glw_make_program(glw_root_t *gr,
+ const char *vertex_shader,
+ const char *fragment_shader)
+{
+ GLuint vs, fs;
+ char path[512];
+ glw_program_t *p;
+
+
+ SHADERPATH("v1.glsl");
+ vs = glw_compile_shader(vertex_shader ?: path, GL_VERTEX_SHADER, gr);
+ if(vs == 0)
+ return NULL;
+ fs = glw_compile_shader(fragment_shader, GL_FRAGMENT_SHADER, gr);
+ if(fs == 0) {
+ glDeleteShader(vs);
+ return NULL;
+ }
+
+ p = glw_link_program(&gr->gr_be, "user shader", vs, fs);
+ glDeleteShader(vs);
+ glDeleteShader(fs);
+
+ return p;
+}
+
+
+
+/**
+ *
+ */
+void
+glw_destroy_program(struct glw_root *gr, struct glw_program *gp)
+{
+ if(gp == NULL)
+ return;
+ free(gp->gp_title);
+ glDeleteProgram(gp->gp_program);
+ free(gp);
+}
+
/**
*
@@ -539,35 +596,42 @@ int
glw_opengl_shaders_init(glw_root_t *gr)
{
glw_backend_root_t *gbr = &gr->gr_be;
-
+ char path[512];
GLuint vs, fs;
- vs = glw_compile_shader("v1.glsl", GL_VERTEX_SHADER);
+ SHADERPATH("v1.glsl");
+ vs = glw_compile_shader(path, GL_VERTEX_SHADER, gr);
- fs = glw_compile_shader("f_tex.glsl", GL_FRAGMENT_SHADER);
- gbr->gbr_renderer_tex = glw_make_program(gbr, "Texture", vs, fs);
+ SHADERPATH("f_tex.glsl");
+ fs = glw_compile_shader(path, GL_FRAGMENT_SHADER, gr);
+ gbr->gbr_renderer_tex = glw_link_program(gbr, "Texture", vs, fs);
glDeleteShader(fs);
- fs = glw_compile_shader("f_tex_stencil.glsl", GL_FRAGMENT_SHADER);
+ SHADERPATH("f_tex_stencil.glsl");
+ fs = glw_compile_shader(path, GL_FRAGMENT_SHADER, gr);
gbr->gbr_renderer_tex_stencil =
- glw_make_program(gbr, "TextureStencil", vs, fs);
+ glw_link_program(gbr, "TextureStencil", vs, fs);
glDeleteShader(fs);
- fs = glw_compile_shader("f_tex_blur.glsl", GL_FRAGMENT_SHADER);
- gbr->gbr_renderer_tex_blur = glw_make_program(gbr, "TextureBlur", vs, fs);
+ SHADERPATH("f_tex_blur.glsl");
+ fs = glw_compile_shader(path, GL_FRAGMENT_SHADER, gr);
+ gbr->gbr_renderer_tex_blur = glw_link_program(gbr, "TextureBlur", vs, fs);
glDeleteShader(fs);
- fs = glw_compile_shader("f_tex_stencil_blur.glsl", GL_FRAGMENT_SHADER);
+ SHADERPATH("f_tex_stencil_blur.glsl");
+ fs = glw_compile_shader(path, GL_FRAGMENT_SHADER, gr);
gbr->gbr_renderer_tex_stencil_blur =
- glw_make_program(gbr, "TextureStencilBlur", vs, fs);
+ glw_link_program(gbr, "TextureStencilBlur", vs, fs);
glDeleteShader(fs);
- fs = glw_compile_shader("f_flat.glsl", GL_FRAGMENT_SHADER);
- gbr->gbr_renderer_flat = glw_make_program(gbr, "Flat", vs, fs);
+ SHADERPATH("f_flat.glsl");
+ fs = glw_compile_shader(path, GL_FRAGMENT_SHADER, gr);
+ gbr->gbr_renderer_flat = glw_link_program(gbr, "Flat", vs, fs);
glDeleteShader(fs);
- fs = glw_compile_shader("f_flat_stencil.glsl", GL_FRAGMENT_SHADER);
- gbr->gbr_renderer_flat_stencil = glw_make_program(gbr, "FlatStencil", vs, fs);
+ SHADERPATH("f_flat_stencil.glsl");
+ fs = glw_compile_shader(path, GL_FRAGMENT_SHADER, gr);
+ gbr->gbr_renderer_flat_stencil = glw_link_program(gbr, "FlatStencil", vs, fs);
glDeleteShader(fs);
glDeleteShader(vs);
@@ -577,15 +641,18 @@ glw_opengl_shaders_init(glw_root_t *gr)
// Video renderer
- vs = glw_compile_shader("yuv2rgb_v.glsl", GL_VERTEX_SHADER);
+ SHADERPATH("yuv2rgb_v.glsl");
+ vs = glw_compile_shader(path, GL_VERTEX_SHADER, gr);
- fs = glw_compile_shader("yuv2rgb_1f_norm.glsl", GL_FRAGMENT_SHADER);
- gbr->gbr_yuv2rgb_1f = glw_make_program(gbr, "yuv2rgb_1f_norm", vs, fs);
+ SHADERPATH("yuv2rgb_1f_norm.glsl");
+ fs = glw_compile_shader(path, GL_FRAGMENT_SHADER, gr);
+ gbr->gbr_yuv2rgb_1f = glw_link_program(gbr, "yuv2rgb_1f_norm", vs, fs);
glDeleteShader(fs);
- fs = glw_compile_shader("yuv2rgb_2f_norm.glsl", GL_FRAGMENT_SHADER);
- gbr->gbr_yuv2rgb_2f = glw_make_program(gbr, "yuv2rgb_2f_norm", vs, fs);
+ SHADERPATH("yuv2rgb_2f_norm.glsl");
+ fs = glw_compile_shader(path, GL_FRAGMENT_SHADER, gr);
+ gbr->gbr_yuv2rgb_2f = glw_link_program(gbr, "yuv2rgb_2f_norm", vs, fs);
glDeleteShader(fs);
glDeleteShader(vs);
View
40 src/ui/glw/glw_primitives.c
@@ -25,6 +25,9 @@ typedef struct glw_quad {
glw_rgb_t color;
glw_renderer_t r;
+ rstr_t *fs;
+ int recompile;
+ glw_program_t *prog;
} glw_quad_t;
@@ -33,7 +36,14 @@ typedef struct glw_quad {
static void
glw_quad_render(glw_t *w, const glw_rctx_t *rc)
{
- glw_quad_t *q = (void *)w;
+ glw_quad_t *q = (glw_quad_t *)w;
+
+ if(q->recompile) {
+ glw_destroy_program(w->glw_root, q->prog);
+ q->prog = glw_make_program(w->glw_root, NULL, rstr_get(q->fs));
+ q->recompile = 0;
+ }
+
if(!glw_renderer_initialized(&q->r)) {
glw_renderer_init_quad(&q->r);
@@ -45,7 +55,8 @@ glw_quad_render(glw_t *w, const glw_rctx_t *rc)
glw_renderer_draw(&q->r, w->glw_root, rc,
NULL,
- &q->color, NULL, rc->rc_alpha * w->glw_alpha, 0);
+ &q->color, NULL, rc->rc_alpha * w->glw_alpha, 0,
+ q->prog);
}
@@ -85,12 +96,30 @@ glw_quad_set_rgb(glw_t *w, const float *rgb)
q->color.b = rgb[2];
}
+
+/**
+ *
+ */
+static void
+glw_quad_set_fs(glw_t *w, rstr_t *vs)
+{
+ glw_quad_t *q = (glw_quad_t *)w;
+ rstr_set(&q->fs, vs);
+ q->recompile = 1;
+
+}
+
+
+/**
+ *
+ */
static void
glw_quad_dtor(glw_t *w)
{
- glw_quad_t *q = (void *)w;
+ glw_quad_t *q = (glw_quad_t *)w;
glw_renderer_free(&q->r);
-
+ rstr_release(q->fs);
+ glw_destroy_program(w->glw_root, q->prog);
}
@@ -102,6 +131,7 @@ static glw_class_t glw_quad = {
.gc_signal_handler = glw_quad_callback,
.gc_set_rgb = glw_quad_set_rgb,
.gc_dtor = glw_quad_dtor,
+ .gc_set_fs = glw_quad_set_fs,
};
@@ -181,7 +211,7 @@ glw_raster_render(glw_t *w, const glw_rctx_t *rc)
}
glw_renderer_draw(&q->r, w->glw_root, rc, &q->tex,
- &q->color, NULL, rc->rc_alpha * w->glw_alpha, 0);
+ &q->color, NULL, rc->rc_alpha * w->glw_alpha, 0, NULL);
}
View
7 src/ui/glw/glw_renderer.c
@@ -901,7 +901,8 @@ glw_renderer_draw(glw_renderer_t *gr, glw_root_t *root,
const struct glw_backend_texture *tex,
const struct glw_rgb *rgb_mul,
const struct glw_rgb *rgb_off,
- float alpha, float blur)
+ float alpha, float blur,
+ glw_program_t *p)
{
rgb_mul = rgb_mul ?: &white;
@@ -926,12 +927,12 @@ glw_renderer_draw(glw_renderer_t *gr, glw_root_t *root,
root->gr_render(root, NULL, tex, root->gr_stencil_texture,
rgb_mul, rgb_off, alpha, blur,
grc->grc_vertices, grc->grc_num_vertices,
- NULL, 0, flags);
+ NULL, 0, flags, p, rc);
} else {
root->gr_render(root, rc->rc_mtx, tex, NULL, rgb_mul, rgb_off, alpha, blur,
gr->gr_vertices, gr->gr_num_vertices,
gr->gr_indices, gr->gr_num_triangles,
- flags);
+ flags, p, rc);
}
gr->gr_dirty = 0;
}
View
3  src/ui/glw/glw_renderer.h
@@ -121,6 +121,7 @@ void glw_renderer_draw(glw_renderer_t *gr, glw_root_t *root,
const struct glw_backend_texture *tex,
const struct glw_rgb *rgb_mul,
const struct glw_rgb *rgb_off,
- float alpha, float blur);
+ float alpha, float blur,
+ glw_program_t *p);
void glw_vtmp_resize(glw_root_t *gr, int num_float);
View
20 src/ui/glw/glw_rsx.c
@@ -274,7 +274,9 @@ rsx_render(struct glw_root *gr,
int num_vertices,
const uint16_t *indices,
int num_triangles,
- int flags)
+ int flags,
+ glw_program_t *p,
+ const glw_rctx_t *rc)
{
gcmContextData *ctx = gr->gr_be.be_ctx;
rsx_vp_t *rvp = gr->gr_be.be_vp_1;
@@ -492,3 +494,19 @@ void glw_frontface(struct glw_root *gr, int how)
REALITY_FRONT_FACE_CCW);
}
+/**
+ * Not implemented yet
+ */
+struct glw_program *
+glw_make_program(struct glw_root *gr,
+ const char *vertex_shader,
+ const char *fragment_shader)
+{
+ return NULL;
+}
+
+void
+glw_destroy_program(struct glw_root *gr, struct glw_program *gp)
+{
+
+}
View
4 src/ui/glw/glw_text_bitmap.c
@@ -380,14 +380,14 @@ glw_text_bitmap_render(glw_t *w, const glw_rctx_t *rc)
if(glw_is_tex_inited(&gtb->gtb_texture) && pm != NULL) {
glw_renderer_draw(&gtb->gtb_text_renderer, w->glw_root, rc,
&gtb->gtb_texture,
- &gtb->gtb_color, NULL, alpha, blur);
+ &gtb->gtb_color, NULL, alpha, blur, NULL);
}
if(gtb->gtb_paint_cursor) {
glw_root_t *gr = w->glw_root;
float a = cos((gr->gr_frames & 2047) * (360.0f / 2048.0f)) * 0.5f + 0.5f;
glw_renderer_draw(&gtb->gtb_cursor_renderer, w->glw_root, rc,
- NULL, NULL, NULL, alpha * a, blur);
+ NULL, NULL, NULL, alpha * a, blur, NULL);
}
}
View
4 src/ui/glw/glw_throbber.c
@@ -116,7 +116,7 @@ glw_throbber3d_render(glw_t *w, const glw_rctx_t *rc)
glw_Rotatef(&rc1, gt->angle - i * (360 / NUMPINS), 0, 0, 1);
glw_renderer_draw(&gt->renderer, gr, &rc1,
- NULL, NULL, NULL, alpha, 0);
+ NULL, NULL, NULL, alpha, 0, NULL);
}
glw_blendmode(gr, GLW_BLEND_NORMAL);
}
@@ -214,7 +214,7 @@ glw_throbber_render(glw_t *w, const glw_rctx_t *rc)
glw_renderer_draw(&gt->renderer, gr, &rc1,
NULL,
- &gt->color, NULL, a0 * alpha, 0);
+ &gt->color, NULL, a0 * alpha, 0, NULL);
}
}
View
2  src/ui/glw/glw_video_overlay.c
@@ -377,7 +377,7 @@ glw_video_overlay_render(glw_video_t *gv, const glw_rctx_t *frc,
glw_renderer_draw(&gvo->gvo_renderer, gr, &rc0,
&gvo->gvo_texture, NULL, NULL,
- gvo->gvo_alpha * rc0.rc_alpha, 0);
+ gvo->gvo_alpha * rc0.rc_alpha, 0, NULL);
break;
case GVO_TEXT:
View
25 src/ui/glw/glw_view_attrib.c
@@ -158,6 +158,30 @@ set_font(glw_view_eval_context_t *ec, const token_attrib_t *a,
}
+
+/**
+ *
+ */
+static int
+set_fs(glw_view_eval_context_t *ec, const token_attrib_t *a,
+ struct token *t)
+{
+ rstr_t *str;
+
+ if(t->type == TOKEN_RSTRING)
+ str = t->t_rstring;
+ else
+ str = NULL;
+
+ str = str ? fa_absolute_path(str, t->file) : NULL;
+
+ if(ec->w->glw_class->gc_set_fs != NULL)
+ ec->w->glw_class->gc_set_fs(ec->w, str);
+ rstr_release(str);
+ return 0;
+}
+
+
/**
*
*/
@@ -958,6 +982,7 @@ static const token_attrib_t attribtab[] = {
{"how", set_string, 0, set_how},
{"caption", set_caption, 0},
{"font", set_font, 0},
+ {"fragmentShader", set_fs, 0},
{"source", set_source},
{"debug", mod_flag, GLW_DEBUG, mod_flags1},
Please sign in to comment.
Something went wrong with that request. Please try again.