X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Foptimize.cpp;h=6e4b56771fa3222ce778a53d37b828b5d34554cf;hp=1b9b41de20e07a63ff38cb7e6f984d7311df9664;hb=HEAD;hpb=03b2ea5c9c611cfa5f02afb49ed7e05743e691b4 diff --git a/source/glsl/optimize.cpp b/source/glsl/optimize.cpp index 1b9b41de..a35e2cd2 100644 --- a/source/glsl/optimize.cpp +++ b/source/glsl/optimize.cpp @@ -115,12 +115,16 @@ string InlineContentInjector::apply(Stage &stage, FunctionDeclaration &target_fu /* Populate referenced_names from the target function so we can rename variables from the inlined function that would conflict. Only consider - names which declared in blocks linearly related to the target block. */ + names declared in blocks linearly related to the target block. */ pass = REFERENCED; tgt_blk.visit(*this); for(const Block *b=&tgt_blk; b; b=b->parent) for(const auto &kvp: b->variables) referenced_names.insert(kvp.first); + for(const auto &kvp: stage.interface_blocks) + if(kvp.second->name.find(' ')!=string::npos) + for(const auto &kvp2: kvp.second->block_declaration->members.variables) + referenced_names.insert(kvp2.first); /* Inline and rename passes must be interleaved so used variable names are known when inlining the return statement. */ @@ -1225,6 +1229,8 @@ void UnusedTypeRemover::visit(ImageTypeDeclaration &type) { if(type.base_type) unused_nodes.erase(type.base_type); + if(type.base_image) + unused_nodes.erase(type.base_image); unused_nodes.insert(&type); }