Skip to content

Commit c3e18a6

Browse files
committed
renderer/command_builder: be robust against shader load failure
Signed-off-by: Yuxuan Shui <[email protected]>
1 parent fda04bd commit c3e18a6

File tree

3 files changed

+2
-6
lines changed

3 files changed

+2
-6
lines changed

src/config.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,6 @@ bool load_plugin(const char *name, const char *include_dir) {
639639
return handle != NULL;
640640
}
641641

642-
struct shader_info null_shader = {0};
643-
644642
bool parse_config(options_t *opt, const char *config_file) {
645643
// clang-format off
646644
*opt = (struct options){

src/config.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ win_options_no_damage(const struct window_options *a, const struct window_option
229229
return memcmp(a, b, offsetof(struct window_options, animations)) == 0;
230230
}
231231

232-
extern struct shader_info null_shader;
233-
234232
/// Structure representing all options.
235233
typedef struct options {
236234
// === Config ===

src/renderer/command_builder.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ commands_for_window_body(struct layer *layer, struct backend_command *cmd_base,
4949
if (layer->options.corner_radius > 0) {
5050
win_region_remove_corners(w, layer->window.origin, &cmd->opaque_region);
5151
}
52-
struct shader_info *shader = &null_shader;
52+
struct shader_info *shader = NULL;
5353
if (layer->options.shader != NULL) {
5454
HASH_FIND_STR(shaders, layer->options.shader, shader);
5555
}
@@ -70,7 +70,7 @@ commands_for_window_body(struct layer *layer, struct backend_command *cmd_base,
7070
.dim = dim,
7171
.scale = layer->scale,
7272
.effective_size = layer->window.size,
73-
.shader = shader->backend_shader,
73+
.shader = shader != NULL ? shader->backend_shader : NULL,
7474
.color_inverted = layer->options.invert_color,
7575
.source_mask = NULL,
7676
.max_brightness = max_brightness,

0 commit comments

Comments
 (0)