MCPcopy Create free account
hub / github.com/carbonengine/trinity / AssignTextureType

Function AssignTextureType

shadercompiler/TextureFunctionConversionDX11.cpp:96–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96static 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
136static Symbol* FindTextureToSampler( ParserState& state, ASTNode* sampler, std::map<Symbol*, SamplerToTexture>& samplers, int usedType, const ScannerToken& token )
137{

Callers 2

FindTextureToSamplerFunction · 0.85
PatchCallsFunction · 0.85

Calls 5

GetTextureTypeNameFunction · 0.85
ShowMessageMethod · 0.80
GetChildOrNullMethod · 0.80
ToStringFunction · 0.70
SetTypeMethod · 0.45

Tested by

no test coverage detected