-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
add @SpirvType
builtin
#23326
base: master
Are you sure you want to change the base?
add @SpirvType
builtin
#23326
Conversation
I don't understand why this is a separate builtin rather than just being a new field in The fact that Your fn SpirvType(info: std.builtin.SpirvType) type {
return @SpirvType(info);
}
test {
const T1 = SpirvType(something);
const T2 = SpirvType(something_else);
comptime assert(T1 != T2); // <-- this assertion will fail
} |
The reason i made it a different builtin is because #10710 is accepted.
these types are stated as opaque in SPIR-V spec and also behaves quite similar (with an exception for allowing the
oh i thought a builtin call would always result a new zir_index. thanks |
In that case, to avoid confusion, let me just explain what that is for you. |
I don't feel good about adding SPIR-V types to the language because there are quite a few of them, and not all of them are even accepted by the SPIR-V standard. Vendors are allowed to add SPIR-V types, and so choosing a method that ties SPIR-V types to Zig causes a moving target and language bloat with types that shouldn't be there. |
This adds a new builtin to the language.
@SpirvType
makes it possible to create a few specific SPIR-V types likeOpTypeImage
andOpTypeRuntimeArray
in a global scope. the usecase can be commonly found in any shader with textures or storage buffersResolves #20550