Let's try this.
class UseBindlessTexturesInitializer {
public:
UseBindlessTexturesInitializer() : value_(0) {
// Do more initialization
}
bool value() const { return value_; }
private:
bool value_;
};
bool getUseBindlessTextures() {
static UseBindlessTexturesInitializer v{};
return v.value();
}
This isn't the neatest way to do this but quite easy and safe. Take a look at Is local static variable initialization thread-safe in C++11?