cocos-engine icon indicating copy to clipboard operation
cocos-engine copied to clipboard

modifications

Open yiwenxue opened this issue 3 years ago • 1 comments

merge programlib, gfx, modifications for shader offline process

Re: #

Changelog

  • merge programlib, gfx, modifications for shader offline process

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.

yiwenxue avatar Sep 22 '22 07:09 yiwenxue

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -11317,8 +11317,9 @@
             defines: __private._cocos_render_scene_core_program_lib__IDefineRecord[];
             constantMacros: string;
             uber: boolean;
         }
+        export type MacroValue = string | number | boolean;
         export const programLib: __private._cocos_render_scene_core_program_lib__ProgramLib;
         export function nearestPOT(num: number): number;
         export interface ITextureBuffer {
             texture: gfx.Texture;
@@ -26031,23 +26032,29 @@
             blocks: IBuiltin[];
             samplerTextures: IBuiltin[];
             images: IBuiltin[];
         }
+        export interface IShaderSourceCode {
+            glsl1: string;
+            glsl3: string;
+            glsl4: string;
+        }
+        export interface IShaderSourceCollection {
+            glsl1: string;
+            glsl3: string;
+            glsl4: string;
+            spv: string;
+            msl: string;
+        }
+        export interface IShaderStage {
+            stage: gfx.ShaderStageFlagBit;
+            source: IShaderSourceCode;
+            collection: IShaderSourceCollection;
+        }
         export interface IShaderInfo {
             name: string;
             hash: number;
-            glsl4: {
-                vert: string;
-                frag: string;
-            };
-            glsl3: {
-                vert: string;
-                frag: string;
-            };
-            glsl1: {
-                vert: string;
-                frag: string;
-            };
+            stages: IShaderStage[];
             builtins: {
                 globals: IBuiltinInfo;
                 locals: IBuiltinInfo;
                 statistics: Record<string, number>;
@@ -54629,16 +54636,40 @@
         export interface _cocos_render_scene_core_program_lib__IDefineRecord extends EffectAsset.IDefineInfo {
             _map: (value: any) => number;
             _offset: number;
         }
+        export interface _cocos_render_scene_core_program_lib__IMacroInfo {
+            name: string;
+            value: string;
+            isDefault: boolean;
+        }
+        export class _cocos_render_scene_core_program_lib__ShaderSource {
+            vert: gfx.ShaderStage;
+            frag: gfx.ShaderStage;
+            comp: gfx.ShaderStage;
+            getStage(stage: gfx.ShaderStageFlagBit): gfx.ShaderStage;
+        }
+        export class _cocos_render_scene_core_program_lib__ShaderCollection {
+            protected _shaderInfo: renderer.IProgramInfo;
+            protected _templateInfo: renderer.ITemplateInfo;
+            protected _templateMacros: Record<string, renderer.MacroValue>;
+            protected _defaultMacros: _cocos_render_scene_core_program_lib__IMacroInfo[];
+            protected _shaderVariants: Record<string, gfx.Shader>;
+            protected _shaderVariantSources: Record<string, _cocos_render_scene_core_program_lib__ShaderSource>;
+            constructor(shaderInfo: EffectAsset.IShaderInfo);
+            get templateInfo(): renderer.ITemplateInfo;
+            get template(): renderer.IProgramInfo;
+            getKey(defines: renderer.MacroRecord): string;
+            getShaderVariant(device: gfx.Device, macros: renderer.MacroRecord, pipeline: rendering.PipelineRuntime, key?: string): gfx.Shader;
+            getDescriptorSetLayout(device: gfx.Device, isLocal?: boolean): gfx.DescriptorSetLayout;
+            destroyShaderByDefines(defines: renderer.MacroRecord): void;
+        }
         /**
          * @en The global maintainer of all shader resources.
          * @zh 维护 shader 资源实例的全局管理器。
          */
         export class _cocos_render_scene_core_program_lib__ProgramLib {
-            protected _templates: Record<string, renderer.IProgramInfo>;
-            protected _cache: Record<string, gfx.Shader>;
-            protected _templateInfos: Record<number, renderer.ITemplateInfo>;
+            protected _shaderCollection: Record<string, _cocos_render_scene_core_program_lib__ShaderCollection>;
             register(effect: EffectAsset): void;
             /**
              * @en Register the shader template with the given info
              * @zh 注册 shader 模板。

github-actions[bot] avatar Sep 22 '22 07:09 github-actions[bot]