diff options
| author | Copilot <198982749+Copilot@users.noreply.github.com> | 2025-07-15 10:11:39 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-15 10:11:39 +0000 |
| commit | d964555d2ee83fac2ba357e4ec81e2a393a7b12f (patch) | |
| tree | 2ae1591535f39a75c8231e2cf56b6492d330c820 /source/slang/hlsl.meta.slang | |
| parent | 66d915ac8ec6ab31320c8dbbb43027b33e3a69fd (diff) | |
Replace [KnownBuiltin] string-based comparisons with enum-based system (#7714)
* Initial plan
* Implement enum-based KnownBuiltin system to replace string comparisons
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Add test for enum-based KnownBuiltin system and verify functionality
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Implement enum-based KnownBuiltin system with direct integer values
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix IntVal access and update tests for new enum-based KnownBuiltin system
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Replace hardcoded KnownBuiltin integers with preprocessor enum syntax
- Updated all KnownBuiltin attributes to use $( (int)KnownBuiltinDeclName::EnumValue) syntax
- Added space between parentheses to avoid preprocessor bug: $( (int) instead of $((int)
- Updated both core.meta.slang and hlsl.meta.slang files
- Eliminates preprocessor-time integer conversion, baking enum values directly into meta files
- Maintains same functionality while using type-safe enum references
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix IDifferentiablePtr KnownBuiltin mapping regression
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Remove unused IDifferentiablePtrType enum case from KnownBuiltinDeclName
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Clean up temporary AST dump files from testing
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Replace hardcoded integer with descriptive constant in KnownBuiltin test
Replace the hardcoded [KnownBuiltin(0)] with a descriptive named constant
GEOMETRY_STREAM_APPEND_BUILTIN to improve code readability and maintainability.
The test now clearly indicates which builtin enum value is being tested.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Gangzheng Tong <gtong-nv@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gangzheng Tong <gtong-nv@users.noreply.github.com>
Co-authored-by: Gangzheng Tong <tonggangzheng@gmail.com>
Diffstat (limited to 'source/slang/hlsl.meta.slang')
| -rw-r--r-- | source/slang/hlsl.meta.slang | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index f7efc3a51..1dcb0b7d4 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -6111,7 +6111,7 @@ __magic_type(HLSLPointStreamType) __intrinsic_type($(kIROp_HLSLPointStreamType)) struct PointStream { - [KnownBuiltin("GeometryStreamAppend")] + [KnownBuiltin($( (int)KnownBuiltinDeclName::GeometryStreamAppend))] void Append(T value) { __target_switch @@ -6122,7 +6122,7 @@ struct PointStream } } - [KnownBuiltin("GeometryStreamRestart")] + [KnownBuiltin($( (int)KnownBuiltinDeclName::GeometryStreamRestart))] void RestartStrip() { __target_switch @@ -6141,7 +6141,7 @@ __magic_type(HLSLLineStreamType) __intrinsic_type($(kIROp_HLSLLineStreamType)) struct LineStream { - [KnownBuiltin("GeometryStreamAppend")] + [KnownBuiltin($( (int)KnownBuiltinDeclName::GeometryStreamAppend))] void Append(T value) { __target_switch @@ -6152,7 +6152,7 @@ struct LineStream } } - [KnownBuiltin("GeometryStreamRestart")] + [KnownBuiltin($( (int)KnownBuiltinDeclName::GeometryStreamRestart))] void RestartStrip() { __target_switch @@ -6171,7 +6171,7 @@ __magic_type(HLSLTriangleStreamType) __intrinsic_type($(kIROp_HLSLTriangleStreamType)) struct TriangleStream { - [KnownBuiltin("GeometryStreamAppend")] + [KnownBuiltin($( (int)KnownBuiltinDeclName::GeometryStreamAppend))] void Append(T value) { __target_switch @@ -6182,7 +6182,7 @@ struct TriangleStream } } - [KnownBuiltin("GeometryStreamRestart")] + [KnownBuiltin($( (int)KnownBuiltinDeclName::GeometryStreamRestart))] void RestartStrip() { __target_switch @@ -10256,7 +10256,7 @@ __generic<T : __BuiltinType> __glsl_version(450) __glsl_extension(GL_EXT_fragment_shader_barycentric) [require(glsl_hlsl_spirv, getattributeatvertex)] -[KnownBuiltin("GetAttributeAtVertex")] +[KnownBuiltin($( (int)KnownBuiltinDeclName::GetAttributeAtVertex))] [__unsafeForceInlineEarly] T GetAttributeAtVertex(__constref T attribute, uint vertexIndex) { @@ -18292,7 +18292,7 @@ void SetMeshOutputCounts(uint vertexCount, uint primitiveCount) /// and provide the values for per-mesh payload parameters. /// @return This function doesn't return. /// @category meshshading -[KnownBuiltin("DispatchMesh")] +[KnownBuiltin($( (int)KnownBuiltinDeclName::DispatchMesh))] [require(glsl_hlsl_metal_spirv, meshshading)] [noRefInline] void DispatchMesh<P>(uint threadGroupCountX, uint threadGroupCountY, uint threadGroupCountZ, __ref P meshPayload) @@ -21579,7 +21579,7 @@ uint3 cudaBlockDim() // the signature or behavior of this function should be adjusted for there). // //@hidden: -[KnownBuiltin("saturated_cooperation")] +[KnownBuiltin($( (int)KnownBuiltinDeclName::saturated_cooperation))] func saturated_cooperation<A : __BuiltinType, B, C>( cooperate : functype (A, B) -> C, fallback : functype (A, B) -> C, @@ -21610,7 +21610,7 @@ func __WaveReadLaneAtBuiltin<T : __BuiltinType>(T t, int i) -> T // waveMatch: a function to return a mask of lanes with the same input as this one // broadcast: a function which returns the value passed into it on the specified lane // -[KnownBuiltin("saturated_cooperation_using")] +[KnownBuiltin($( (int)KnownBuiltinDeclName::saturated_cooperation_using))] func saturated_cooperation_using<A, B, C>( cooperate : functype (A, B) -> C, fallback : functype (A, B) -> C, |
