| 94 | } |
| 95 | |
| 96 | static bool AssignTextureType( ParserState& state, Symbol* texture, int type, const ScannerToken& token ) |
| 97 | { |
| 98 | switch( texture->type.builtInType ) |
| 99 | { |
| 100 | case OP_TEXTURE1D: |
| 101 | case OP_TEXTURE2D: |
| 102 | case OP_TEXTURE3D: |
| 103 | case OP_TEXTURECUBE: |
| 104 | if( texture->type.builtInType != type ) |
| 105 | { |
| 106 | state.ShowMessage( token.fileLocation, EC_MISMATCHED_TEXTURE_TYPE, ToString( texture->name ).c_str(), GetTextureTypeName( texture->type.builtInType ), GetTextureTypeName( type ) ); |
| 107 | texture->type.builtInType = type; |
| 108 | if( texture->definition ) |
| 109 | { |
| 110 | ASTNode* textureType = texture->definition->GetChildOrNull( 0 ); |
| 111 | if( textureType ) |
| 112 | { |
| 113 | textureType->SetType( texture->type ); |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | break; |
| 118 | case OP_TEXTURE: |
| 119 | texture->type.builtInType = type; |
| 120 | if( texture->definition ) |
| 121 | { |
| 122 | ASTNode* textureType = texture->definition->GetChildOrNull( 0 ); |
| 123 | if( textureType ) |
| 124 | { |
| 125 | textureType->SetType( texture->type ); |
| 126 | } |
| 127 | } |
| 128 | break; |
| 129 | default: |
| 130 | state.ShowMessage( token.fileLocation, EC_NO_OVERRIDE, ToString( token.stringValue ).c_str(), "" ); |
| 131 | return false; |
| 132 | } |
| 133 | return true; |
| 134 | } |
| 135 | |
| 136 | static Symbol* FindTextureToSampler( ParserState& state, ASTNode* sampler, std::map<Symbol*, SamplerToTexture>& samplers, int usedType, const ScannerToken& token ) |
| 137 | { |
no test coverage detected