TODO: Nothing calling this?
| 408 | |
| 409 | // TODO: Nothing calling this? |
| 410 | bool HLSLTree::NeedsFunction(const char *name) |
| 411 | { |
| 412 | // Early out |
| 413 | if (!GetContainsString(name)) |
| 414 | return false; |
| 415 | |
| 416 | struct NeedsFunctionVisitor : HLSLTreeVisitor { |
| 417 | const char *name; |
| 418 | bool result; |
| 419 | |
| 420 | virtual ~NeedsFunctionVisitor() {} |
| 421 | |
| 422 | virtual void VisitTopLevelStatement(HLSLStatement *node) |
| 423 | { |
| 424 | if (!node->hidden) |
| 425 | HLSLTreeVisitor::VisitTopLevelStatement(node); |
| 426 | } |
| 427 | |
| 428 | virtual void VisitFunctionCall(HLSLFunctionCall *node) |
| 429 | { |
| 430 | result = result || String_Equal(name, node->function->name); |
| 431 | |
| 432 | HLSLTreeVisitor::VisitFunctionCall(node); |
| 433 | } |
| 434 | }; |
| 435 | |
| 436 | NeedsFunctionVisitor visitor; |
| 437 | visitor.name = name; |
| 438 | visitor.result = false; |
| 439 | |
| 440 | visitor.VisitRoot(m_root); |
| 441 | |
| 442 | return visitor.result; |
| 443 | } |
| 444 | |
| 445 | // Returns dimension, 0 if invalid. |
| 446 | int HLSLTree::GetExpressionValue(HLSLExpression *expression, float values[4]) |