-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emit a "Count" member or constant for enums #90
Comments
Do you have an example count? Counts should have been dropped in official headers long ago, because we are now using what is effectively a sparse space, with extensions bringing in unpredictable ranges. The model should be to |
AMD’s compiler has arrays the size of the number of opcodes. They recently
added suppprt for a bunch of spirv extensions and did not update the size
of that array. They maintain a count constant because the generated headers
do not.
…On Mon, Jan 21, 2019 at 15:12 John Kessenich ***@***.***> wrote:
Do you have an example count?
Counts should have been dropped in official headers long ago, because we
are now using what is effectively a sparse space, with extensions bringing
in unpredictable ranges.
The model should be to switch on values you know about, but not to make
arrays sized by enum values, which is the key reason they headers don't
provide such a count.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#90 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADBkqn4MEhtKrclfD-C2dnaivwwBaRCks5vFklOgaJpZM4aIuYa>
.
|
Just opcodes? I guess you could size the array as 2^16. Any number less than that could suddenly show up as an opcode. As you note, sizing arrays this way is quite fragile, and is the reason we don't supply a count, especially since it could be immediately obsoleted by an extension, especially a non-public extension. What about the all other enumerants? |
They have
All of these are used. In some cases, only for reflection code, but many also for codegen. |
We just found and fixed a major buffer overflow in a compiler caused by an out-of-date spirv op count constant. Looking at spirv.hpp, there is no machine-generate count enum member or constant for the various enums. This seems like an easy addition that would help prevent unfortunate bugs.
The text was updated successfully, but these errors were encountered: