X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fsyntax.cpp;h=6c766fd758161283006de48f0cdbc09666e8d305;hb=bd8816692056230c36504dcccd76c6946dff47b1;hp=b0d462a816acc854f881f0cafd7e599953ea64af;hpb=7a16308e72aef363727b21348779673edf8e5c07;p=libs%2Fgl.git diff --git a/source/glsl/syntax.cpp b/source/glsl/syntax.cpp index b0d462a8..6c766fd7 100644 --- a/source/glsl/syntax.cpp +++ b/source/glsl/syntax.cpp @@ -73,7 +73,15 @@ Statement::Statement(): Block::Block(): - use_braces(false) + use_braces(false), + parent(0) +{ } + +Block::Block(const Block &other): + Node(other), + body(other.body), + use_braces(other.use_braces), + parent(0) { } void Block::visit(NodeVisitor &visitor) @@ -98,12 +106,42 @@ VariableReference::VariableReference(): declaration(0) { } +VariableReference::VariableReference(const VariableReference &other): + name(other.name), + declaration(0) +{ } + void VariableReference::visit(NodeVisitor &visitor) { visitor.visit(*this); } +InterfaceBlockReference::InterfaceBlockReference(): + declaration(0) +{ } + +InterfaceBlockReference::InterfaceBlockReference(const InterfaceBlockReference &other): + name(other.name), + declaration(0) +{ } + +void InterfaceBlockReference::visit(NodeVisitor &visitor) +{ + visitor.visit(*this); +} + + +MemberAccess::MemberAccess(): + declaration(0) +{ } + +MemberAccess::MemberAccess(const MemberAccess &other): + left(other.left), + member(other.member), + declaration(0) +{ } + void MemberAccess::visit(NodeVisitor &visitor) { visitor.visit(*this); @@ -131,6 +169,11 @@ Assignment::Assignment(): target_declaration(0) { } +Assignment::Assignment(const Assignment &other): + self_referencing(other.self_referencing), + target_declaration(0) +{ } + void Assignment::visit(NodeVisitor &visitor) { visitor.visit(*this); @@ -142,6 +185,13 @@ FunctionCall::FunctionCall(): constructor(false) { } +FunctionCall::FunctionCall(const FunctionCall &other): + name(other.name), + declaration(0), + constructor(other.constructor), + arguments(other.arguments) +{ } + void FunctionCall::visit(NodeVisitor &visitor) { visitor.visit(*this); @@ -196,6 +246,22 @@ VariableDeclaration::VariableDeclaration(): linked_declaration(0) { } +VariableDeclaration::VariableDeclaration(const VariableDeclaration &other): + constant(other.constant), + sampling(other.sampling), + interpolation(other.interpolation), + interface(other.interface), + precision(other.precision), + type(other.type), + type_declaration(0), + name(other.name), + array(other.array), + array_size(other.array_size), + init_expression(other.init_expression), + linked_declaration(0), + layout(other.layout) +{ } + void VariableDeclaration::visit(NodeVisitor &visitor) { visitor.visit(*this); @@ -203,11 +269,21 @@ void VariableDeclaration::visit(NodeVisitor &visitor) InterfaceBlock::InterfaceBlock(): - array(false) + array(false), + linked_block(0) { members.use_braces = true; } +InterfaceBlock::InterfaceBlock(const InterfaceBlock &other): + interface(other.interface), + name(other.name), + members(other.members), + instance_name(other.instance_name), + array(other.array), + linked_block(0) +{ } + void InterfaceBlock::visit(NodeVisitor &visitor) { visitor.visit(*this); @@ -222,7 +298,7 @@ FunctionDeclaration::FunctionDeclaration(const FunctionDeclaration &other): return_type(other.return_type), name(other.name), parameters(other.parameters), - definition(other.definition==&other ? this : other.definition), + definition(other.definition==&other ? this : 0), body(other.body) { } @@ -267,6 +343,12 @@ Stage::Stage(Stage::Type t): previous(0) { } +const char *Stage::get_stage_name(Type type) +{ + static const char *names[] = { "shared", "vertex", "geometry", "fragment" }; + return names[type]; +} + Module::Module(): shared(Stage::SHARED)