Since 0 is a valid value it may come up again when our global/local frameno counts wrap around. So we either:
1. Need to allow it (proposed solution)
2. Make the value invalid and ensure 100% that it never comes up during normal operation
I am OK with (1). It allows the user to start with any initial value they want and this is in IMO a better interface since less is expected from the user and there is no opportunity for error.
That being said, I would also be happy with something like the following for approach (2):
struct FrameNumber
{
void operator++() { if (++number == invalid_value) ++number; }
int operator int() { return number; }
Since 0 is a valid value it may come up again when our global/local frameno counts wrap around. So we either:
1. Need to allow it (proposed solution)
2. Make the value invalid and ensure 100% that it never comes up during normal operation
I am OK with (1). It allows the user to start with any initial value they want and this is in IMO a better interface since less is expected from the user and there is no opportunity for error.
That being said, I would also be happy with something like the following for approach (2):
struct FrameNumber
{
void operator++() { if (++number == invalid_value) ++number; }
int operator int() { return number; }
static int const invalid_value = 0;
private:
int number = invalid_value + 1;
};
BufferBundle: :compositor_ acquire( FrameNumber frameno);