| 1547 | } |
| 1548 | |
| 1549 | void parseTextureSupportLine(char* currentLine, uint32_t preferedGpuId) |
| 1550 | { |
| 1551 | char formatName[MAX_GPU_VENDOR_STRING_LENGTH] = {}; |
| 1552 | char ruleParameters[MAX_GPU_VENDOR_STRING_LENGTH] = {}; |
| 1553 | char formatCaps[MAX_GPU_VENDOR_STRING_LENGTH] = {}; |
| 1554 | size_t ruleLength = strcspn(currentLine, "#"); |
| 1555 | const char* pLineEnd = currentLine + ruleLength; |
| 1556 | TextureSupportRule* textureSupportRule = &gGraphicsConfigRules.mTextureSupportRules[gGraphicsConfigRules.mTextureSupportRulesCount]; |
| 1557 | *textureSupportRule = {}; |
| 1558 | |
| 1559 | char* tokens[] = { formatName, ruleParameters, formatCaps }; |
| 1560 | tokenizeLine(currentLine, pLineEnd, ";", MAX_GPU_VENDOR_STRING_LENGTH, TF_ARRAY_COUNT(tokens), tokens); |
| 1561 | char* rulesBegin = ruleParameters; |
| 1562 | textureSupportRule->imageFormat = TinyImageFormat_FromName(formatName); |
| 1563 | if (textureSupportRule->imageFormat == TinyImageFormat_UNDEFINED) |
| 1564 | { |
| 1565 | LOGF(eDEBUG, "parseTextureFormatSetting: %s is not a valid texture format'.", formatName); |
| 1566 | return; |
| 1567 | } |
| 1568 | |
| 1569 | char* textureCapCursor = formatCaps; |
| 1570 | textureCapCursor += strspn(textureCapCursor, " "); |
| 1571 | if (textureCapCursor[0] == '+') |
| 1572 | { |
| 1573 | textureSupportRule->enableCapibility = true; |
| 1574 | textureCapCursor++; |
| 1575 | } |
| 1576 | else if (textureCapCursor[0] == '-') |
| 1577 | { |
| 1578 | textureSupportRule->enableCapibility = false; |
| 1579 | textureCapCursor++; |
| 1580 | } |
| 1581 | else |
| 1582 | { |
| 1583 | LOGF(eDEBUG, "parseTextureFormatSetting: texture capability must begin with '+' or '-' in '%s'.", formatName); |
| 1584 | return; |
| 1585 | } |
| 1586 | |
| 1587 | size_t capLength = strcspn(textureCapCursor, " "); |
| 1588 | char capName[MAX_GPU_VENDOR_STRING_LENGTH] = {}; |
| 1589 | strncpy(capName, textureCapCursor, capLength); |
| 1590 | FormatCapability formatCap = stringToFormatCapability(capName); |
| 1591 | if (formatCap == FORMAT_CAP_NONE) |
| 1592 | { |
| 1593 | LOGF(eDEBUG, "parseTextureFormatSetting: texture capability invalid '%s' in %s.", capName, formatCaps); |
| 1594 | return; |
| 1595 | } |
| 1596 | textureSupportRule->formatCapability = formatCap; |
| 1597 | |
| 1598 | parseConfigurationRules(&textureSupportRule->pConfigurationRules, &textureSupportRule->comparisonRulesCount, rulesBegin, preferedGpuId); |
| 1599 | if (textureSupportRule->pConfigurationRules == NULL) |
| 1600 | { |
| 1601 | LOGF(eDEBUG, "parseTextureFormatSetting: invalid rules for Field name: '%s'.", formatName); |
| 1602 | tf_free(textureSupportRule->pConfigurationRules); |
| 1603 | } |
| 1604 | else |
| 1605 | { |
| 1606 | gGraphicsConfigRules.mTextureSupportRulesCount++; |
no test coverage detected