MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / translateExpression

Method translateExpression

src/HLSLCompiler.cpp:482–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480 }
481
482 void HLSLCompiler::translateExpression(M4::HLSLExpression* expression)
483 {
484 m_exportLine((M4::HLSLNode*)expression);
485
486 if (expression->nodeType == M4::HLSLNodeType_IdentifierExpression)
487 {
488 M4::HLSLIdentifierExpression* identifierExpression = static_cast<M4::HLSLIdentifierExpression*>(expression);
489 translateIdentifierExpression(identifierExpression);
490 }
491 else if (expression->nodeType == M4::HLSLNodeType_CastingExpression)
492 {
493 M4::HLSLCastingExpression* castingExpression = static_cast<M4::HLSLCastingExpression*>(expression);
494 translateCastingExpression(castingExpression);
495 }
496 else if (expression->nodeType == M4::HLSLNodeType_ConstructorExpression)
497 {
498 M4::HLSLConstructorExpression* constructorExpression = static_cast<M4::HLSLConstructorExpression*>(expression);
499
500 // TODO: move this to translateConstructor
501 int argc = 0;
502 M4::HLSLExpression* arg = constructorExpression->argument;
503 while (arg) {
504 arg = arg->nextExpression;
505 argc++;
506 }
507
508 int index = argc-1;
509 if (argc != 0) {
510 while (index >= 0)
511 {
512 arg = constructorExpression->argument;
513 for (int i = 0; i < index; i++)
514 arg = arg->nextExpression;
515 translateExpression(arg);
516 index--;
517 }
518 }
519
520 m_generateConvert(m_convertType(constructorExpression->type), argc);
521 }
522 else if (expression->nodeType == M4::HLSLNodeType_LiteralExpression)
523 {
524 M4::HLSLLiteralExpression* literalExpression = static_cast<M4::HLSLLiteralExpression*>(expression);
525 translateLiteralExpression(literalExpression);
526 }
527 else if (expression->nodeType == M4::HLSLNodeType_UnaryExpression)
528 {
529 M4::HLSLUnaryExpression* unaryExpression = static_cast<M4::HLSLUnaryExpression*>(expression);
530 translateUnaryExpression(unaryExpression);
531 }
532 else if (expression->nodeType == M4::HLSLNodeType_BinaryExpression)
533 {
534 M4::HLSLBinaryExpression* binaryExpression = static_cast<M4::HLSLBinaryExpression*>(expression);
535
536 bool isAssign = false;
537 switch (binaryExpression->binaryOp)
538 {
539 case M4::HLSLBinaryOp_Assign:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected