Merge pull request #575 from steve-lunarg/iomap-warning-fix
Fix build warnings in iomapper.cpp, re-indent to glslang standard
This commit is contained in:
		
						commit
						e5e58cfee3
					
				@ -174,15 +174,16 @@ struct TResolverAdaptor
 | 
			
		||||
      , error(e)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    inline void operator()(TVarEntryInfo& ent)
 | 
			
		||||
    {
 | 
			
		||||
        bool isValid = resolver.validateBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live);
 | 
			
		||||
        const bool isValid = resolver.validateBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live);
 | 
			
		||||
        if (isValid) {
 | 
			
		||||
            ent.newBinding = resolver.resolveBinding(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live);
 | 
			
		||||
            ent.newSet = resolver.resolveSet(stage, ent.symbol->getName().c_str(), ent.symbol->getType(), ent.live);
 | 
			
		||||
 | 
			
		||||
            if (ent.newBinding != -1) {
 | 
			
		||||
                if (ent.newBinding >= TQualifier::layoutBindingEnd) {
 | 
			
		||||
                if (ent.newBinding >= int(TQualifier::layoutBindingEnd)) {
 | 
			
		||||
                    TString err = "mapped binding out of range: " + ent.symbol->getName();
 | 
			
		||||
 | 
			
		||||
                    infoSink.info.message(EPrefixInternalError, err.c_str());
 | 
			
		||||
@ -190,7 +191,7 @@ struct TResolverAdaptor
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (ent.newSet != -1) {
 | 
			
		||||
                if (ent.newSet >= TQualifier::layoutSetEnd) {
 | 
			
		||||
                if (ent.newSet >= int(TQualifier::layoutSetEnd)) {
 | 
			
		||||
                    TString err = "mapped set out of range: " + ent.symbol->getName();
 | 
			
		||||
 | 
			
		||||
                    infoSink.info.message(EPrefixInternalError, err.c_str());
 | 
			
		||||
@ -203,6 +204,7 @@ struct TResolverAdaptor
 | 
			
		||||
            error = true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    EShLanguage     stage;
 | 
			
		||||
    TIoMapResolver& resolver;
 | 
			
		||||
    TInfoSink&      infoSink;
 | 
			
		||||
@ -225,21 +227,25 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
 | 
			
		||||
    typedef std::vector<int> TSlotSet;
 | 
			
		||||
    typedef std::unordered_map<int, TSlotSet> TSlotSetMap;
 | 
			
		||||
    TSlotSetMap slots;
 | 
			
		||||
 | 
			
		||||
    TSlotSet::iterator findSlot(int set, int slot)
 | 
			
		||||
    {
 | 
			
		||||
        return std::lower_bound(slots[set].begin(), slots[set].end(), slot);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool checkEmpty(int set, int slot)
 | 
			
		||||
    {
 | 
			
		||||
        TSlotSet::iterator at = findSlot(set, slot);
 | 
			
		||||
        return !(at != slots[set].end() && *at == slot);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int reserveSlot(int set, int slot)
 | 
			
		||||
    {
 | 
			
		||||
        TSlotSet::iterator at = findSlot(set, slot);
 | 
			
		||||
        slots[set].insert(at, slot);
 | 
			
		||||
        return slot;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int getFreeSlot(int set, int base)
 | 
			
		||||
    {
 | 
			
		||||
        TSlotSet::iterator at = findSlot(set, base);
 | 
			
		||||
@ -252,7 +258,8 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
 | 
			
		||||
                break;
 | 
			
		||||
        return reserveSlot(set, base);
 | 
			
		||||
    }
 | 
			
		||||
  bool validateBinding(EShLanguage stage, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
 | 
			
		||||
 | 
			
		||||
    bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
 | 
			
		||||
    {
 | 
			
		||||
        if (type.getQualifier().hasBinding()) {
 | 
			
		||||
            int set;
 | 
			
		||||
@ -275,7 +282,8 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
  int resolveBinding(EShLanguage stage, const char* /*name*/, const glslang::TType& type, bool is_live) override
 | 
			
		||||
 | 
			
		||||
    int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override
 | 
			
		||||
    {
 | 
			
		||||
        int set;
 | 
			
		||||
        if (type.getQualifier().hasSet())
 | 
			
		||||
@ -313,6 +321,7 @@ struct TDefaultIoResolver : public glslang::TIoMapResolver
 | 
			
		||||
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int resolveSet(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override
 | 
			
		||||
    {
 | 
			
		||||
        if (type.getQualifier().hasSet())
 | 
			
		||||
@ -365,6 +374,7 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
 | 
			
		||||
        iter_binding_live.functions.pop_back();
 | 
			
		||||
        function->traverse(&iter_binding_live);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // sort entries by priority. see TVarEntryInfo::TOrderByPriority for info.
 | 
			
		||||
    std::sort(varMap.begin(), varMap.end(), TVarEntryInfo::TOrderByPriority());
 | 
			
		||||
 | 
			
		||||
@ -378,6 +388,7 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate &intermediate, TInfoSi
 | 
			
		||||
        TVarSetTraverser iter_iomap(intermediate, varMap);
 | 
			
		||||
        root->traverse(&iter_iomap);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return !hadError;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user