forked from cocos/cocos-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize shader sources build (cocos#7998)
* Optimize shader sources build * Linting * HTML5, WeChat branch * Comment
- Loading branch information
1 parent
aa3cf70
commit a069eec
Showing
5 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { HTML5, MINIGAME, RUNTIME_BASED, WECHAT } from 'internal:constants'; | ||
import glsl1 from './shader-sources/glsl1'; | ||
import glsl3 from './shader-sources/glsl3'; | ||
import glsl4 from './shader-sources/glsl4'; | ||
|
||
type ShaderVersion = | ||
| 'glsl1' | ||
| 'glsl3' | ||
| 'glsl4' | ||
; | ||
|
||
type ShaderSource = unknown[][]; | ||
|
||
/** | ||
* The shader sources assembled in this build. | ||
*/ | ||
const assembly: Partial<Record<ShaderVersion, ShaderSource>> = (() => { | ||
if (HTML5 || WECHAT) { | ||
return { | ||
glsl1, | ||
glsl3, | ||
}; | ||
} else if (MINIGAME || RUNTIME_BASED) { | ||
return { | ||
glsl1, | ||
}; | ||
} else { | ||
return { | ||
glsl1, | ||
glsl3, | ||
glsl4, | ||
}; | ||
} | ||
})(); | ||
|
||
export default assembly; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters