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

Function SplitCoordVec

shadercompiler/TextureFunctionConversionDX11.cpp:719–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

717}
718
719void SplitCoordVec( ASTNode* call, const Type& textureType, size_t coordOffset = 1 )
720{
721 switch( textureType.builtInType )
722 {
723 case OP_TEXTURE1DARRAY:
724 case OP_TEXTURE2DARRAY:
725 case OP_TEXTURE3DARRAY:
726 case OP_TEXTURECUBEARRAY: {
727 const char* xyzw = "xyzw";
728
729 auto coord = call->GetChild( coordOffset );
730 ScannerToken swizzle = ScannerToken::ID( MakeInlineString( xyzw, xyzw + coord->GetType().width - 1 ) );
731 ASTNode* dot = new ASTNode( NT_POSTFIX_EXPRESSION, coord->GetLocation(), coord->GetScope(), &swizzle );
732 dot->AddChild( coord->Copy() );
733 call->ReplaceChild( coordOffset, dot );
734
735 swizzle = ScannerToken::ID( MakeInlineString( xyzw + coord->GetType().width - 1, xyzw + coord->GetType().width ) );
736 dot = new ASTNode( NT_POSTFIX_EXPRESSION, coord->GetLocation(), coord->GetScope(), &swizzle );
737 dot->AddChild( coord->Copy() );
738
739 ScannerToken typeToken = ScannerToken::FromTokenType( OP_UINT );
740 typeToken.intValue = 1;
741 ASTNode* cast = new ASTNode( NT_CAST_EXPRESSION, coord->GetLocation(), coord->GetScope(), &typeToken );
742 cast->SetType( TypeFromTokenType( OP_UINT ) );
743 cast->AddChild( dot );
744
745 call->InsertChild( coordOffset + 1, cast );
746 break;
747 }
748 default:
749 break;
750 }
751};
752
753
754void PatchMetalBufferCalls( ParserState& state, ASTNode* node )

Callers 2

PatchMetalTextureCallFunction · 0.85
PatchMetalTextureCallsFunction · 0.85

Calls 10

MakeInlineStringFunction · 0.85
TypeFromTokenTypeFunction · 0.85
GetScopeMethod · 0.80
AddChildMethod · 0.80
CopyMethod · 0.80
ReplaceChildMethod · 0.80
InsertChildMethod · 0.80
GetChildMethod · 0.45
GetTypeMethod · 0.45
SetTypeMethod · 0.45

Tested by

no test coverage detected