| 2432 | } |
| 2433 | |
| 2434 | s32 parse_uniform_decl(UniformMetadata &um, const char *decl, CompileOptions &opts) |
| 2435 | { |
| 2436 | const char *comment; |
| 2437 | |
| 2438 | um.type = UniformType::COUNT; |
| 2439 | |
| 2440 | if (str_has_prefix(decl, "uniform")) { |
| 2441 | const char *type = skip_spaces(decl + 7); |
| 2442 | const char *name = type; |
| 2443 | |
| 2444 | while (!isspace(*name)) ++name; |
| 2445 | name = skip_spaces(name); |
| 2446 | |
| 2447 | const char *semicol = strchr(name, ';'); |
| 2448 | if (!semicol) |
| 2449 | RETURN_IF_FALSE(SHADER_RESOURCE, false, opts, "Malformed uniform declaration"); |
| 2450 | |
| 2451 | const char *name_end = name; |
| 2452 | while (name_end != semicol && !isspace(*name_end)) ++name_end; |
| 2453 | strncpy(um.name, name, name_end - name); |
| 2454 | um.name[name_end - name] = '\0'; |
| 2455 | } |
| 2456 | |
| 2457 | if ((comment = strstr(decl, "//")) != NULL) { |
| 2458 | s32 err = parse_decl_comment(um, comment, opts); |
| 2459 | ENSURE_OR_RETURN(SHADER_RESOURCE, err == 0, opts); |
| 2460 | } else { |
| 2461 | um.type = UniformType::COUNT; // Do not add to metadata. |
| 2462 | } |
| 2463 | |
| 2464 | return 0; |
| 2465 | } |
| 2466 | |
| 2467 | s32 parse_metadata(Vector<UniformMetadata> &meta, const Buffer &pp_code, CompileOptions &opts) |
| 2468 | { |
nothing calls this directly
no test coverage detected