| 2158 | } |
| 2159 | |
| 2160 | s32 parse_bgfx_includes(BgfxShader &bgfxshader, const char *json) |
| 2161 | { |
| 2162 | if (json::type(json) == JsonValueType::STRING) { |
| 2163 | TempAllocator256 ta; |
| 2164 | DynamicString inc(ta); |
| 2165 | RETURN_IF_ERROR(sjson::parse_string(inc, json)); |
| 2166 | vector::push_back(bgfxshader._includes, inc); |
| 2167 | logw(SHADER_RESOURCE, "'includes' string format is deprecated. Use array-of-strings format instead."); |
| 2168 | return 0; |
| 2169 | } else if (json::type(json) == JsonValueType::ARRAY) { |
| 2170 | TempAllocator1024 ta; |
| 2171 | JsonArray includes(ta); |
| 2172 | |
| 2173 | RETURN_IF_ERROR(sjson::parse_array(includes, json)); |
| 2174 | |
| 2175 | for (u32 i = 0; i < array::size(includes); ++i) { |
| 2176 | DynamicString inc(ta); |
| 2177 | RETURN_IF_ERROR(sjson::parse_string(inc, includes[i])); |
| 2178 | vector::push_back(bgfxshader._includes, inc); |
| 2179 | } |
| 2180 | return 0; |
| 2181 | } |
| 2182 | |
| 2183 | RETURN_IF_FALSE(SHADER_RESOURCE, false, _opts, "'includes' must be either an array-of-strings or a string"); |
| 2184 | } |
| 2185 | |
| 2186 | s32 parse_shaders(const char *json) |
| 2187 | { |
nothing calls this directly
no test coverage detected