From 400697ddba94d310047e6fc31d044b9d8e562415 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 11:17:00 +0800 Subject: [PATCH 01/13] refactor(rename): rename passEncoderRayTracing to passEncoder --- .../dependency/interface/IWebGPURayTracingDp.re | 4 ++-- .../entity/jobs/render/RenderPathTracingCPJobEntity.re | 8 ++++---- test/construct/tool/WebGPURayTracingDependencyTool.re | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/construct/domain_layer/dependency/interface/IWebGPURayTracingDp.re b/src/construct/domain_layer/dependency/interface/IWebGPURayTracingDp.re index 4d3afb2a15..c91ae8b7a6 100755 --- a/src/construct/domain_layer/dependency/interface/IWebGPURayTracingDp.re +++ b/src/construct/domain_layer/dependency/interface/IWebGPURayTracingDp.re @@ -160,7 +160,7 @@ type queryWidthDimension = int; type queryHeightDimension = int; type queryDepthDimension = int; -type passEncoderRayTracing = { +type passEncoder = { setPipeline: (rayTracingPipelineObject, passEncoderRayTracingObject) => unit, setBindGroup: (bindingPoint, bindGroupObject, passEncoderRayTracingObject) => unit, @@ -249,7 +249,7 @@ type bufferUsage = { type webgpuRayTracing = { accelerationContainer, - passEncoderRayTracing, + passEncoder, commandEncoder, device, accelerationContainerUsage, diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderPathTracingCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderPathTracingCPJobEntity.re index 76295fa3a7..1877b75512 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderPathTracingCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderPathTracingCPJobEntity.re @@ -20,7 +20,7 @@ let exec = () => { commandEncoder, ); - WebGPURayTracingDpRunAPI.unsafeGet().passEncoderRayTracing. + WebGPURayTracingDpRunAPI.unsafeGet().passEncoder. setPipeline( pipeline, rtPass, @@ -29,7 +29,7 @@ let exec = () => { PathTracingPassCPRepo.getAllStaticBindGroupData() ->ListSt.forEach( ({setSlot, bindGroup}: PassCPPOType.staticBindGroupData) => { - WebGPURayTracingDpRunAPI.unsafeGet().passEncoderRayTracing. + WebGPURayTracingDpRunAPI.unsafeGet().passEncoder. setBindGroup( setSlot, bindGroup, @@ -37,7 +37,7 @@ let exec = () => { ) }); - WebGPURayTracingDpRunAPI.unsafeGet().passEncoderRayTracing.traceRays( + WebGPURayTracingDpRunAPI.unsafeGet().passEncoder.traceRays( 0, // sbt ray-generation offset 1, // sbt ray-hit offset 2, // sbt ray-miss offset @@ -47,7 +47,7 @@ let exec = () => { rtPass, ); - WebGPURayTracingDpRunAPI.unsafeGet().passEncoderRayTracing.endPass( + WebGPURayTracingDpRunAPI.unsafeGet().passEncoder.endPass( rtPass, ); diff --git a/test/construct/tool/WebGPURayTracingDependencyTool.re b/test/construct/tool/WebGPURayTracingDependencyTool.re index a1d0a48a01..c446f424d6 100755 --- a/test/construct/tool/WebGPURayTracingDependencyTool.re +++ b/test/construct/tool/WebGPURayTracingDependencyTool.re @@ -104,7 +104,7 @@ let build = updateInstance, setSubFloat32Data, }, - passEncoderRayTracing: { + passEncoder: { setPipeline, setBindGroup, traceRays, From 2b146a76034376185889df8e3a02a2e5e76efc7a Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 13:54:50 +0800 Subject: [PATCH 02/13] chore(npm): publish npm add .npmignore --- .npmignore | 29 +++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .npmignore diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000000..30b317c448 --- /dev/null +++ b/.npmignore @@ -0,0 +1,29 @@ +.DS_Store +.merlin +.idea/ +.vscode/ +jest_0/ +reference/ +node_modules/ +mine/ + +test/ + +.github/ + +donate/ + +lib/bs/ + +lib/js/test/ + +coverage + +dist/ + +npm-debug + +.bsb.lock + +yarn.lock + diff --git a/package.json b/package.json index 4933d9605b..3215c1874a 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wonder.js", - "version": "2.0.0-alpha.2", + "version": "2.0.0-alpha.2.1", "authors": "Wonder", "description": "", "homepage": "https://github.com/Wonder-Technology/Wonder.js", From f92298b4ce2df7d182578f1acb211c8f414f5ee4 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 15:19:47 +0800 Subject: [PATCH 03/13] fix(dependency): fix IWebGPUCoreDp->passEncoderCompute->setDynamicBindGroup --- .../domain_layer/dependency/interface/IWebGPUCoreDp.re | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re b/src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re index 1350b8a674..a617632845 100755 --- a/src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re +++ b/src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re @@ -414,7 +414,7 @@ type passEncoderCompute = { setBindGroup: (bindingPoint, bindGroupObject, passEncoderComputeObject) => unit, setDynamicBindGroup: - (bindingPoint, bindGroupObject, array(int), passEncoderRenderObject) => + (bindingPoint, bindGroupObject, array(int), passEncoderComputeObject) => unit, dispatchX: (x, passEncoderComputeObject) => unit, endPass: passEncoderComputeObject => unit, From ec5b0f8253c18a6cece3c3691f0d28a244fa03eb Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 15:35:47 +0800 Subject: [PATCH 04/13] fix(cloud-picture): fix "if create gameObject(should use gameObject repo dp) before init and after prepare, will error" bug --- .../domain_layer/library/structure/Result.re | 18 +++++++++++------ .../application_layer/DirectorCPApService.re | 20 +++++++++---------- test/construct/tool/ExpectTool.re | 20 +++++++++++++------ test/run/cloud_picture/tool/DirectorCPTool.re | 1 + .../cloud_picture/unit/DirectorCPAPI_test.re | 16 ++++++++++++++- 5 files changed, 52 insertions(+), 23 deletions(-) diff --git a/src/construct/domain_layer/library/structure/Result.re b/src/construct/domain_layer/library/structure/Result.re index 29cae291ab..4113d2517c 100755 --- a/src/construct/domain_layer/library/structure/Result.re +++ b/src/construct/domain_layer/library/structure/Result.re @@ -12,18 +12,24 @@ let _buildErr = msg => msg->Exception.buildErr; let failWith = x => x->_buildErr->fail; -let either = (twoTrackInput, successFunc, failureFunc) => - switch (twoTrackInput) { +let isSuccess = result => { + switch (result) { + | Success(s) => true + | Fail(f) => false + }; +}; + +let either = (result, successFunc, failureFunc) => + switch (result) { | Success(s) => successFunc(s) | Fail(f) => failureFunc(f) }; -let bind = (twoTrackInput, switchFunc) => - either(twoTrackInput, switchFunc, fail); +let bind = (result, switchFunc) => either(result, switchFunc, fail); -let tap = (twoTrackInput, oneTrackFunc) => +let tap = (result, oneTrackFunc) => either( - twoTrackInput, + result, result => { result->oneTrackFunc->ignore; result->succeed; diff --git a/src/run/cloud_picture/application_layer/DirectorCPApService.re b/src/run/cloud_picture/application_layer/DirectorCPApService.re index bff1136cf5..b1891b80b4 100755 --- a/src/run/cloud_picture/application_layer/DirectorCPApService.re +++ b/src/run/cloud_picture/application_layer/DirectorCPApService.re @@ -15,14 +15,6 @@ let _createAndSetAllComponentPOs = () => { }); }; -let prepare = (pictureSize, sampleCount) => { - _createAndSetAllComponentPOs() - ->Result.mapSuccess(() => { - PictureCPDoService.setSize(pictureSize); - PassCPDoService.setSampleCount(sampleCount); - }); -}; - let _injectDependencies = () => { RepoDpRunAPI.set({ sceneRepo: { @@ -173,13 +165,21 @@ let _injectDependencies = () => { }); }; +let prepare = (pictureSize, sampleCount) => { + _injectDependencies(); + + _createAndSetAllComponentPOs() + ->Result.mapSuccess(() => { + PictureCPDoService.setSize(pictureSize); + PassCPDoService.setSampleCount(sampleCount); + }); +}; + let _parseAndSetPipelineStream = pipelineData => { pipelineData->PipelineRunAPI.parsePipelineData; }; let init = () => { - _injectDependencies(); - JobCPDoService.registerAllJobs(); PipelineCPDoService.getInitPipelineData()->_parseAndSetPipelineStream; diff --git a/test/construct/tool/ExpectTool.re b/test/construct/tool/ExpectTool.re index 558d5c17aa..ec07a21001 100755 --- a/test/construct/tool/ExpectTool.re +++ b/test/construct/tool/ExpectTool.re @@ -17,10 +17,18 @@ let toFail = (result, message) => { ); }; -// let toPass = () => { -// open Wonder_jest; -// open Expect; -// open! Expect.Operators; +let toPass = () => { + open Wonder_jest; + open Expect; + open! Expect.Operators; + + true->expect == true; +}; -// true->expect == true; -// }; +let judgeResult = result => { + open Wonder_jest; + open Expect; + open! Expect.Operators; + + result->Result.isSuccess->expect == true; +}; diff --git a/test/run/cloud_picture/tool/DirectorCPTool.re b/test/run/cloud_picture/tool/DirectorCPTool.re index 9d4d509deb..7bb9aec44a 100755 --- a/test/run/cloud_picture/tool/DirectorCPTool.re +++ b/test/run/cloud_picture/tool/DirectorCPTool.re @@ -38,6 +38,7 @@ let initAndUpdate = let (_, updatePipelineStream) = DirectorCPAPI.update()->Result.handleFail(handleFailFunc->Obj.magic); + PipelineTool.execPipelineStream( ~pipelineStream= initPipelineStream diff --git a/test/run/cloud_picture/unit/DirectorCPAPI_test.re b/test/run/cloud_picture/unit/DirectorCPAPI_test.re index 3a183485bc..b5b2462482 100755 --- a/test/run/cloud_picture/unit/DirectorCPAPI_test.re +++ b/test/run/cloud_picture/unit/DirectorCPAPI_test.re @@ -10,7 +10,8 @@ let _ = beforeEach(() => { sandbox := createSandbox(); - TestCPTool.init(~sandbox, ()); + + OtherConfigDpCPAPI.set({getIsDebug: () => true}); }); describe("prepare", () => { @@ -47,4 +48,17 @@ let _ = PassCPTool.getSampleCount()->expect == sampleCount; }); }); + + describe("fix bug", () => { + test( + "if create gameObject(should use gameObject repo dp) before init and after prepare, should not error", + () => { + let sampleCount = 111; + + DirectorCPTool.prepare(~sampleCount, ()); + + GameObjectRunAPI.create()->ExpectTool.judgeResult; + }, + ) + }); }); From 8e11d5afcf3e7525ebe2e54ce711740d04d156a6 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 17:03:18 +0800 Subject: [PATCH 05/13] fix(pipeline): now if one job in the pipeline stream err, it will trigger the stream's error handler --- .../service/ParseDataPipelineDoService.re | 4 -- .../integration/pipeline/pipeline_api_test.re | 38 +++++++++++++++++++ test/construct/tool/ExpectStreamTool.re | 25 ++++++++++++ test/construct/tool/PipelineTool.re | 14 ++++++- 4 files changed, 75 insertions(+), 6 deletions(-) diff --git a/src/construct/domain_layer/domain/pipeline/pipeline/service/ParseDataPipelineDoService.re b/src/construct/domain_layer/domain/pipeline/pipeline/service/ParseDataPipelineDoService.re index bf09d6125b..30c1cd1565 100755 --- a/src/construct/domain_layer/domain/pipeline/pipeline/service/ParseDataPipelineDoService.re +++ b/src/construct/domain_layer/domain/pipeline/pipeline/service/ParseDataPipelineDoService.re @@ -62,10 +62,6 @@ let parse = ({name, groups, firstGroup}) => { pipelineStream ->Obj.magic ->WonderBsMost.Most.map(_ => Result.succeed(), _) - ->WonderBsMost.Most.recoverWith( - err => {WonderBsMost.Most.just(err->Result.fail)}, - _, - ) }) }) ->Result.mapSuccess(Tuple2.create(PipelineEntity.create(name))); diff --git a/test/construct/integration/pipeline/pipeline_api_test.re b/test/construct/integration/pipeline/pipeline_api_test.re index 53439927cd..f602ba909f 100755 --- a/test/construct/integration/pipeline/pipeline_api_test.re +++ b/test/construct/integration/pipeline/pipeline_api_test.re @@ -172,5 +172,43 @@ let _ = ~message, ); }); + testPromise("if one job fail, then not exec the remain jobs", () => { + let value = ref(0); + let message = "fail"; + PipelineTool.registerJobs( + ~jobs=[ + _createJob(~jobName="fail", ~execFunc=() => { + Result.failWith(message)->WonderBsMost.Most.just + }), + _createJob(~jobName="do", ~execFunc=() => { + value := 10; + Result.succeed()->WonderBsMost.Most.just; + }), + ], + (), + ); + + ExpectStreamTool.testAfterFail( + ~execFunc= + _execPipelineStream( + ~pipelineData={ + name: "init", + firstGroup: "frame", + groups: [ + { + name: "frame", + link: Concat, + elements: [ + {name: "fail", type_: Job}, + {name: "do", type_: Job}, + ], + }, + ], + }: PipelineVOType.pipelineData, + ), + ~handleFunc=errMessage => { + (errMessage, value^)->expect == (message, 0) + }); + }); }); }); diff --git a/test/construct/tool/ExpectStreamTool.re b/test/construct/tool/ExpectStreamTool.re index a0144ac342..04a715b671 100755 --- a/test/construct/tool/ExpectStreamTool.re +++ b/test/construct/tool/ExpectStreamTool.re @@ -23,3 +23,28 @@ let toFail = (), ); }; + +let testAfterFail = + ( + ~execFunc: + ( + ~handleSuccessFunc: unit => 'a, + ~handleFailFunc: Js.Exn.t => unit=?, + unit + ) => + Js.Promise.t('a), + ~handleFunc, + ) => { + open Wonder_jest; + open Expect; + open! Expect.Operators; + + let resultMessage = ref(""); + + execFunc( + ~handleFailFunc= + err => {resultMessage := err->Js.Exn.message->OptionSt.getExn}, + ~handleSuccessFunc=() => {handleFunc(resultMessage^)}, + (), + ); +}; diff --git a/test/construct/tool/PipelineTool.re b/test/construct/tool/PipelineTool.re index aade8b7b26..b4dc286e8e 100755 --- a/test/construct/tool/PipelineTool.re +++ b/test/construct/tool/PipelineTool.re @@ -13,13 +13,23 @@ let execPipelineStream = (), ) => { pipelineStream + ->WonderBsMost.Most.recoverWith( + err => {WonderBsMost.Most.just(err->Result.fail)}, + _, + ) ->WonderBsMost.Most.tap( result => {result->Result.handleFail(handleFailFunc)->ignore}, _, ) ->WonderBsMost.Most.drain - ->Js.Promise.then_(() => handleSuccessFunc()->Js.Promise.resolve, _) - ->Js.Promise.catch(e => {Js.Promise.reject(e->Obj.magic)}, _); + ->Js.Promise.then_( + () => + { + handleSuccessFunc(); + } + ->Js.Promise.resolve, + _, + ); }; let buildEmptyPipelineData = (): PipelineVOType.pipelineData => { From 11305033b1910f7ae3bdf495e8714015f7825a8d Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 17:15:41 +0800 Subject: [PATCH 06/13] fix(cloud-picture): initWebGPUCPJobEntity should set window --- .../core/service/LoadWebGPUDoService.re | 2 +- .../entity/jobs/init/InitWebGPUCPJobEntity.re | 3 ++- .../integration/initWebGPUCPJob_test.re | 22 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.re b/src/construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.re index f0951fbeea..5b5f9854ce 100755 --- a/src/construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.re +++ b/src/construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.re @@ -34,7 +34,7 @@ let load = window => { ) ->map( swapChainFormat => { - (adapter, device, context, queue, swapChainFormat) + (window, adapter, device, context, queue, swapChainFormat) }, _, ); diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitWebGPUCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitWebGPUCPJobEntity.re index 03bb8cf7d5..c7dd92ce20 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitWebGPUCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitWebGPUCPJobEntity.re @@ -12,13 +12,14 @@ let exec = () => { }) ->WebGPUCoreRunAPI.load ->WonderBsMost.Most.map( - ((adapter, device, context, queue, swapChainFormat)) => { + ((window, adapter, device, context, queue, swapChainFormat)) => { let swapChain = WebGPUCoreDpRunAPI.unsafeGet().context.configureSwapChain( {"device": device, "format": swapChainFormat}, context, ); + WebGPUCPRepo.setWindow(window); WebGPUCPRepo.setDevice(device); WebGPUCPRepo.setAdapter(adapter); WebGPUCPRepo.setContext(context); diff --git a/test/run/cloud_picture/integration/initWebGPUCPJob_test.re b/test/run/cloud_picture/integration/initWebGPUCPJob_test.re index 5447caf28e..7882ec8d05 100755 --- a/test/run/cloud_picture/integration/initWebGPUCPJob_test.re +++ b/test/run/cloud_picture/integration/initWebGPUCPJob_test.re @@ -223,6 +223,28 @@ let _ = (), ); }); + testPromise("set window", () => { + let ( + (width, height), + (window, adapter, device, swapChainFormat, swapChain, queue, context), + ( + make, + requestAdapter, + requestDeviceStubData, + getSwapChainPreferredFormatStubData, + configureSwapChainStubData, + getContext, + getQueue, + ), + ) = + _prepare(sandbox); + + DirectorCPTool.init( + ~handleSuccessFunc= + () => {WebGPUCPTool.getWindow()->OptionSt.getExn->expect == window}, + (), + ); + }); testPromise( "set device, adapter, context, queue, swapChainFormat, swapChain", () => { let ( From fe9d97aa83f8e2091ae23f7834ebe316a0d6c979 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 18:01:36 +0800 Subject: [PATCH 07/13] refactor(rename): rename PassCPDoService->getCommonBufferSize to getCommonBufferDataSize --- .../pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re | 2 +- .../domain/pipeline/pipeline/service/PassCPDoService.re | 2 +- .../cloud_picture/integration/updatePathTracingCPJob_test.re | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re index 09558d3d60..c490d05c2b 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re @@ -401,7 +401,7 @@ let _createAndAddRayTracingBindGroup = ~binding=2, ~buffer=commonBuffer->UniformBufferVO.value, ~offset=0, - ~size=commonBufferData->PassCPDoService.getCommonBufferSize, + ~size=commonBufferData->PassCPDoService.getCommonBufferDataSize, (), ), IWebGPURayTracingDp.binding( diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/PassCPDoService.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/PassCPDoService.re index 32279f1eb6..9e040525ce 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/PassCPDoService.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/PassCPDoService.re @@ -2,7 +2,7 @@ let setSampleCount = sampleCount => { PassCPRepo.setSampleCount(sampleCount); }; -let getCommonBufferSize = commonBufferData => +let getCommonBufferDataSize = commonBufferData => commonBufferData->Js.Typed_array.Uint32Array.byteLength; let getResolutionBufferDataSize = resolutionBufferData => diff --git a/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re b/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re index 893b1966d3..32c7a6a259 100644 --- a/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re +++ b/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re @@ -1425,7 +1425,7 @@ let _ = ~buffer=commonBuffer->UniformBufferVO.value, ~offset=0, ~size= - commonBufferData->PassCPDoService.getCommonBufferSize, + commonBufferData->PassCPDoService.getCommonBufferDataSize, (), ), IWebGPURayTracingDp.binding( From 1026c935e54a432a9822a3728dc301e2a1b84144 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 18:02:52 +0800 Subject: [PATCH 08/13] fix(cloud-picture): fix InitPathTracingCPJobEntity->_createShaderBindingTable->groups --- .../pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re | 4 ++-- .../cloud_picture/integration/initPathTracingCPJob_test.re | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re index c7d8b27db3..1e59cfe116 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re @@ -271,8 +271,8 @@ let _createShaderBindingTable = device => { ~closestHitIndex=1, (), ), - IWebGPURayTracingDp.group(~type_="general", ~closestHitIndex=2, ()), - IWebGPURayTracingDp.group(~type_="general", ~closestHitIndex=3, ()), + IWebGPURayTracingDp.group(~type_="general", ~generalIndex=2, ()), + IWebGPURayTracingDp.group(~type_="general", ~generalIndex=3, ()), |], }, device, diff --git a/test/run/cloud_picture/integration/initPathTracingCPJob_test.re b/test/run/cloud_picture/integration/initPathTracingCPJob_test.re index 56ff8db378..adb7dd7eeb 100755 --- a/test/run/cloud_picture/integration/initPathTracingCPJob_test.re +++ b/test/run/cloud_picture/integration/initPathTracingCPJob_test.re @@ -215,12 +215,12 @@ let _ = ), IWebGPURayTracingDp.group( ~type_="general", - ~closestHitIndex=2, + ~generalIndex=2, (), ), IWebGPURayTracingDp.group( ~type_="general", - ~closestHitIndex=3, + ~generalIndex=3, (), ), |], From 3aa29eada20cce3e5b6fcd04dd258212b6f2b6d7 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 18:04:11 +0800 Subject: [PATCH 09/13] fix(cloud-picture): fix InitAccumulationCPJobEntity->_createAndSetPipeline->baseShaderPath --- .../pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re | 2 +- .../run/cloud_picture/integration/initAccumulationCPJob_test.re | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re index 7f227b75d9..b989924276 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re @@ -99,7 +99,7 @@ let _createAndSetBindGroup = }; let _createAndSetPipeline = (device, swapChainFormat, bindGroupLayout) => { - let baseShaderPath = "src/run/cloud_picture/domain_layer/domain/pipeline/shader/accumulation"; + let baseShaderPath = "src/run/cloud_picture/domain_layer/domain/shader/accumulation"; let vertexShaderModule = WebGPUCoreDpRunAPI.unsafeGet().device.createShaderModule( diff --git a/test/run/cloud_picture/integration/initAccumulationCPJob_test.re b/test/run/cloud_picture/integration/initAccumulationCPJob_test.re index 14eaacb81e..95621f94cd 100755 --- a/test/run/cloud_picture/integration/initAccumulationCPJob_test.re +++ b/test/run/cloud_picture/integration/initAccumulationCPJob_test.re @@ -242,7 +242,7 @@ let _ = describe("create pipeline and set to po", () => { testPromise("create all shader modules", () => { let (window, device, swapChainFormat) = _prepare(); - let baseShaderPath = "src/run/cloud_picture/domain_layer/domain/pipeline/shader/accumulation"; + let baseShaderPath = "src/run/cloud_picture/domain_layer/domain/shader/accumulation"; let buffer = WebGPUDependencyTool.createBufferObject(); let vertexGLSL = "a1"; let fragmentGLSL = "a2"; From 7f9154dee62c80dbf09a7f60c70d8e4b2fb7766a Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 18:06:12 +0800 Subject: [PATCH 10/13] fix(cloud-picture): fix InitPathTracingCPJobEntity->camera,directionLight bind group layout->visibility --- .../jobs/init/InitPathTracingCPJobEntity.re | 20 ++++++------------- .../integration/initPathTracingCPJob_test.re | 4 ++-- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re index 1e59cfe116..a84d01a590 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.re @@ -240,24 +240,20 @@ let _createShaderBindingTable = device => { { "module": rayGenShaderModule, "stage": - WebGPURayTracingDpRunAPI.unsafeGet().shaderStage. - ray_generation, + WebGPURayTracingDpRunAPI.unsafeGet().shaderStage.ray_generation, }, { "module": rayRChitShaderModule, "stage": - WebGPURayTracingDpRunAPI.unsafeGet().shaderStage. - ray_closest_hit, + WebGPURayTracingDpRunAPI.unsafeGet().shaderStage.ray_closest_hit, }, { "module": rayMissShaderModule, - "stage": - WebGPURayTracingDpRunAPI.unsafeGet().shaderStage.ray_miss, + "stage": WebGPURayTracingDpRunAPI.unsafeGet().shaderStage.ray_miss, }, { "module": rayMissShadowShaderModule, - "stage": - WebGPURayTracingDpRunAPI.unsafeGet().shaderStage.ray_miss, + "stage": WebGPURayTracingDpRunAPI.unsafeGet().shaderStage.ray_miss, }, |], "groups": [| @@ -293,9 +289,7 @@ let exec = () => { ~binding=0, ~visibility= WebGPURayTracingDpRunAPI.unsafeGet().shaderStage. - ray_generation - lor WebGPURayTracingDpRunAPI.unsafeGet().shaderStage. - ray_closest_hit, + ray_generation, ~type_="uniform-buffer", (), ), @@ -338,9 +332,7 @@ let exec = () => { ~binding=0, ~visibility= WebGPURayTracingDpRunAPI.unsafeGet().shaderStage. - ray_generation - lor WebGPURayTracingDpRunAPI.unsafeGet().shaderStage. - ray_closest_hit, + ray_closest_hit, ~type_="storage-buffer", (), ), diff --git a/test/run/cloud_picture/integration/initPathTracingCPJob_test.re b/test/run/cloud_picture/integration/initPathTracingCPJob_test.re index adb7dd7eeb..f64a575804 100755 --- a/test/run/cloud_picture/integration/initPathTracingCPJob_test.re +++ b/test/run/cloud_picture/integration/initPathTracingCPJob_test.re @@ -271,7 +271,7 @@ let _ = "entries": [| IWebGPUCoreDp.layoutBinding( ~binding=0, - ~visibility=ray_generation lor ray_closest_hit, + ~visibility=ray_generation, ~type_="uniform-buffer", (), ), @@ -324,7 +324,7 @@ let _ = "entries": [| IWebGPUCoreDp.layoutBinding( ~binding=0, - ~visibility=ray_generation lor ray_closest_hit, + ~visibility=ray_closest_hit, ~type_="storage-buffer", (), ), From 1a7bc7ef83148d6a44069e23c505b8becff2fa9d Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 18:09:10 +0800 Subject: [PATCH 11/13] fix(cloud-picture): fix InitAccumulationCPJobEntity->bind group and layout: add commonBuffer --- .../jobs/init/InitAccumulationCPJobEntity.re | 28 ++++++++++++++----- .../integration/initAccumulationCPJob_test.re | 16 +++++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re index b989924276..1a2fe7ab31 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.re @@ -28,6 +28,7 @@ let _createAndSetBindGroup = ( (resolutionBuffer, resolutionBufferData), (pixelBuffer, pixelBufferSize), + (commonBuffer, commonBufferData), (accumulationPixelBuffer, accumulationPixelBufferSize), ), ) => { @@ -37,22 +38,25 @@ let _createAndSetBindGroup = "entries": [| IWebGPUCoreDp.layoutBinding( ~binding=0, - ~visibility= - WebGPUCoreDpRunAPI.unsafeGet().shaderStage.fragment, + ~visibility=WebGPUCoreDpRunAPI.unsafeGet().shaderStage.fragment, ~type_="storage-buffer", (), ), IWebGPUCoreDp.layoutBinding( ~binding=1, - ~visibility= - WebGPUCoreDpRunAPI.unsafeGet().shaderStage.fragment, + ~visibility=WebGPUCoreDpRunAPI.unsafeGet().shaderStage.fragment, ~type_="storage-buffer", (), ), IWebGPUCoreDp.layoutBinding( ~binding=2, - ~visibility= - WebGPUCoreDpRunAPI.unsafeGet().shaderStage.fragment, + ~visibility=WebGPUCoreDpRunAPI.unsafeGet().shaderStage.fragment, + ~type_="uniform-buffer", + (), + ), + IWebGPUCoreDp.layoutBinding( + ~binding=3, + ~visibility=WebGPUCoreDpRunAPI.unsafeGet().shaderStage.fragment, ~type_="uniform-buffer", (), ), @@ -89,6 +93,13 @@ let _createAndSetBindGroup = resolutionBufferData->PassCPDoService.getResolutionBufferDataSize, (), ), + IWebGPUCoreDp.binding( + ~binding=3, + ~buffer=commonBuffer, + ~offset=0, + ~size=commonBufferData->PassCPDoService.getCommonBufferDataSize, + (), + ), |], }, device, @@ -168,9 +179,10 @@ let exec = () => { _buildAccumulationPixelBufferData(window, device) ->AccumulationPassCPRepo.setAccumulationPixelBufferData; - Tuple3.collectOption( + Tuple4.collectOption( PassCPRepo.getResolutionBufferData(), PassCPRepo.getPixelBufferData(), + PassCPRepo.getCommonBufferData(), AccumulationPassCPRepo.getAccumulationPixelBufferData(), ) ->Result.mapSuccess( @@ -178,6 +190,7 @@ let exec = () => { ( (resolutionBuffer, resolutionBufferData), (pixelBuffer, pixelBufferSize), + (commonBuffer, commonBufferData), (accumulationPixelBuffer, accumulationPixelBufferSize), ) as allBufferData, ) => { @@ -186,6 +199,7 @@ let exec = () => { ( (resolutionBuffer->UniformBufferVO.value, resolutionBufferData), (pixelBuffer->StorageBufferVO.value, pixelBufferSize), + (commonBuffer->UniformBufferVO.value, commonBufferData), ( accumulationPixelBuffer->StorageBufferVO.value, accumulationPixelBufferSize, diff --git a/test/run/cloud_picture/integration/initAccumulationCPJob_test.re b/test/run/cloud_picture/integration/initAccumulationCPJob_test.re index 95621f94cd..3f6c69e7d7 100755 --- a/test/run/cloud_picture/integration/initAccumulationCPJob_test.re +++ b/test/run/cloud_picture/integration/initAccumulationCPJob_test.re @@ -153,6 +153,12 @@ let _ = ~type_="uniform-buffer", (), ), + IWebGPUCoreDp.layoutBinding( + ~binding=3, + ~visibility=fragment, + ~type_="uniform-buffer", + (), + ), |], }, device, @@ -191,6 +197,8 @@ let _ = PassCPTool.getResolutionBufferData(); let (pixelBuffer, pixelBufferSize) = PassCPTool.getPixelBufferData(); + let (commonBuffer, commonBufferData) = + PassCPTool.getCommonBufferData(); let (accumulationPixelBuffer, accumulationPixelBufferSize) = AccumulationPassCPTool.getAccumulationPixelBufferData(); @@ -225,6 +233,14 @@ let _ = resolutionBufferData->PassCPDoService.getResolutionBufferDataSize, (), ), + IWebGPUCoreDp.binding( + ~binding=3, + ~buffer=commonBuffer->UniformBufferVO.value, + ~offset=0, + ~size= + commonBufferData->PassCPDoService.getCommonBufferDataSize, + (), + ), |], }, device, From 7dbfdc85417229eacac7c6192f77cedaee079477 Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 18:11:10 +0800 Subject: [PATCH 12/13] fix(cloud-picture): fix UpdatePathTracingCPJobEntity->bind group layout->visibility --- .../entity/jobs/update/UpdatePathTracingCPJobEntity.re | 4 +--- .../cloud_picture/integration/updatePathTracingCPJob_test.re | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re index c490d05c2b..2acaaadbcb 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.re @@ -331,9 +331,7 @@ let _createAndAddRayTracingBindGroup = IWebGPUCoreDp.layoutBinding( ~binding=2, ~visibility= - WebGPURayTracingDpRunAPI.unsafeGet().shaderStage.ray_generation - lor WebGPURayTracingDpRunAPI.unsafeGet().shaderStage. - ray_closest_hit, + WebGPURayTracingDpRunAPI.unsafeGet().shaderStage.ray_generation, ~type_="uniform-buffer", (), ), diff --git a/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re b/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re index 32c7a6a259..ba10a49bb2 100644 --- a/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re +++ b/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re @@ -1302,7 +1302,7 @@ let _ = ), IWebGPUCoreDp.layoutBinding( ~binding=2, - ~visibility=ray_generation lor ray_closest_hit, + ~visibility=ray_generation, ~type_="uniform-buffer", (), ), From 5e4a2bf5ca4257676f9261dd9a18a88bc7323a8a Mon Sep 17 00:00:00 2001 From: yyc <395976266@qq.com> Date: Mon, 14 Sep 2020 18:21:20 +0800 Subject: [PATCH 13/13] chore(npm): publish npm --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3215c1874a..10893c0612 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wonder.js", - "version": "2.0.0-alpha.2.1", + "version": "2.0.0-alpha.2.2", "authors": "Wonder", "description": "", "homepage": "https://github.com/Wonder-Technology/Wonder.js",