Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
56a39221
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
56a39221
编写于
2月 14, 2022
作者:
S
sunag
提交者:
GitHub
2月 14, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WebGPU: update to latest WebGPU API (#23483)
上级
210d4202
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
18 deletion
+25
-18
examples/jsm/renderers/webgpu/WebGPUBackground.js
examples/jsm/renderers/webgpu/WebGPUBackground.js
+14
-10
examples/jsm/renderers/webgpu/WebGPURenderer.js
examples/jsm/renderers/webgpu/WebGPURenderer.js
+3
-3
examples/jsm/renderers/webgpu/WebGPUTextureUtils.js
examples/jsm/renderers/webgpu/WebGPUTextureUtils.js
+5
-3
examples/jsm/renderers/webgpu/constants.js
examples/jsm/renderers/webgpu/constants.js
+3
-2
未找到文件。
examples/jsm/renderers/webgpu/WebGPUBackground.js
浏览文件 @
56a39221
import
{
GPULoadOp
}
from
'
./constants.js
'
;
import
{
GPULoadOp
,
GPUStoreOp
}
from
'
./constants.js
'
;
import
{
Color
}
from
'
three
'
;
let
_clearAlpha
;
...
...
@@ -57,39 +57,43 @@ class WebGPUBackground {
if
(
renderer
.
autoClearColor
===
true
)
{
colorAttachment
.
loadValue
=
{
r
:
_clearColor
.
r
,
g
:
_clearColor
.
g
,
b
:
_clearColor
.
b
,
a
:
_clearAlpha
};
colorAttachment
.
clearValue
=
{
r
:
_clearColor
.
r
,
g
:
_clearColor
.
g
,
b
:
_clearColor
.
b
,
a
:
_clearAlpha
};
colorAttachment
.
loadOp
=
GPULoadOp
.
Clear
;
colorAttachment
.
storeOp
=
GPUStoreOp
.
Store
;
}
else
{
colorAttachment
.
load
Value
=
GPULoadOp
.
Load
;
colorAttachment
.
load
Op
=
GPULoadOp
.
Load
;
}
if
(
renderer
.
autoClearDepth
===
true
)
{
depthStencilAttachment
.
depthLoadValue
=
renderer
.
_clearDepth
;
depthStencilAttachment
.
depthClearValue
=
renderer
.
_clearDepth
;
depthStencilAttachment
.
depthLoadOp
=
GPULoadOp
.
Clear
;
}
else
{
depthStencilAttachment
.
depthLoad
Value
=
GPULoadOp
.
Load
;
depthStencilAttachment
.
depthLoad
Op
=
GPULoadOp
.
Load
;
}
if
(
renderer
.
autoClearStencil
===
true
)
{
depthStencilAttachment
.
stencilLoadValue
=
renderer
.
_clearStencil
;
depthStencilAttachment
.
stencilClearValue
=
renderer
.
_clearStencil
;
depthStencilAttachment
.
stencilLoadOp
=
GPULoadOp
.
Clear
;
}
else
{
depthStencilAttachment
.
stencilLoad
Value
=
GPULoadOp
.
Load
;
depthStencilAttachment
.
stencilLoad
Op
=
GPULoadOp
.
Load
;
}
}
else
{
colorAttachment
.
load
Value
=
GPULoadOp
.
Load
;
depthStencilAttachment
.
depthLoad
Value
=
GPULoadOp
.
Load
;
depthStencilAttachment
.
stencilLoad
Value
=
GPULoadOp
.
Load
;
colorAttachment
.
load
Op
=
GPULoadOp
.
Load
;
depthStencilAttachment
.
depthLoad
Op
=
GPULoadOp
.
Load
;
depthStencilAttachment
.
stencilLoad
Op
=
GPULoadOp
.
Load
;
}
...
...
examples/jsm/renderers/webgpu/WebGPURenderer.js
浏览文件 @
56a39221
...
...
@@ -193,7 +193,7 @@ class WebGPURenderer {
colorAttachments
:
[
{
view
:
null
}
],
depthStencilAttachment
:
{
depthStencilAttachment
:
{
view
:
null
,
depthStoreOp
:
GPUStoreOp
.
Store
,
stencilStoreOp
:
GPUStoreOp
.
Store
...
...
@@ -313,7 +313,7 @@ class WebGPURenderer {
// finish render pass
passEncoder
.
end
Pass
();
passEncoder
.
end
();
device
.
queue
.
submit
(
[
cmdEncoder
.
finish
()
]
);
}
...
...
@@ -620,7 +620,7 @@ class WebGPURenderer {
}
passEncoder
.
end
Pass
();
passEncoder
.
end
();
device
.
queue
.
submit
(
[
cmdEncoder
.
finish
()
]
);
}
...
...
examples/jsm/renderers/webgpu/WebGPUTextureUtils.js
浏览文件 @
56a39221
...
...
@@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import
{
GPUIndexFormat
,
GPUFilterMode
,
GPUPrimitiveTopology
}
from
'
./constants.js
'
;
import
{
GPUIndexFormat
,
GPUFilterMode
,
GPUPrimitiveTopology
,
GPULoadOp
,
GPUStoreOp
}
from
'
./constants.js
'
;
// ported from https://github.com/toji/web-texture-tool/blob/master/src/webgpu-mipmap-generator.js
...
...
@@ -145,7 +145,9 @@ fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {
const
passEncoder
=
commandEncoder
.
beginRenderPass
(
{
colorAttachments
:
[
{
view
:
dstView
,
loadValue
:
[
0
,
0
,
0
,
0
]
loadOp
:
GPULoadOp
.
Clear
,
storeOp
:
GPUStoreOp
.
Store
,
clearValue
:
[
0
,
0
,
0
,
0
]
}
]
}
);
...
...
@@ -163,7 +165,7 @@ fn main( @location( 0 ) vTex : vec2<f32> ) -> @location( 0 ) vec4<f32> {
passEncoder
.
setPipeline
(
pipeline
);
passEncoder
.
setBindGroup
(
0
,
bindGroup
);
passEncoder
.
draw
(
4
,
1
,
0
,
0
);
passEncoder
.
end
Pass
();
passEncoder
.
end
();
srcView
=
dstView
;
...
...
examples/jsm/renderers/webgpu/constants.js
浏览文件 @
56a39221
...
...
@@ -19,11 +19,12 @@ export const GPUCompareFunction = {
export
const
GPUStoreOp
=
{
Store
:
'
store
'
,
Clear
:
'
clear
'
Discard
:
'
discard
'
};
export
const
GPULoadOp
=
{
Load
:
'
load
'
Load
:
'
load
'
,
Clear
:
'
clear
'
};
export
const
GPUFrontFace
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录