vo_gpu: fix possible segfault on shader miscompile
Iterations after the first time will fail to realize that the pass was never created. This function's logic and control flow is so annoying...
This commit is contained in:
1 parent
365b1d4f3d
commit
89cdccfa6c
1 file changed
+6
-5
@@ -571,10 +571,6 @@ static bool create_pass(struct gl_shader_cache *sc, struct sc_entry *entry)
|
||||
MP_TARRAY_APPEND(sc, params.inputs, params.num_inputs, ubo_input);
|
||||
}
|
||||
|
||||
entry->pass = sc->ra->fns->renderpass_create(sc->ra, ¶ms);
|
||||
if (!entry->pass)
|
||||
goto error;
|
||||
|
||||
if (sc->ubo_size) {
|
||||
struct ra_buf_params ubo_params = {
|
||||
.type = RA_BUF_TYPE_UNIFORM,
|
||||
@@ -589,6 +585,10 @@ static bool create_pass(struct gl_shader_cache *sc, struct sc_entry *entry)
|
||||
}
|
||||
}
|
||||
|
||||
entry->pass = sc->ra->fns->renderpass_create(sc->ra, ¶ms);
|
||||
if (!entry->pass)
|
||||
goto error;
|
||||
|
||||
if (entry->pass && cache_filename) {
|
||||
bstr nc = entry->pass->params.cached_program;
|
||||
if (nc.len && !bstr_equals(params.cached_program, nc)) {
|
||||
@@ -869,7 +869,8 @@ static void gl_sc_generate(struct gl_shader_cache *sc,
|
||||
sc->error_state = true;
|
||||
MP_TARRAY_APPEND(sc, sc->entries, sc->num_entries, entry);
|
||||
}
|
||||
if (sc->error_state) {
|
||||
|
||||
if (!entry->pass) {
|
||||
sc->current_shader = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user