int resolveBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool is_live) override { int set; if (type.getQualifier().hasSet()) set = type.getQualifier().layoutSet; else set = 0; if (type.getQualifier().hasBinding()) { if (type.getBasicType() == glslang::EbtSampler) { const glslang::TSampler& sampler = type.getSampler(); if (sampler.isImage()) return reserveSlot(set, baseImageBinding + type.getQualifier().layoutBinding); if (sampler.isPureSampler()) return reserveSlot(set, baseSamplerBinding + type.getQualifier().layoutBinding); if (sampler.isTexture()) return reserveSlot(set, baseTextureBinding + type.getQualifier().layoutBinding); } if (type.getQualifier().storage == EvqUniform) return reserveSlot(set, baseUboBinding + type.getQualifier().layoutBinding); if (type.getQualifier().storage == EvqBuffer) return reserveSlot(set, baseSsboBinding + type.getQualifier().layoutBinding); } else if (is_live && doAutoMapping) { // find free slot, the caller did make sure it passes all vars with binding // first and now all are passed that do not have a binding and needs one if (type.getBasicType() == glslang::EbtSampler) { const glslang::TSampler& sampler = type.getSampler(); if (sampler.isImage()) return getFreeSlot(set, baseImageBinding); if (sampler.isPureSampler()) return getFreeSlot(set, baseSamplerBinding); if (sampler.isTexture()) return getFreeSlot(set, baseTextureBinding); } if (type.getQualifier().storage == EvqUniform) return getFreeSlot(set, baseUboBinding); if (type.getQualifier().storage == EvqBuffer) return getFreeSlot(set, baseSsboBinding); } return -1; }
bool validateBinding(EShLanguage /*stage*/, const char* /*name*/, const glslang::TType& type, bool /*is_live*/) override { if (type.getQualifier().hasBinding()) { int set; if (type.getQualifier().hasSet()) set = type.getQualifier().layoutSet; else set = 0; if (type.getBasicType() == glslang::EbtSampler) { const glslang::TSampler& sampler = type.getSampler(); if (sampler.isPureSampler()) return checkEmpty(set, baseSamplerBinding + type.getQualifier().layoutBinding); if (sampler.isTexture()) return checkEmpty(set, baseTextureBinding + type.getQualifier().layoutBinding); } if (type.getQualifier().storage == EvqUniform) return checkEmpty(set, baseUboBinding + type.getQualifier().layoutBinding); if (type.getQualifier().storage == EvqBuffer) return checkEmpty(set, baseSsboBinding + type.getQualifier().layoutBinding); } return true; }