Skip to content
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 WebGPU BindGroupLayout data structures #18136

Merged
merged 24 commits into from
Jan 10, 2025
Merged

Conversation

star-e
Copy link
Contributor

@star-e star-e commented Jan 7, 2025

Add data structures for WebGPU BindGroupLayout

Changelog

  • Upgraded gfx.DescriptorSetLayoutBinding
  • Updated descriptor info collection in editor.

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Copy link

github-actions bot commented Jan 7, 2025

👍 Package size ⤵ -1196 bytes, old: 5272276, new: 5271080

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -8539,8 +8539,14 @@
             INT = 4,
             UFLOAT = 5,
             FLOAT = 6
         }
+        export enum SampleType {
+            FLOAT = 0,
+            UNFILTERABLE_FLOAT = 1,
+            SINT = 2,
+            UINT = 3
+        }
         export enum Type {
             UNKNOWN = 0,
             BOOL = 1,
             BOOL2 = 2,
@@ -8621,8 +8627,22 @@
             CUBE = 3,
             TEX1D_ARRAY = 4,
             TEX2D_ARRAY = 5
         }
+        export enum ViewDimension {
+            UNKNOWN = 0,
+            BUFFER = 1,
+            TEX1D = 2,
+            TEX1D_ARRAY = 3,
+            TEX2D = 4,
+            TEX2D_ARRAY = 5,
+            TEX2DMS = 6,
+            TEX2DMS_ARRAY = 7,
+            TEX3D = 8,
+            TEXCUBE = 9,
+            TEXCUBE_ARRAY = 10,
+            RAYTRACING_ACCELERATION_STRUCTURE = 11
+        }
         export enum TextureUsageBit {
             NONE = 0,
             TRANSFER_SRC = 1,
             TRANSFER_DST = 2,
@@ -9347,10 +9367,14 @@
             binding: number;
             descriptorType: DescriptorType;
             count: number;
             stageFlags: ShaderStageFlags;
+            access: MemoryAccess;
+            viewDimension: ViewDimension;
+            sampleType: SampleType;
+            format: Format;
             immutableSamplers: Sampler[];
-            constructor(binding?: number, descriptorType?: DescriptorType, count?: number, stageFlags?: ShaderStageFlags, immutableSamplers?: Sampler[]);
+            constructor(binding?: number, descriptorType?: DescriptorType, count?: number, stageFlags?: ShaderStageFlags, access?: MemoryAccess, viewDimension?: ViewDimension, sampleType?: SampleType, format?: Format, immutableSamplers?: Sampler[]);
             copy(info: Readonly<DescriptorSetLayoutBinding>): DescriptorSetLayoutBinding;
         }
         export class DescriptorSetLayoutInfo {
             bindings: DescriptorSetLayoutBinding[];
@@ -29232,8 +29256,9 @@
             name: string;
             type: gfx.Type;
             count: number;
             stageFlags: gfx.ShaderStageFlags;
+            sampleType: gfx.SampleType;
         }
         export interface ISamplerInfo {
             set: number;
             binding: number;
@@ -29247,8 +29272,9 @@
             name: string;
             type: gfx.Type;
             count: number;
             stageFlags: gfx.ShaderStageFlags;
+            sampleType: gfx.SampleType;
         }
         export interface IBufferInfo {
             binding: number;
             name: string;
@@ -35829,22 +35855,8 @@
             TEXTURE1D = 1,
             TEXTURE2D = 2,
             TEXTURE3D = 3
         }
-        export enum ViewDimension {
-            UNKNOWN = 0,
-            BUFFER = 1,
-            TEX1D = 2,
-            TEX1DARRAY = 3,
-            TEX2D = 4,
-            TEX2DARRAY = 5,
-            TEX2DMS = 6,
-            TEX2DMSARRAY = 7,
-            TEX3D = 8,
-            TEXCUBE = 9,
-            TEXCUBEARRAY = 10,
-            RAYTRACING_ACCELERATION_STRUCTURE = 11
-        }
         export enum ResourceFlags {
             NONE = 0,
             UNIFORM = 1,
             INDIRECT = 2,

@star-e star-e changed the title V3.8.6 pipeline Add WebGPU BindGroupLayout data structures Jan 9, 2025
@star-e star-e requested a review from minggo January 9, 2025 08:17
@minggo
Copy link
Contributor

minggo commented Jan 9, 2025

Please fix errors reported by clang tidy as possible.

@star-e
Copy link
Contributor Author

star-e commented Jan 9, 2025

  • Disabled misc-include-cleaner for generated files. It is too hard to tracking all includes.
  • Disabled bugprone-easily-swappable-parameters. It is difficult to avoid swappable-parameters in gfx/pipeline, such as uint32_t width, uint32_t height.
  • Force noexcept move assignment. For pmr object, move assignment is not noexcept, however, it only happens when memory allocation fails, which is extremely rare and almost unrecoverable.
  • Disabled performance-enum-size for flags. Size of flags increases fast as code evolving, so the warning is unnecessary.

@star-e star-e requested a review from minggo January 9, 2025 12:46
@star-e
Copy link
Contributor Author

star-e commented Jan 9, 2025

@cocos-robot run test cases

Copy link

github-actions bot commented Jan 9, 2025

@star-e, Please check the result of run test cases:

Task Details

Copy link

github-actions bot commented Jan 9, 2025

@star-e, Please check the result of run test cases:

Task Details

@minggo
Copy link
Contributor

minggo commented Jan 10, 2025

It seems this function + constructor(binding?: number, descriptorType?: DescriptorType, count?: number, stageFlags?: ShaderStageFlags, memoryAccessFlags?: MemoryAccess, viewDimension?: ViewDimension, sampleType?: SampleType, format?: Format, immutableSamplers?: Sampler[]); break compatibility?

@star-e
Copy link
Contributor Author

star-e commented Jan 10, 2025

It seems this function + constructor(binding?: number, descriptorType?: DescriptorType, count?: number, stageFlags?: ShaderStageFlags, memoryAccessFlags?: MemoryAccess, viewDimension?: ViewDimension, sampleType?: SampleType, format?: Format, immutableSamplers?: Sampler[]); break compatibility?

Immutable Samplers is not used in gfx. It is only supported in vulkan.
It also shouldn't be in DescriptorSetLayoutBinding. It might be refactored later.

@minggo
Copy link
Contributor

minggo commented Jan 10, 2025

Got it.

@star-e star-e merged commit 84bf9c6 into cocos:v3.8.6 Jan 10, 2025
26 checks passed
@star-e star-e deleted the v3.8.6-pipeline branch January 10, 2025 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants