Remove chromium-experimental-primitive-id Now that Dawn has been updated to use the primitive-index feature name, the previous chromium-experimental-primitive-id enum can be removed. This change also marks primitive-index as experimental again temporarily to avoid accidentally shipping the feature before we get approval on the Intent to Ship. Bug: 342172182 Change-Id: I4cdc83aa4dc09e6574ea0cd4cc1cdee95bf0c4a5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/258734 Auto-Submit: Brandon Jones <bajones@chromium.org> Commit-Queue: dan sinclair <dsinclair@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org>
diff --git a/docs/tint/extensions/chromium_experimental_primitive_id.md b/docs/tint/extensions/chromium_experimental_primitive_id.md deleted file mode 100644 index 2330fda..0000000 --- a/docs/tint/extensions/chromium_experimental_primitive_id.md +++ /dev/null
@@ -1,75 +0,0 @@ -# Chromium Experimental Primitive ID - -The `chromium_experimental_primitive_id` is an experimental extension that allows the use of the -`primitive_id` builtin in fragment shaders in WGSL. - -# Status - -This extension is experimental and the syntax is being discussed. No official WebGPU specification -has been written yet. - -# Availability - -The usage is restricted to `fragment` shaders. - -| Platform | Type | Notes | -|----------|------|-------| -| SPIR-V | 32-bit integer | Requires geometry shaders, mesh shaders, or raytracing. Available as the `PrimitiveID` builtin | -| HLSL | u32 | Requires D3D10. Available as the `SV_PrimitiveID` semantic | -| GLSL | i32 | Requires GLSL 1.50 and later, ESSL 3.2. (ESSL 3.1 with GL_EXT_geometry_shader). Available as the `gl_primitiveID` builtin | -| Metal | u32 | Requires Metal 2.2 on MacOS or Metal 2.3 on iOS. Available as `[[primitive_id]]` | - -Due to the limited availability, this will need a `enable` statement to be used. For this -experimental extension it would be `enable chromium_experimental_primitive_id`. - -All of the topologies in `GPUPrimitiveTopology` are supported. (Generally, adjacency topologies would -not be supported but WebGPU does not have any adjacency topologies). - -| Topology | Primitive | -|----------|-----------| -| point-list | Each vertex is a primitive | -| line-list | Each vertex pair is a primitive | -| line-strip | Each adjacent vertex pair is a primitive | -| triangle-list | Each vertex triplet is a primitive | -| triangle-strip | Each group of 3 adjacent vertices is a primitive | - -# Specification - -This extension adds a new `builtin_value_name` entry for `primitive_id`. - -An entry is added to the _Built-in input and output values_ table: - - * _Name_: `primitive_id` - * _Stage_: `fragment` - * _Direction_: `input` - * _Type_: `u32` - * _Extension_: `chromium_experimental_primitive_id` - -* The index of the first primitive is zero, incrementing by one for each subsequent primitive. -* `primitive_id` resets to zero between each instance drawn. -* If the primitive id overflows (exceeds 2^32 – 1), it wraps to 0. (This is from HLSL, is it true for - other backends?) -* There is no support for automatically generating a primitive id for adjacent primitives. - * For an adjacent primitive, the id is only maintained for the internal non-adjacent primitives. -* The `primitive_id` value is uniform across the primitive. -* Primitive restart has no effect on the value of variables decorated with primitive_id. - * Is this true for HLSL and MSL? I can see it in the spec for GLSL and SPIR-V but haven't found - reference for HLSL or MSL. - -# Example usage - -```wgsl -@vertex fn vs_main(@builtin(primitive_id) my_id: u32) -> @builtin(position) vec4f { - return vec4f(f32(my_id)); -} -``` - -# References -* [GLSL gl_PrimitiveID](https://registry.khronos.org/OpenGL-Refpages/gl4/html/gl_PrimitiveID.xhtml) - * [GL_EXT_geometry_shader](https://registry.khronos.org/OpenGL/extensions/EXT/EXT_geometry_shader.txt) -* [ESSL gl_PrimitiveID](https://registry.khronos.org/OpenGL-Refpages/es3/html/gl_PrimitiveID.xhtml) -* [HLSL PrimitiveId](https://learn.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-input-assembler-stage-using#primitiveid) -* [HLSL SV_PrimitiveId](https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-semantics) - * [HLSL FunctionalSpec](https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm#:~:text=declaration%20for%20Shaders.-,8.17%20PrimitiveID,-PrimitiveID%20is%20a) -* [Metal p.119](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf) -* [Vulkan PrimitiveId](https://registry.khronos.org/vulkan/specs/latest/man/html/PrimitiveId.html)
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json index 630039c..ec30cfa 100644 --- a/src/dawn/dawn.json +++ b/src/dawn/dawn.json
@@ -2392,7 +2392,6 @@ {"value": 56, "name": "shared fence EGL sync", "tags": ["dawn", "native"]}, {"value": 57, "name": "dawn device allocator control", "tags": ["dawn"]}, {"value": 58, "name": "texture component swizzle", "tags": ["dawn"]}, - {"value": 59, "name": "chromium experimental primitive id", "tags": ["dawn"]}, {"value": 60, "name": "chromium experimental bindless", "tags": ["dawn"]} ] },
diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp index 0aa28c3..47d2343 100644 --- a/src/dawn/native/Device.cpp +++ b/src/dawn/native/Device.cpp
@@ -1732,8 +1732,7 @@ mWGSLAllowedFeatures.extensions.insert( tint::wgsl::Extension::kChromiumExperimentalSubgroupMatrix); } - if (mEnabledFeatures.IsEnabled(Feature::PrimitiveIndex) || - mEnabledFeatures.IsEnabled(Feature::ChromiumExperimentalPrimitiveId)) { + if (mEnabledFeatures.IsEnabled(Feature::PrimitiveIndex)) { mWGSLAllowedFeatures.extensions.insert(tint::wgsl::Extension::kPrimitiveIndex); }
diff --git a/src/dawn/native/Features.cpp b/src/dawn/native/Features.cpp index 7885c90..56f317d 100644 --- a/src/dawn/native/Features.cpp +++ b/src/dawn/native/Features.cpp
@@ -429,14 +429,10 @@ "https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/dawn/features/" "dawn_device_allocator_control.md", FeatureInfo::FeatureState::Experimental}}, - {Feature::ChromiumExperimentalPrimitiveId, - {"(Deprecated) Supports the \"enable primitive_index;\" directive in WGSL", - "https://gpuweb.github.io/gpuweb/#dom-gpufeaturename-primitive-index", - FeatureInfo::FeatureState::Experimental}}, {Feature::PrimitiveIndex, {"Supports the \"enable primitive_index;\" directive in WGSL", "https://gpuweb.github.io/gpuweb/#dom-gpufeaturename-primitive-index", - FeatureInfo::FeatureState::Stable}}, + FeatureInfo::FeatureState::Experimental}}, {Feature::ChromiumExperimentalBindless, {"Experimental support for the prototype of a bindless extension", "https://hackmd.io/@kangz/bindless-proposal", FeatureInfo::FeatureState::Experimental}}};
diff --git a/src/dawn/node/binding/Converter.cpp b/src/dawn/node/binding/Converter.cpp index 758cd11..ee55960 100644 --- a/src/dawn/node/binding/Converter.cpp +++ b/src/dawn/node/binding/Converter.cpp
@@ -1627,7 +1627,6 @@ case interop::GPUFeatureName::kTextureComponentSwizzle: out = wgpu::FeatureName::TextureComponentSwizzle; return true; - case interop::GPUFeatureName::kChromiumExperimentalPrimitiveId: case interop::GPUFeatureName::kPrimitiveIndex: out = wgpu::FeatureName::PrimitiveIndex; return true; @@ -1725,7 +1724,6 @@ case wgpu::FeatureName::DawnTexelCopyBufferRowAlignment: case wgpu::FeatureName::FlexibleTextureViews: case wgpu::FeatureName::ChromiumExperimentalBindless: - case wgpu::FeatureName::ChromiumExperimentalPrimitiveId: return false; } return false;
diff --git a/src/dawn/node/interop/DawnExtensions.idl b/src/dawn/node/interop/DawnExtensions.idl index 701aa1a..6453c2c 100644 --- a/src/dawn/node/interop/DawnExtensions.idl +++ b/src/dawn/node/interop/DawnExtensions.idl
@@ -32,7 +32,6 @@ "multi-draw-indirect", "chromium-experimental-subgroup-matrix", "texture-component-swizzle", - "chromium-experimental-primitive-id", "primitive-index", };
diff --git a/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp b/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp index e92b212..46c85ae 100644 --- a/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/dawn/tests/unittests/validation/ShaderModuleValidationTests.cpp
@@ -877,7 +877,7 @@ {"clip_distances", false, {"clip-distances"}, {}}, {"dual_source_blending", false, {"dual-source-blending"}, {}}, {"subgroups", false, {"subgroups"}, {}}, - {"primitive_index", false, {"primitive-index"}, {}}, + {"primitive_index", true, {"primitive-index"}, {}}, {"chromium_experimental_pixel_local", true, {"pixel-local-storage-coherent"}, {}}, {"chromium_disable_uniformity_analysis", true, {}, {}}, {"chromium_internal_graphite", true, {}, {}},
diff --git a/src/dawn/wire/SupportedFeatures.cpp b/src/dawn/wire/SupportedFeatures.cpp index 7014887..b7b45e9 100644 --- a/src/dawn/wire/SupportedFeatures.cpp +++ b/src/dawn/wire/SupportedFeatures.cpp
@@ -121,7 +121,6 @@ case WGPUFeatureName_TextureFormatsTier1: case WGPUFeatureName_TextureFormatsTier2: case WGPUFeatureName_TextureComponentSwizzle: - case WGPUFeatureName_ChromiumExperimentalPrimitiveId: case WGPUFeatureName_ChromiumExperimentalBindless: case WGPUFeatureName_PrimitiveIndex: return true;