MCPcopy Create free account
hub / github.com/crownengine/crown / parse_render_state

Method parse_render_state

src/resource/shader_resource.cpp:1905–1940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1903 }
1904
1905 s32 parse_render_state(RenderState &rs, const char *json)
1906 {
1907 // gui = { <-- You are here.
1908 // states = {
1909 // }
1910 // ...
1911 // }
1912
1913 TempAllocator4096 ta;
1914 JsonObject obj(ta);
1915 RETURN_IF_ERROR(sjson::parse_object(obj, json));
1916 s32 err = 0;
1917
1918 // Read inherit render state if any.
1919 if (json_object::has(obj, "inherit")) {
1920 RETURN_IF_ERROR(sjson::parse_string(rs._inherit, obj["inherit"]));
1921 }
1922
1923 // Read states from render state object itself; for backwards compatibility.
1924 RenderState::State states_compat;
1925 err = parse_states_compat(states_compat, obj);
1926 ENSURE_OR_RETURN(SHADER_RESOURCE, err == 0, _opts);
1927 rs.push_back_states("1", states_compat, 0u); // Always applied.
1928
1929 // Read states from new, dedicated "states" object.
1930 if (json_object::has(obj, "states")) {
1931 RenderState::State states;
1932 err = parse_states(states, obj["states"]);
1933 ENSURE_OR_RETURN(SHADER_RESOURCE, err == 0, _opts);
1934 rs.push_back_states("1", states, 1u); // Always applied.
1935
1936 err = parse_conditional_states(rs, obj["states"]);
1937 }
1938
1939 return 0;
1940 }
1941
1942 s32 parse_render_states(const char *json)
1943 {

Callers

nothing calls this directly

Calls 4

push_back_statesMethod · 0.80
parse_objectFunction · 0.50
hasFunction · 0.50
parse_stringFunction · 0.50

Tested by

no test coverage detected