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

Move classes from interface to implementation #18091

Merged
merged 4 commits into from
Dec 30, 2024

Conversation

star-e
Copy link
Contributor

@star-e star-e commented Dec 27, 2024

Descriptor layout classes belong to implementation. So they are moved from interface.

Changelog


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 Dec 27, 2024

👍 Package size ⤵ -1581 bytes, old: 5316212, new: 5314631

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -35696,16 +35696,8 @@
     }
     export namespace rendering {
         export function saveLightInfo(a: OutputArchive, v: LightInfo): void;
         export function loadLightInfo(a: InputArchive, v: LightInfo): void;
-        export function saveDescriptor(a: OutputArchive, v: Descriptor): void;
-        export function loadDescriptor(a: InputArchive, v: Descriptor): void;
-        export function saveDescriptorBlock(a: OutputArchive, v: DescriptorBlock): void;
-        export function loadDescriptorBlock(a: InputArchive, v: DescriptorBlock): void;
-        export function saveDescriptorBlockFlattened(a: OutputArchive, v: DescriptorBlockFlattened): void;
-        export function loadDescriptorBlockFlattened(a: InputArchive, v: DescriptorBlockFlattened): void;
-        export function saveDescriptorBlockIndex(a: OutputArchive, v: DescriptorBlockIndex): void;
-        export function loadDescriptorBlockIndex(a: InputArchive, v: DescriptorBlockIndex): void;
         export function saveResolvePair(a: OutputArchive, v: ResolvePair): void;
         export function loadResolvePair(a: InputArchive, v: ResolvePair): void;
         export function saveCopyPair(a: OutputArchive, v: CopyPair): void;
         export function loadCopyPair(a: InputArchive, v: CopyPair): void;
@@ -35749,8 +35741,22 @@
             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,
@@ -35817,48 +35823,8 @@
             probe: renderer.scene.ReflectionProbe | null;
             level: number;
             culledByLight: boolean;
         }
-        export const enum DescriptorTypeOrder {
-            UNIFORM_BUFFER = 0,
-            DYNAMIC_UNIFORM_BUFFER = 1,
-            SAMPLER_TEXTURE = 2,
-            SAMPLER = 3,
-            TEXTURE = 4,
-            STORAGE_BUFFER = 5,
-            DYNAMIC_STORAGE_BUFFER = 6,
-            STORAGE_IMAGE = 7,
-            INPUT_ATTACHMENT = 8
-        }
-        export class Descriptor {
-            constructor(type?: gfx.Type);
-            reset(type: gfx.Type): void;
-            type: gfx.Type;
-            count: number;
-        }
-        export class DescriptorBlock {
-            reset(): void;
-            readonly descriptors: Map<string, Descriptor>;
-            readonly uniformBlocks: Map<string, gfx.UniformBlock>;
-            capacity: number;
-            count: number;
-        }
-        export class DescriptorBlockFlattened {
-            reset(): void;
-            readonly descriptorNames: string[];
-            readonly uniformBlockNames: string[];
-            readonly descriptors: Descriptor[];
-            readonly uniformBlocks: gfx.UniformBlock[];
-            capacity: number;
-            count: number;
-        }
-        export class DescriptorBlockIndex {
-            constructor(updateFrequency?: UpdateFrequency, parameterType?: ParameterType, descriptorType?: DescriptorTypeOrder, visibility?: gfx.ShaderStageFlagBit);
-            updateFrequency: UpdateFrequency;
-            parameterType: ParameterType;
-            descriptorType: DescriptorTypeOrder;
-            visibility: gfx.ShaderStageFlagBit;
-        }
         export const enum ResolveFlags {
             NONE = 0,
             COLOR = 1,
             DEPTH = 2,
@@ -35926,12 +35892,8 @@
         export class RenderCommonObjectPool {
             constructor();
             reset(): void;
             createLightInfo(light?: renderer.scene.Light | null, level?: number, culledByLight?: boolean, probe?: renderer.scene.ReflectionProbe | null): LightInfo;
-            createDescriptor(type?: gfx.Type): Descriptor;
-            createDescriptorBlock(): DescriptorBlock;
-            createDescriptorBlockFlattened(): DescriptorBlockFlattened;
-            createDescriptorBlockIndex(updateFrequency?: UpdateFrequency, parameterType?: ParameterType, descriptorType?: DescriptorTypeOrder, visibility?: gfx.ShaderStageFlagBit): DescriptorBlockIndex;
             createResolvePair(source?: string, target?: string, resolveFlags?: ResolveFlags, mode?: gfx.ResolveMode, mode1?: gfx.ResolveMode): ResolvePair;
             createCopyPair(source?: string, target?: string, mipLevels?: number, numSlices?: number, sourceMostDetailedMip?: number, sourceFirstSlice?: number, sourcePlaneSlice?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): CopyPair;
             createUploadPair(target?: string, mipLevels?: number, numSlices?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): UploadPair;
             createMovePair(source?: string, target?: string, mipLevels?: number, numSlices?: number, targetMostDetailedMip?: number, targetFirstSlice?: number, targetPlaneSlice?: number): MovePair;

@star-e star-e requested a review from minggo December 27, 2024 08:07
@minggo minggo requested a review from dumganhar December 27, 2024 08:21
@@ -471,11 +473,101 @@ export class DescriptorSetData {
declare /*refcount*/ descriptorSet: DescriptorSet | null;
}

export class DescriptorGroupBlockData {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed to be exported to developer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refactor the types and move them into internal modules.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refactor the types and move them into internal modules.

That will be good, in that case, all properties could be mangled by adding /** @mangle */ for the classes or properties.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refactor the types and move them into internal modules.

Will you do it in this PR or other PR?

this.accessType = accessType;
this.viewDimension = viewDimension;
this.format = format;
this.capacity = capacity;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we invoke reset method in constructor? If we could, it will save some package size.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this pr, I will only move classes from types.ts to layout-graph.ts. reset will be changed in the following pr.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found implementations of constructor and reset are a bit different. For containers, constructor will assign to members while reset will only change the size to 0.

@star-e star-e changed the title add descriptor group Move classes from interface to implementation Dec 30, 2024
@star-e star-e requested review from minggo and dumganhar December 30, 2024 02:48
a.n(v.count);
}

export function loadDescriptorBlockFlattened (a: InputArchive, v: DescriptorBlockFlattened): void {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameters a & v are not detailed.
Parameter names could be mangled/minified by terser.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rename these values in another pr.

bool sevalue_to_native(const se::Value &from, cc::render::DescriptorBlockFlattened *to, se::Object *ctx); // NOLINT

template <>
bool sevalue_to_native(const se::Value &from, cc::render::DescriptorBlockIndex *to, se::Object *ctx); // NOLINT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't need these conversions now ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they are not needed now. These values are filled by serialization now.

@dumganhar dumganhar merged commit f3ee5c8 into cocos:v3.8.6 Dec 30, 2024
25 checks passed
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.

3 participants