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 shader lab package and support shader framework #1610

Merged
merged 47 commits into from
Jul 21, 2023

Conversation

Sway007
Copy link
Member

@Sway007 Sway007 commented Jun 19, 2023

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Featutres:

  • Create shader directly using galacen shader code
import { ShaderLab } from "@galacean/engine-shaderlab";

// Create engine with shaderLab
const engine = await WebGLEngine.create({ canvas: "canvas", shaderLab });

......

// Create shader by galacean shader code directly!
const shader = Shader.create(galaceanShaderCode);

Example

galacean/galacean.github.io#763

@Sway007 Sway007 requested a review from GuoLei1990 June 19, 2023 07:14
@GuoLei1990 GuoLei1990 added the enhancement New feature or request label Jun 19, 2023
@Sway007 Sway007 marked this pull request as draft June 19, 2023 07:53
@GuoLei1990 GuoLei1990 marked this pull request as draft June 19, 2023 07:53
@GuoLei1990 GuoLei1990 marked this pull request as ready for review June 19, 2023 07:53
@Sway007 Sway007 marked this pull request as draft June 19, 2023 07:53
@Sway007 Sway007 added this to the 1.1 milestone Jun 19, 2023
@Sway007 Sway007 linked an issue Jun 19, 2023 that may be closed by this pull request
3 tasks
@Sway007 Sway007 requested a review from zhuxudong June 19, 2023 10:21
@Sway007 Sway007 changed the title Dev/shader lab feat(shader): add shader lab package Jun 19, 2023
@Sway007 Sway007 added shader Shader related functions design engine design engine labels Jun 19, 2023
@Sway007 Sway007 marked this pull request as ready for review June 20, 2023 07:35
@Sway007 Sway007 added the test unit test label Jun 20, 2023
@GuoLei1990 GuoLei1990 removed the engine label Jun 26, 2023
@GuoLei1990 GuoLei1990 changed the title feat(shader): add shader lab package Add shader lab package and support shader framework Jun 26, 2023

export const Enabled = createKeywordToken("Enabled");
export const SrcColorBlendFactor = createKeywordToken("SrcColorBlendFactor");
export const DestColorBlendFactor = createKeywordToken("DestColorBlendFactor");
Copy link
Member

Choose a reason for hiding this comment

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

Where to consume these variables,RenderState is in Material instead of Shader now

Copy link
Member Author

Choose a reason for hiding this comment

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

Where to consume these variables,RenderState is in Material instead of Shader now

  1. The keywords mentioned above is for shader DSL parser only, and invisible to engine user
  2. yes, the renderstate keywords should be present in subshader or pass block

Copy link
Member Author

Choose a reason for hiding this comment

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

All shader grammer rules is declared in src/parser/rules

Copy link
Member

Choose a reason for hiding this comment

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

yes,so you should put these variables from Material to Shader to enable these function

// built-in variable
export const GLPosition = createKeywordToken("gl_Position");
export const GLFragColor = createKeywordToken("gl_FragColor");

Copy link
Member

Choose a reason for hiding this comment

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

miss gl_FragCoord, gl_FragDepth, gl_FragData and so on,may be you can refer to this document:https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf

Copy link
Member Author

Choose a reason for hiding this comment

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

miss gl_FragCoord, gl_FragDepth, gl_FragData and so on,may be you can refer to this document:https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf

Complementation of all glsl keywords is not the key aim of this pull request, plan to do it in next iteration.

@Sway007 Sway007 requested a review from GuoLei1990 July 19, 2023 07:20
@Sway007 Sway007 requested a review from GuoLei1990 July 21, 2023 02:43
@GuoLei1990 GuoLei1990 merged commit fbd5e82 into galacean:dev/1.1 Jul 21, 2023
5 checks passed
GuoLei1990 added a commit to GuoLei1990/galacean-engine that referenced this pull request Aug 2, 2023
* dev/1.1: (48 commits)
  fix: skin mesh error (galacean#1675)
  fix: test error (galacean#1674)
  test: fix github test (galacean#1669)
  test: fix ci not work (galacean#1670)
  glTF support basisu (galacean#1662)
  fix: `EventDispatcher` static pool bug
  fix: eventdispatcher bug (galacean#1671)
  fix: animation event bug (galacean#1666)
  Shader pass support blend (galacean#1668)
  Fix model mesh advanced data write bug (galacean#1663)
  Cherry pick glTF conflict (galacean#1660)
  Fix worker status set error and can't throw error bug (galacean#1652)
  Fix parse glTF texture wrap & filterMode bug (galacean#1659)
  Add shader lab package and support shader framework (galacean#1610)
  Fix text wrap bug (galacean#1644)
  chore: use strict error msg and type (galacean#1647)
  Fix text error for set text to "" and set enableWrapping to true (galacean#1634)
  "v1.0.0-beta.17"
  Process GLTFBufferParser and GLTFTextureParser pipelines in parallel (galacean#1638)
  Fix animation clip loader, clip change promise to assetPromise, controller json parse (galacean#1506)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request shader Shader related functions test unit test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shader framework
3 participants