| 973 | } |
| 974 | |
| 975 | void HLSLCompiler::translateStatements(M4::HLSLStatement* statement) |
| 976 | { |
| 977 | while (statement != NULL) |
| 978 | { |
| 979 | if (statement->hidden) |
| 980 | { |
| 981 | statement = statement->nextStatement; |
| 982 | continue; |
| 983 | } |
| 984 | |
| 985 | m_exportLine((M4::HLSLNode*)statement); |
| 986 | |
| 987 | // TODO: flatten, unroll? |
| 988 | // translateAttributes(statement->attributes); |
| 989 | |
| 990 | if (statement->nodeType == M4::HLSLNodeType_Declaration) |
| 991 | { |
| 992 | M4::HLSLDeclaration* declaration = static_cast<M4::HLSLDeclaration*>(statement); |
| 993 | translateDeclaration(declaration); |
| 994 | |
| 995 | declaration = declaration->nextDeclaration; |
| 996 | |
| 997 | while (declaration != NULL) { |
| 998 | translateDeclaration(declaration); |
| 999 | declaration = declaration->nextDeclaration; |
| 1000 | } |
| 1001 | } |
| 1002 | else if (statement->nodeType == M4::HLSLNodeType_Struct) |
| 1003 | { |
| 1004 | M4::HLSLStruct* structure = static_cast<M4::HLSLStruct*>(statement); |
| 1005 | translateStructure(structure); |
| 1006 | } |
| 1007 | else if (statement->nodeType == M4::HLSLNodeType_Buffer) |
| 1008 | { |
| 1009 | M4::HLSLBuffer* buffer = static_cast<M4::HLSLBuffer*>(statement); |
| 1010 | M4::HLSLDeclaration* field = buffer->field; |
| 1011 | |
| 1012 | m_isInsideBuffer = true; |
| 1013 | |
| 1014 | while (field != NULL) |
| 1015 | { |
| 1016 | // just add cbuffer members as a global variables |
| 1017 | if (!field->hidden) |
| 1018 | translateDeclaration(field); |
| 1019 | field = (M4::HLSLDeclaration*)field->nextDeclaration; |
| 1020 | } |
| 1021 | |
| 1022 | m_isInsideBuffer = false; |
| 1023 | } |
| 1024 | else if (statement->nodeType == M4::HLSLNodeType_Function) |
| 1025 | { |
| 1026 | M4::HLSLFunction* function = static_cast<M4::HLSLFunction*>(statement); |
| 1027 | translateFunction(function); |
| 1028 | } |
| 1029 | else if (statement->nodeType == M4::HLSLNodeType_ExpressionStatement) |
| 1030 | { |
| 1031 | M4::HLSLExpressionStatement* expressionStatement = static_cast<M4::HLSLExpressionStatement*>(statement); |
| 1032 | translateExpression(expressionStatement->expression); |
nothing calls this directly
no outgoing calls
no test coverage detected