Skip to content

Commit dc2e013

Browse files
committed
protocol: Fix missing textures on worker nodes
The network protocol hasn't seen much attention for a long time, so state sync bugs have appeared. It's not really sustainable to have to maintain protocol.c every time a node is added or the internal structs change. I need a nice minimal library that can generate serialize/deserialize code for me, I think.
1 parent 7199b03 commit dc2e013

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/lib/protocol/protocol.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,6 @@ struct world *deserialize_scene(const cJSON *in) {
773773
out->asset_path = stringCopy(asset_path->valuestring);
774774
}
775775

776-
const cJSON *background = cJSON_GetObjectItem(in, "background");
777-
if (cJSON_IsObject(background)) {
778-
out->bg_desc = deserialize_shader_node(background);
779-
out->background = build_bsdf_node((struct cr_scene *)out, out->bg_desc);
780-
}
781776
const cJSON *textures = cJSON_GetObjectItem(in, "textures");
782777
if (cJSON_IsArray(textures)) {
783778
cJSON *texture = NULL;
@@ -789,6 +784,12 @@ struct world *deserialize_scene(const cJSON *in) {
789784
}
790785
}
791786

787+
const cJSON *background = cJSON_GetObjectItem(in, "background");
788+
if (cJSON_IsObject(background)) {
789+
out->bg_desc = deserialize_shader_node(background);
790+
out->background = build_bsdf_node((struct cr_scene *)out, out->bg_desc);
791+
}
792+
792793
const cJSON *shader_buffers = cJSON_GetObjectItem(in, "shader_buffers");
793794
if (cJSON_IsArray(shader_buffers)) {
794795
cJSON *s_buffer = NULL;

0 commit comments

Comments
 (0)