forked from cocos/cocos-engine
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cab07e9
commit f5c4dee
Showing
76 changed files
with
4,123 additions
and
2,148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
*.jsb.ts | ||
**/*.ems.ts | ||
cocos/core/gfx/webgpu/**/* | ||
cocos/webgpu/**/* |
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,9 @@ | ||
declare module 'url:native/external/emscripten/webgpu/webgpu_wasm.wasm' { | ||
const url: string; | ||
export default url; | ||
} | ||
|
||
declare module 'url:native/external/emscripten/webgpu/glslang.wasm' { | ||
const url: string; | ||
export default url; | ||
} |
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,64 @@ | ||
/* | ||
Copyright (c) 2020 Xiamen Yaji Software Co., Ltd. | ||
https://www.cocos.com/ | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated engine source code (the "Software"), a limited, | ||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license | ||
to use Cocos Creator solely to develop games on your target platforms. You shall | ||
not use Cocos Creator software for developing other software or tools that's | ||
used for developing games. You are not granted to publish, distribute, | ||
sublicense, and/or sell copies of Cocos Creator. | ||
The software or tools in this License Agreement are licensed, not sold. | ||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* @packageDocumentation | ||
* @module gfx | ||
*/ | ||
|
||
import { legacyCC } from '../global-exports'; | ||
import { gfx, webgpuAdapter } from '../../webgpu/instantiated'; | ||
|
||
import './deprecated-3.0.0'; | ||
|
||
export { BlendState, PipelineStateInfo, RasterizerState, DepthStencilState, BlendTarget } from './base/pipeline-state' | ||
export * from './base/define'; | ||
export * from './device-manager'; | ||
|
||
|
||
const polyfillCC: Record<string, unknown> = { ...gfx }; | ||
polyfillCC.Device = gfx.CCWGPUDevice; | ||
polyfillCC.Swapchain = gfx.CCWGPUSwapchain; | ||
polyfillCC.Buffer = gfx.CCWGPUBuffer; | ||
polyfillCC.Texture = gfx.CCWGPUTexture; | ||
polyfillCC.Sampler = gfx.CCWGPUSampler; | ||
polyfillCC.Shader = gfx.CCWGPUShader; | ||
polyfillCC.InputAssembler = gfx.CCWGPUInputAssembler; | ||
polyfillCC.RenderPass = gfx.CCWGPURenderPass; | ||
polyfillCC.Framebuffer = gfx.CCWGPUFramebuffer; | ||
polyfillCC.DescriptorSet = gfx.CCWGPUDescriptorSet; | ||
polyfillCC.DescriptorSetLayout = gfx.CCWGPUDescriptorSetLayout; | ||
polyfillCC.PipelineLayout = gfx.CCWGPUPipelineLayout; | ||
polyfillCC.PipelineState = gfx.CCWGPUPipelineState; | ||
polyfillCC.CommandBuffer = gfx.CCWGPUCommandBuffer; | ||
polyfillCC.Queue = gfx.CCWGPUQueue; | ||
legacyCC.gfx = polyfillCC; | ||
|
||
export * from './webgpu/override'; | ||
export * from './webgpu/webgpu-define' | ||
|
||
export const WGPU_WASM = true; | ||
|
||
console.log(gfx.Device); |
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,56 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-expressions */ | ||
/* eslint-disable import/no-mutable-exports */ | ||
import { WEBGPU } from 'internal:constants'; | ||
import { gfx, promiseForWebGPUInstantiation } from '../../../webgpu/instantiated'; | ||
|
||
export let Device: any; | ||
export let WebGPUDevice: any; | ||
export let Queue: any; | ||
export let Swapchain: any; | ||
export let Buffer: any; | ||
export let Texture: any; | ||
export let Shader: any; | ||
export let Sampler: any; | ||
export let InputAssembler: any; | ||
export let RenderPass: any; | ||
export let Framebuffer: any; | ||
export let DescriptorSet: any; | ||
export let DescriptorSetLayout: any; | ||
export let PipelineLayout: any; | ||
export let PipelineState: any; | ||
export let CommandBuffer: any; | ||
export let GeneralBarrier: any; | ||
export let TextureBarrier: any; | ||
export let BufferBarrier: any; | ||
|
||
WEBGPU && promiseForWebGPUInstantiation.then(() => { | ||
Device = gfx.CCWGPUDevice; | ||
WebGPUDevice = gfx.CCWGPUDevice; | ||
Queue = gfx.CCWGPUQueue; | ||
Swapchain = gfx.CCWGPUSwapchain; | ||
Buffer = gfx.CCWGPUBuffer; | ||
Texture = gfx.CCWGPUTexture; | ||
Shader = gfx.CCWGPUShader; | ||
Sampler = gfx.CCWGPUSampler; | ||
InputAssembler = gfx.CCWGPUInputAssembler; | ||
RenderPass = gfx.CCWGPURenderPass; | ||
Framebuffer = gfx.CCWGPUFramebuffer; | ||
DescriptorSet = gfx.CCWGPUDescriptorSet; | ||
DescriptorSetLayout = gfx.CCWGPUDescriptorSetLayout; | ||
PipelineLayout = gfx.CCWGPUPipelineLayout; | ||
PipelineState = gfx.CCWGPUPipelineState; | ||
CommandBuffer = gfx.CCWGPUCommandBuffer; | ||
GeneralBarrier = gfx.WGPUGeneralBarrier; | ||
TextureBarrier = gfx.WGPUTextureBarrier; | ||
BufferBarrier = gfx.WGPUBufferBarrier; | ||
|
||
// immutable excluded | ||
[Device, Queue, Swapchain, Buffer, Texture, Shader, InputAssembler, RenderPass, Framebuffer, DescriptorSet, | ||
DescriptorSetLayout, PipelineState, CommandBuffer].forEach((ele) => { | ||
const oldDestroy = ele.prototype.destroy; | ||
ele.prototype.destroy = function () { | ||
oldDestroy.call(this); | ||
this.delete(); | ||
}; | ||
}); | ||
}); |
Oops, something went wrong.