diff --git a/.cz-config.js b/.cz-config.js index 222ccc44b4..41b85884ea 100755 --- a/.cz-config.js +++ b/.cz-config.js @@ -18,6 +18,7 @@ module.exports = { { name: "scene" }, { name: "gameObject" }, { name: "transform" }, + { name: "geometry" }, { name: "pipeline" }, { name: "dependency" }, { name: "cloud-picture" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index 48b7256037..0aa7ee14f8 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,37 @@ + +# [2.0.0-alpha.3](https://github.com/Wonder-Technology/Wonder.js/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2020-09-16) + + +### Bug Fixes + +* **cloud-picture:** fix "if create gameObject(should use gameObject repo dp) before init and after prepare, will error" bug ([ec5b0f8](https://github.com/Wonder-Technology/Wonder.js/commit/ec5b0f8)) +* **cloud-picture:** fix glsl ([2346c0a](https://github.com/Wonder-Technology/Wonder.js/commit/2346c0a)) +* **cloud-picture:** fix glsl ([d808234](https://github.com/Wonder-Technology/Wonder.js/commit/d808234)) +* **cloud-picture:** fix glsl ([540c991](https://github.com/Wonder-Technology/Wonder.js/commit/540c991)) +* **cloud-picture:** fix InitAccumulationCPJobEntity->_createAndSetPipeline->baseShaderPath ([3aa29ea](https://github.com/Wonder-Technology/Wonder.js/commit/3aa29ea)) +* **cloud-picture:** fix InitAccumulationCPJobEntity->bind group and layout: add commonBuffer ([1a7bc7e](https://github.com/Wonder-Technology/Wonder.js/commit/1a7bc7e)) +* **cloud-picture:** fix InitPathTracingCPJobEntity->_createShaderBindingTable->groups ([1026c93](https://github.com/Wonder-Technology/Wonder.js/commit/1026c93)) +* **cloud-picture:** fix InitPathTracingCPJobEntity->camera,directionLight bind group layout->visibility ([7f9154d](https://github.com/Wonder-Technology/Wonder.js/commit/7f9154d)) +* **cloud-picture:** fix maxPayloadSize ([7facf78](https://github.com/Wonder-Technology/Wonder.js/commit/7facf78)) +* **cloud-picture:** fix UpdatePathTracingCPJobEntity->_buildAndSetPointIndexBufferData->set vertexIndex data ([e670a46](https://github.com/Wonder-Technology/Wonder.js/commit/e670a46)) +* **cloud-picture:** fix UpdatePathTracingCPJobEntity->_buildAndSetSceneDescBufferData->set localToWorldMatrix data ([da96b11](https://github.com/Wonder-Technology/Wonder.js/commit/da96b11)) +* **cloud-picture:** fix UpdatePathTracingCPJobEntity->bind group layout->visibility ([7dbfdc8](https://github.com/Wonder-Technology/Wonder.js/commit/7dbfdc8)) +* **cloud-picture:** fix UpdatePathTracingCPJobEntity->set vertex buffer's and index buffer's data ([eb74b19](https://github.com/Wonder-Technology/Wonder.js/commit/eb74b19)) +* **cloud-picture:** initWebGPUCPJobEntity should set window ([1130503](https://github.com/Wonder-Technology/Wonder.js/commit/1130503)) +* **cloud-picture:** move "build all path tracing buffer data" to UpdateTransformCPJobEntity ([adcd873](https://github.com/Wonder-Technology/Wonder.js/commit/adcd873)) +* **cloud-picture:** the index buffer's data should be new type arr! ([46f39f0](https://github.com/Wonder-Technology/Wonder.js/commit/46f39f0)) +* **dependency:** fix IWebGPUCoreDp->passEncoderCompute->setDynamicBindGroup ([f92298b](https://github.com/Wonder-Technology/Wonder.js/commit/f92298b)) +* **dependency:** fix IWebGPUCoreDp->pollEvents type ([fc070bc](https://github.com/Wonder-Technology/Wonder.js/commit/fc070bc)) +* **pipeline:** now if one job in the pipeline stream err, it will trigger the stream's error handler ([8e11d5a](https://github.com/Wonder-Technology/Wonder.js/commit/8e11d5a)) + + +### Features + +* **geometry:** GeometryRunAPI add createPlaneGeometry api ([9bfb1bb](https://github.com/Wonder-Technology/Wonder.js/commit/9bfb1bb)) +* **pipeline:** add end_render job ([2c20a0a](https://github.com/Wonder-Technology/Wonder.js/commit/2c20a0a)) + + + # [2.0.0-alpha.2](https://github.com/Wonder-Technology/Wonder.js/compare/v2.0.0-alpha.1...v2.0.0-alpha.2) (2020-09-09) diff --git a/jest_coverage.json b/jest_coverage.json index a8e9420104..97d1ccef47 100755 --- a/jest_coverage.json +++ b/jest_coverage.json @@ -19,6 +19,7 @@ "/lib/js/src/.+/data/", "/lib/js/src/.+/interface/", "/lib/js/src/.+/type/", + "/lib/js/src/run/cloud_picture/domain_layer/domain/shader/", "/lib/js/src/.+/ParseDataPipelineDoService.*" ], diff --git a/lib/js/src/construct/application_layer/scene/GeometryApService.bs.js b/lib/js/src/construct/application_layer/scene/GeometryApService.bs.js index d9ee3ca60a..c2189ac8a5 100644 --- a/lib/js/src/construct/application_layer/scene/GeometryApService.bs.js +++ b/lib/js/src/construct/application_layer/scene/GeometryApService.bs.js @@ -5,6 +5,7 @@ var IndicesGeometryDoService$Wonderjs = require("../../domain_layer/domain/scene var NormalsGeometryDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/geometry/NormalsGeometryDoService.bs.js"); var VerticesGeometryDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/geometry/VerticesGeometryDoService.bs.js"); var GameObjectGeometryDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/geometry/GameObjectGeometryDoService.bs.js"); +var CreatePlaneGeometryDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/geometry/CreatePlaneGeometryDoService.bs.js"); var CreateSphereGeometryDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/geometry/CreateSphereGeometryDoService.bs.js"); function create(param) { @@ -15,6 +16,10 @@ var getGameObjects = GameObjectGeometryDoService$Wonderjs.getGameObjects; var createSphereGeometry = CreateSphereGeometryDoService$Wonderjs.create; +function createPlaneGeometry(param) { + return CreatePlaneGeometryDoService$Wonderjs.create(undefined); +} + var getVertices = VerticesGeometryDoService$Wonderjs.getVertices; var setVertices = VerticesGeometryDoService$Wonderjs.setVertices; @@ -38,6 +43,7 @@ var getIndicesCount = IndicesGeometryDoService$Wonderjs.getIndicesCount; exports.create = create; exports.getGameObjects = getGameObjects; exports.createSphereGeometry = createSphereGeometry; +exports.createPlaneGeometry = createPlaneGeometry; exports.getVertices = getVertices; exports.setVertices = setVertices; exports.getNormals = getNormals; diff --git a/lib/js/src/construct/application_layer/scene/PerspectiveCameraProjectionApService.bs.js b/lib/js/src/construct/application_layer/scene/PerspectiveCameraProjectionApService.bs.js index 7474138eb7..197da94a99 100644 --- a/lib/js/src/construct/application_layer/scene/PerspectiveCameraProjectionApService.bs.js +++ b/lib/js/src/construct/application_layer/scene/PerspectiveCameraProjectionApService.bs.js @@ -2,6 +2,7 @@ var DirtyPerspectiveCameraProjectionDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/DirtyPerspectiveCameraProjectionDoService.bs.js"); var CreatePerspectiveCameraProjectionDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/CreatePerspectiveCameraProjectionDoService.bs.js"); +var UpdatePerspectiveCameraProjectionDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/UpdatePerspectiveCameraProjectionDoService.bs.js"); var FrustumPerspectiveCameraProjectionDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/FrustumPerspectiveCameraProjectionDoService.bs.js"); var PMatrixPerspectiveCameraProjectionDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/PMatrixPerspectiveCameraProjectionDoService.bs.js"); var GameObjectPerspectiveCameraProjectionDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/GameObjectPerspectiveCameraProjectionDoService.bs.js"); @@ -34,6 +35,8 @@ var markDirty = DirtyPerspectiveCameraProjectionDoService$Wonderjs.markDirty; var markNotDirty = DirtyPerspectiveCameraProjectionDoService$Wonderjs.markNotDirty; +var update = UpdatePerspectiveCameraProjectionDoService$Wonderjs.update; + exports.create = create; exports.getGameObject = getGameObject; exports.getPMatrix = getPMatrix; @@ -47,4 +50,5 @@ exports.getFar = getFar; exports.setFar = setFar; exports.markDirty = markDirty; exports.markNotDirty = markNotDirty; -/* No side effect */ +exports.update = update; +/* UpdatePerspectiveCameraProjectionDoService-Wonderjs Not a pure module */ diff --git a/lib/js/src/construct/application_layer/scene/TransformApService.bs.js b/lib/js/src/construct/application_layer/scene/TransformApService.bs.js index a2dced486f..e6745e2254 100644 --- a/lib/js/src/construct/application_layer/scene/TransformApService.bs.js +++ b/lib/js/src/construct/application_layer/scene/TransformApService.bs.js @@ -1,5 +1,6 @@ 'use strict'; +var IndexTransformDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/transform/IndexTransformDoService.bs.js"); var CreateTransformDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/transform/CreateTransformDoService.bs.js"); var RotateTransformDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/transform/RotateTransformDoService.bs.js"); var UpdateTransformDoService$Wonderjs = require("../../domain_layer/domain/scene/scene_graph/service/transform/UpdateTransformDoService.bs.js"); @@ -73,6 +74,10 @@ var getLocalToWorldMatrix = ModelMatrixTransformDoService$Wonderjs.getLocalToWor var getNormalMatrix = ModelMatrixTransformDoService$Wonderjs.getNormalMatrix; +var getMaxIndex = IndexTransformDoService$Wonderjs.getMaxIndex; + +var mutableUpdate = UpdateTransformDoService$Wonderjs.mutableUpdate; + exports.create = create; exports.getGameObject = getGameObject; exports.getParent = getParent; @@ -100,4 +105,6 @@ exports.rotateLocalOnAxis = rotateLocalOnAxis; exports.rotateWorldOnAxis = rotateWorldOnAxis; exports.getLocalToWorldMatrix = getLocalToWorldMatrix; exports.getNormalMatrix = getNormalMatrix; +exports.getMaxIndex = getMaxIndex; +exports.mutableUpdate = mutableUpdate; /* No side effect */ diff --git a/lib/js/src/construct/application_layer/statistic/TimeApService.bs.js b/lib/js/src/construct/application_layer/statistic/TimeApService.bs.js new file mode 100644 index 0000000000..1c3d84cd25 --- /dev/null +++ b/lib/js/src/construct/application_layer/statistic/TimeApService.bs.js @@ -0,0 +1,8 @@ +'use strict'; + +var TimeDoService$Wonderjs = require("../../domain_layer/domain/statistic/time/service/TimeDoService.bs.js"); + +var start = TimeDoService$Wonderjs.start; + +exports.start = start; +/* No side effect */ diff --git a/lib/js/src/construct/application_layer/webgpu/WebGPUCoreApService.bs.js b/lib/js/src/construct/application_layer/webgpu/WebGPUCoreApService.bs.js new file mode 100644 index 0000000000..3888927586 --- /dev/null +++ b/lib/js/src/construct/application_layer/webgpu/WebGPUCoreApService.bs.js @@ -0,0 +1,8 @@ +'use strict'; + +var LoadWebGPUDoService$Wonderjs = require("../../domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.bs.js"); + +var load = LoadWebGPUDoService$Wonderjs.load; + +exports.load = load; +/* LoadWebGPUDoService-Wonderjs Not a pure module */ diff --git a/lib/js/src/construct/application_layer/webgpu/WebGPURayTracingApService.bs.js b/lib/js/src/construct/application_layer/webgpu/WebGPURayTracingApService.bs.js new file mode 100644 index 0000000000..f7f3f1b117 --- /dev/null +++ b/lib/js/src/construct/application_layer/webgpu/WebGPURayTracingApService.bs.js @@ -0,0 +1,8 @@ +'use strict'; + +var BuildAccerlerationContainerDoService$Wonderjs = require("../../domain_layer/domain/webgpu/ray_tracing/service/BuildAccerlerationContainerDoService.bs.js"); + +var buildContainers = BuildAccerlerationContainerDoService$Wonderjs.buildContainers; + +exports.buildContainers = buildContainers; +/* No side effect */ diff --git a/lib/js/src/construct/domain_layer/domain/pipeline/pipeline/service/ParseDataPipelineDoService.bs.js b/lib/js/src/construct/domain_layer/domain/pipeline/pipeline/service/ParseDataPipelineDoService.bs.js index a549993d77..b1e821075d 100644 --- a/lib/js/src/construct/domain_layer/domain/pipeline/pipeline/service/ParseDataPipelineDoService.bs.js +++ b/lib/js/src/construct/domain_layer/domain/pipeline/pipeline/service/ParseDataPipelineDoService.bs.js @@ -73,12 +73,9 @@ function parse(param) { var partial_arg = PipelineEntity$Wonderjs.create(name); return Result$Wonderjs.mapSuccess(Result$Wonderjs.bind(_findGroup(param.firstGroup, groups), (function (group) { return Result$Wonderjs.mapSuccess(_buildPipelineStream(name, group, groups), (function (pipelineStream) { - var __x = Most.map((function (param) { - return Result$Wonderjs.succeed(undefined); - }), pipelineStream); - return Most.recoverWith((function (err) { - return Most.just(Result$Wonderjs.fail(err)); - }), __x); + return Most.map((function (param) { + return Result$Wonderjs.succeed(undefined); + }), pipelineStream); })); })), (function (param) { return Tuple2$Wonderjs.create(partial_arg, param); diff --git a/lib/js/src/construct/domain_layer/domain/scene/scene_graph/service/geometry/CreatePlaneGeometryDoService.bs.js b/lib/js/src/construct/domain_layer/domain/scene/scene_graph/service/geometry/CreatePlaneGeometryDoService.bs.js new file mode 100644 index 0000000000..269b13b0d1 --- /dev/null +++ b/lib/js/src/construct/domain_layer/domain/scene/scene_graph/service/geometry/CreatePlaneGeometryDoService.bs.js @@ -0,0 +1,50 @@ +'use strict'; + +var CreateDefaultGeometryDoService$Wonderjs = require("./CreateDefaultGeometryDoService.bs.js"); + +function create(param) { + var vertices = [ + 1.0, + 0.0, + -1.0, + 1.0, + 0.0, + 1.0, + -1.0, + 0.0, + 1.0, + -1.0, + 0.0, + -1.0 + ]; + var normals = [ + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0 + ]; + var indices = [ + 2, + 1, + 0, + 0, + 3, + 2 + ]; + return CreateDefaultGeometryDoService$Wonderjs.create([ + vertices, + normals, + indices + ]); +} + +exports.create = create; +/* No side effect */ diff --git a/lib/js/src/construct/domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/FrustumPerspectiveCameraProjectionDoService.bs.js b/lib/js/src/construct/domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/FrustumPerspectiveCameraProjectionDoService.bs.js index 023cca537f..0ac853bc0b 100644 --- a/lib/js/src/construct/domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/FrustumPerspectiveCameraProjectionDoService.bs.js +++ b/lib/js/src/construct/domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/FrustumPerspectiveCameraProjectionDoService.bs.js @@ -14,7 +14,8 @@ function getFovy(cameraProjection) { } function setFovy(cameraProjection, fovy) { - return Curry._2(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).setFovy, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection), FovyVO$Wonderjs.value(fovy)); + Curry._2(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).setFovy, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection), FovyVO$Wonderjs.value(fovy)); + return Curry._1(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).markDirty, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection)); } function getAspect(cameraProjection) { @@ -22,7 +23,8 @@ function getAspect(cameraProjection) { } function setAspect(cameraProjection, aspect) { - return Curry._2(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).setAspect, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection), AspectVO$Wonderjs.value(aspect)); + Curry._2(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).setAspect, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection), AspectVO$Wonderjs.value(aspect)); + return Curry._1(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).markDirty, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection)); } function getNear(cameraProjection) { @@ -30,7 +32,8 @@ function getNear(cameraProjection) { } function setNear(cameraProjection, near) { - return Curry._2(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).setNear, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection), NearVO$Wonderjs.value(near)); + Curry._2(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).setNear, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection), NearVO$Wonderjs.value(near)); + return Curry._1(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).markDirty, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection)); } function getFar(cameraProjection) { @@ -38,7 +41,8 @@ function getFar(cameraProjection) { } function setFar(cameraProjection, far) { - return Curry._2(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).setFar, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection), FarVO$Wonderjs.value(far)); + Curry._2(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).setFar, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection), FarVO$Wonderjs.value(far)); + return Curry._1(DpContainer$Wonderjs.unsafeGetPerspectiveCameraProjectionRepoDp(undefined).markDirty, PerspectiveCameraProjectionEntity$Wonderjs.value(cameraProjection)); } function computeAspect(param) { diff --git a/lib/js/src/construct/domain_layer/domain/statistic/statistic/service/TimeStatisticDoService.bs.js b/lib/js/src/construct/domain_layer/domain/statistic/time/service/TimeDoService.bs.js similarity index 100% rename from lib/js/src/construct/domain_layer/domain/statistic/statistic/service/TimeStatisticDoService.bs.js rename to lib/js/src/construct/domain_layer/domain/statistic/time/service/TimeDoService.bs.js diff --git a/lib/js/src/construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.bs.js b/lib/js/src/construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.bs.js index 2662a214e2..f60ae6d452 100644 --- a/lib/js/src/construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.bs.js +++ b/lib/js/src/construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.bs.js @@ -5,13 +5,21 @@ var Curry = require("bs-platform/lib/js/curry.js"); var DpContainer$Wonderjs = require("../../../../dependency/container/DpContainer.bs.js"); function load($$window) { + var __x = Most.fromPromise(Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).gpu.requestAdapter, { + window: $$window, + preferredBackend: "Vulkan" + })); return Most.flatMap((function (adapter) { + var __x = Most.fromPromise(Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).adapter.requestDevice, { + extensions: ["ray_tracing"] + }, adapter)); return Most.flatMap((function (device) { var context = Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getContext, $$window); var queue = Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.getQueue, device); var __x = Most.fromPromise(Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).context.getSwapChainPreferredFormat, device, context)); return Most.map((function (swapChainFormat) { return [ + $$window, adapter, device, context, @@ -19,13 +27,8 @@ function load($$window) { swapChainFormat ]; }), __x); - }), Most.fromPromise(Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).adapter.requestDevice, { - extensions: ["ray_tracing"] - }, adapter))); - }), Most.fromPromise(Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).gpu.requestAdapter, { - window: $$window, - preferredBackend: "Vulkan" - }))); + }), __x); + }), __x); } exports.load = load; diff --git a/lib/js/src/construct/domain_layer/domain/webgpu/ray_tracing/service/BuildAccerlerationContainerDoService.bs.js b/lib/js/src/construct/domain_layer/domain/webgpu/ray_tracing/service/BuildAccerlerationContainerDoService.bs.js index d6d8b74b30..2a0db2b2aa 100644 --- a/lib/js/src/construct/domain_layer/domain/webgpu/ray_tracing/service/BuildAccerlerationContainerDoService.bs.js +++ b/lib/js/src/construct/domain_layer/domain/webgpu/ray_tracing/service/BuildAccerlerationContainerDoService.bs.js @@ -16,7 +16,7 @@ var VerticesVO$Wonderjs = require("../../../scene/scene_graph/value_object/Verti var DpContainer$Wonderjs = require("../../../../dependency/container/DpContainer.bs.js"); var EulerAnglesVO$Wonderjs = require("../../../scene/scene_graph/value_object/EulerAnglesVO.bs.js"); var GeometryEntity$Wonderjs = require("../../../scene/scene_graph/entity/GeometryEntity.bs.js"); -var GameObjectRunAPI$Wonderjs = require("../../../../../external_layer/api/run/GameObjectRunAPI.bs.js"); +var GameObjectRunAPI$Wonderjs = require("../../../../../external_layer/api/run/domain/GameObjectRunAPI.bs.js"); var ImmutableSparseMap$Wonderjs = require("../../../../library/structure/sparse_map/ImmutableSparseMap.bs.js"); var RayTracingBufferVO$Wonderjs = require("../value_object/RayTracingBufferVO.bs.js"); var IndicesGeometryDoService$Wonderjs = require("../../../scene/scene_graph/service/geometry/IndicesGeometryDoService.bs.js"); diff --git a/lib/js/src/construct/domain_layer/library/structure/ListSt.bs.js b/lib/js/src/construct/domain_layer/library/structure/ListSt.bs.js index 3e0a72359f..9e8c350e4a 100644 --- a/lib/js/src/construct/domain_layer/library/structure/ListSt.bs.js +++ b/lib/js/src/construct/domain_layer/library/structure/ListSt.bs.js @@ -45,7 +45,7 @@ function ignoreTraverseResultValue(traverseResult) { } function range(start, end_) { - return Belt_List.makeBy((end_ - start | 0) + 1 | 0, (function (i) { + return Belt_List.makeBy(end_ - start | 0, (function (i) { return i + start | 0; })); } @@ -73,6 +73,10 @@ function remove(list, value) { })); } +function getLast(list) { + return Belt_List.get(list, Belt_List.length(list) - 1 | 0); +} + function removeDuplicateItems(list) { var arr = Belt_List.toArray(list); var resultArr = []; @@ -105,6 +109,8 @@ var length = Belt_List.length; var head = Belt_List.head; +var nth = Belt_List.get; + exports.traverseResultM = traverseResultM; exports.traverseReduceResultM = traverseReduceResultM; exports._id = _id; @@ -123,5 +129,7 @@ exports.fromArray = fromArray; exports.remove = remove; exports.length = length; exports.head = head; +exports.nth = nth; +exports.getLast = getLast; exports.removeDuplicateItems = removeDuplicateItems; /* No side effect */ diff --git a/lib/js/src/construct/domain_layer/library/structure/Result.bs.js b/lib/js/src/construct/domain_layer/library/structure/Result.bs.js index d29aa9c59c..dd5caad406 100644 --- a/lib/js/src/construct/domain_layer/library/structure/Result.bs.js +++ b/lib/js/src/construct/domain_layer/library/structure/Result.bs.js @@ -19,7 +19,7 @@ function fail(x) { }; } -var _raiseErrorAndReturn = Exception$Wonderjs.buildErr; +var _buildErr = Exception$Wonderjs.buildErr; function failWith(x) { return { @@ -28,20 +28,28 @@ function failWith(x) { }; } -function either(twoTrackInput, successFunc, failureFunc) { - if (twoTrackInput.TAG) { - return Curry._1(failureFunc, twoTrackInput._0); +function isSuccess(result) { + if (result.TAG) { + return false; + } else { + return true; + } +} + +function either(result, successFunc, failureFunc) { + if (result.TAG) { + return Curry._1(failureFunc, result._0); } else { - return Curry._1(successFunc, twoTrackInput._0); + return Curry._1(successFunc, result._0); } } -function bind(twoTrackInput, switchFunc) { - return either(twoTrackInput, switchFunc, fail); +function bind(result, switchFunc) { + return either(result, switchFunc, fail); } -function tap(twoTrackInput, oneTrackFunc) { - return either(twoTrackInput, (function (result) { +function tap(result, oneTrackFunc) { + return either(result, (function (result) { Curry._1(oneTrackFunc, result); return { TAG: /* Success */0, @@ -101,8 +109,9 @@ function getExn(result) { exports.succeed = succeed; exports.fail = fail; -exports._raiseErrorAndReturn = _raiseErrorAndReturn; +exports._buildErr = _buildErr; exports.failWith = failWith; +exports.isSuccess = isSuccess; exports.either = either; exports.bind = bind; exports.tap = tap; diff --git a/lib/js/src/construct/domain_layer/library/structure/ResultOption.bs.js b/lib/js/src/construct/domain_layer/library/structure/ResultOption.bs.js index cdd94956ff..96aa455bca 100644 --- a/lib/js/src/construct/domain_layer/library/structure/ResultOption.bs.js +++ b/lib/js/src/construct/domain_layer/library/structure/ResultOption.bs.js @@ -1,5 +1,7 @@ 'use strict'; +var Curry = require("bs-platform/lib/js/curry.js"); +var Caml_option = require("bs-platform/lib/js/caml_option.js"); var Result$Wonderjs = require("./Result.bs.js"); var OptionSt$Wonderjs = require("./OptionSt.bs.js"); @@ -7,5 +9,16 @@ function openInverse(resultOptionData) { return Result$Wonderjs.bind(resultOptionData, OptionSt$Wonderjs.get); } +function openInverseSucceedWithNone(resultOptionData, handleSomeFunc) { + return Result$Wonderjs.bind(resultOptionData, (function (valueOpt) { + if (valueOpt !== undefined) { + return Curry._1(handleSomeFunc, Caml_option.valFromOption(valueOpt)); + } else { + return Result$Wonderjs.succeed(undefined); + } + })); +} + exports.openInverse = openInverse; +exports.openInverseSucceedWithNone = openInverseSucceedWithNone; /* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js index 4d90a8276b..fbfb86d0f5 100644 --- a/lib/js/src/construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js @@ -1,8 +1,14 @@ 'use strict'; +var DpContainer$Wonderjs = require("../../../../domain_layer/dependency/container/DpContainer.bs.js"); var OtherConfigDpApService$Wonderjs = require("../../../../application_layer/dependency/OtherConfigDpApService.bs.js"); +function unsafeGet(param) { + return DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined); +} + var set = OtherConfigDpApService$Wonderjs.set; +exports.unsafeGet = unsafeGet; exports.set = set; /* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/dependency/POConfigDpRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/dependency/POConfigDpRunAPI.bs.js index 6d77e0e1fd..dee6c75817 100644 --- a/lib/js/src/construct/external_layer/api/run/dependency/POConfigDpRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/dependency/POConfigDpRunAPI.bs.js @@ -1,8 +1,14 @@ 'use strict'; +var DpContainer$Wonderjs = require("../../../../domain_layer/dependency/container/DpContainer.bs.js"); var POConfigDpApService$Wonderjs = require("../../../../application_layer/dependency/POConfigDpApService.bs.js"); +function unsafeGet(param) { + return DpContainer$Wonderjs.unsafeGetPOConfigDp(undefined); +} + var set = POConfigDpApService$Wonderjs.set; +exports.unsafeGet = unsafeGet; exports.set = set; /* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/dependency/RepoDpRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/dependency/RepoDpRunAPI.bs.js index e1b34585b1..1a66a59730 100644 --- a/lib/js/src/construct/external_layer/api/run/dependency/RepoDpRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/dependency/RepoDpRunAPI.bs.js @@ -1,8 +1,14 @@ 'use strict'; +var DpContainer$Wonderjs = require("../../../../domain_layer/dependency/container/DpContainer.bs.js"); var RepoDpApService$Wonderjs = require("../../../../application_layer/dependency/RepoDpApService.bs.js"); +function unsafeGet(param) { + return DpContainer$Wonderjs.unsafeGetTimeRepoDp(undefined); +} + var set = RepoDpApService$Wonderjs.set; +exports.unsafeGet = unsafeGet; exports.set = set; /* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/dependency/TimeDpRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/dependency/TimeDpRunAPI.bs.js index da48566373..77a2b45ab8 100644 --- a/lib/js/src/construct/external_layer/api/run/dependency/TimeDpRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/dependency/TimeDpRunAPI.bs.js @@ -1,8 +1,14 @@ 'use strict'; +var DpContainer$Wonderjs = require("../../../../domain_layer/dependency/container/DpContainer.bs.js"); var TimeDpApService$Wonderjs = require("../../../../application_layer/dependency/TimeDpApService.bs.js"); +function unsafeGet(param) { + return DpContainer$Wonderjs.unsafeGetTimeRepoDp(undefined); +} + var set = TimeDpApService$Wonderjs.set; +exports.unsafeGet = unsafeGet; exports.set = set; /* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js index 1607deac9d..74410bedf7 100644 --- a/lib/js/src/construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js @@ -1,8 +1,14 @@ 'use strict'; +var DpContainer$Wonderjs = require("../../../../domain_layer/dependency/container/DpContainer.bs.js"); var WebGPUCoreDpApService$Wonderjs = require("../../../../application_layer/dependency/WebGPUCoreDpApService.bs.js"); +function unsafeGet(param) { + return DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined); +} + var set = WebGPUCoreDpApService$Wonderjs.set; +exports.unsafeGet = unsafeGet; exports.set = set; /* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/dependency/WebGPURayTracingDpRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/dependency/WebGPURayTracingDpRunAPI.bs.js index a1220d6c51..e0ca3778fb 100644 --- a/lib/js/src/construct/external_layer/api/run/dependency/WebGPURayTracingDpRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/dependency/WebGPURayTracingDpRunAPI.bs.js @@ -1,8 +1,14 @@ 'use strict'; +var DpContainer$Wonderjs = require("../../../../domain_layer/dependency/container/DpContainer.bs.js"); var WebGPURayTracingDpApService$Wonderjs = require("../../../../application_layer/dependency/WebGPURayTracingDpApService.bs.js"); +function unsafeGet(param) { + return DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined); +} + var set = WebGPURayTracingDpApService$Wonderjs.set; +exports.unsafeGet = unsafeGet; exports.set = set; /* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/BasicCameraViewRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/BasicCameraViewRunAPI.bs.js similarity index 88% rename from lib/js/src/construct/external_layer/api/run/BasicCameraViewRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/BasicCameraViewRunAPI.bs.js index 7ca5c25506..8c69b1f327 100644 --- a/lib/js/src/construct/external_layer/api/run/BasicCameraViewRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/BasicCameraViewRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var BasicCameraViewApService$Wonderjs = require("../../../application_layer/scene/BasicCameraViewApService.bs.js"); +var BasicCameraViewApService$Wonderjs = require("../../../../application_layer/scene/BasicCameraViewApService.bs.js"); function create(param) { return BasicCameraViewApService$Wonderjs.create(undefined); diff --git a/lib/js/src/construct/external_layer/api/run/DirectionLightRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/DirectionLightRunAPI.bs.js similarity index 89% rename from lib/js/src/construct/external_layer/api/run/DirectionLightRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/DirectionLightRunAPI.bs.js index 9aa0ebb02b..bbf66dd020 100644 --- a/lib/js/src/construct/external_layer/api/run/DirectionLightRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/DirectionLightRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var DirectionLightApService$Wonderjs = require("../../../application_layer/scene/DirectionLightApService.bs.js"); +var DirectionLightApService$Wonderjs = require("../../../../application_layer/scene/DirectionLightApService.bs.js"); function create(param) { return DirectionLightApService$Wonderjs.create(undefined); diff --git a/lib/js/src/construct/external_layer/api/run/GameObjectRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/GameObjectRunAPI.bs.js similarity index 96% rename from lib/js/src/construct/external_layer/api/run/GameObjectRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/GameObjectRunAPI.bs.js index d476f3b330..fd6c82990b 100644 --- a/lib/js/src/construct/external_layer/api/run/GameObjectRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/GameObjectRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var GameObjectApService$Wonderjs = require("../../../application_layer/scene/GameObjectApService.bs.js"); +var GameObjectApService$Wonderjs = require("../../../../application_layer/scene/GameObjectApService.bs.js"); function create(param) { return GameObjectApService$Wonderjs.create(undefined); diff --git a/lib/js/src/construct/external_layer/api/run/GeometryRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/GeometryRunAPI.bs.js similarity index 83% rename from lib/js/src/construct/external_layer/api/run/GeometryRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/GeometryRunAPI.bs.js index 1b0472f877..60fc0cc62d 100644 --- a/lib/js/src/construct/external_layer/api/run/GeometryRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/GeometryRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var GeometryApService$Wonderjs = require("../../../application_layer/scene/GeometryApService.bs.js"); +var GeometryApService$Wonderjs = require("../../../../application_layer/scene/GeometryApService.bs.js"); function create(param) { return GeometryApService$Wonderjs.create(undefined); @@ -10,6 +10,10 @@ var getGameObjects = GeometryApService$Wonderjs.getGameObjects; var createSphereGeometry = GeometryApService$Wonderjs.createSphereGeometry; +function createPlaneGeometry(param) { + return GeometryApService$Wonderjs.createPlaneGeometry(undefined); +} + var getVertices = GeometryApService$Wonderjs.getVertices; var setVertices = GeometryApService$Wonderjs.setVertices; @@ -33,6 +37,7 @@ var getIndicesCount = GeometryApService$Wonderjs.getIndicesCount; exports.create = create; exports.getGameObjects = getGameObjects; exports.createSphereGeometry = createSphereGeometry; +exports.createPlaneGeometry = createPlaneGeometry; exports.getVertices = getVertices; exports.setVertices = setVertices; exports.getNormals = getNormals; diff --git a/lib/js/src/construct/external_layer/api/run/PBRMaterialRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/PBRMaterialRunAPI.bs.js similarity index 90% rename from lib/js/src/construct/external_layer/api/run/PBRMaterialRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/PBRMaterialRunAPI.bs.js index 939703007f..5d84401b1a 100644 --- a/lib/js/src/construct/external_layer/api/run/PBRMaterialRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/PBRMaterialRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var PBRMaterialApService$Wonderjs = require("../../../application_layer/scene/PBRMaterialApService.bs.js"); +var PBRMaterialApService$Wonderjs = require("../../../../application_layer/scene/PBRMaterialApService.bs.js"); function create(param) { return PBRMaterialApService$Wonderjs.create(undefined); diff --git a/lib/js/src/construct/external_layer/api/run/PerspectiveCameraProjectionRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/PerspectiveCameraProjectionRunAPI.bs.js similarity index 85% rename from lib/js/src/construct/external_layer/api/run/PerspectiveCameraProjectionRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/PerspectiveCameraProjectionRunAPI.bs.js index 09da120799..4abf5ab3d3 100644 --- a/lib/js/src/construct/external_layer/api/run/PerspectiveCameraProjectionRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/PerspectiveCameraProjectionRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var PerspectiveCameraProjectionApService$Wonderjs = require("../../../application_layer/scene/PerspectiveCameraProjectionApService.bs.js"); +var PerspectiveCameraProjectionApService$Wonderjs = require("../../../../application_layer/scene/PerspectiveCameraProjectionApService.bs.js"); function create(param) { return PerspectiveCameraProjectionApService$Wonderjs.create(undefined); @@ -30,6 +30,8 @@ var markDirty = PerspectiveCameraProjectionApService$Wonderjs.markDirty; var markNotDirty = PerspectiveCameraProjectionApService$Wonderjs.markNotDirty; +var update = PerspectiveCameraProjectionApService$Wonderjs.update; + exports.create = create; exports.getGameObject = getGameObject; exports.getPMatrix = getPMatrix; @@ -43,4 +45,5 @@ exports.getFar = getFar; exports.setFar = setFar; exports.markDirty = markDirty; exports.markNotDirty = markNotDirty; -/* No side effect */ +exports.update = update; +/* PerspectiveCameraProjectionApService-Wonderjs Not a pure module */ diff --git a/lib/js/src/construct/external_layer/api/run/PipelineRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/PipelineRunAPI.bs.js similarity index 82% rename from lib/js/src/construct/external_layer/api/run/PipelineRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/PipelineRunAPI.bs.js index 5f467da42d..629d788a24 100644 --- a/lib/js/src/construct/external_layer/api/run/PipelineRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/PipelineRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var PipelineApService$Wonderjs = require("../../../application_layer/pipeline/PipelineApService.bs.js"); +var PipelineApService$Wonderjs = require("../../../../application_layer/pipeline/PipelineApService.bs.js"); var parsePipelineData = PipelineApService$Wonderjs.parsePipelineData; diff --git a/lib/js/src/construct/external_layer/api/run/SceneRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/SceneRunAPI.bs.js similarity index 75% rename from lib/js/src/construct/external_layer/api/run/SceneRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/SceneRunAPI.bs.js index fa767faff8..c0dfa382e3 100644 --- a/lib/js/src/construct/external_layer/api/run/SceneRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/SceneRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var SceneApService$Wonderjs = require("../../../application_layer/scene/SceneApService.bs.js"); +var SceneApService$Wonderjs = require("../../../../application_layer/scene/SceneApService.bs.js"); function getSceneGameObject(param) { return SceneApService$Wonderjs.getSceneGameObject(undefined); diff --git a/lib/js/src/construct/external_layer/api/run/domain/TimeRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/TimeRunAPI.bs.js new file mode 100644 index 0000000000..b639e20312 --- /dev/null +++ b/lib/js/src/construct/external_layer/api/run/domain/TimeRunAPI.bs.js @@ -0,0 +1,8 @@ +'use strict'; + +var TimeApService$Wonderjs = require("../../../../application_layer/statistic/TimeApService.bs.js"); + +var start = TimeApService$Wonderjs.start; + +exports.start = start; +/* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/TransformRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/TransformRunAPI.bs.js similarity index 91% rename from lib/js/src/construct/external_layer/api/run/TransformRunAPI.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/TransformRunAPI.bs.js index f8c00e9312..7b23e3a3d6 100644 --- a/lib/js/src/construct/external_layer/api/run/TransformRunAPI.bs.js +++ b/lib/js/src/construct/external_layer/api/run/domain/TransformRunAPI.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var TransformApService$Wonderjs = require("../../../application_layer/scene/TransformApService.bs.js"); +var TransformApService$Wonderjs = require("../../../../application_layer/scene/TransformApService.bs.js"); function create(param) { return TransformApService$Wonderjs.create(undefined); @@ -68,6 +68,10 @@ var getLocalToWorldMatrix = TransformApService$Wonderjs.getLocalToWorldMatrix; var getNormalMatrix = TransformApService$Wonderjs.getNormalMatrix; +var getMaxIndex = TransformApService$Wonderjs.getMaxIndex; + +var mutableUpdate = TransformApService$Wonderjs.mutableUpdate; + exports.create = create; exports.getGameObject = getGameObject; exports.getParent = getParent; @@ -95,4 +99,6 @@ exports.rotateLocalOnAxis = rotateLocalOnAxis; exports.rotateWorldOnAxis = rotateWorldOnAxis; exports.getLocalToWorldMatrix = getLocalToWorldMatrix; exports.getNormalMatrix = getNormalMatrix; +exports.getMaxIndex = getMaxIndex; +exports.mutableUpdate = mutableUpdate; /* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/domain/WebGPUCoreRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/WebGPUCoreRunAPI.bs.js new file mode 100644 index 0000000000..60ed40b094 --- /dev/null +++ b/lib/js/src/construct/external_layer/api/run/domain/WebGPUCoreRunAPI.bs.js @@ -0,0 +1,8 @@ +'use strict'; + +var WebGPUCoreApService$Wonderjs = require("../../../../application_layer/webgpu/WebGPUCoreApService.bs.js"); + +var load = WebGPUCoreApService$Wonderjs.load; + +exports.load = load; +/* WebGPUCoreApService-Wonderjs Not a pure module */ diff --git a/lib/js/src/construct/external_layer/api/run/domain/WebGPURayTracingRunAPI.bs.js b/lib/js/src/construct/external_layer/api/run/domain/WebGPURayTracingRunAPI.bs.js new file mode 100644 index 0000000000..553fe75b2f --- /dev/null +++ b/lib/js/src/construct/external_layer/api/run/domain/WebGPURayTracingRunAPI.bs.js @@ -0,0 +1,8 @@ +'use strict'; + +var WebGPURayTracingApService$Wonderjs = require("../../../../application_layer/webgpu/WebGPURayTracingApService.bs.js"); + +var buildContainers = WebGPURayTracingApService$Wonderjs.buildContainers; + +exports.buildContainers = buildContainers; +/* No side effect */ diff --git a/lib/js/src/construct/external_layer/api/run/type/PipelineVOType.bs.js b/lib/js/src/construct/external_layer/api/run/domain/type/PipelineVOType.bs.js similarity index 100% rename from lib/js/src/construct/external_layer/api/run/type/PipelineVOType.bs.js rename to lib/js/src/construct/external_layer/api/run/domain/type/PipelineVOType.bs.js diff --git a/lib/js/src/run/cloud_picture/application_layer/DirectorCPApService.bs.js b/lib/js/src/run/cloud_picture/application_layer/DirectorCPApService.bs.js index 4e1deb20e7..faafc5f7d5 100644 --- a/lib/js/src/run/cloud_picture/application_layer/DirectorCPApService.bs.js +++ b/lib/js/src/run/cloud_picture/application_layer/DirectorCPApService.bs.js @@ -1,12 +1,12 @@ 'use strict'; -var CPRepo$Wonderjs = require("../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../infrastructure_layer/data/container/CPRepo.bs.js"); var Result$Wonderjs = require("../../../construct/domain_layer/library/structure/Result.bs.js"); var RepoDpRunAPI$Wonderjs = require("../../../construct/external_layer/api/run/dependency/RepoDpRunAPI.bs.js"); var TimeCPRepoDp$Wonderjs = require("../infrastructure_layer/dependency/repo/TimeCPRepoDp.bs.js"); var SceneCPRepoDp$Wonderjs = require("../infrastructure_layer/dependency/repo/scene/SceneCPRepoDp.bs.js"); var JobCPDoService$Wonderjs = require("../domain_layer/domain/pipeline/pipeline/service/JobCPDoService.bs.js"); -var PipelineRunAPI$Wonderjs = require("../../../construct/external_layer/api/run/PipelineRunAPI.bs.js"); +var PipelineRunAPI$Wonderjs = require("../../../construct/external_layer/api/run/domain/PipelineRunAPI.bs.js"); var PassCPDoService$Wonderjs = require("../domain_layer/domain/pipeline/pipeline/service/PassCPDoService.bs.js"); var GeometryCPRepoDp$Wonderjs = require("../infrastructure_layer/dependency/repo/scene/component/GeometryCPRepoDp.bs.js"); var POConfigCPRepoDp$Wonderjs = require("../infrastructure_layer/dependency/repo/POConfigCPRepoDp.bs.js"); @@ -36,13 +36,6 @@ function _createAndSetAllComponentPOs(param) { })); } -function prepare(pictureSize, sampleCount) { - return Result$Wonderjs.mapSuccess(_createAndSetAllComponentPOs(undefined), (function (param) { - PictureCPDoService$Wonderjs.setSize(pictureSize); - return PassCPDoService$Wonderjs.setSampleCount(sampleCount); - })); -} - function _injectDependencies(param) { RepoDpRunAPI$Wonderjs.set({ sceneRepo: { @@ -192,10 +185,17 @@ function _injectDependencies(param) { }); } +function prepare(pictureSize, sampleCount) { + _injectDependencies(undefined); + return Result$Wonderjs.mapSuccess(_createAndSetAllComponentPOs(undefined), (function (param) { + PictureCPDoService$Wonderjs.setSize(pictureSize); + return PassCPDoService$Wonderjs.setSampleCount(sampleCount); + })); +} + var _parseAndSetPipelineStream = PipelineRunAPI$Wonderjs.parsePipelineData; function init(param) { - _injectDependencies(undefined); JobCPDoService$Wonderjs.registerAllJobs(undefined); return PipelineRunAPI$Wonderjs.parsePipelineData(PipelineCPDoService$Wonderjs.getInitPipelineData(undefined)); } @@ -209,8 +209,8 @@ function render(param) { } exports._createAndSetAllComponentPOs = _createAndSetAllComponentPOs; -exports.prepare = prepare; exports._injectDependencies = _injectDependencies; +exports.prepare = prepare; exports._parseAndSetPipelineStream = _parseAndSetPipelineStream; exports.init = init; exports.update = update; diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.bs.js index dae8c23b6e..4607547568 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitAccumulationCPJobEntity.bs.js @@ -4,22 +4,23 @@ var Most = require("most"); var Curry = require("bs-platform/lib/js/curry.js"); var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var Tuple3$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/tuple/Tuple3.bs.js"); +var Tuple4$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/tuple/Tuple4.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); var PassCPRepo$Wonderjs = require("../../../../../../repo/pipeline/PassCPRepo.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var WebGPUCPRepo$Wonderjs = require("../../../../../../repo/WebGPUCPRepo.bs.js"); +var PassCPDoService$Wonderjs = require("../../../service/PassCPDoService.bs.js"); var StorageBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/StorageBufferVO.bs.js"); var UniformBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/UniformBufferVO.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); var AccumulationPassCPRepo$Wonderjs = require("../../../../../../repo/pipeline/AccumulationPassCPRepo.bs.js"); -var AccumulationCPDoService$Wonderjs = require("../../../service/AccumulationCPDoService.bs.js"); function create(param) { return JobEntity$Wonderjs.create("init_accumulation"); } function _buildAccumulationPixelBufferData($$window, device) { - var bufferSize = Math.imul((Math.imul(Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getWidth, $$window), Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getHeight, $$window)) << 2), Float32Array.BYTES_PER_ELEMENT); - var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.copy_dst | DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.storage, undefined); + var bufferSize = Math.imul((Math.imul(Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.getWidth, $$window), Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.getHeight, $$window)) << 2), Float32Array.BYTES_PER_ELEMENT); + var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined); return [ buffer, bufferSize @@ -27,44 +28,42 @@ function _buildAccumulationPixelBufferData($$window, device) { } function _createAndSetBindGroup(device, param) { - var match = param[2]; - var match$1 = param[1]; - var pixelBufferSize = match$1[1]; - var pixelBuffer = match$1[0]; - var match$2 = param[0]; - var bindGroupLayout = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createBindGroupLayout, { + var match = param[3]; + var match$1 = param[2]; + var match$2 = param[1]; + var match$3 = param[0]; + var bindGroupLayout = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createBindGroupLayout, { entries: [ { binding: 0, - visibility: DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).shaderStage.fragment, + visibility: WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.fragment, type: "storage-buffer" }, { binding: 1, - visibility: DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).shaderStage.fragment, + visibility: WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.fragment, type: "storage-buffer" }, { binding: 2, - visibility: DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).shaderStage.fragment, + visibility: WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.fragment, + type: "uniform-buffer" + }, + { + binding: 3, + visibility: WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.fragment, type: "uniform-buffer" } ] }, device); - AccumulationPassCPRepo$Wonderjs.setStaticBindGroupData(0, Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createBindGroup, { + AccumulationPassCPRepo$Wonderjs.setStaticBindGroupData(0, Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createBindGroup, { layout: bindGroupLayout, entries: [ { binding: 0, - buffer: pixelBuffer, - offset: 0, - size: pixelBufferSize - }, - { - binding: 1, - buffer: pixelBuffer, + buffer: match$2[0], offset: 0, - size: pixelBufferSize + size: match$2[1] }, { binding: 1, @@ -74,9 +73,15 @@ function _createAndSetBindGroup(device, param) { }, { binding: 2, - buffer: match$2[0], + buffer: match$3[0], offset: 0, - size: AccumulationCPDoService$Wonderjs.getResolutionBufferDataSize(match$2[1]) + size: PassCPDoService$Wonderjs.getResolutionBufferDataSize(match$3[1]) + }, + { + binding: 3, + buffer: match$1[0], + offset: 0, + size: PassCPDoService$Wonderjs.getCommonBufferDataSize(match$1[1]) } ] }, device)); @@ -84,15 +89,15 @@ function _createAndSetBindGroup(device, param) { } function _createAndSetPipeline(device, swapChainFormat, bindGroupLayout) { - var baseShaderPath = "src/run/cloud_picture/domain_layer/domain/pipeline/shader/accumulation"; - var vertexShaderModule = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createShaderModule, { - code: Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).loadGLSL, "" + baseShaderPath + "/accumulation.vert") + var baseShaderPath = "src/run/cloud_picture/domain_layer/domain/shader/accumulation"; + var vertexShaderModule = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createShaderModule, { + code: Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).loadGLSL, "" + baseShaderPath + "/accumulation.vert") }, device); - var fragmentShaderModule = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createShaderModule, { - code: Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).loadGLSL, "" + baseShaderPath + "/accumulation.frag") + var fragmentShaderModule = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createShaderModule, { + code: Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).loadGLSL, "" + baseShaderPath + "/accumulation.frag") }, device); - return AccumulationPassCPRepo$Wonderjs.setPipeline(Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createRenderPipeline, { - layout: Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createPipelineLayout, { + return AccumulationPassCPRepo$Wonderjs.setPipeline(Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createRenderPipeline, { + layout: Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createPipelineLayout, { bindGroupLayouts: [bindGroupLayout] }, device), vertexStage: { @@ -121,17 +126,22 @@ function exec(param) { var swapChainFormat = param[2]; var device = param[1]; AccumulationPassCPRepo$Wonderjs.setAccumulationPixelBufferData(_buildAccumulationPixelBufferData(param[0], device)); - return Result$Wonderjs.mapSuccess(Tuple3$Wonderjs.collectOption(PassCPRepo$Wonderjs.getResolutionBufferData(undefined), PassCPRepo$Wonderjs.getPixelBufferData(undefined), AccumulationPassCPRepo$Wonderjs.getAccumulationPixelBufferData(undefined)), (function (allBufferData) { - var match = allBufferData[2]; - var match$1 = allBufferData[1]; - var match$2 = allBufferData[0]; + return Result$Wonderjs.mapSuccess(Tuple4$Wonderjs.collectOption(PassCPRepo$Wonderjs.getResolutionBufferData(undefined), PassCPRepo$Wonderjs.getPixelBufferData(undefined), PassCPRepo$Wonderjs.getCommonBufferData(undefined), AccumulationPassCPRepo$Wonderjs.getAccumulationPixelBufferData(undefined)), (function (allBufferData) { + var match = allBufferData[3]; + var match$1 = allBufferData[2]; + var match$2 = allBufferData[1]; + var match$3 = allBufferData[0]; return _createAndSetPipeline(device, swapChainFormat, _createAndSetBindGroup(device, [ [ - UniformBufferVO$Wonderjs.value(match$2[0]), + UniformBufferVO$Wonderjs.value(match$3[0]), + match$3[1] + ], + [ + StorageBufferVO$Wonderjs.value(match$2[0]), match$2[1] ], [ - StorageBufferVO$Wonderjs.value(match$1[0]), + UniformBufferVO$Wonderjs.value(match$1[0]), match$1[1] ], [ diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitCameraCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitCameraCPJobEntity.bs.js index 185707a2e6..5065b0fb4a 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitCameraCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitCameraCPJobEntity.bs.js @@ -13,7 +13,7 @@ function create(param) { } function _buildCameraBufferData(device) { - var bufferData = new Float32Array(36); + var bufferData = new Float32Array(34); var bufferSize = bufferData.byteLength; var buffer = UniformBufferVO$Wonderjs.createFromDevice(device, bufferSize); return [ @@ -22,6 +22,10 @@ function _buildCameraBufferData(device) { ]; } +function _buildAndSetAllBufferData(device) { + return CameraCPRepo$Wonderjs.setCameraBufferData(_buildCameraBufferData(device)); +} + function exec(param) { return Most.just(Result$Wonderjs.mapSuccess(OptionSt$Wonderjs.get(WebGPUCPRepo$Wonderjs.getDevice(undefined)), (function (device) { CameraCPRepo$Wonderjs.setCameraBufferData(_buildCameraBufferData(device)); @@ -31,5 +35,6 @@ function exec(param) { exports.create = create; exports._buildCameraBufferData = _buildCameraBufferData; +exports._buildAndSetAllBufferData = _buildAndSetAllBufferData; exports.exec = exec; /* most Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPassCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPassCPJobEntity.bs.js index b08e7e5df9..562c95d8ce 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPassCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPassCPJobEntity.bs.js @@ -6,17 +6,17 @@ var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer var Tuple2$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/tuple/Tuple2.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); var PassCPRepo$Wonderjs = require("../../../../../../repo/pipeline/PassCPRepo.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var WebGPUCPRepo$Wonderjs = require("../../../../../../repo/WebGPUCPRepo.bs.js"); var StorageBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/StorageBufferVO.bs.js"); var UniformBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/UniformBufferVO.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); function create(param) { return JobEntity$Wonderjs.create("init_pass"); } function _buildPixelBufferData($$window, device) { - var bufferSize = Math.imul((Math.imul(Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getWidth, $$window), Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getHeight, $$window)) << 2), Float32Array.BYTES_PER_ELEMENT); + var bufferSize = Math.imul((Math.imul(Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.getWidth, $$window), Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.getHeight, $$window)) << 2), Float32Array.BYTES_PER_ELEMENT); var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, undefined, undefined); return [ buffer, @@ -36,25 +36,27 @@ function _buildCommonBufferData(device) { function _buildResolutionBufferData($$window, device) { var bufferData = new Float32Array([ - Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getWidth, $$window), - Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getHeight, $$window) + Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.getWidth, $$window), + Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.getHeight, $$window) ]); var bufferSize = bufferData.byteLength; var buffer = UniformBufferVO$Wonderjs.createFromDevice(device, bufferSize); - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubFloat32Data, 0, bufferData, UniformBufferVO$Wonderjs.value(buffer)); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubFloat32Data, 0, bufferData, UniformBufferVO$Wonderjs.value(buffer)); return [ buffer, bufferData ]; } +function _buildAndSetAllBufferData($$window, device) { + PassCPRepo$Wonderjs.setPixelBufferData(_buildPixelBufferData($$window, device)); + PassCPRepo$Wonderjs.setCommonBufferData(_buildCommonBufferData(device)); + return PassCPRepo$Wonderjs.setResolutionBufferData(_buildResolutionBufferData($$window, device)); +} + function exec(param) { return Most.just(Result$Wonderjs.mapSuccess(Tuple2$Wonderjs.collectOption(WebGPUCPRepo$Wonderjs.getWindow(undefined), WebGPUCPRepo$Wonderjs.getDevice(undefined)), (function (param) { - var device = param[1]; - var $$window = param[0]; - PassCPRepo$Wonderjs.setPixelBufferData(_buildPixelBufferData($$window, device)); - PassCPRepo$Wonderjs.setCommonBufferData(_buildCommonBufferData(device)); - PassCPRepo$Wonderjs.setResolutionBufferData(_buildResolutionBufferData($$window, device)); + _buildAndSetAllBufferData(param[0], param[1]); }))); } @@ -63,5 +65,6 @@ exports.create = create; exports._buildPixelBufferData = _buildPixelBufferData; exports._buildCommonBufferData = _buildCommonBufferData; exports._buildResolutionBufferData = _buildResolutionBufferData; +exports._buildAndSetAllBufferData = _buildAndSetAllBufferData; exports.exec = exec; /* most Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.bs.js index 2f232fb90a..96ed374e15 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitPathTracingCPJobEntity.bs.js @@ -11,111 +11,51 @@ var OptionSt$Wonderjs = require("../../../../../../../../../construct/domain_lay var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); var ListResult$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/ListResult.bs.js"); var DirectionVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/value_object/DirectionVO.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var IntensityVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/value_object/IntensityVO.bs.js"); var CameraCPRepo$Wonderjs = require("../../../../../../repo/pipeline/CameraCPRepo.bs.js"); var WebGPUCPRepo$Wonderjs = require("../../../../../../repo/WebGPUCPRepo.bs.js"); var POConfigCPRepo$Wonderjs = require("../../../../../../repo/POConfigCPRepo.bs.js"); var StorageBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/StorageBufferVO.bs.js"); var UniformBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/UniformBufferVO.bs.js"); -var DirectionLightRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/DirectionLightRunAPI.bs.js"); -var TypeArrayCPRepoUtils$Wonderjs = require("../../../../../../repo/structure/utils/TypeArrayCPRepoUtils.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); +var OtherConfigDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js"); +var DirectionLightRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/DirectionLightRunAPI.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("../../../../../../../infrastructure_layer/dependency/repo/scene/component/utils/TypeArrayCPRepoUtils.bs.js"); var PathTracingPassCPRepo$Wonderjs = require("../../../../../../repo/pipeline/PathTracingPassCPRepo.bs.js"); +var WebGPURayTracingDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPURayTracingDpRunAPI.bs.js"); function create(param) { return JobEntity$Wonderjs.create("init_pathTracing"); } -function _buildSceneDescBufferData(device) { - var gameObjectCount = POConfigCPRepo$Wonderjs.getTransformCount(undefined); - var bufferData = new Float32Array((gameObjectCount << 5)); - var bufferSize = bufferData.byteLength; - var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.copy_dst | DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.storage, undefined); - return [ - buffer, - bufferSize, - bufferData - ]; -} - -function _buildPointIndexBufferData(device) { - var geometryCount = POConfigCPRepo$Wonderjs.getGeometryCount(undefined); - var bufferData = new Uint32Array((geometryCount << 1)); - var bufferSize = bufferData.byteLength; - var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.copy_dst | DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.storage, undefined); - return [ - buffer, - bufferSize, - bufferData - ]; -} - -function _buildVertexBufferData(device) { - var geometryPopintCount = POConfigCPRepo$Wonderjs.getGeometryPointCount(undefined); - var bufferData = new Float32Array(((geometryPopintCount << 2) << 1)); - var bufferSize = bufferData.byteLength; - var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.copy_dst | DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.storage, undefined); - return [ - buffer, - bufferSize, - bufferData - ]; -} - -function _buildIndexBufferData(device) { - var geometryPopintCount = POConfigCPRepo$Wonderjs.getGeometryPointCount(undefined); - var bufferSize = (geometryPopintCount << 0); - var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.copy_dst | DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.storage, undefined); - return [ - buffer, - bufferSize - ]; -} - -function _buildPBRMaterialBufferData(device) { - var pbrMaterialCount = POConfigCPRepo$Wonderjs.getPBRMaterialCount(undefined); - var bufferData = new Float32Array((pbrMaterialCount << 3)); - var bufferSize = bufferData.byteLength; - var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.copy_dst | DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.storage, undefined); - return [ - buffer, - bufferSize, - bufferData - ]; -} - function _buildDirectionLightBufferData(device) { return Result$Wonderjs.bind(Contract$Wonderjs.requireCheck((function (param) { return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("only has one direction light", "not"), (function (param) { return Contract$Wonderjs.Operators.$eq(DirectionLightRunAPI$Wonderjs.getLightCount(undefined), 1); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { - return Result$Wonderjs.mapSuccess(Result$Wonderjs.bind(ListSt$Wonderjs.traverseResultM(DirectionLightRunAPI$Wonderjs.getAllLights(undefined), (function (light) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { + return Result$Wonderjs.mapSuccess(Result$Wonderjs.bind(Result$Wonderjs.bind(OptionSt$Wonderjs.get(ListSt$Wonderjs.head(DirectionLightRunAPI$Wonderjs.getAllLights(undefined))), (function (light) { return Result$Wonderjs.mapSuccess(OptionSt$Wonderjs.get(DirectionLightRunAPI$Wonderjs.getDirection(light)), (function (direction) { return [ IntensityVO$Wonderjs.value(DirectionLightRunAPI$Wonderjs.getIntensity(light)), DirectionVO$Wonderjs.value(direction) ]; })); - })), (function (list) { + })), (function (param) { var directionLightBufferData = new Float32Array((POConfigCPRepo$Wonderjs.getDirectionLightCount(undefined) << 3)); - return Result$Wonderjs.mapSuccess(ListSt$Wonderjs.traverseReduceResultM(list, 0, (function (offset, param) { - return Result$Wonderjs.mapSuccess(ListResult$Wonderjs.mergeResults({ - hd: TypeArrayCPRepoUtils$Wonderjs.setFloat1(offset + 0 | 0, param[0], directionLightBufferData), - tl: { - hd: TypeArrayCPRepoUtils$Wonderjs.setFloat3(offset + 4 | 0, param[1], directionLightBufferData), - tl: /* [] */0 - } - }), (function (param) { - return offset + 8 | 0; - })); - })), (function (param) { + return Result$Wonderjs.mapSuccess(ListResult$Wonderjs.mergeResults({ + hd: TypeArrayCPRepoUtils$Wonderjs.setFloat1(0, param[0], directionLightBufferData), + tl: { + hd: TypeArrayCPRepoUtils$Wonderjs.setFloat3(4, param[1], directionLightBufferData), + tl: /* [] */0 + } + }), (function (param) { return directionLightBufferData; })); })), (function (directionLightBufferData) { var bufferSize = directionLightBufferData.byteLength; - var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.copy_dst | DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).bufferUsage.storage, undefined); - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubFloat32Data, 0, directionLightBufferData, StorageBufferVO$Wonderjs.value(buffer)); + var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubFloat32Data, 0, directionLightBufferData, StorageBufferVO$Wonderjs.value(buffer)); return [ buffer, bufferSize @@ -124,36 +64,37 @@ function _buildDirectionLightBufferData(device) { })); } -function _createShaderBindingTable(baseShaderPath, device) { - var rayGenShaderModule = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createShaderModule, { - code: Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).loadGLSL, "" + baseShaderPath + "/ray-generation.rgen") +function _createShaderBindingTable(device) { + var baseShaderPath = "src/run/cloud_picture/domain_layer/domain/shader/ray_tracing"; + var rayGenShaderModule = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createShaderModule, { + code: Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).loadGLSL, "" + baseShaderPath + "/ray-generation.rgen") }, device); - var rayRChitShaderModule = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createShaderModule, { - code: Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).loadGLSL, "" + baseShaderPath + "/ray-closest-hit.rchit") + var rayRChitShaderModule = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createShaderModule, { + code: Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).loadGLSL, "" + baseShaderPath + "/ray-closest-hit.rchit") }, device); - var rayMissShaderModule = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createShaderModule, { - code: Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).loadGLSL, "" + baseShaderPath + "/ray-miss.rmiss") + var rayMissShaderModule = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createShaderModule, { + code: Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).loadGLSL, "" + baseShaderPath + "/ray-miss.rmiss") }, device); - var rayMissShadowShaderModule = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createShaderModule, { - code: Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).loadGLSL, "" + baseShaderPath + "/ray-miss-shadow.rmiss") + var rayMissShadowShaderModule = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createShaderModule, { + code: Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).loadGLSL, "" + baseShaderPath + "/ray-miss-shadow.rmiss") }, device); - return Curry._2(DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).device.createRayTracingShaderBindingTable, { + return Curry._2(WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).device.createRayTracingShaderBindingTable, { stages: [ { module: rayGenShaderModule, - stage: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_generation + stage: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_generation }, { module: rayRChitShaderModule, - stage: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit + stage: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_closest_hit }, { module: rayMissShaderModule, - stage: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_miss + stage: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_miss }, { module: rayMissShadowShaderModule, - stage: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_miss + stage: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_miss } ], groups: [ @@ -167,11 +108,11 @@ function _createShaderBindingTable(baseShaderPath, device) { }, { type: "general", - closestHitIndex: 2 + generalIndex: 2 }, { type: "general", - closestHitIndex: 3 + generalIndex: 3 } ] }, device); @@ -180,63 +121,51 @@ function _createShaderBindingTable(baseShaderPath, device) { function exec(param) { return Most.just(Result$Wonderjs.bind(Tuple2$Wonderjs.collectOption(WebGPUCPRepo$Wonderjs.getDevice(undefined), WebGPUCPRepo$Wonderjs.getQueue(undefined)), (function (param) { var device = param[0]; - PathTracingPassCPRepo$Wonderjs.setShaderBindingTable(_createShaderBindingTable("src/run/cloud_picture/domain_layer/domain/shader/ray_tracing", device)); - var cameraBindGroupLayout = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createBindGroupLayout, { + PathTracingPassCPRepo$Wonderjs.setShaderBindingTable(_createShaderBindingTable(device)); + var cameraBindGroupLayout = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createBindGroupLayout, { entries: [{ binding: 0, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_generation | DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_generation, type: "uniform-buffer" }] }, device); PathTracingPassCPRepo$Wonderjs.setCameraBindGroupLayout(cameraBindGroupLayout); - return Result$Wonderjs.mapSuccess(Result$Wonderjs.bind(Result$Wonderjs.mapSuccess(OptionSt$Wonderjs.get(CameraCPRepo$Wonderjs.getCameraBufferData(undefined)), (function (param) { - PathTracingPassCPRepo$Wonderjs.addStaticBindGroupData(1, Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createBindGroup, { - layout: cameraBindGroupLayout, - entries: [{ - binding: 0, - buffer: UniformBufferVO$Wonderjs.value(param[0]), - offset: 0, - size: param[1].byteLength - }] - }, device)); - - })), (function (param) { - var directionLightBindGroupLayout = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createBindGroupLayout, { - entries: [{ - binding: 0, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_generation | DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, - type: "storage-buffer" - }] - }, device); - PathTracingPassCPRepo$Wonderjs.setDirectionLightBindGroupLayout(directionLightBindGroupLayout); - return Result$Wonderjs.mapSuccess(_buildDirectionLightBufferData(device), (function (param) { - return PathTracingPassCPRepo$Wonderjs.addStaticBindGroupData(2, Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createBindGroup, { - layout: directionLightBindGroupLayout, - entries: [{ - binding: 0, - buffer: StorageBufferVO$Wonderjs.value(param[0]), - offset: 0, - size: param[1] - }] - }, device)); - })); + return Result$Wonderjs.bind(Result$Wonderjs.mapSuccess(OptionSt$Wonderjs.get(CameraCPRepo$Wonderjs.getCameraBufferData(undefined)), (function (param) { + PathTracingPassCPRepo$Wonderjs.addStaticBindGroupData(1, Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createBindGroup, { + layout: cameraBindGroupLayout, + entries: [{ + binding: 0, + buffer: UniformBufferVO$Wonderjs.value(param[0]), + offset: 0, + size: param[1].byteLength + }] + }, device)); + })), (function (param) { - PathTracingPassCPRepo$Wonderjs.setSceneDescBufferData(_buildSceneDescBufferData(device)); - PathTracingPassCPRepo$Wonderjs.setPointIndexBufferData(_buildPointIndexBufferData(device)); - PathTracingPassCPRepo$Wonderjs.setVertexBufferData(_buildVertexBufferData(device)); - PathTracingPassCPRepo$Wonderjs.setIndexBufferData(_buildIndexBufferData(device)); - PathTracingPassCPRepo$Wonderjs.setPBRMaterialBufferData(_buildPBRMaterialBufferData(device)); - + var directionLightBindGroupLayout = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createBindGroupLayout, { + entries: [{ + binding: 0, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_closest_hit, + type: "storage-buffer" + }] + }, device); + PathTracingPassCPRepo$Wonderjs.setDirectionLightBindGroupLayout(directionLightBindGroupLayout); + return Result$Wonderjs.mapSuccess(_buildDirectionLightBufferData(device), (function (param) { + return PathTracingPassCPRepo$Wonderjs.addStaticBindGroupData(2, Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createBindGroup, { + layout: directionLightBindGroupLayout, + entries: [{ + binding: 0, + buffer: StorageBufferVO$Wonderjs.value(param[0]), + offset: 0, + size: param[1] + }] + }, device)); + })); })); }))); } exports.create = create; -exports._buildSceneDescBufferData = _buildSceneDescBufferData; -exports._buildPointIndexBufferData = _buildPointIndexBufferData; -exports._buildVertexBufferData = _buildVertexBufferData; -exports._buildIndexBufferData = _buildIndexBufferData; -exports._buildPBRMaterialBufferData = _buildPBRMaterialBufferData; exports._buildDirectionLightBufferData = _buildDirectionLightBufferData; exports._createShaderBindingTable = _createShaderBindingTable; exports.exec = exec; diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitWebGPUCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitWebGPUCPJobEntity.bs.js index f5a90f15f6..14caff86a2 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitWebGPUCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/InitWebGPUCPJobEntity.bs.js @@ -6,10 +6,10 @@ var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer var OptionSt$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); var ResultMost$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/ResultMost.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var WebGPUCPRepo$Wonderjs = require("../../../../../../repo/WebGPUCPRepo.bs.js"); +var WebGPUCoreRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/WebGPUCoreRunAPI.bs.js"); var PictureCPDoService$Wonderjs = require("../../../../../picture/picture/service/PictureCPDoService.bs.js"); -var LoadWebGPUDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/service/LoadWebGPUDoService.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); function create(param) { return JobEntity$Wonderjs.create("init_webgpu"); @@ -17,24 +17,25 @@ function create(param) { function exec(param) { return ResultMost$Wonderjs.sequenceMostM(Result$Wonderjs.mapSuccess(OptionSt$Wonderjs.get(PictureCPDoService$Wonderjs.getSize(undefined)), (function (param) { - var __x = LoadWebGPUDoService$Wonderjs.load(Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.make, { + var __x = WebGPUCoreRunAPI$Wonderjs.load(Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.make, { width: param[0], height: param[1], title: "Cloud Picture", resizable: false })); return Most.map((function (param) { - var swapChainFormat = param[4]; - var context = param[2]; - var device = param[1]; - var swapChain = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).context.configureSwapChain, { + var swapChainFormat = param[5]; + var context = param[3]; + var device = param[2]; + var swapChain = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).context.configureSwapChain, { device: device, format: swapChainFormat }, context); + WebGPUCPRepo$Wonderjs.setWindow(param[0]); WebGPUCPRepo$Wonderjs.setDevice(device); - WebGPUCPRepo$Wonderjs.setAdapter(param[0]); + WebGPUCPRepo$Wonderjs.setAdapter(param[1]); WebGPUCPRepo$Wonderjs.setContext(context); - WebGPUCPRepo$Wonderjs.setQueue(param[3]); + WebGPUCPRepo$Wonderjs.setQueue(param[4]); WebGPUCPRepo$Wonderjs.setSwapChainFormat(swapChainFormat); WebGPUCPRepo$Wonderjs.setSwapChain(swapChain); diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/StartTimeCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/StartTimeCPJobEntity.bs.js index 30f17acab5..0b4cf42b96 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/StartTimeCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/init/StartTimeCPJobEntity.bs.js @@ -3,14 +3,14 @@ var Most = require("most"); var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); -var TimeStatisticDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/statistic/statistic/service/TimeStatisticDoService.bs.js"); +var TimeRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/TimeRunAPI.bs.js"); function create(param) { return JobEntity$Wonderjs.create("start_time"); } function exec(param) { - return Most.just(Result$Wonderjs.succeed(TimeStatisticDoService$Wonderjs.start(undefined))); + return Most.just(Result$Wonderjs.succeed(TimeRunAPI$Wonderjs.start(undefined))); } exports.create = create; diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/EndRenderCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/EndRenderCPJobEntity.bs.js new file mode 100644 index 0000000000..cb85efb4ec --- /dev/null +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/EndRenderCPJobEntity.bs.js @@ -0,0 +1,24 @@ +'use strict'; + +var Most = require("most"); +var Curry = require("bs-platform/lib/js/curry.js"); +var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); +var Tuple2$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/tuple/Tuple2.bs.js"); +var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); +var WebGPUCPRepo$Wonderjs = require("../../../../../../repo/WebGPUCPRepo.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); + +function create(param) { + return JobEntity$Wonderjs.create("end_render"); +} + +function exec(param) { + return Most.just(Result$Wonderjs.mapSuccess(Tuple2$Wonderjs.collectOption(WebGPUCPRepo$Wonderjs.getWindow(undefined), WebGPUCPRepo$Wonderjs.getSwapChain(undefined)), (function (param) { + Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).swapChain.present, param[1]); + return Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.pollEvents, param[0]); + }))); +} + +exports.create = create; +exports.exec = exec; +/* most Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderAccumulationCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderAccumulationCPJobEntity.bs.js index ea0155c779..76d76ee01e 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderAccumulationCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderAccumulationCPJobEntity.bs.js @@ -5,8 +5,8 @@ var Curry = require("bs-platform/lib/js/curry.js"); var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var Tuple6$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/tuple/Tuple6.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var WebGPUCPRepo$Wonderjs = require("../../../../../../repo/WebGPUCPRepo.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); var AccumulationPassCPRepo$Wonderjs = require("../../../../../../repo/pipeline/AccumulationPassCPRepo.bs.js"); function create(param) { @@ -16,9 +16,9 @@ function create(param) { function exec(param) { return Most.just(Result$Wonderjs.mapSuccess(Tuple6$Wonderjs.collectOption(WebGPUCPRepo$Wonderjs.getDevice(undefined), WebGPUCPRepo$Wonderjs.getQueue(undefined), WebGPUCPRepo$Wonderjs.getWindow(undefined), WebGPUCPRepo$Wonderjs.getSwapChain(undefined), AccumulationPassCPRepo$Wonderjs.getStaticBindGroupData(undefined), AccumulationPassCPRepo$Wonderjs.getPipeline(undefined)), (function (param) { var match = param[4]; - var backBufferView = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).swapChain.getCurrentTextureView, undefined, param[3]); - var commandEncoder = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createCommandEncoder, {}, param[0]); - var renderPass = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).commandEncoder.beginRenderPass, { + var backBufferView = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).swapChain.getCurrentTextureView, undefined, param[3]); + var commandEncoder = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createCommandEncoder, {}, param[0]); + var renderPass = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).commandEncoder.beginRenderPass, { colorAttachments: [{ clearColor: { r: 0.0, @@ -31,11 +31,11 @@ function exec(param) { attachment: backBufferView }] }, commandEncoder); - Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).passEncoder.render.setPipeline, param[5], renderPass); - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).passEncoder.render.setBindGroup, match.setSlot, match.bindGroup, renderPass); - Curry._5(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).passEncoder.render.draw, 3, 1, 0, 0, renderPass); - Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).passEncoder.render.endPass, renderPass); - return Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).queue.submit, [Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).commandEncoder.finish, commandEncoder)], param[1]); + Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).passEncoder.render.setPipeline, param[5], renderPass); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).passEncoder.render.setBindGroup, match.setSlot, match.bindGroup, renderPass); + Curry._5(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).passEncoder.render.draw, 3, 1, 0, 0, renderPass); + Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).passEncoder.render.endPass, renderPass); + return Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).queue.submit, [Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).commandEncoder.finish, commandEncoder)], param[1]); }))); } diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderPathTracingCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderPathTracingCPJobEntity.bs.js index c0ec1ed932..d0765e54e1 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderPathTracingCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/RenderPathTracingCPJobEntity.bs.js @@ -6,9 +6,10 @@ var ListSt$Wonderjs = require("../../../../../../../../../construct/domain_layer var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var Tuple4$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/tuple/Tuple4.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var WebGPUCPRepo$Wonderjs = require("../../../../../../repo/WebGPUCPRepo.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); var PathTracingPassCPRepo$Wonderjs = require("../../../../../../repo/pipeline/PathTracingPassCPRepo.bs.js"); +var WebGPURayTracingDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPURayTracingDpRunAPI.bs.js"); function create(param) { return JobEntity$Wonderjs.create("render_pathTracing"); @@ -17,15 +18,15 @@ function create(param) { function exec(param) { return Most.just(Result$Wonderjs.mapSuccess(Tuple4$Wonderjs.collectOption(WebGPUCPRepo$Wonderjs.getDevice(undefined), WebGPUCPRepo$Wonderjs.getQueue(undefined), WebGPUCPRepo$Wonderjs.getWindow(undefined), PathTracingPassCPRepo$Wonderjs.getPipeline(undefined)), (function (param) { var $$window = param[2]; - var commandEncoder = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createCommandEncoder, {}, param[0]); - var rtPass = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).commandEncoder.beginRayTracingPass, {}, commandEncoder); - Curry._2(DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).passEncoderRayTracing.setPipeline, param[3], rtPass); + var commandEncoder = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createCommandEncoder, {}, param[0]); + var rtPass = Curry._2(WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).commandEncoder.beginRayTracingPass, {}, commandEncoder); + Curry._2(WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).passEncoder.setPipeline, param[3], rtPass); ListSt$Wonderjs.forEach(PathTracingPassCPRepo$Wonderjs.getAllStaticBindGroupData(undefined), (function (param) { - return Curry._3(DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).passEncoderRayTracing.setBindGroup, param.setSlot, param.bindGroup, rtPass); + return Curry._3(WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).passEncoder.setBindGroup, param.setSlot, param.bindGroup, rtPass); })); - Curry._7(DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).passEncoderRayTracing.traceRays, 0, 1, 2, Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getWidth, $$window), Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).window.getHeight, $$window), 1, rtPass); - Curry._1(DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).passEncoderRayTracing.endPass, rtPass); - return Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).queue.submit, [Curry._1(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).commandEncoder.finish, commandEncoder)], param[1]); + Curry._7(WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).passEncoder.traceRays, 0, 1, 2, Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.getWidth, $$window), Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).window.getHeight, $$window), 1, rtPass); + Curry._1(WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).passEncoder.endPass, rtPass); + return Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).queue.submit, [Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).commandEncoder.finish, commandEncoder)], param[1]); }))); } diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateAccumulationCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateAccumulationCPJobEntity.bs.js index 3e93d8d53a..7476de3c37 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateAccumulationCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateAccumulationCPJobEntity.bs.js @@ -3,14 +3,14 @@ var Most = require("most"); var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); -var AccumulationCPDoService$Wonderjs = require("../../../service/AccumulationCPDoService.bs.js"); +var AccumulationPassCPDoService$Wonderjs = require("../../../service/AccumulationPassCPDoService.bs.js"); function create(param) { return JobEntity$Wonderjs.create("update_accumulation"); } function exec(param) { - return Most.just(Result$Wonderjs.succeed(AccumulationCPDoService$Wonderjs.increaseSampleAccumulation(undefined))); + return Most.just(Result$Wonderjs.succeed(AccumulationPassCPDoService$Wonderjs.increaseSampleAccumulation(undefined))); } exports.create = create; diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateCameraCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateCameraCPJobEntity.bs.js index 97a45c3a5a..17e4acc7e0 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateCameraCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateCameraCPJobEntity.bs.js @@ -11,19 +11,16 @@ var Matrix4$Wonderjs = require("../../../../../../../../../construct/domain_laye var OptionSt$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); var ListResult$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/ListResult.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var CameraCPRepo$Wonderjs = require("../../../../../../repo/pipeline/CameraCPRepo.bs.js"); var ResultOption$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/ResultOption.bs.js"); var ViewMatrixVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/value_object/ViewMatrixVO.bs.js"); var UniformBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/UniformBufferVO.bs.js"); +var GameObjectRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/GameObjectRunAPI.bs.js"); var ProjectionMatrixVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/value_object/ProjectionMatrixVO.bs.js"); -var TypeArrayCPRepoUtils$Wonderjs = require("../../../../../../repo/structure/utils/TypeArrayCPRepoUtils.bs.js"); -var BasicCameraViewRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/BasicCameraViewRunAPI.bs.js"); -var ActiveBasicCameraViewDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/service/basic_camera_view/ActiveBasicCameraViewDoService.bs.js"); -var GetComponentGameObjectDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/service/gameObject/GetComponentGameObjectDoService.bs.js"); -var PerspectiveCameraProjectionRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/PerspectiveCameraProjectionRunAPI.bs.js"); -var GameObjectBasicCameraViewDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/service/basic_camera_view/GameObjectBasicCameraViewDoService.bs.js"); -var UpdatePerspectiveCameraProjectionDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/service/perspective_camera_projection/UpdatePerspectiveCameraProjectionDoService.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("../../../../../../../infrastructure_layer/dependency/repo/scene/component/utils/TypeArrayCPRepoUtils.bs.js"); +var BasicCameraViewRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/BasicCameraViewRunAPI.bs.js"); +var PerspectiveCameraProjectionRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/PerspectiveCameraProjectionRunAPI.bs.js"); function create(param) { return JobEntity$Wonderjs.create("update_camera"); @@ -38,9 +35,9 @@ function _updateCameraBuffer(param) { var cameraBufferData = param[1]; var cameraBuffer = param[0]; return Result$Wonderjs.mapSuccess(ListResult$Wonderjs.mergeResults({ - hd: TypeArrayCPRepoUtils$Wonderjs.setFloat32Array(0, viewInverse, cameraBufferData), + hd: TypeArrayCPRepoUtils$Wonderjs.setFloat16WithFloat32Array(0, viewInverse, cameraBufferData), tl: { - hd: TypeArrayCPRepoUtils$Wonderjs.setFloat32Array(16, projectionInverse, cameraBufferData), + hd: TypeArrayCPRepoUtils$Wonderjs.setFloat16WithFloat32Array(16, projectionInverse, cameraBufferData), tl: { hd: TypeArrayCPRepoUtils$Wonderjs.setFloat2(32, [ near, @@ -50,7 +47,7 @@ function _updateCameraBuffer(param) { } } }), (function (param) { - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubFloat32Data, 0, cameraBufferData, UniformBufferVO$Wonderjs.value(cameraBuffer)); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubFloat32Data, 0, cameraBufferData, UniformBufferVO$Wonderjs.value(cameraBuffer)); return CameraCPRepo$Wonderjs.setCameraBufferData([ cameraBuffer, cameraBufferData @@ -60,9 +57,9 @@ function _updateCameraBuffer(param) { } function _updateCamera(param) { - return Result$Wonderjs.bind(ResultOption$Wonderjs.openInverse(ActiveBasicCameraViewDoService$Wonderjs.getActiveCameraView(undefined)), (function (activeCameraView) { - return Result$Wonderjs.bind(Result$Wonderjs.bind(Result$Wonderjs.bind(OptionSt$Wonderjs.get(GameObjectBasicCameraViewDoService$Wonderjs.getGameObject(activeCameraView)), (function (gameObject) { - return Tuple2$Wonderjs.collectOption(GetComponentGameObjectDoService$Wonderjs.getTransform(gameObject), GetComponentGameObjectDoService$Wonderjs.getPerspectiveCameraProjection(gameObject)); + return ResultOption$Wonderjs.openInverseSucceedWithNone(BasicCameraViewRunAPI$Wonderjs.getActiveBasicCameraView(undefined), (function (activeCameraView) { + return Result$Wonderjs.bind(Result$Wonderjs.bind(Result$Wonderjs.bind(OptionSt$Wonderjs.get(BasicCameraViewRunAPI$Wonderjs.getGameObject(activeCameraView)), (function (gameObject) { + return Tuple2$Wonderjs.collectOption(GameObjectRunAPI$Wonderjs.getTransform(gameObject), GameObjectRunAPI$Wonderjs.getPerspectiveCameraProjection(gameObject)); })), (function (param) { var cameraProjection = param[1]; return Tuple4$Wonderjs.collectResult(Result$Wonderjs.bind(ResultOption$Wonderjs.openInverse(BasicCameraViewRunAPI$Wonderjs.getViewWorldToCameraMatrix(activeCameraView)), (function (viewMatrix) { @@ -82,7 +79,13 @@ function _updateCamera(param) { } function exec(param) { - return Most.just(UpdatePerspectiveCameraProjectionDoService$Wonderjs.update(undefined)); + return Most.just(ListResult$Wonderjs.mergeResults({ + hd: PerspectiveCameraProjectionRunAPI$Wonderjs.update(undefined), + tl: { + hd: _updateCamera(undefined), + tl: /* [] */0 + } + })); } exports.create = create; diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePassCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePassCPJobEntity.bs.js index 51001aef4f..9e60ca54c3 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePassCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePassCPJobEntity.bs.js @@ -7,9 +7,9 @@ var OptionSt$Wonderjs = require("../../../../../../../../../construct/domain_lay var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); var ListResult$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/ListResult.bs.js"); var PassCPRepo$Wonderjs = require("../../../../../../repo/pipeline/PassCPRepo.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var UniformBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/UniformBufferVO.bs.js"); -var TypeArrayCPRepoUtils$Wonderjs = require("../../../../../../repo/structure/utils/TypeArrayCPRepoUtils.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("../../../../../../../infrastructure_layer/dependency/repo/scene/component/utils/TypeArrayCPRepoUtils.bs.js"); function create(param) { return JobEntity$Wonderjs.create("update_pass"); @@ -27,7 +27,7 @@ function _updateCommonBufferData(param) { tl: /* [] */0 } }), (function (param) { - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubUint32Data, 0, commonBufferData, UniformBufferVO$Wonderjs.value(commonBuffer)); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubUint32Data, 0, commonBufferData, UniformBufferVO$Wonderjs.value(commonBuffer)); return PassCPRepo$Wonderjs.setCommonBufferData([ commonBuffer, commonBufferData diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.bs.js index 096457cd17..94e0cb9755 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdatePathTracingCPJobEntity.bs.js @@ -22,25 +22,29 @@ var GeometryEntity$Wonderjs = require("../../../../../../../../../construct/doma var NormalMatrixVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/value_object/NormalMatrixVO.bs.js"); var PassCPDoService$Wonderjs = require("../../../service/PassCPDoService.bs.js"); var StorageBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/StorageBufferVO.bs.js"); -var TransformRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/TransformRunAPI.bs.js"); +var TransformRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/TransformRunAPI.bs.js"); var UniformBufferVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/core/value_object/UniformBufferVO.bs.js"); -var GameObjectRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/GameObjectRunAPI.bs.js"); +var GameObjectRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/GameObjectRunAPI.bs.js"); var PBRMaterialEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/entity/PBRMaterialEntity.bs.js"); -var PBRMaterialRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/PBRMaterialRunAPI.bs.js"); +var PBRMaterialRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/PBRMaterialRunAPI.bs.js"); +var WebGPUCoreDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPUCoreDpRunAPI.bs.js"); +var OtherConfigDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js"); var LocalToWorldMatrixVO$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/value_object/LocalToWorldMatrixVO.bs.js"); var PointsGeometryCPRepo$Wonderjs = require("../../../../../../repo/scene/component/geometry/PointsGeometryCPRepo.bs.js"); -var TypeArrayCPRepoUtils$Wonderjs = require("../../../../../../repo/structure/utils/TypeArrayCPRepoUtils.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("../../../../../../../infrastructure_layer/dependency/repo/scene/component/utils/TypeArrayCPRepoUtils.bs.js"); var PathTracingPassCPRepo$Wonderjs = require("../../../../../../repo/pipeline/PathTracingPassCPRepo.bs.js"); -var BuildAccerlerationContainerDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/webgpu/ray_tracing/service/BuildAccerlerationContainerDoService.bs.js"); +var WebGPURayTracingRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/WebGPURayTracingRunAPI.bs.js"); +var WebGPURayTracingDpRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/dependency/WebGPURayTracingDpRunAPI.bs.js"); function create(param) { return JobEntity$Wonderjs.create("update_pathTracing"); } -function _updateSceneDescBufferData(param, allRenderGameObjects) { - var sceneDescBufferData = param[2]; - var sceneDescBufferSize = param[1]; - var sceneDescBuffer = param[0]; +function _buildAndSetSceneDescBufferData(device, allRenderGameObjects) { + var gameObjectCount = ListSt$Wonderjs.length(allRenderGameObjects); + var bufferData = new Float32Array((gameObjectCount << 5)); + var bufferSize = bufferData.byteLength; + var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined); return Result$Wonderjs.mapSuccess(Result$Wonderjs.bind(ListSt$Wonderjs.traverseResultM(allRenderGameObjects, (function (gameObject) { return Tuple3$Wonderjs.collectOption(GameObjectRunAPI$Wonderjs.getTransform(gameObject), GameObjectRunAPI$Wonderjs.getGeometry(gameObject), GameObjectRunAPI$Wonderjs.getPBRMaterial(gameObject)); })), (function (list) { @@ -53,11 +57,11 @@ function _updateSceneDescBufferData(param, allRenderGameObjects) { hd: TypeArrayCPRepoUtils$Wonderjs.setFloat2(offset + 0 | 0, [ GeometryEntity$Wonderjs.value(geometry), PBRMaterialEntity$Wonderjs.value(pbrMaterial) - ], sceneDescBufferData), + ], bufferData), tl: { - hd: TypeArrayCPRepoUtils$Wonderjs.setMat3Data(offset + 4 | 0, NormalMatrixVO$Wonderjs.value(normalMatrix), sceneDescBufferData), + hd: TypeArrayCPRepoUtils$Wonderjs.setMat3Data(offset + 4 | 0, NormalMatrixVO$Wonderjs.value(normalMatrix), bufferData), tl: { - hd: TypeArrayCPRepoUtils$Wonderjs.setMat3Data((offset + 4 | 0) + 12 | 0, LocalToWorldMatrixVO$Wonderjs.value(TransformRunAPI$Wonderjs.getLocalToWorldMatrix(transform)), sceneDescBufferData), + hd: TypeArrayCPRepoUtils$Wonderjs.setFloat16WithFloat32Array((offset + 4 | 0) + 12 | 0, LocalToWorldMatrixVO$Wonderjs.value(TransformRunAPI$Wonderjs.getLocalToWorldMatrix(transform)), bufferData), tl: /* [] */0 } } @@ -67,156 +71,156 @@ function _updateSceneDescBufferData(param, allRenderGameObjects) { })); })); })), (function (param) { - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubFloat32Data, 0, sceneDescBufferData, StorageBufferVO$Wonderjs.value(sceneDescBuffer)); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubFloat32Data, 0, bufferData, StorageBufferVO$Wonderjs.value(buffer)); return PathTracingPassCPRepo$Wonderjs.setSceneDescBufferData([ - sceneDescBuffer, - sceneDescBufferSize, - sceneDescBufferData + buffer, + bufferSize, + bufferData ]); })); } -function _updatePointIndexBufferData(param, allRenderGeometries) { - var pointIndexBufferData = param[2]; - var pointIndexBufferSize = param[1]; - var pointIndexBuffer = param[0]; +function _convertVertexStartIndexFromAlignedInPOToInVertexBufferData(vertexStartIndex) { + return Result$Wonderjs.mapSuccess(Contract$Wonderjs.requireCheck((function (param) { + return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("vertexStartIndex:" + vertexStartIndex + " be 3 times", "not"), (function (param) { + var x = vertexStartIndex / 3; + return Contract$Wonderjs.Operators.$eq$eq$dot(x - Math.floor(x), 0.0); + })); + }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + return vertexStartIndex / 3 | 0; + })); +} + +function _buildAndSetPointIndexBufferData(device, allRenderGeometries) { + var geometryCount = ListSt$Wonderjs.length(allRenderGeometries); + var bufferData = new Uint32Array((geometryCount << 1)); + var bufferSize = bufferData.byteLength; + var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined); return Result$Wonderjs.mapSuccess(Result$Wonderjs.bind(ListSt$Wonderjs.traverseResultM(allRenderGeometries, (function (geometry) { var geometry$1 = GeometryEntity$Wonderjs.value(geometry); return Tuple3$Wonderjs.collectResult(Result$Wonderjs.succeed(geometry$1), PointsGeometryCPRepo$Wonderjs.getVertexInfo(geometry$1), PointsGeometryCPRepo$Wonderjs.getIndexInfo(geometry$1)); })), (function (list) { return ListSt$Wonderjs.traverseResultM(list, (function (param) { + var faceStartIndex = param[2][0]; var geometry = param[0]; - return ListResult$Wonderjs.mergeResults({ - hd: TypeArrayCPRepoUtils$Wonderjs.setUint32_1((geometry << 1), param[1][0] / 3 * 8 | 0, pointIndexBufferData), - tl: { - hd: TypeArrayCPRepoUtils$Wonderjs.setUint32_1((geometry << 1) + 1 | 0, param[2][0], pointIndexBufferData), - tl: /* [] */0 - } - }); + return Result$Wonderjs.bind(_convertVertexStartIndexFromAlignedInPOToInVertexBufferData(param[1][0]), (function (vertexStartIndex) { + return ListResult$Wonderjs.mergeResults({ + hd: TypeArrayCPRepoUtils$Wonderjs.setUint32_1((geometry << 1), vertexStartIndex, bufferData), + tl: { + hd: TypeArrayCPRepoUtils$Wonderjs.setUint32_1((geometry << 1) + 1 | 0, faceStartIndex, bufferData), + tl: /* [] */0 + } + }); + })); })); })), (function (param) { - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubUint32Data, 0, pointIndexBufferData, StorageBufferVO$Wonderjs.value(pointIndexBuffer)); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubUint32Data, 0, bufferData, StorageBufferVO$Wonderjs.value(buffer)); return PathTracingPassCPRepo$Wonderjs.setPointIndexBufferData([ - pointIndexBuffer, - pointIndexBufferSize, - pointIndexBufferData + buffer, + bufferSize, + bufferData ]); })); } -function _updateVertexBufferData(param) { - var vertexBufferData = param[2]; - var vertexBufferSize = param[1]; - var vertexBuffer = param[0]; - return Result$Wonderjs.tap(Contract$Wonderjs.requireCheck((function (param) { - return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("vertices.length == normals.length", "not"), (function (param) { - var vertices = PointsGeometryCPRepo$Wonderjs.getVerticesTypeArr(undefined); - var normals = PointsGeometryCPRepo$Wonderjs.getNormalsTypeArr(undefined); - return Contract$Wonderjs.Operators.$eq(vertices.length, normals.length); +function _buildAndSetVertexBufferData(device) { + return Result$Wonderjs.mapSuccess(Contract$Wonderjs.requireCheck((function (param) { + Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("vertices.length == normals.length", "not"), (function (param) { + var vertices = PointsGeometryCPRepo$Wonderjs.getVerticesTypeArr(undefined); + var normals = PointsGeometryCPRepo$Wonderjs.getNormalsTypeArr(undefined); + return Contract$Wonderjs.Operators.$eq(vertices.length, normals.length); + })); + Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("verticesOffset == normalsOffset", "not"), (function (param) { + return Contract$Wonderjs.Operators.$eq(PointsGeometryCPRepo$Wonderjs.getVerticesOffset(undefined), PointsGeometryCPRepo$Wonderjs.getNormalsOffset(undefined)); + })); + return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("verticesOffset be 3 times", "not"), (function (param) { + var x = PointsGeometryCPRepo$Wonderjs.getVerticesOffset(undefined) / 3; + return Contract$Wonderjs.Operators.$eq$eq$dot(x - Math.floor(x), 0.0); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { + var bufferData = new Float32Array(((PointsGeometryCPRepo$Wonderjs.getVerticesOffset(undefined) / 3 | 0) << 3)); + var bufferSize = bufferData.byteLength; + var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined); var vertices = PointsGeometryCPRepo$Wonderjs.getVerticesTypeArr(undefined); var normals = PointsGeometryCPRepo$Wonderjs.getNormalsTypeArr(undefined); - var length = vertices.length; + var length = PointsGeometryCPRepo$Wonderjs.getVerticesOffset(undefined); var i = 0; var j = 0; while(i < length) { - vertexBufferData[j] = vertices[i]; - vertexBufferData[j + 1 | 0] = vertices[i + 1 | 0]; - vertexBufferData[j + 2 | 0] = vertices[i + 2 | 0]; - vertexBufferData[j + 4 | 0] = normals[i]; - vertexBufferData[j + 5 | 0] = normals[i + 1 | 0]; - vertexBufferData[j + 6 | 0] = normals[i + 2 | 0]; + bufferData[j] = vertices[i]; + bufferData[j + 1 | 0] = vertices[i + 1 | 0]; + bufferData[j + 2 | 0] = vertices[i + 2 | 0]; + bufferData[j + 4 | 0] = normals[i]; + bufferData[j + 5 | 0] = normals[i + 1 | 0]; + bufferData[j + 6 | 0] = normals[i + 2 | 0]; i = i + 3 | 0; j = j + 8 | 0; }; - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubFloat32Data, 0, vertexBufferData, StorageBufferVO$Wonderjs.value(vertexBuffer)); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubFloat32Data, 0, bufferData, StorageBufferVO$Wonderjs.value(buffer)); return PathTracingPassCPRepo$Wonderjs.setVertexBufferData([ - vertexBuffer, - vertexBufferSize, - vertexBufferData + buffer, + bufferSize, + bufferData ]); })); } -function _updateIndexBufferData(param) { - var indexBuffer = param[0]; - var indices = PointsGeometryCPRepo$Wonderjs.getIndicesTypeArr(undefined); - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubUint32Data, 0, indices, StorageBufferVO$Wonderjs.value(indexBuffer)); +function _buildAndSetIndexBufferData(device) { + var bufferData = PointsGeometryCPRepo$Wonderjs.getCopyUsedIndicesTypeArr(undefined); + var bufferSize = bufferData.byteLength; + var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubUint32Data, 0, bufferData, StorageBufferVO$Wonderjs.value(buffer)); return PathTracingPassCPRepo$Wonderjs.setIndexBufferData([ - indexBuffer, - param[1] + buffer, + bufferSize ]); } -function _updatePBRMaterialBufferData(param, allRenderPBRMaterials) { - var pbrMaterialBufferData = param[2]; - var pbrMaterialBufferSize = param[1]; - var pbrMaterialBuffer = param[0]; +function _buildAndSetPBRMaterialBufferData(device, allRenderPBRMaterials) { + var pbrMaterialCount = ListSt$Wonderjs.length(allRenderPBRMaterials); + var bufferData = new Float32Array((pbrMaterialCount << 3)); + var bufferSize = bufferData.byteLength; + var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined); return Result$Wonderjs.mapSuccess(ListSt$Wonderjs.traverseReduceResultM(allRenderPBRMaterials, 0, (function (offset, pbrMaterial) { var diffuse = DiffuseVO$Wonderjs.getPrimitiveValue(PBRMaterialRunAPI$Wonderjs.getDiffuseColor(pbrMaterial)); var specular = SpecularVO$Wonderjs.value(PBRMaterialRunAPI$Wonderjs.getSpecular(pbrMaterial)); var roughness = RoughnessVO$Wonderjs.value(PBRMaterialRunAPI$Wonderjs.getRoughness(pbrMaterial)); var metalness = MetalnessVO$Wonderjs.value(PBRMaterialRunAPI$Wonderjs.getMetalness(pbrMaterial)); return Result$Wonderjs.mapSuccess(ListResult$Wonderjs.mergeResults({ - hd: TypeArrayCPRepoUtils$Wonderjs.setFloat3(offset + 0 | 0, diffuse, pbrMaterialBufferData), + hd: TypeArrayCPRepoUtils$Wonderjs.setFloat3(offset + 0 | 0, diffuse, bufferData), tl: { hd: TypeArrayCPRepoUtils$Wonderjs.setFloat3(offset + 4 | 0, [ metalness, roughness, specular - ], pbrMaterialBufferData), + ], bufferData), tl: /* [] */0 } }), (function (param) { return (offset + 4 | 0) + 4 | 0; })); })), (function (param) { - Curry._3(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).buffer.setSubFloat32Data, 0, pbrMaterialBufferData, StorageBufferVO$Wonderjs.value(pbrMaterialBuffer)); + Curry._3(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).buffer.setSubFloat32Data, 0, bufferData, StorageBufferVO$Wonderjs.value(buffer)); return PathTracingPassCPRepo$Wonderjs.setPBRMaterialBufferData([ - pbrMaterialBuffer, - pbrMaterialBufferSize, - pbrMaterialBufferData + buffer, + bufferSize, + bufferData ]); })); } -function _updateAllBufferData(param) { - var match = param[4]; - var match$1 = param[3]; - var match$2 = param[2]; - var match$3 = param[1]; - var match$4 = param[0]; +function _buildAndSetAllBufferData(device) { var allRenderGeometries = GameObjectRunAPI$Wonderjs.getAllRenderGeometries(undefined); return ListResult$Wonderjs.mergeResults({ - hd: _updateSceneDescBufferData([ - match$4[0], - match$4[1], - match$4[2] - ], GameObjectRunAPI$Wonderjs.getAllRenderGameObjects(undefined)), + hd: _buildAndSetSceneDescBufferData(device, GameObjectRunAPI$Wonderjs.getAllRenderGameObjects(undefined)), tl: { - hd: _updatePointIndexBufferData([ - match$3[0], - match$3[1], - match$3[2] - ], allRenderGeometries), + hd: _buildAndSetPointIndexBufferData(device, allRenderGeometries), tl: { - hd: _updateVertexBufferData([ - match$2[0], - match$2[1], - match$2[2] - ]), + hd: _buildAndSetVertexBufferData(device), tl: { - hd: Result$Wonderjs.succeed(_updateIndexBufferData([ - match$1[0], - match$1[1] - ])), + hd: Result$Wonderjs.succeed(_buildAndSetIndexBufferData(device)), tl: { - hd: _updatePBRMaterialBufferData([ - match[0], - match[1], - match[2] - ], GameObjectRunAPI$Wonderjs.getAllRenderPBRMaterials(undefined)), + hd: _buildAndSetPBRMaterialBufferData(device, GameObjectRunAPI$Wonderjs.getAllRenderPBRMaterials(undefined)), tl: /* [] */0 } } @@ -233,51 +237,51 @@ function _createAndAddRayTracingBindGroup(device, instanceContainer, param, para var match$4 = param[2]; var match$5 = param[1]; var match$6 = param[0]; - var rtBindGroupLayout = Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createBindGroupLayout, { + var rtBindGroupLayout = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createBindGroupLayout, { entries: [ { binding: 0, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_generation | DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_generation | WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_closest_hit, type: "acceleration-container" }, { binding: 1, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_generation, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_generation, type: "storage-buffer" }, { binding: 2, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_generation | DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_generation, type: "uniform-buffer" }, { binding: 3, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_closest_hit, type: "storage-buffer" }, { binding: 4, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_closest_hit, type: "storage-buffer" }, { binding: 5, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_closest_hit, type: "storage-buffer" }, { binding: 6, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_closest_hit, type: "storage-buffer" }, { binding: 7, - visibility: DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).shaderStage.ray_closest_hit, + visibility: WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).shaderStage.ray_closest_hit, type: "storage-buffer" } ] }, device); - PathTracingPassCPRepo$Wonderjs.addStaticBindGroupData(0, Curry._2(DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).device.createRayTracingBindGroup, { + PathTracingPassCPRepo$Wonderjs.addStaticBindGroupData(0, Curry._2(WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).device.createRayTracingBindGroup, { layout: rtBindGroupLayout, entries: [ { @@ -296,7 +300,7 @@ function _createAndAddRayTracingBindGroup(device, instanceContainer, param, para binding: 2, buffer: UniformBufferVO$Wonderjs.value(match[0]), offset: 0, - size: PassCPDoService$Wonderjs.getCommonDataBufferSize(match[1]) + size: PassCPDoService$Wonderjs.getCommonBufferDataSize(match[1]) }, { binding: 3, @@ -335,8 +339,8 @@ function _createAndAddRayTracingBindGroup(device, instanceContainer, param, para function _createAndSetPipeline(device, rtBindGroupLayout) { return Result$Wonderjs.mapSuccess(Tuple3$Wonderjs.collectOption(PathTracingPassCPRepo$Wonderjs.getShaderBindingTable(undefined), PathTracingPassCPRepo$Wonderjs.getCameraBindGroupLayout(undefined), PathTracingPassCPRepo$Wonderjs.getDirectionLightBindGroupLayout(undefined)), (function (param) { - return PathTracingPassCPRepo$Wonderjs.setPipeline(Curry._2(DpContainer$Wonderjs.unsafeGetWebGPURayTracingDp(undefined).device.createRayTracingPipeline, { - layout: Curry._2(DpContainer$Wonderjs.unsafeGetWebGPUCoreDp(undefined).device.createPipelineLayout, { + return PathTracingPassCPRepo$Wonderjs.setPipeline(Curry._2(WebGPURayTracingDpRunAPI$Wonderjs.unsafeGet(undefined).device.createRayTracingPipeline, { + layout: Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createPipelineLayout, { bindGroupLayouts: [ rtBindGroupLayout, param[1], @@ -346,7 +350,7 @@ function _createAndSetPipeline(device, rtBindGroupLayout) { rayTracingState: { shaderBindingTable: param[0], maxRecursionDepth: 1, - maxPayloadSize: (Math.imul(9, Float32Array.BYTES_PER_ELEMENT) + (Uint32Array.BYTES_PER_ELEMENT << 0) | 0) + (Float32Array.BYTES_PER_ELEMENT << 0) | 0 + maxPayloadSize: ((Math.imul(9, Float32Array.BYTES_PER_ELEMENT) + (Uint32Array.BYTES_PER_ELEMENT << 0) | 0) + (Float32Array.BYTES_PER_ELEMENT << 0) | 0) + (Float32Array.BYTES_PER_ELEMENT << 0) | 0 } }, device)); })); @@ -355,47 +359,11 @@ function _createAndSetPipeline(device, rtBindGroupLayout) { function exec(param) { return Most.just(Result$Wonderjs.bind(Tuple2$Wonderjs.collectOption(WebGPUCPRepo$Wonderjs.getDevice(undefined), WebGPUCPRepo$Wonderjs.getQueue(undefined)), (function (param) { var device = param[0]; - return Result$Wonderjs.bind(BuildAccerlerationContainerDoService$Wonderjs.buildContainers(device, param[1]), (function (instanceContainer) { - return Result$Wonderjs.bind(Tuple5$Wonderjs.collectOption(PathTracingPassCPRepo$Wonderjs.getSceneDescBufferData(undefined), PathTracingPassCPRepo$Wonderjs.getPointIndexBufferData(undefined), PathTracingPassCPRepo$Wonderjs.getVertexBufferData(undefined), PathTracingPassCPRepo$Wonderjs.getIndexBufferData(undefined), PathTracingPassCPRepo$Wonderjs.getPBRMaterialBufferData(undefined)), (function (allBufferData) { - var match = allBufferData[4]; - var pbrMaterialBufferSize = match[1]; - var pbrMaterialBuffer = match[0]; - var match$1 = allBufferData[3]; - var indexBufferSize = match$1[1]; - var indexBuffer = match$1[0]; - var match$2 = allBufferData[2]; - var vertexBufferSize = match$2[1]; - var vertexBuffer = match$2[0]; - var match$3 = allBufferData[1]; - var pointIndexBufferSize = match$3[1]; - var pointIndexBuffer = match$3[0]; - var match$4 = allBufferData[0]; - var sceneDescBufferSize = match$4[1]; - var sceneDescBuffer = match$4[0]; - return Result$Wonderjs.bind(_updateAllBufferData(allBufferData), (function (param) { - return Result$Wonderjs.bind(Tuple2$Wonderjs.collectOption(PassCPRepo$Wonderjs.getPixelBufferData(undefined), PassCPRepo$Wonderjs.getCommonBufferData(undefined)), (function (passAllBufferData) { - return _createAndSetPipeline(device, _createAndAddRayTracingBindGroup(device, instanceContainer, [ - [ - sceneDescBuffer, - sceneDescBufferSize - ], - [ - pointIndexBuffer, - pointIndexBufferSize - ], - [ - vertexBuffer, - vertexBufferSize - ], - [ - indexBuffer, - indexBufferSize - ], - [ - pbrMaterialBuffer, - pbrMaterialBufferSize - ] - ], passAllBufferData)); + return Result$Wonderjs.bind(WebGPURayTracingRunAPI$Wonderjs.buildContainers(device, param[1]), (function (instanceContainer) { + return Result$Wonderjs.bind(_buildAndSetAllBufferData(device), (function (param) { + return Result$Wonderjs.bind(Tuple2$Wonderjs.collectOption(PassCPRepo$Wonderjs.getPixelBufferData(undefined), PassCPRepo$Wonderjs.getCommonBufferData(undefined)), (function (passAllBufferData) { + return Result$Wonderjs.bind(Tuple5$Wonderjs.collectOption(PathTracingPassCPRepo$Wonderjs.getSceneDescBufferData(undefined), PathTracingPassCPRepo$Wonderjs.getPointIndexBufferData(undefined), PathTracingPassCPRepo$Wonderjs.getVertexBufferData(undefined), PathTracingPassCPRepo$Wonderjs.getIndexBufferData(undefined), PathTracingPassCPRepo$Wonderjs.getPBRMaterialBufferData(undefined)), (function (pathTracingAllBufferData) { + return _createAndSetPipeline(device, _createAndAddRayTracingBindGroup(device, instanceContainer, pathTracingAllBufferData, passAllBufferData)); })); })); })); @@ -404,12 +372,13 @@ function exec(param) { } exports.create = create; -exports._updateSceneDescBufferData = _updateSceneDescBufferData; -exports._updatePointIndexBufferData = _updatePointIndexBufferData; -exports._updateVertexBufferData = _updateVertexBufferData; -exports._updateIndexBufferData = _updateIndexBufferData; -exports._updatePBRMaterialBufferData = _updatePBRMaterialBufferData; -exports._updateAllBufferData = _updateAllBufferData; +exports._buildAndSetSceneDescBufferData = _buildAndSetSceneDescBufferData; +exports._convertVertexStartIndexFromAlignedInPOToInVertexBufferData = _convertVertexStartIndexFromAlignedInPOToInVertexBufferData; +exports._buildAndSetPointIndexBufferData = _buildAndSetPointIndexBufferData; +exports._buildAndSetVertexBufferData = _buildAndSetVertexBufferData; +exports._buildAndSetIndexBufferData = _buildAndSetIndexBufferData; +exports._buildAndSetPBRMaterialBufferData = _buildAndSetPBRMaterialBufferData; +exports._buildAndSetAllBufferData = _buildAndSetAllBufferData; exports._createAndAddRayTracingBindGroup = _createAndAddRayTracingBindGroup; exports._createAndSetPipeline = _createAndSetPipeline; exports.exec = exec; diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateTransformCPJobEntity.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateTransformCPJobEntity.bs.js index dddfb39424..cc2738894f 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateTransformCPJobEntity.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/update/UpdateTransformCPJobEntity.bs.js @@ -4,16 +4,15 @@ var Most = require("most"); var Result$Wonderjs = require("../../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var JobEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/JobEntity.bs.js"); var TransformEntity$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/entity/TransformEntity.bs.js"); -var IndexTransformDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/service/transform/IndexTransformDoService.bs.js"); -var UpdateTransformDoService$Wonderjs = require("../../../../../../../../../construct/domain_layer/domain/scene/scene_graph/service/transform/UpdateTransformDoService.bs.js"); +var TransformRunAPI$Wonderjs = require("../../../../../../../../../construct/external_layer/api/run/domain/TransformRunAPI.bs.js"); function create(param) { return JobEntity$Wonderjs.create("update_transform"); } function exec(param) { - for(var i = 0 ,i_finish = IndexTransformDoService$Wonderjs.getMaxIndex(undefined); i < i_finish; ++i){ - UpdateTransformDoService$Wonderjs.mutableUpdate(TransformEntity$Wonderjs.create(i)); + for(var i = 0 ,i_finish = TransformRunAPI$Wonderjs.getMaxIndex(undefined); i < i_finish; ++i){ + TransformRunAPI$Wonderjs.mutableUpdate(TransformEntity$Wonderjs.create(i)); } return Most.just(Result$Wonderjs.succeed(undefined)); } diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/AccumulationCPDoService.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/AccumulationPassCPDoService.bs.js similarity index 70% rename from lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/AccumulationCPDoService.bs.js rename to lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/AccumulationPassCPDoService.bs.js index 1505f78eb4..785abfefbd 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/AccumulationCPDoService.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/AccumulationPassCPDoService.bs.js @@ -6,10 +6,5 @@ function increaseSampleAccumulation(param) { return PassCPRepo$Wonderjs.setTotalSampleCount(PassCPRepo$Wonderjs.getTotalSampleCount(undefined) + PassCPRepo$Wonderjs.getSampleCount(undefined) | 0); } -function getResolutionBufferDataSize(resolutionBufferData) { - return resolutionBufferData.byteLength; -} - exports.increaseSampleAccumulation = increaseSampleAccumulation; -exports.getResolutionBufferDataSize = getResolutionBufferDataSize; /* PassCPRepo-Wonderjs Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/JobCPDoService.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/JobCPDoService.bs.js index a127e37ff2..cfd95eb05d 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/JobCPDoService.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/JobCPDoService.bs.js @@ -2,8 +2,9 @@ var ListSt$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/ListSt.bs.js"); var PipelineCPRepo$Wonderjs = require("../../../../repo/pipeline/PipelineCPRepo.bs.js"); -var PipelineRunAPI$Wonderjs = require("../../../../../../../construct/external_layer/api/run/PipelineRunAPI.bs.js"); +var PipelineRunAPI$Wonderjs = require("../../../../../../../construct/external_layer/api/run/domain/PipelineRunAPI.bs.js"); var InitPassCPJobEntity$Wonderjs = require("../entity/jobs/init/InitPassCPJobEntity.bs.js"); +var EndRenderCPJobEntity$Wonderjs = require("../entity/jobs/render/EndRenderCPJobEntity.bs.js"); var StartTimeCPJobEntity$Wonderjs = require("../entity/jobs/init/StartTimeCPJobEntity.bs.js"); var InitCameraCPJobEntity$Wonderjs = require("../entity/jobs/init/InitCameraCPJobEntity.bs.js"); var InitWebGPUCPJobEntity$Wonderjs = require("../entity/jobs/init/InitWebGPUCPJobEntity.bs.js"); @@ -102,7 +103,13 @@ function _getRenderPipelineJobs(param) { RenderAccumulationCPJobEntity$Wonderjs.create(undefined), RenderAccumulationCPJobEntity$Wonderjs.exec ], - tl: /* [] */0 + tl: { + hd: [ + EndRenderCPJobEntity$Wonderjs.create(undefined), + EndRenderCPJobEntity$Wonderjs.exec + ], + tl: /* [] */0 + } } }; } diff --git a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/PassCPDoService.bs.js b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/PassCPDoService.bs.js index 2c5d4fae77..c7ab5d952d 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/PassCPDoService.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/service/PassCPDoService.bs.js @@ -2,12 +2,17 @@ var PassCPRepo$Wonderjs = require("../../../../repo/pipeline/PassCPRepo.bs.js"); -function getCommonDataBufferSize(commonDataBufferData) { - return commonDataBufferData.byteLength; +var setSampleCount = PassCPRepo$Wonderjs.setSampleCount; + +function getCommonBufferDataSize(commonBufferData) { + return commonBufferData.byteLength; } -var setSampleCount = PassCPRepo$Wonderjs.setSampleCount; +function getResolutionBufferDataSize(resolutionBufferData) { + return resolutionBufferData.byteLength; +} -exports.getCommonDataBufferSize = getCommonDataBufferSize; exports.setSampleCount = setSampleCount; +exports.getCommonBufferDataSize = getCommonBufferDataSize; +exports.getResolutionBufferDataSize = getResolutionBufferDataSize; /* PassCPRepo-Wonderjs Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/CreateCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/CreateCPRepo.bs.js index b5f962fcb3..e530ba40ce 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/CreateCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/CreateCPRepo.bs.js @@ -115,7 +115,13 @@ function create(param) { name: "render_accumulation", type_: /* Job */0 }, - tl: /* [] */0 + tl: { + hd: { + name: "end_render", + type_: /* Job */0 + }, + tl: /* [] */0 + } } } }, diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/POConfigCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/POConfigCPRepo.bs.js index 033b786560..563ef99584 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/POConfigCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/POConfigCPRepo.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("./CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../infrastructure_layer/data/container/CPRepo.bs.js"); var POConfigCPRepoDp$Wonderjs = require("../../infrastructure_layer/dependency/repo/POConfigCPRepoDp.bs.js"); function getTransformCount(param) { diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/PictureCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/PictureCPRepo.bs.js index 9e488056e2..198d381003 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/PictureCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/PictureCPRepo.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("./CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../infrastructure_layer/data/container/CPRepo.bs.js"); function getSize(param) { return CPRepo$Wonderjs.getPicture(undefined).size; diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/WebGPUCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/WebGPUCPRepo.bs.js index 56c5d788cc..a6fd64120f 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/WebGPUCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/WebGPUCPRepo.bs.js @@ -1,7 +1,7 @@ 'use strict'; var Caml_option = require("bs-platform/lib/js/caml_option.js"); -var CPRepo$Wonderjs = require("./CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../infrastructure_layer/data/container/CPRepo.bs.js"); function getDevice(param) { return CPRepo$Wonderjs.getWebGPU(undefined).device; diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/AccumulationPassCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/AccumulationPassCPRepo.bs.js index ef472126af..38916a3dd5 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/AccumulationPassCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/AccumulationPassCPRepo.bs.js @@ -1,7 +1,7 @@ 'use strict'; var Caml_option = require("bs-platform/lib/js/caml_option.js"); -var CPRepo$Wonderjs = require("../CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../infrastructure_layer/data/container/CPRepo.bs.js"); var OptionSt$Wonderjs = require("../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); var StorageBufferVO$Wonderjs = require("../../../../../construct/domain_layer/domain/webgpu/core/value_object/StorageBufferVO.bs.js"); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/CameraCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/CameraCPRepo.bs.js index ecebe4d789..61899d39da 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/CameraCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/CameraCPRepo.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("../CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../infrastructure_layer/data/container/CPRepo.bs.js"); var OptionSt$Wonderjs = require("../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); var UniformBufferVO$Wonderjs = require("../../../../../construct/domain_layer/domain/webgpu/core/value_object/UniformBufferVO.bs.js"); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PassCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PassCPRepo.bs.js index 5291a86290..512efcde2d 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PassCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PassCPRepo.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("../CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../infrastructure_layer/data/container/CPRepo.bs.js"); var OptionSt$Wonderjs = require("../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); var StorageBufferVO$Wonderjs = require("../../../../../construct/domain_layer/domain/webgpu/core/value_object/StorageBufferVO.bs.js"); var UniformBufferVO$Wonderjs = require("../../../../../construct/domain_layer/domain/webgpu/core/value_object/UniformBufferVO.bs.js"); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PathTracingPassCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PathTracingPassCPRepo.bs.js index 83bb9ddb82..0554a191f9 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PathTracingPassCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PathTracingPassCPRepo.bs.js @@ -1,7 +1,7 @@ 'use strict'; var Caml_option = require("bs-platform/lib/js/caml_option.js"); -var CPRepo$Wonderjs = require("../CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../infrastructure_layer/data/container/CPRepo.bs.js"); var OptionSt$Wonderjs = require("../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); var StorageBufferVO$Wonderjs = require("../../../../../construct/domain_layer/domain/webgpu/core/value_object/StorageBufferVO.bs.js"); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PipelineCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PipelineCPRepo.bs.js index 2a247ddfed..35ff5810d9 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PipelineCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/pipeline/PipelineCPRepo.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("../CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../infrastructure_layer/data/container/CPRepo.bs.js"); var OptionSt$Wonderjs = require("../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); var PipelineEntity$Wonderjs = require("../../../../../construct/domain_layer/domain/pipeline/pipeline/entity/PipelineEntity.bs.js"); var PipelineCPRepoDp$Wonderjs = require("../../../infrastructure_layer/dependency/repo/PipelineCPRepoDp.bs.js"); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/direction_light/CreatePODirectionLightCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/direction_light/CreatePODirectionLightCPRepo.bs.js index cdbd773dc4..a5b7879516 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/direction_light/CreatePODirectionLightCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/direction_light/CreatePODirectionLightCPRepo.bs.js @@ -6,7 +6,7 @@ var POConfigCPRepo$Wonderjs = require("../../../POConfigCPRepo.bs.js"); var CreateMapComponentCPRepoUtils$Wonderjs = require("../utils/CreateMapComponentCPRepoUtils.bs.js"); var BufferDirectionLightCPRepoUtils$Wonderjs = require("./utils/BufferDirectionLightCPRepoUtils.bs.js"); var CreateTypeArrayDirectionLightCPRepoUtils$Wonderjs = require("./utils/CreateTypeArrayDirectionLightCPRepoUtils.bs.js"); -var OperateTypeArrayDirectionLightCPRepoUtils$Wonderjs = require("./utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js"); +var OperateTypeArrayDirectionLightCPRepoUtils$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js"); function _setAllTypeArrDataToDefault(param, count, param$1) { var defaultIntensity = param$1[1]; diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/CreatePOGeometryCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/CreatePOGeometryCPRepo.bs.js index b2858b4b40..108ace9ac5 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/CreatePOGeometryCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/CreatePOGeometryCPRepo.bs.js @@ -2,7 +2,7 @@ var Result$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var POConfigCPRepo$Wonderjs = require("../../../POConfigCPRepo.bs.js"); -var BufferGeometryCPRepoUtils$Wonderjs = require("./utils/BufferGeometryCPRepoUtils.bs.js"); +var BufferGeometryCPRepoUtils$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/utils/BufferGeometryCPRepoUtils.bs.js"); var CreateMapComponentCPRepoUtils$Wonderjs = require("../utils/CreateMapComponentCPRepoUtils.bs.js"); var CreateTypeArrayGeometryCPRepoUtils$Wonderjs = require("./utils/CreateTypeArrayGeometryCPRepoUtils.bs.js"); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/IndicesGeometryCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/IndicesGeometryCPRepo.bs.js index fc72000dd4..1a1431dccd 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/IndicesGeometryCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/IndicesGeometryCPRepo.bs.js @@ -1,59 +1,17 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../CPRepo.bs.js"); -var Result$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); -var TypeArrayCPRepoUtils$Wonderjs = require("../../../structure/utils/TypeArrayCPRepoUtils.bs.js"); -var BufferGeometryCPRepoUtils$Wonderjs = require("./utils/BufferGeometryCPRepoUtils.bs.js"); -var ReallocatedPointsGeometryCPRepoUtils$Wonderjs = require("./utils/ReallocatedPointsGeometryCPRepoUtils.bs.js"); +var GeometryCPRepoDp$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/GeometryCPRepoDp.bs.js"); -function getIndices(index) { - var match = CPRepo$Wonderjs.getExnGeometry(undefined); - var indices = match.indices; - var indicesInfos = match.indicesInfos; - return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.getUint32PointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), indices, indicesInfos); -} +var getIndices = GeometryCPRepoDp$Wonderjs.getIndices; -function setIndices(index, data) { - var geometryPO = CPRepo$Wonderjs.getExnGeometry(undefined); - var indices = geometryPO.indices; - var indicesInfos = geometryPO.indicesInfos; - return Result$Wonderjs.mapSuccess(ReallocatedPointsGeometryCPRepoUtils$Wonderjs.setUint32PointData([ - BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), - indicesInfos, - geometryPO.indicesOffset, - data.length - ], (function (param) { - return TypeArrayCPRepoUtils$Wonderjs.fillUint32ArrayWithOffset(indices, data, param); - })), (function (indicesOffset) { - return CPRepo$Wonderjs.setGeometry({ - maxIndex: geometryPO.maxIndex, - buffer: geometryPO.buffer, - vertices: geometryPO.vertices, - normals: geometryPO.normals, - indices: geometryPO.indices, - verticesInfos: geometryPO.verticesInfos, - normalsInfos: geometryPO.normalsInfos, - indicesInfos: geometryPO.indicesInfos, - verticesOffset: geometryPO.verticesOffset, - normalsOffset: geometryPO.normalsOffset, - indicesOffset: indicesOffset, - gameObjectsMap: geometryPO.gameObjectsMap - }); - })); -} +var setIndices = GeometryCPRepoDp$Wonderjs.setIndices; -function hasIndices(index) { - return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.hasPointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), CPRepo$Wonderjs.getExnGeometry(undefined).indicesInfos); -} +var hasIndices = GeometryCPRepoDp$Wonderjs.hasIndices; -function getIndicesCount(index) { - return Result$Wonderjs.mapSuccess(ReallocatedPointsGeometryCPRepoUtils$Wonderjs.getInfo(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), CPRepo$Wonderjs.getExnGeometry(undefined).indicesInfos), (function (param) { - return param[1] - param[0] | 0; - })); -} +var getIndicesCount = GeometryCPRepoDp$Wonderjs.getIndicesCount; exports.getIndices = getIndices; exports.setIndices = setIndices; exports.hasIndices = hasIndices; exports.getIndicesCount = getIndicesCount; -/* CPRepo-Wonderjs Not a pure module */ +/* GeometryCPRepoDp-Wonderjs Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/NormalsGeometryCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/NormalsGeometryCPRepo.bs.js index ea890231aa..6b7236e595 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/NormalsGeometryCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/NormalsGeometryCPRepo.bs.js @@ -1,54 +1,14 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../CPRepo.bs.js"); -var Result$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); -var TypeArrayCPRepoUtils$Wonderjs = require("../../../structure/utils/TypeArrayCPRepoUtils.bs.js"); -var BufferGeometryCPRepoUtils$Wonderjs = require("./utils/BufferGeometryCPRepoUtils.bs.js"); -var ReallocatedPointsGeometryCPRepoUtils$Wonderjs = require("./utils/ReallocatedPointsGeometryCPRepoUtils.bs.js"); +var GeometryCPRepoDp$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/GeometryCPRepoDp.bs.js"); -function getNormals(index) { - var match = CPRepo$Wonderjs.getExnGeometry(undefined); - var normals = match.normals; - var normalsInfos = match.normalsInfos; - return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.getFloat32PointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), normals, normalsInfos); -} +var getNormals = GeometryCPRepoDp$Wonderjs.getNormals; -function setNormals(index, data) { - var geometryPO = CPRepo$Wonderjs.getExnGeometry(undefined); - var normals = geometryPO.normals; - var normalsInfos = geometryPO.normalsInfos; - return Result$Wonderjs.mapSuccess(ReallocatedPointsGeometryCPRepoUtils$Wonderjs.setFloat32PointData([ - BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), - normalsInfos, - geometryPO.normalsOffset, - data.length - ], (function (param) { - return TypeArrayCPRepoUtils$Wonderjs.fillFloat32ArrayWithOffset(normals, data, param); - })), (function (normalsOffset) { - return CPRepo$Wonderjs.setGeometry({ - maxIndex: geometryPO.maxIndex, - buffer: geometryPO.buffer, - vertices: geometryPO.vertices, - normals: geometryPO.normals, - indices: geometryPO.indices, - verticesInfos: geometryPO.verticesInfos, - normalsInfos: geometryPO.normalsInfos, - indicesInfos: geometryPO.indicesInfos, - verticesOffset: geometryPO.verticesOffset, - normalsOffset: normalsOffset, - indicesOffset: geometryPO.indicesOffset, - gameObjectsMap: geometryPO.gameObjectsMap - }); - })); -} +var setNormals = GeometryCPRepoDp$Wonderjs.setNormals; -function hasNormals(index) { - var match = CPRepo$Wonderjs.getExnGeometry(undefined); - var normalsInfos = match.normalsInfos; - return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.hasPointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), normalsInfos); -} +var hasNormals = GeometryCPRepoDp$Wonderjs.hasNormals; exports.getNormals = getNormals; exports.setNormals = setNormals; exports.hasNormals = hasNormals; -/* CPRepo-Wonderjs Not a pure module */ +/* GeometryCPRepoDp-Wonderjs Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/PointsGeometryCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/PointsGeometryCPRepo.bs.js index 67fe29cb1e..4dc8b056e1 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/PointsGeometryCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/PointsGeometryCPRepo.bs.js @@ -2,12 +2,12 @@ var Curry = require("bs-platform/lib/js/curry.js"); var Log$Wonderjs = require("../../../../../../../construct/domain_layer/library/log/Log.bs.js"); -var CPRepo$Wonderjs = require("../../../CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../../../infrastructure_layer/data/container/CPRepo.bs.js"); var Result$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var Contract$Wonderjs = require("../../../../../../../construct/domain_layer/library/contract/Contract.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); -var BufferGeometryCPRepoUtils$Wonderjs = require("./utils/BufferGeometryCPRepoUtils.bs.js"); -var ReallocatedPointsGeometryCPRepoUtils$Wonderjs = require("./utils/ReallocatedPointsGeometryCPRepoUtils.bs.js"); +var OtherConfigDpRunAPI$Wonderjs = require("../../../../../../../construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js"); +var BufferGeometryCPRepoUtils$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/utils/BufferGeometryCPRepoUtils.bs.js"); +var ReallocatedPointsGeometryCPRepoUtils$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/utils/ReallocatedPointsGeometryCPRepoUtils.bs.js"); function getVertexInfo(index) { var match = CPRepo$Wonderjs.getExnGeometry(undefined); @@ -33,7 +33,7 @@ function getVertexInfo(index) { var x = startIndex / 3; return Contract$Wonderjs.Operators.$eq$eq$dot(x - Math.floor(x), 0.0); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)); + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)); })); } @@ -55,9 +55,29 @@ function getIndicesTypeArr(param) { return CPRepo$Wonderjs.getExnGeometry(undefined).indices; } +function getVerticesOffset(param) { + return CPRepo$Wonderjs.getExnGeometry(undefined).verticesOffset; +} + +function getNormalsOffset(param) { + return CPRepo$Wonderjs.getExnGeometry(undefined).normalsOffset; +} + +function getIndicesOffset(param) { + return CPRepo$Wonderjs.getExnGeometry(undefined).indicesOffset; +} + +function getCopyUsedIndicesTypeArr(param) { + return CPRepo$Wonderjs.getExnGeometry(undefined).indices.slice(0, CPRepo$Wonderjs.getExnGeometry(undefined).indicesOffset); +} + exports.getVertexInfo = getVertexInfo; exports.getIndexInfo = getIndexInfo; exports.getVerticesTypeArr = getVerticesTypeArr; exports.getNormalsTypeArr = getNormalsTypeArr; exports.getIndicesTypeArr = getIndicesTypeArr; +exports.getVerticesOffset = getVerticesOffset; +exports.getNormalsOffset = getNormalsOffset; +exports.getIndicesOffset = getIndicesOffset; +exports.getCopyUsedIndicesTypeArr = getCopyUsedIndicesTypeArr; /* CPRepo-Wonderjs Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/VerticesGeometryCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/VerticesGeometryCPRepo.bs.js index 139f37d843..848f711abd 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/VerticesGeometryCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/VerticesGeometryCPRepo.bs.js @@ -1,54 +1,14 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../CPRepo.bs.js"); -var Result$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); -var TypeArrayCPRepoUtils$Wonderjs = require("../../../structure/utils/TypeArrayCPRepoUtils.bs.js"); -var BufferGeometryCPRepoUtils$Wonderjs = require("./utils/BufferGeometryCPRepoUtils.bs.js"); -var ReallocatedPointsGeometryCPRepoUtils$Wonderjs = require("./utils/ReallocatedPointsGeometryCPRepoUtils.bs.js"); +var GeometryCPRepoDp$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/GeometryCPRepoDp.bs.js"); -function getVertices(index) { - var match = CPRepo$Wonderjs.getExnGeometry(undefined); - var vertices = match.vertices; - var verticesInfos = match.verticesInfos; - return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.getFloat32PointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), vertices, verticesInfos); -} +var getVertices = GeometryCPRepoDp$Wonderjs.getVertices; -function setVertices(index, data) { - var geometryPO = CPRepo$Wonderjs.getExnGeometry(undefined); - var vertices = geometryPO.vertices; - var verticesInfos = geometryPO.verticesInfos; - return Result$Wonderjs.mapSuccess(ReallocatedPointsGeometryCPRepoUtils$Wonderjs.setFloat32PointData([ - BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), - verticesInfos, - geometryPO.verticesOffset, - data.length - ], (function (param) { - return TypeArrayCPRepoUtils$Wonderjs.fillFloat32ArrayWithOffset(vertices, data, param); - })), (function (verticesOffset) { - return CPRepo$Wonderjs.setGeometry({ - maxIndex: geometryPO.maxIndex, - buffer: geometryPO.buffer, - vertices: geometryPO.vertices, - normals: geometryPO.normals, - indices: geometryPO.indices, - verticesInfos: geometryPO.verticesInfos, - normalsInfos: geometryPO.normalsInfos, - indicesInfos: geometryPO.indicesInfos, - verticesOffset: verticesOffset, - normalsOffset: geometryPO.normalsOffset, - indicesOffset: geometryPO.indicesOffset, - gameObjectsMap: geometryPO.gameObjectsMap - }); - })); -} +var setVertices = GeometryCPRepoDp$Wonderjs.setVertices; -function hasVertices(index) { - var match = CPRepo$Wonderjs.getExnGeometry(undefined); - var verticesInfos = match.verticesInfos; - return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.hasPointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(index), verticesInfos); -} +var hasVertices = GeometryCPRepoDp$Wonderjs.hasVertices; exports.getVertices = getVertices; exports.setVertices = setVertices; exports.hasVertices = hasVertices; -/* CPRepo-Wonderjs Not a pure module */ +/* GeometryCPRepoDp-Wonderjs Not a pure module */ diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/CreateTypeArrayGeometryCPRepoUtils.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/CreateTypeArrayGeometryCPRepoUtils.bs.js index 01d9444358..94c64091d8 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/CreateTypeArrayGeometryCPRepoUtils.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/CreateTypeArrayGeometryCPRepoUtils.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var BufferGeometryCPRepoUtils$Wonderjs = require("./BufferGeometryCPRepoUtils.bs.js"); +var BufferGeometryCPRepoUtils$Wonderjs = require("../../../../../../infrastructure_layer/dependency/repo/scene/component/utils/BufferGeometryCPRepoUtils.bs.js"); function createTypeArrays(buffer, geometryPointCount, geometryCount) { return [ diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/pbr_material/CreatePOPBRMaterialCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/pbr_material/CreatePOPBRMaterialCPRepo.bs.js index 3d8981ef8a..8d2566d6b9 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/pbr_material/CreatePOPBRMaterialCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/pbr_material/CreatePOPBRMaterialCPRepo.bs.js @@ -6,7 +6,7 @@ var POConfigCPRepo$Wonderjs = require("../../../POConfigCPRepo.bs.js"); var BufferPBRMaterialCPRepoUtils$Wonderjs = require("./utils/BufferPBRMaterialCPRepoUtils.bs.js"); var CreateMapComponentCPRepoUtils$Wonderjs = require("../utils/CreateMapComponentCPRepoUtils.bs.js"); var CreateTypeArrayPBRMaterialCPRepoUtils$Wonderjs = require("./utils/CreateTypeArrayPBRMaterialCPRepoUtils.bs.js"); -var OperateTypeArrayPBRMaterialCPRepoUtils$Wonderjs = require("./utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js"); +var OperateTypeArrayPBRMaterialCPRepoUtils$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js"); function _setAllTypeArrDataToDefault(param, count, param$1) { var defaultMetalness = param$1[3]; diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/transform/CreatePOTransformCPRepo.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/transform/CreatePOTransformCPRepo.bs.js index e545d5d361..c585a97dc4 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/transform/CreatePOTransformCPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/transform/CreatePOTransformCPRepo.bs.js @@ -6,7 +6,7 @@ var POConfigCPRepo$Wonderjs = require("../../../POConfigCPRepo.bs.js"); var BufferTransformCPRepoUtils$Wonderjs = require("./utils/BufferTransformCPRepoUtils.bs.js"); var CreateMapComponentCPRepoUtils$Wonderjs = require("../utils/CreateMapComponentCPRepoUtils.bs.js"); var CreateTypeArrayTransformCPRepoUtils$Wonderjs = require("./utils/CreateTypeArrayTransformCPRepoUtils.bs.js"); -var OperateTypeArrayTransformCPRepoUtils$Wonderjs = require("./utils/OperateTypeArrayTransformCPRepoUtils.bs.js"); +var OperateTypeArrayTransformCPRepoUtils$Wonderjs = require("../../../../../infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayTransformCPRepoUtils.bs.js"); function _setAllTypeArrDataToDefault(param, count, param$1) { var defaultLocalScale = param$1[3]; diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/utils/SharedArrayBufferCPRepoUtils.bs.js b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/utils/SharedArrayBufferCPRepoUtils.bs.js index 8539fa49cf..4882d47fe1 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/utils/SharedArrayBufferCPRepoUtils.bs.js +++ b/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/utils/SharedArrayBufferCPRepoUtils.bs.js @@ -4,7 +4,7 @@ var Curry = require("bs-platform/lib/js/curry.js"); var Log$Wonderjs = require("../../../../../../../construct/domain_layer/library/log/Log.bs.js"); var Result$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var Contract$Wonderjs = require("../../../../../../../construct/domain_layer/library/contract/Contract.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); +var OtherConfigDpRunAPI$Wonderjs = require("../../../../../../../construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js"); var _isSupportSharedArrayBuffer = (function(param){ return typeof SharedArrayBuffer !== "undefined" @@ -15,7 +15,7 @@ function newSharedArrayBuffer(totalByteLength) { return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("support sharedArrayBuffer", "not"), (function (param) { return Contract$Wonderjs.assertTrue(_isSupportSharedArrayBuffer(undefined)); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { return new SharedArrayBuffer(totalByteLength); })); } diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/CPRepo.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/data/container/CPRepo.bs.js similarity index 98% rename from lib/js/src/run/cloud_picture/domain_layer/repo/CPRepo.bs.js rename to lib/js/src/run/cloud_picture/infrastructure_layer/data/container/CPRepo.bs.js index 01e1e4cb74..a44bed519f 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/CPRepo.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/data/container/CPRepo.bs.js @@ -1,7 +1,7 @@ 'use strict'; -var OptionSt$Wonderjs = require("../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); -var CPContainerManager$Wonderjs = require("../../infrastructure_layer/data/CPContainerManager.bs.js"); +var OptionSt$Wonderjs = require("../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); +var CPContainerManager$Wonderjs = require("../CPContainerManager.bs.js"); function getPipeline(param) { return CPContainerManager$Wonderjs.getPO(undefined).pipeline; diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/GlobalTempCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/GlobalTempCPRepoDp.bs.js index 73b9035190..27aed0cefc 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/GlobalTempCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/GlobalTempCPRepoDp.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../data/container/CPRepo.bs.js"); function getFloat32Array1(param) { return CPRepo$Wonderjs.getGlobalTemp(undefined).float16Array1; diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/POConfigCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/POConfigCPRepoDp.bs.js index 509fa4936f..68d3773041 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/POConfigCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/POConfigCPRepoDp.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../data/container/CPRepo.bs.js"); function getTransformCount(param) { return CPRepo$Wonderjs.getPOConfig(undefined).transformCount; diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/PipelineCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/PipelineCPRepoDp.bs.js index e566f2ee5a..04f7318eb6 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/PipelineCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/PipelineCPRepoDp.bs.js @@ -1,7 +1,7 @@ 'use strict'; var Caml_option = require("bs-platform/lib/js/caml_option.js"); -var CPRepo$Wonderjs = require("../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../data/container/CPRepo.bs.js"); var ImmutableHashMap$Wonderjs = require("../../../../../construct/domain_layer/library/structure/hash_map/ImmutableHashMap.bs.js"); function getJobExecFunc(pipelineName, jobName) { diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/TimeCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/TimeCPRepoDp.bs.js index 903a20c558..3eef05fdd2 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/TimeCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/TimeCPRepoDp.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../data/container/CPRepo.bs.js"); function start(startTime) { return CPRepo$Wonderjs.setTime({ diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/GameObjectCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/GameObjectCPRepoDp.bs.js index 8daea4039b..368da224d1 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/GameObjectCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/GameObjectCPRepoDp.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../data/container/CPRepo.bs.js"); var ListSt$Wonderjs = require("../../../../../../construct/domain_layer/library/structure/ListSt.bs.js"); var ImmutableSparseMap$Wonderjs = require("../../../../../../construct/domain_layer/library/structure/sparse_map/ImmutableSparseMap.bs.js"); diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/SceneCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/SceneCPRepoDp.bs.js index 580794575b..2f4bcf6b42 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/SceneCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/SceneCPRepoDp.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../data/container/CPRepo.bs.js"); function getSceneGameObject(gameObject) { return CPRepo$Wonderjs.getScene(undefined).sceneGameObject; diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/BasicCameraViewCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/BasicCameraViewCPRepoDp.bs.js index f4f65d6f79..74533a8dc0 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/BasicCameraViewCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/BasicCameraViewCPRepoDp.bs.js @@ -2,12 +2,12 @@ var Curry = require("bs-platform/lib/js/curry.js"); var Log$Wonderjs = require("../../../../../../../construct/domain_layer/library/log/Log.bs.js"); -var CPRepo$Wonderjs = require("../../../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../../data/container/CPRepo.bs.js"); var ListSt$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/ListSt.bs.js"); var Contract$Wonderjs = require("../../../../../../../construct/domain_layer/library/contract/Contract.bs.js"); var OptionSt$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/OptionSt.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); var ImmutableSparseMap$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/sparse_map/ImmutableSparseMap.bs.js"); +var OtherConfigDpRunAPI$Wonderjs = require("../../../../../../../construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js"); function getMaxIndex(param) { return CPRepo$Wonderjs.getBasicCameraView(undefined).maxIndex; @@ -70,7 +70,7 @@ function getActiveBasicCameraViews(param) { return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("only has one active cameraView at most", "not"), (function (param) { return Contract$Wonderjs.Operators.$less$eq(ListSt$Wonderjs.length(r), 1); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)); + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)); } exports.getMaxIndex = getMaxIndex; diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/DirectionLightCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/DirectionLightCPRepoDp.bs.js index 6f8380239c..6050de04e4 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/DirectionLightCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/DirectionLightCPRepoDp.bs.js @@ -1,8 +1,8 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../../data/container/CPRepo.bs.js"); var ImmutableSparseMap$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/sparse_map/ImmutableSparseMap.bs.js"); -var OperateTypeArrayDirectionLightCPRepoUtils$Wonderjs = require("../../../../../domain_layer/repo/scene/component/direction_light/utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js"); +var OperateTypeArrayDirectionLightCPRepoUtils$Wonderjs = require("./utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js"); function getMaxIndex(param) { return CPRepo$Wonderjs.getExnDirectionLight(undefined).maxIndex; diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/GeometryCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/GeometryCPRepoDp.bs.js index 44fadd58dd..8eaad0b45b 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/GeometryCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/GeometryCPRepoDp.bs.js @@ -1,14 +1,12 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../../data/container/CPRepo.bs.js"); var Result$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var ListMapRepoUtils$Wonderjs = require("../../utils/ListMapRepoUtils.bs.js"); var ImmutableSparseMap$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/sparse_map/ImmutableSparseMap.bs.js"); -var IndicesGeometryCPRepo$Wonderjs = require("../../../../../domain_layer/repo/scene/component/geometry/IndicesGeometryCPRepo.bs.js"); -var NormalsGeometryCPRepo$Wonderjs = require("../../../../../domain_layer/repo/scene/component/geometry/NormalsGeometryCPRepo.bs.js"); -var VerticesGeometryCPRepo$Wonderjs = require("../../../../../domain_layer/repo/scene/component/geometry/VerticesGeometryCPRepo.bs.js"); -var BufferGeometryCPRepoUtils$Wonderjs = require("../../../../../domain_layer/repo/scene/component/geometry/utils/BufferGeometryCPRepoUtils.bs.js"); -var ReallocatedPointsGeometryCPRepoUtils$Wonderjs = require("../../../../../domain_layer/repo/scene/component/geometry/utils/ReallocatedPointsGeometryCPRepoUtils.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("./utils/TypeArrayCPRepoUtils.bs.js"); +var BufferGeometryCPRepoUtils$Wonderjs = require("./utils/BufferGeometryCPRepoUtils.bs.js"); +var ReallocatedPointsGeometryCPRepoUtils$Wonderjs = require("./utils/ReallocatedPointsGeometryCPRepoUtils.bs.js"); function getMaxIndex(param) { return CPRepo$Wonderjs.getExnGeometry(undefined).maxIndex; @@ -54,23 +52,129 @@ function addGameObject(geometry, gameObject) { }); } -var getVertices = VerticesGeometryCPRepo$Wonderjs.getVertices; +function getVertices(geometry) { + var match = CPRepo$Wonderjs.getExnGeometry(undefined); + var vertices = match.vertices; + var verticesInfos = match.verticesInfos; + return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.getFloat32PointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), vertices, verticesInfos); +} -var setVertices = VerticesGeometryCPRepo$Wonderjs.setVertices; +function setVertices(geometry, data) { + var geometryPO = CPRepo$Wonderjs.getExnGeometry(undefined); + var vertices = geometryPO.vertices; + var verticesInfos = geometryPO.verticesInfos; + return Result$Wonderjs.mapSuccess(ReallocatedPointsGeometryCPRepoUtils$Wonderjs.setFloat32PointData([ + BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), + verticesInfos, + geometryPO.verticesOffset, + data.length + ], (function (param) { + return TypeArrayCPRepoUtils$Wonderjs.fillFloat32ArrayWithOffset(vertices, data, param); + })), (function (verticesOffset) { + return CPRepo$Wonderjs.setGeometry({ + maxIndex: geometryPO.maxIndex, + buffer: geometryPO.buffer, + vertices: geometryPO.vertices, + normals: geometryPO.normals, + indices: geometryPO.indices, + verticesInfos: geometryPO.verticesInfos, + normalsInfos: geometryPO.normalsInfos, + indicesInfos: geometryPO.indicesInfos, + verticesOffset: verticesOffset, + normalsOffset: geometryPO.normalsOffset, + indicesOffset: geometryPO.indicesOffset, + gameObjectsMap: geometryPO.gameObjectsMap + }); + })); +} -var getNormals = NormalsGeometryCPRepo$Wonderjs.getNormals; +function getNormals(geometry) { + var match = CPRepo$Wonderjs.getExnGeometry(undefined); + var normals = match.normals; + var normalsInfos = match.normalsInfos; + return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.getFloat32PointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), normals, normalsInfos); +} -var setNormals = NormalsGeometryCPRepo$Wonderjs.setNormals; +function setNormals(geometry, data) { + var geometryPO = CPRepo$Wonderjs.getExnGeometry(undefined); + var normals = geometryPO.normals; + var normalsInfos = geometryPO.normalsInfos; + return Result$Wonderjs.mapSuccess(ReallocatedPointsGeometryCPRepoUtils$Wonderjs.setFloat32PointData([ + BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), + normalsInfos, + geometryPO.normalsOffset, + data.length + ], (function (param) { + return TypeArrayCPRepoUtils$Wonderjs.fillFloat32ArrayWithOffset(normals, data, param); + })), (function (normalsOffset) { + return CPRepo$Wonderjs.setGeometry({ + maxIndex: geometryPO.maxIndex, + buffer: geometryPO.buffer, + vertices: geometryPO.vertices, + normals: geometryPO.normals, + indices: geometryPO.indices, + verticesInfos: geometryPO.verticesInfos, + normalsInfos: geometryPO.normalsInfos, + indicesInfos: geometryPO.indicesInfos, + verticesOffset: geometryPO.verticesOffset, + normalsOffset: normalsOffset, + indicesOffset: geometryPO.indicesOffset, + gameObjectsMap: geometryPO.gameObjectsMap + }); + })); +} -var getIndices = IndicesGeometryCPRepo$Wonderjs.getIndices; +function getIndices(geometry) { + var match = CPRepo$Wonderjs.getExnGeometry(undefined); + var indices = match.indices; + var indicesInfos = match.indicesInfos; + return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.getUint32PointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), indices, indicesInfos); +} -var setIndices = IndicesGeometryCPRepo$Wonderjs.setIndices; +function setIndices(geometry, data) { + var geometryPO = CPRepo$Wonderjs.getExnGeometry(undefined); + var indices = geometryPO.indices; + var indicesInfos = geometryPO.indicesInfos; + return Result$Wonderjs.mapSuccess(ReallocatedPointsGeometryCPRepoUtils$Wonderjs.setUint32PointData([ + BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), + indicesInfos, + geometryPO.indicesOffset, + data.length + ], (function (param) { + return TypeArrayCPRepoUtils$Wonderjs.fillUint32ArrayWithOffset(indices, data, param); + })), (function (indicesOffset) { + return CPRepo$Wonderjs.setGeometry({ + maxIndex: geometryPO.maxIndex, + buffer: geometryPO.buffer, + vertices: geometryPO.vertices, + normals: geometryPO.normals, + indices: geometryPO.indices, + verticesInfos: geometryPO.verticesInfos, + normalsInfos: geometryPO.normalsInfos, + indicesInfos: geometryPO.indicesInfos, + verticesOffset: geometryPO.verticesOffset, + normalsOffset: geometryPO.normalsOffset, + indicesOffset: indicesOffset, + gameObjectsMap: geometryPO.gameObjectsMap + }); + })); +} -var hasVertices = VerticesGeometryCPRepo$Wonderjs.hasVertices; +function hasVertices(geometry) { + var match = CPRepo$Wonderjs.getExnGeometry(undefined); + var verticesInfos = match.verticesInfos; + return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.hasPointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), verticesInfos); +} -var hasNormals = NormalsGeometryCPRepo$Wonderjs.hasNormals; +function hasNormals(geometry) { + var match = CPRepo$Wonderjs.getExnGeometry(undefined); + var normalsInfos = match.normalsInfos; + return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.hasPointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), normalsInfos); +} -var hasIndices = IndicesGeometryCPRepo$Wonderjs.hasIndices; +function hasIndices(geometry) { + return ReallocatedPointsGeometryCPRepoUtils$Wonderjs.hasPointData(BufferGeometryCPRepoUtils$Wonderjs.getInfoIndex(geometry), CPRepo$Wonderjs.getExnGeometry(undefined).indicesInfos); +} function getIndicesCount(geometry) { var match = CPRepo$Wonderjs.getExnGeometry(undefined); diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/PBRMaterialCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/PBRMaterialCPRepoDp.bs.js index aac7cbc546..7037dffe73 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/PBRMaterialCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/PBRMaterialCPRepoDp.bs.js @@ -1,9 +1,9 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../../data/container/CPRepo.bs.js"); var ListMapRepoUtils$Wonderjs = require("../../utils/ListMapRepoUtils.bs.js"); var ImmutableSparseMap$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/sparse_map/ImmutableSparseMap.bs.js"); -var OperateTypeArrayPBRMaterialCPRepoUtils$Wonderjs = require("../../../../../domain_layer/repo/scene/component/pbr_material/utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js"); +var OperateTypeArrayPBRMaterialCPRepoUtils$Wonderjs = require("./utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js"); function getMaxIndex(param) { return CPRepo$Wonderjs.getExnPBRMaterial(undefined).maxIndex; diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/PerspectiveCameraProjectionCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/PerspectiveCameraProjectionCPRepoDp.bs.js index aabf87d60c..b8499e399d 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/PerspectiveCameraProjectionCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/PerspectiveCameraProjectionCPRepoDp.bs.js @@ -1,7 +1,7 @@ 'use strict'; var Curry = require("bs-platform/lib/js/curry.js"); -var CPRepo$Wonderjs = require("../../../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../../data/container/CPRepo.bs.js"); var DirtyListRepoUtils$Wonderjs = require("../../utils/DirtyListRepoUtils.bs.js"); var ImmutableSparseMap$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/sparse_map/ImmutableSparseMap.bs.js"); diff --git a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/TransformCPRepoDp.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/TransformCPRepoDp.bs.js index 2bde0c44c1..6dfc685b96 100644 --- a/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/TransformCPRepoDp.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/TransformCPRepoDp.bs.js @@ -1,9 +1,9 @@ 'use strict'; -var CPRepo$Wonderjs = require("../../../../../domain_layer/repo/CPRepo.bs.js"); +var CPRepo$Wonderjs = require("../../../../data/container/CPRepo.bs.js"); var ListSt$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/ListSt.bs.js"); var ImmutableSparseMap$Wonderjs = require("../../../../../../../construct/domain_layer/library/structure/sparse_map/ImmutableSparseMap.bs.js"); -var OperateTypeArrayTransformCPRepoUtils$Wonderjs = require("../../../../../domain_layer/repo/scene/component/transform/utils/OperateTypeArrayTransformCPRepoUtils.bs.js"); +var OperateTypeArrayTransformCPRepoUtils$Wonderjs = require("./utils/OperateTypeArrayTransformCPRepoUtils.bs.js"); function getMaxIndex(param) { return CPRepo$Wonderjs.getExnTransform(undefined).maxIndex; diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/BufferGeometryCPRepoUtils.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/BufferGeometryCPRepoUtils.bs.js similarity index 81% rename from lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/BufferGeometryCPRepoUtils.bs.js rename to lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/BufferGeometryCPRepoUtils.bs.js index f1994907a4..e4a921d274 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/BufferGeometryCPRepoUtils.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/BufferGeometryCPRepoUtils.bs.js @@ -1,6 +1,6 @@ 'use strict'; -var SharedArrayBufferCPRepoUtils$Wonderjs = require("../../utils/SharedArrayBufferCPRepoUtils.bs.js"); +var SharedArrayBufferCPRepoUtils$Wonderjs = require("../../../../../../domain_layer/repo/scene/component/utils/SharedArrayBufferCPRepoUtils.bs.js"); function getVertexSize(param) { return 3; @@ -23,7 +23,7 @@ function getIndexSize(param) { } function getIndicesLength(geometryPointCount) { - return (geometryPointCount << 0); + return ((3 + Math.imul(geometryPointCount - 3 | 0, 3) | 0) << 0); } function getIndicesOffset(geometryPointCount) { @@ -39,7 +39,7 @@ function getVerticesInfosLength(geometryCount) { } function getVerticesInfosOffset(geometryPointCount) { - return getIndicesOffset(geometryPointCount) + Math.imul((geometryPointCount << 0), Uint32Array.BYTES_PER_ELEMENT) | 0; + return getIndicesOffset(geometryPointCount) + Math.imul(getIndicesLength(geometryPointCount), Uint32Array.BYTES_PER_ELEMENT) | 0; } function getNormalsInfosLength(geometryCount) { @@ -71,7 +71,7 @@ function getInfoIndex(index) { } function getTotalByteLength(geometryPointCount, geometryCount) { - return Math.imul(geometryPointCount, (Math.imul(Float32Array.BYTES_PER_ELEMENT, 3) << 1) + (Uint32Array.BYTES_PER_ELEMENT << 0) | 0) + Math.imul(Math.imul(geometryCount, Uint32Array.BYTES_PER_ELEMENT), 6) | 0; + return (Math.imul(geometryPointCount, (Math.imul(Float32Array.BYTES_PER_ELEMENT, 3) << 1)) + Math.imul(getIndicesLength(geometryPointCount), Uint32Array.BYTES_PER_ELEMENT) | 0) + Math.imul(Math.imul(geometryCount, Uint32Array.BYTES_PER_ELEMENT), 6) | 0; } function createBuffer(geometryPointCount, geometryCount) { diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/direction_light/utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js similarity index 77% rename from lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/direction_light/utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js rename to lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js index 37cd214c33..d784a9df6b 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/direction_light/utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayDirectionLightCPRepoUtils.bs.js @@ -1,7 +1,7 @@ 'use strict'; -var TypeArrayCPRepoUtils$Wonderjs = require("../../../../structure/utils/TypeArrayCPRepoUtils.bs.js"); -var BufferDirectionLightCPRepoUtils$Wonderjs = require("./BufferDirectionLightCPRepoUtils.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("./TypeArrayCPRepoUtils.bs.js"); +var BufferDirectionLightCPRepoUtils$Wonderjs = require("../../../../../../domain_layer/repo/scene/component/direction_light/utils/BufferDirectionLightCPRepoUtils.bs.js"); function getColor(index, typeArr) { return TypeArrayCPRepoUtils$Wonderjs.getFloat3Tuple(BufferDirectionLightCPRepoUtils$Wonderjs.getColorIndex(index), typeArr); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/pbr_material/utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js similarity index 87% rename from lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/pbr_material/utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js rename to lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js index 1899f59ad7..ea140e786e 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/pbr_material/utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayPBRMaterialCPRepoUtils.bs.js @@ -1,7 +1,7 @@ 'use strict'; -var TypeArrayCPRepoUtils$Wonderjs = require("../../../../structure/utils/TypeArrayCPRepoUtils.bs.js"); -var BufferPBRMaterialCPRepoUtils$Wonderjs = require("./BufferPBRMaterialCPRepoUtils.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("./TypeArrayCPRepoUtils.bs.js"); +var BufferPBRMaterialCPRepoUtils$Wonderjs = require("../../../../../../domain_layer/repo/scene/component/pbr_material/utils/BufferPBRMaterialCPRepoUtils.bs.js"); function getDiffuseColor(index, typeArr) { return TypeArrayCPRepoUtils$Wonderjs.getFloat3Tuple(BufferPBRMaterialCPRepoUtils$Wonderjs.getDiffuseColorIndex(index), typeArr); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/transform/utils/OperateTypeArrayTransformCPRepoUtils.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayTransformCPRepoUtils.bs.js similarity index 89% rename from lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/transform/utils/OperateTypeArrayTransformCPRepoUtils.bs.js rename to lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayTransformCPRepoUtils.bs.js index 865768038e..65a2a750a7 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/transform/utils/OperateTypeArrayTransformCPRepoUtils.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/OperateTypeArrayTransformCPRepoUtils.bs.js @@ -1,7 +1,7 @@ 'use strict'; -var TypeArrayCPRepoUtils$Wonderjs = require("../../../../structure/utils/TypeArrayCPRepoUtils.bs.js"); -var BufferTransformCPRepoUtils$Wonderjs = require("./BufferTransformCPRepoUtils.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("./TypeArrayCPRepoUtils.bs.js"); +var BufferTransformCPRepoUtils$Wonderjs = require("../../../../../../domain_layer/repo/scene/component/transform/utils/BufferTransformCPRepoUtils.bs.js"); function getLocalToWorldMatrixTypeArray(index, typeArr) { return TypeArrayCPRepoUtils$Wonderjs.getFloat16TypeArray(BufferTransformCPRepoUtils$Wonderjs.getLocalToWorldMatrixIndex(index), typeArr); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/ReallocatedPointsGeometryCPRepoUtils.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/ReallocatedPointsGeometryCPRepoUtils.bs.js similarity index 89% rename from lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/ReallocatedPointsGeometryCPRepoUtils.bs.js rename to lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/ReallocatedPointsGeometryCPRepoUtils.bs.js index 9dd6ccd100..6a89a345ac 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/utils/ReallocatedPointsGeometryCPRepoUtils.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/ReallocatedPointsGeometryCPRepoUtils.bs.js @@ -4,8 +4,8 @@ var Curry = require("bs-platform/lib/js/curry.js"); var Log$Wonderjs = require("../../../../../../../../construct/domain_layer/library/log/Log.bs.js"); var Result$Wonderjs = require("../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); var Contract$Wonderjs = require("../../../../../../../../construct/domain_layer/library/contract/Contract.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); -var TypeArrayCPRepoUtils$Wonderjs = require("../../../../structure/utils/TypeArrayCPRepoUtils.bs.js"); +var OtherConfigDpRunAPI$Wonderjs = require("../../../../../../../../construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js"); +var TypeArrayCPRepoUtils$Wonderjs = require("./TypeArrayCPRepoUtils.bs.js"); function getInfo(infoIndex, infos) { return Contract$Wonderjs.ensureCheck([ @@ -26,7 +26,7 @@ function getInfo(infoIndex, infos) { return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("endIndex >= startIndex", "is " + endIndex), (function (param) { return Contract$Wonderjs.Operators.$great$eq(endIndex, startIndex); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)); + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)); } function setInfo(infoIndex, startIndex, endIndex, infos) { @@ -37,7 +37,7 @@ function setInfo(infoIndex, startIndex, endIndex, infos) { return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("endIndex >= startIndex", "is " + endIndex), (function (param) { return Contract$Wonderjs.Operators.$great$eq(endIndex, startIndex); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { return TypeArrayCPRepoUtils$Wonderjs.setUint32_1(infoIndex, startIndex, infos); })), (function (param) { return TypeArrayCPRepoUtils$Wonderjs.setUint32_1(infoIndex + 1 | 0, endIndex, infos); diff --git a/lib/js/src/run/cloud_picture/domain_layer/repo/structure/utils/TypeArrayCPRepoUtils.bs.js b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/TypeArrayCPRepoUtils.bs.js similarity index 84% rename from lib/js/src/run/cloud_picture/domain_layer/repo/structure/utils/TypeArrayCPRepoUtils.bs.js rename to lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/TypeArrayCPRepoUtils.bs.js index 0fe146a645..26ad803817 100644 --- a/lib/js/src/run/cloud_picture/domain_layer/repo/structure/utils/TypeArrayCPRepoUtils.bs.js +++ b/lib/js/src/run/cloud_picture/infrastructure_layer/dependency/repo/scene/component/utils/TypeArrayCPRepoUtils.bs.js @@ -1,10 +1,10 @@ 'use strict'; var Curry = require("bs-platform/lib/js/curry.js"); -var Log$Wonderjs = require("../../../../../../construct/domain_layer/library/log/Log.bs.js"); -var Result$Wonderjs = require("../../../../../../construct/domain_layer/library/structure/Result.bs.js"); -var Contract$Wonderjs = require("../../../../../../construct/domain_layer/library/contract/Contract.bs.js"); -var DpContainer$Wonderjs = require("../../../../../../construct/domain_layer/dependency/container/DpContainer.bs.js"); +var Log$Wonderjs = require("../../../../../../../../construct/domain_layer/library/log/Log.bs.js"); +var Result$Wonderjs = require("../../../../../../../../construct/domain_layer/library/structure/Result.bs.js"); +var Contract$Wonderjs = require("../../../../../../../../construct/domain_layer/library/contract/Contract.bs.js"); +var OtherConfigDpRunAPI$Wonderjs = require("../../../../../../../../construct/external_layer/api/run/dependency/OtherConfigDpRunAPI.bs.js"); function _checkNotExceedBound(getLengthFunc, index, typeArray) { return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("not exceed bound", "exceed"), (function (param) { @@ -21,7 +21,7 @@ function setMat3Data(index, mat3, typeArray) { return _checkNotExceedBound((function (prim) { return prim.length; }), index + 11 | 0, typeArray); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { typeArray[index] = mat3[0]; typeArray[index + 1 | 0] = mat3[1]; typeArray[index + 2 | 0] = mat3[2]; @@ -43,7 +43,7 @@ function setFloat1(index, value, typeArray) { return _checkNotExceedBound((function (prim) { return prim.length; }), index + 0 | 0, typeArray); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { typeArray[index] = value; })); @@ -56,7 +56,7 @@ function setFloat2(index, param, typeArray) { return _checkNotExceedBound((function (prim) { return prim.length; }), index + 1 | 0, typeArray); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { typeArray[index] = x; typeArray[index + 1 | 0] = y; @@ -71,7 +71,7 @@ function setFloat3(index, param, typeArray) { return _checkNotExceedBound((function (prim) { return prim.length; }), index + 2 | 0, typeArray); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { typeArray[index] = x; typeArray[index + 1 | 0] = y; typeArray[index + 2 | 0] = z; @@ -88,7 +88,7 @@ function setFloat4(index, param, typeArray) { return _checkNotExceedBound((function (prim) { return prim.length; }), index + 3 | 0, typeArray); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { typeArray[index] = x; typeArray[index + 1 | 0] = y; typeArray[index + 2 | 0] = z; @@ -118,7 +118,7 @@ function setFloat16(index, param, typeArray) { return _checkNotExceedBound((function (prim) { return prim.length; }), index + 15 | 0, typeArray); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { typeArray[index + 0 | 0] = a0; typeArray[index + 1 | 0] = a1; typeArray[index + 2 | 0] = a2; @@ -139,12 +139,12 @@ function setFloat16(index, param, typeArray) { })); } -function setFloat32Array(index, target, typeArray) { +function setFloat16WithFloat32Array(index, target, typeArray) { return Result$Wonderjs.mapSuccess(Contract$Wonderjs.requireCheck((function (param) { return _checkNotExceedBound((function (prim) { return prim.length; - }), index + 31 | 0, typeArray); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), index + 15 | 0, typeArray); + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { typeArray.set(target, index); })); @@ -155,7 +155,7 @@ function setUint32_1(index, value, typeArray) { return _checkNotExceedBound((function (prim) { return prim.length; }), index + 0 | 0, typeArray); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { typeArray[index] = value; })); @@ -233,7 +233,7 @@ function fillFloat32ArrayWithOffset(targetTypeArr, sourceTypeArr, offset) { return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("sourceTypeArr.length:" + sourceTypeArrLen + " + offset:" + offset + " <= targetTypeArr.length:" + targetTypeArrLen, "not"), (function (param) { return Contract$Wonderjs.Operators.$less$eq(sourceTypeArrLen + offset | 0, targetTypeArrLen); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { targetTypeArr.set(sourceTypeArr, offset); })); @@ -249,7 +249,7 @@ function fillUint32ArrayWithOffset(targetTypeArr, sourceTypeArr, offset) { return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("sourceTypeArr.length:" + sourceTypeArrLen + " + offset:" + offset + " <= targetTypeArr.length:" + targetTypeArrLen, "not"), (function (param) { return Contract$Wonderjs.Operators.$less$eq(sourceTypeArrLen + offset | 0, targetTypeArrLen); })); - }), Curry._1(DpContainer$Wonderjs.unsafeGetOtherConfigDp(undefined).getIsDebug, undefined)), (function (param) { + }), Curry._1(OtherConfigDpRunAPI$Wonderjs.unsafeGet(undefined).getIsDebug, undefined)), (function (param) { targetTypeArr.set(sourceTypeArr, offset); })); @@ -263,7 +263,7 @@ exports.setFloat2 = setFloat2; exports.setFloat3 = setFloat3; exports.setFloat4 = setFloat4; exports.setFloat16 = setFloat16; -exports.setFloat32Array = setFloat32Array; +exports.setFloat16WithFloat32Array = setFloat16WithFloat32Array; exports.setUint32_1 = setUint32_1; exports.getFloat3Tuple = getFloat3Tuple; exports.getFloat4Tuple = getFloat4Tuple; diff --git a/package.json b/package.json index 10893c0612..b117e88307 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wonder.js", - "version": "2.0.0-alpha.2.2", + "version": "2.0.0-alpha.3", "authors": "Wonder", "description": "", "homepage": "https://github.com/Wonder-Technology/Wonder.js", diff --git a/src/construct/application_layer/scene/GeometryApService.re b/src/construct/application_layer/scene/GeometryApService.re index 4cf508ff18..ba34ffb174 100755 --- a/src/construct/application_layer/scene/GeometryApService.re +++ b/src/construct/application_layer/scene/GeometryApService.re @@ -10,6 +10,10 @@ let createSphereGeometry = (radius, bands) => { CreateSphereGeometryDoService.create(radius, bands); }; +let createPlaneGeometry = () => { + CreatePlaneGeometryDoService.create(); +}; + let getVertices = geometry => { VerticesGeometryDoService.getVertices(geometry); }; diff --git a/src/construct/application_layer/statistic/TimeApService.re b/src/construct/application_layer/statistic/TimeApService.re old mode 100644 new mode 100755 diff --git a/src/construct/application_layer/webgpu/WebGPUCoreApService.re b/src/construct/application_layer/webgpu/WebGPUCoreApService.re old mode 100644 new mode 100755 diff --git a/src/construct/application_layer/webgpu/WebGPURayTracingApService.re b/src/construct/application_layer/webgpu/WebGPURayTracingApService.re old mode 100644 new mode 100755 diff --git a/src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re b/src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re index a617632845..087ab5afab 100755 --- a/src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re +++ b/src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re @@ -464,7 +464,7 @@ type context = { type window = { make: windowDescriptor => windowObject, getContext: windowObject => contextObject, - pollEvents: (unit, windowObject) => unit, + pollEvents: windowObject => unit, shouldClose: windowObject => bool, getWidth: windowObject => int, getHeight: windowObject => int, diff --git a/src/construct/domain_layer/domain/scene/scene_graph/service/geometry/CreatePlaneGeometryDoService.re b/src/construct/domain_layer/domain/scene/scene_graph/service/geometry/CreatePlaneGeometryDoService.re new file mode 100755 index 0000000000..e6c364ff03 --- /dev/null +++ b/src/construct/domain_layer/domain/scene/scene_graph/service/geometry/CreatePlaneGeometryDoService.re @@ -0,0 +1,33 @@ +let create = () => { + let vertices = [| + 1.0, + 0.0, + (-1.0), + 1.0, + 0.0, + 1.0, + (-1.0), + 0.0, + 1.0, + (-1.0), + 0.0, + (-1.0), + |]; + let normals = [| + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + |]; + let indices = [|2, 1, 0, 0, 3, 2|]; + + CreateDefaultGeometryDoService.create((vertices, normals, indices)); +}; diff --git a/src/construct/external_layer/api/run/domain/GeometryRunAPI.re b/src/construct/external_layer/api/run/domain/GeometryRunAPI.re index 6fbc0b2466..895b6a43be 100755 --- a/src/construct/external_layer/api/run/domain/GeometryRunAPI.re +++ b/src/construct/external_layer/api/run/domain/GeometryRunAPI.re @@ -10,6 +10,10 @@ let createSphereGeometry = (radius, bands) => { GeometryApService.createSphereGeometry(radius, bands); }; +let createPlaneGeometry = () => { + GeometryApService.createPlaneGeometry(); +}; + let getVertices = geometry => { GeometryApService.getVertices(geometry); }; diff --git a/src/construct/external_layer/api/run/domain/TimeRunAPI.re b/src/construct/external_layer/api/run/domain/TimeRunAPI.re old mode 100644 new mode 100755 diff --git a/src/construct/external_layer/api/run/domain/WebGPUCoreRunAPI.re b/src/construct/external_layer/api/run/domain/WebGPUCoreRunAPI.re old mode 100644 new mode 100755 diff --git a/src/construct/external_layer/api/run/domain/WebGPURayTracingRunAPI.re b/src/construct/external_layer/api/run/domain/WebGPURayTracingRunAPI.re old mode 100644 new mode 100755 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 a84d01a590..eb9228a84d 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 @@ -2,116 +2,6 @@ open Js.Typed_array; let create = () => JobEntity.create("init_pathTracing"); -let _buildSceneDescBufferData = device => { - let gameObjectCount = POConfigCPRepo.getTransformCount(); - - let dataCount = 4 + 12 + 16; - let bufferData = Float32Array.fromLength(gameObjectCount * dataCount); - let bufferSize = bufferData->Float32Array.byteLength; - - let buffer = - StorageBufferVO.createFromDevice( - ~device, - ~bufferSize, - ~usage= - WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst - lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, - (), - ); - - (buffer, bufferSize, bufferData); -}; - -let _buildPointIndexBufferData = device => { - let geometryCount = POConfigCPRepo.getGeometryCount(); - let dataCount = 2; - let bufferData = Uint32Array.fromLength(geometryCount * dataCount); - let bufferSize = bufferData->Uint32Array.byteLength; - - let buffer = - StorageBufferVO.createFromDevice( - ~device, - ~bufferSize, - ~usage= - WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst - lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, - (), - ); - - (buffer, bufferSize, bufferData); -}; - -let _buildVertexBufferData = device => { - let geometryPointCount = POConfigCPRepo.getGeometryPointCount(); - let bufferData = Float32Array.fromLength(geometryPointCount * 4 * 2); - let bufferSize = bufferData->Float32Array.byteLength; - - let buffer = - StorageBufferVO.createFromDevice( - ~device, - ~bufferSize, - ~usage= - WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst - lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, - (), - ); - - (buffer, bufferSize, bufferData); -}; - -let _buildIndexBufferData = device => { - let geometryPointCount = POConfigCPRepo.getGeometryPointCount(); - let bufferSize = - BufferGeometryCPRepoUtils.getIndicesLength(geometryPointCount) - * Uint32Array._BYTES_PER_ELEMENT; - - let buffer = - StorageBufferVO.createFromDevice( - ~device, - ~bufferSize, - ~usage= - WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst - lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, - (), - ); - - (buffer, bufferSize); -}; - -let _buildPBRMaterialBufferData = device => { - let pbrMaterialCount = POConfigCPRepo.getPBRMaterialCount(); - let dataCount = 4 + 4; - let bufferData = Float32Array.fromLength(pbrMaterialCount * dataCount); - let bufferSize = bufferData->Float32Array.byteLength; - - let buffer = - StorageBufferVO.createFromDevice( - ~device, - ~bufferSize, - ~usage= - WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst - lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, - (), - ); - - (buffer, bufferSize, bufferData); -}; - -let _buildAndSetAllBufferData = device => { - _buildSceneDescBufferData(device) - ->PathTracingPassCPRepo.setSceneDescBufferData; - - _buildPointIndexBufferData(device) - ->PathTracingPassCPRepo.setPointIndexBufferData; - - _buildVertexBufferData(device)->PathTracingPassCPRepo.setVertexBufferData; - - _buildIndexBufferData(device)->PathTracingPassCPRepo.setIndexBufferData; - - _buildPBRMaterialBufferData(device) - ->PathTracingPassCPRepo.setPBRMaterialBufferData; -}; - let _buildDirectionLightBufferData = device => { Contract.requireCheck( () => { @@ -367,11 +257,6 @@ let exec = () => { ), ) }); - }) - ->Result.mapSuccess(() => { - _buildAndSetAllBufferData(device); - - (); }); }) ->WonderBsMost.Most.just; diff --git a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/EndRenderCPJobEntity.re b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/EndRenderCPJobEntity.re index bd8e1ec0f6..86c0383dcb 100755 --- a/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/EndRenderCPJobEntity.re +++ b/src/run/cloud_picture/domain_layer/domain/pipeline/pipeline/entity/jobs/render/EndRenderCPJobEntity.re @@ -5,7 +5,7 @@ let exec = () => { ->Result.mapSuccess(((window, swapChain)) => { WebGPUCoreDpRunAPI.unsafeGet().swapChain.present(swapChain); - WebGPUCoreDpRunAPI.unsafeGet().window.pollEvents((), window); + WebGPUCoreDpRunAPI.unsafeGet().window.pollEvents(window); }) ->WonderBsMost.Most.just; }; 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 2acaaadbcb..cd6e8519f2 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 @@ -2,11 +2,23 @@ open Js.Typed_array; let create = () => JobEntity.create("update_pathTracing"); -let _updateSceneDescBufferData = - ( - (sceneDescBuffer, sceneDescBufferSize, sceneDescBufferData), - allRenderGameObjects, - ) => { +let _buildAndSetSceneDescBufferData = (device, allRenderGameObjects) => { + let gameObjectCount = allRenderGameObjects->ListSt.length; + + let dataCount = 4 + 12 + 16; + let bufferData = Float32Array.fromLength(gameObjectCount * dataCount); + let bufferSize = bufferData->Float32Array.byteLength; + + let buffer = + StorageBufferVO.createFromDevice( + ~device, + ~bufferSize, + ~usage= + WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst + lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, + (), + ); + allRenderGameObjects ->ListSt.traverseResultM(gameObject => { Tuple3.collectOption( @@ -27,18 +39,18 @@ let _updateSceneDescBufferData = geometry->GeometryEntity.value->Belt.Float.fromInt, pbrMaterial->PBRMaterialEntity.value->Belt.Float.fromInt, ), - sceneDescBufferData, + bufferData, ), TypeArrayCPRepoUtils.setMat3Data( offset + 4, normalMatrix->NormalMatrixVO.value, - sceneDescBufferData, + bufferData, ), - TypeArrayCPRepoUtils.setMat3Data( + TypeArrayCPRepoUtils.setFloat16WithFloat32Array( offset + 4 + 12, TransformRunAPI.getLocalToWorldMatrix(transform) ->LocalToWorldMatrixVO.value, - sceneDescBufferData, + bufferData, ), ]) }) @@ -48,24 +60,59 @@ let _updateSceneDescBufferData = ->Result.mapSuccess(_ => { WebGPUCoreDpRunAPI.unsafeGet().buffer.setSubFloat32Data( 0, - sceneDescBufferData, - sceneDescBuffer->StorageBufferVO.value, + bufferData, + buffer->StorageBufferVO.value, ); PathTracingPassCPRepo.setSceneDescBufferData(( - sceneDescBuffer, - sceneDescBufferSize, - sceneDescBufferData, + buffer, + bufferSize, + bufferData, )); }); }; -let _updatePointIndexBufferData = - ( - (pointIndexBuffer, pointIndexBufferSize, pointIndexBufferData), - allRenderGeometries, - ) => { +let _convertVertexStartIndexFromAlignedInPOToInVertexBufferData = + vertexStartIndex => { + Contract.requireCheck( + () => { + Contract.( + Operators.( + test( + Log.buildAssertMessage( + ~expect={j|vertexStartIndex:$vertexStartIndex be 3 times|j}, + ~actual={j|not|j}, + ), + () => { + let x = vertexStartIndex->Belt.Float.fromInt /. 3.; + + x -. x->Js.Math.floor_float ==. 0.0; + }, + ) + ) + ) + }, + DpContainer.unsafeGetOtherConfigDp().getIsDebug(), + ) + ->Result.mapSuccess(() => {vertexStartIndex / 3}); +}; + +let _buildAndSetPointIndexBufferData = (device, allRenderGeometries) => { + let geometryCount = allRenderGeometries->ListSt.length; let dataCount = 2; + let bufferData = Uint32Array.fromLength(geometryCount * dataCount); + let bufferSize = bufferData->Uint32Array.byteLength; + + let buffer = + StorageBufferVO.createFromDevice( + ~device, + ~bufferSize, + ~usage= + WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst + lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, + (), + ); + let stride = dataCount; allRenderGeometries @@ -81,38 +128,41 @@ let _updatePointIndexBufferData = ->Result.bind(list => { list->ListSt.traverseResultM( ((geometry, (vertexStartIndex, _), (faceStartIndex, _))) => { - ListResult.mergeResults([ - TypeArrayCPRepoUtils.setUint32_1( - geometry * stride, - (vertexStartIndex->Belt.Float.fromInt /. 3. *. 8.) - ->Belt.Int.fromFloat, - pointIndexBufferData, - ), - TypeArrayCPRepoUtils.setUint32_1( - geometry * stride + 1, - faceStartIndex, - pointIndexBufferData, - ), - ]) + _convertVertexStartIndexFromAlignedInPOToInVertexBufferData( + vertexStartIndex, + ) + ->Result.bind(vertexStartIndex => { + ListResult.mergeResults([ + TypeArrayCPRepoUtils.setUint32_1( + geometry * stride, + vertexStartIndex, + bufferData, + ), + TypeArrayCPRepoUtils.setUint32_1( + geometry * stride + 1, + faceStartIndex, + bufferData, + ), + ]) + }) }) }) ->Result.mapSuccess(_ => { WebGPUCoreDpRunAPI.unsafeGet().buffer.setSubUint32Data( 0, - pointIndexBufferData, - pointIndexBuffer->StorageBufferVO.value, + bufferData, + buffer->StorageBufferVO.value, ); PathTracingPassCPRepo.setPointIndexBufferData(( - pointIndexBuffer, - pointIndexBufferSize, - pointIndexBufferData, + buffer, + bufferSize, + bufferData, )); }); }; -let _updateVertexBufferData = - ((vertexBuffer, vertexBufferSize, vertexBufferData)) => { +let _buildAndSetVertexBufferData = device => { Contract.requireCheck( () => { open Contract; @@ -139,10 +189,38 @@ let _updateVertexBufferData = PointsGeometryCPRepo.getVerticesOffset() == PointsGeometryCPRepo.getNormalsOffset() }); + test( + Log.buildAssertMessage( + ~expect={j|verticesOffset be 3 times|j}, + ~actual={j|not|j}, + ), + () => { + let x = + PointsGeometryCPRepo.getVerticesOffset()->Belt.Float.fromInt /. 3.; + + x -. x->Js.Math.floor_float ==. 0.0; + }, + ); }, OtherConfigDpRunAPI.unsafeGet().getIsDebug(), ) - ->Result.tap(() => { + ->Result.mapSuccess(() => { + let bufferData = + Float32Array.fromLength( + PointsGeometryCPRepo.getVerticesOffset() / 3 * 8, + ); + let bufferSize = bufferData->Float32Array.byteLength; + + let buffer = + StorageBufferVO.createFromDevice( + ~device, + ~bufferSize, + ~usage= + WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst + lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, + (), + ); + let vertices = PointsGeometryCPRepo.getVerticesTypeArr(); let normals = PointsGeometryCPRepo.getNormalsTypeArr(); @@ -152,33 +230,33 @@ let _updateVertexBufferData = let j = ref(0); while (i^ < length) { Float32Array.unsafe_set( - vertexBufferData, + bufferData, j^, Float32Array.unsafe_get(vertices, i^), ); Float32Array.unsafe_set( - vertexBufferData, + bufferData, j^ + 1, Float32Array.unsafe_get(vertices, i^ + 1), ); Float32Array.unsafe_set( - vertexBufferData, + bufferData, j^ + 2, Float32Array.unsafe_get(vertices, i^ + 2), ); Float32Array.unsafe_set( - vertexBufferData, + bufferData, j^ + 4, Float32Array.unsafe_get(normals, i^), ); Float32Array.unsafe_set( - vertexBufferData, + bufferData, j^ + 5, Float32Array.unsafe_get(normals, i^ + 1), ); Float32Array.unsafe_set( - vertexBufferData, + bufferData, j^ + 6, Float32Array.unsafe_get(normals, i^ + 2), ); @@ -189,35 +267,57 @@ let _updateVertexBufferData = WebGPUCoreDpRunAPI.unsafeGet().buffer.setSubFloat32Data( 0, - vertexBufferData, - vertexBuffer->StorageBufferVO.value, + bufferData, + buffer->StorageBufferVO.value, ); PathTracingPassCPRepo.setVertexBufferData(( - vertexBuffer, - vertexBufferSize, - vertexBufferData, + buffer, + bufferSize, + bufferData, )); }); }; -let _updateIndexBufferData = ((indexBuffer, indexBufferSize)) => { - let indices = PointsGeometryCPRepo.getIndicesTypeArr(); +let _buildAndSetIndexBufferData = device => { + let bufferData = PointsGeometryCPRepo.getCopyUsedIndicesTypeArr(); + let bufferSize = bufferData->Uint32Array.byteLength; + + let buffer = + StorageBufferVO.createFromDevice( + ~device, + ~bufferSize, + ~usage= + WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst + lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, + (), + ); WebGPUCoreDpRunAPI.unsafeGet().buffer.setSubUint32Data( 0, - indices, - indexBuffer->StorageBufferVO.value, + bufferData, + buffer->StorageBufferVO.value, ); - PathTracingPassCPRepo.setIndexBufferData((indexBuffer, indexBufferSize)); + PathTracingPassCPRepo.setIndexBufferData((buffer, bufferSize)); }; -let _updatePBRMaterialBufferData = - ( - (pbrMaterialBuffer, pbrMaterialBufferSize, pbrMaterialBufferData), - allRenderPBRMaterials, - ) => { +let _buildAndSetPBRMaterialBufferData = (device, allRenderPBRMaterials) => { + let pbrMaterialCount = allRenderPBRMaterials->ListSt.length; + let dataCount = 4 + 4; + let bufferData = Float32Array.fromLength(pbrMaterialCount * dataCount); + let bufferSize = bufferData->Float32Array.byteLength; + + let buffer = + StorageBufferVO.createFromDevice( + ~device, + ~bufferSize, + ~usage= + WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.copy_dst + lor WebGPUCoreDpRunAPI.unsafeGet().bufferUsage.storage, + (), + ); + allRenderPBRMaterials ->ListSt.traverseReduceResultM( 0, @@ -233,15 +333,11 @@ let _updatePBRMaterialBufferData = PBRMaterialRunAPI.getMetalness(pbrMaterial)->MetalnessVO.value; ListResult.mergeResults([ - TypeArrayCPRepoUtils.setFloat3( - offset + 0, - diffuse, - pbrMaterialBufferData, - ), + TypeArrayCPRepoUtils.setFloat3(offset + 0, diffuse, bufferData), TypeArrayCPRepoUtils.setFloat3( offset + 4, (metalness, roughness, specular), - pbrMaterialBufferData, + bufferData, ), ]) ->Result.mapSuccess(() => {offset + 4 + 4}); @@ -250,46 +346,30 @@ let _updatePBRMaterialBufferData = ->Result.mapSuccess(_ => { WebGPUCoreDpRunAPI.unsafeGet().buffer.setSubFloat32Data( 0, - pbrMaterialBufferData, - pbrMaterialBuffer->StorageBufferVO.value, + bufferData, + buffer->StorageBufferVO.value, ); PathTracingPassCPRepo.setPBRMaterialBufferData(( - pbrMaterialBuffer, - pbrMaterialBufferSize, - pbrMaterialBufferData, + buffer, + bufferSize, + bufferData, )); }); }; -let _updateAllBufferData = - ( - ( - (sceneDescBuffer, sceneDescBufferSize, sceneDescBufferData), - (pointIndexBuffer, pointIndexBufferSize, pointIndexBufferData), - (vertexBuffer, vertexBufferSize, vertexBufferData), - (indexBuffer, indexBufferSize), - (pbrMaterialBuffer, pbrMaterialBufferSize, pbrMaterialBufferData), - ), - ) => { +let _buildAndSetAllBufferData = device => { let allRenderGeometries = GameObjectRunAPI.getAllRenderGeometries(); ListResult.mergeResults([ - _updateSceneDescBufferData( - (sceneDescBuffer, sceneDescBufferSize, sceneDescBufferData), + _buildAndSetSceneDescBufferData( + device, GameObjectRunAPI.getAllRenderGameObjects(), ), - _updatePointIndexBufferData( - (pointIndexBuffer, pointIndexBufferSize, pointIndexBufferData), - allRenderGeometries, - ), - _updateVertexBufferData(( - vertexBuffer, - vertexBufferSize, - vertexBufferData, - )), - _updateIndexBufferData((indexBuffer, indexBufferSize))->Result.succeed, - _updatePBRMaterialBufferData( - (pbrMaterialBuffer, pbrMaterialBufferSize, pbrMaterialBufferData), + _buildAndSetPointIndexBufferData(device, allRenderGeometries), + _buildAndSetVertexBufferData(device), + _buildAndSetIndexBufferData(device)->Result.succeed, + _buildAndSetPBRMaterialBufferData( + device, GameObjectRunAPI.getAllRenderPBRMaterials(), ), ]); @@ -300,11 +380,11 @@ let _createAndAddRayTracingBindGroup = device, instanceContainer, ( - (sceneDescBuffer, sceneDescBufferSize), - (pointIndexBuffer, pointIndexBufferSize), - (vertexBuffer, vertexBufferSize), + (sceneDescBuffer, sceneDescBufferSize, _), + (pointIndexBuffer, pointIndexBufferSize, _), + (vertexBuffer, vertexBufferSize, _), (indexBuffer, indexBufferSize), - (pbrMaterialBuffer, pbrMaterialBufferSize), + (pbrMaterialBuffer, pbrMaterialBufferSize, _), ), ((pixelBuffer, pixelBufferSize), (commonBuffer, commonBufferData)), ) => { @@ -484,6 +564,8 @@ let _createAndSetPipeline = (device, rtBindGroupLayout) => { + 1 * Uint32Array._BYTES_PER_ELEMENT + 1 + * Float32Array._BYTES_PER_ELEMENT + + 1 * Float32Array._BYTES_PER_ELEMENT, ); }, @@ -499,48 +581,25 @@ let exec = () => { ->Result.bind(((device, queue)) => { WebGPURayTracingRunAPI.buildContainers(device, queue) ->Result.bind(instanceContainer => { - Tuple5.collectOption( - PathTracingPassCPRepo.getSceneDescBufferData(), - PathTracingPassCPRepo.getPointIndexBufferData(), - PathTracingPassCPRepo.getVertexBufferData(), - PathTracingPassCPRepo.getIndexBufferData(), - PathTracingPassCPRepo.getPBRMaterialBufferData(), - ) - ->Result.bind( - ( - ( - (sceneDescBuffer, sceneDescBufferSize, sceneDescBufferData), - ( - pointIndexBuffer, - pointIndexBufferSize, - pointIndexBufferData, - ), - (vertexBuffer, vertexBufferSize, vertexBufferData), - (indexBuffer, indexBufferSize), - ( - pbrMaterialBuffer, - pbrMaterialBufferSize, - pbrMaterialBufferData, - ), - ) as allBufferData, - ) => { - _updateAllBufferData(allBufferData) - ->Result.bind(() => { - Tuple2.collectOption( - PassCPRepo.getPixelBufferData(), - PassCPRepo.getCommonBufferData(), + _buildAndSetAllBufferData(device) + ->Result.bind(() => { + Tuple2.collectOption( + PassCPRepo.getPixelBufferData(), + PassCPRepo.getCommonBufferData(), + ) + ->Result.bind(passAllBufferData => { + Tuple5.collectOption( + PathTracingPassCPRepo.getSceneDescBufferData(), + PathTracingPassCPRepo.getPointIndexBufferData(), + PathTracingPassCPRepo.getVertexBufferData(), + PathTracingPassCPRepo.getIndexBufferData(), + PathTracingPassCPRepo.getPBRMaterialBufferData(), ) - ->Result.bind(passAllBufferData => { + ->Result.bind(pathTracingAllBufferData => { _createAndAddRayTracingBindGroup( device, instanceContainer, - ( - (sceneDescBuffer, sceneDescBufferSize), - (pointIndexBuffer, pointIndexBufferSize), - (vertexBuffer, vertexBufferSize), - (indexBuffer, indexBufferSize), - (pbrMaterialBuffer, pbrMaterialBufferSize), - ), + pathTracingAllBufferData, passAllBufferData, ) ->_createAndSetPipeline(device, _) diff --git a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/get_hit_shading_data.glsl b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/get_hit_shading_data.glsl index aa61f30b14..2ed950c8b3 100755 --- a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/get_hit_shading_data.glsl +++ b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/get_hit_shading_data.glsl @@ -1,7 +1,7 @@ struct InstanceData { - uint geometryIndex; - uint materialIndex; + float geometryIndex; + float materialIndex; float pad_0; float pad_1; @@ -22,8 +22,6 @@ extract this to avoid duplicate instead of move this into InstanceData. struct PointIndexData { uint vertexIndex; uint faceIndex; - float pad_0; - float pad_1; }; struct PBRMaterial { @@ -114,16 +112,11 @@ struct HitShadingData { }; -vec2 _blerp(vec2 b, vec2 p1, vec2 p2, vec2 p3) { - return (1.0 - b.x - b.y) * p1 + b.x * p2 + b.y * p3; -} - - HitShadingData getHitShadingData(uint instanceIndex, uint primitiveIndex) { InstanceData instanceData = _getInstanceData(instanceIndex); - uint geometryIndex = instanceData.geometryIndex; - uint materialIndex = instanceData.materialIndex; + uint geometryIndex = uint(instanceData.geometryIndex); + uint materialIndex = uint(instanceData.materialIndex); PointIndexData pointIndexData = _getPointIndexData(geometryIndex); uint vertexIndex = _getVertexIndex(pointIndexData); diff --git a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ggx_direct.glsl b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ggx_direct.glsl index dff83e2e2e..fc2375a087 100755 --- a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ggx_direct.glsl +++ b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ggx_direct.glsl @@ -30,7 +30,9 @@ vec3 computeDirectLight( const vec3 N = worldNormal; + const vec3 L = lightDir; + const vec3 H = normalize(V + L); const float NdotH = max(0.0, dot(N, H)); @@ -38,8 +40,6 @@ vec3 computeDirectLight( const float HdotL = max(0.0, dot(H, L)); const float NdotV = max(0.0, dot(N, V)); - const float bsdfPdf = computeDiffuseAndSpecularPdf(NdotH, NdotL, HdotL, shading); - vec3 f = eval(NdotL, NdotV, NdotH, HdotL, shading); /*! not consider light pdf! because its pdf === 1.0 @@ -47,7 +47,8 @@ vec3 computeDirectLight( // float lightPdf = 1 / float(lightCount); // float lightPdf = 1.0; */ - Lo += lightIntensity * f / bsdfPdf; + + Lo += lightIntensity * f; return max(vec3(0.0), Lo) ; } \ No newline at end of file diff --git a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ggx_indirect.glsl b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ggx_indirect.glsl index 2c404a49b9..700dc540dd 100755 --- a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ggx_indirect.glsl +++ b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ggx_indirect.glsl @@ -3,8 +3,8 @@ void computeIndirectLight( in vec3 V, vec3 worldNormal, in ShadingData shading, - out vec3 throughput, - out float t + inout vec3 throughput, + inout float t ) { const vec3 N = worldNormal; const vec3 L = bsdfDir; diff --git a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/light.glsl b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/light.glsl index 350814a200..24fb6a92ca 100755 --- a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/light.glsl +++ b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/light.glsl @@ -20,7 +20,7 @@ void getLightData(in uint lightIndex, out float lightIntensity, lightDistance = 100000.0; // lightDir = normalize(vec3(data.position) - vec3(0.0)); - lightDir = vec3(data.direction); + lightDir = normalize(vec3(data.direction)); } bool isLightVisibleFromTheSurface(vec3 worldNormal, vec3 lightDir) { diff --git a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-closest-hit.rchit b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-closest-hit.rchit index cf7e3ab829..d4ae7c5a4a 100755 --- a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-closest-hit.rchit +++ b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-closest-hit.rchit @@ -2,6 +2,7 @@ #extension GL_EXT_ray_tracing : enable #extension GL_EXT_nonuniform_qualifier : enable #extension GL_GOOGLE_include_directive : enable +#extension GL_EXT_scalar_block_layout : enable #pragma shader_stage(closest) #include "define.glsl" @@ -40,7 +41,7 @@ void main() { vec3 radiance = vec3(0.0); vec3 throughput = prd.throughput; - vec3 seed = prd.seed; + uint seed = prd.seed; HitShadingData data = getHitShadingData(gl_InstanceID, gl_PrimitiveID); @@ -50,7 +51,7 @@ void main() { computeSpecularLobeProb(data.materialDiffuse, data.materialSpecular, data.materialMetalness) ); - prd.radiance += computeDirectLight( + radiance += computeDirectLight( tMin, data.worldPosition, data.worldNormal, data.V, shading, topLevelAS) * throughput; diff --git a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-generation.rgen b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-generation.rgen index 4e8a99c138..19c5796460 100755 --- a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-generation.rgen +++ b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-generation.rgen @@ -5,6 +5,8 @@ #pragma shader_stage(raygen) #include "../common/camera.glsl" +#include "random.glsl" +#include "raycommon.glsl" layout(location = 0) rayPayloadEXT hitPayload prd; @@ -12,53 +14,53 @@ layout(set = 0, binding = 0) uniform accelerationStructureEXT topLevelAS; layout(std140, set = 0, binding = 1) buffer PixelBuffer { vec4 pixels[]; } pixelBuffer; -layout(std140, set = 0, binding = 2) uniform CommonData { +layout(std140, set = 0, binding = 2) uniform CommonData { uint sampleCount; uint totalSampleCount; uint pad_0; uint pad_1; - } +} pushC; void main() { const ivec2 ipos = ivec2(gl_LaunchIDEXT.xy); const ivec2 resolution = ivec2(gl_LaunchSizeEXT.xy); - const uint sampleCount = pushC.sampleCount; const uint totalSampleCount = pushC.totalSampleCount; const uint bounceCount = 3; - - prd.seed = tea(tea(ipos.x, ipos.y), totalSampleCount); const uint cullMask = 0xFF; vec3 pixelColor = vec3(0.0); for (uint ss = 0; ss < sampleCount; ++ss) { - const vec2 offset = 1.0 * randInUnitDisk(prd.seed); + // const vec2 offset = 1.0 * randInUnitDisk(prd.seed); + const vec2 offset = vec2(0.0); const vec2 pixel = vec2(ipos.x + rnd(prd.seed), ipos.y + rnd(prd.seed)); const vec2 uv = (pixel / gl_LaunchSizeEXT.xy) * 2.0 - 1.0; - vec4 origin = uCamera.viewInverse * vec4(offset, 0, 1); vec4 target = uCamera.projectionInverse * (vec4(uv.x, uv.y, 1, 1)); - vec4 direction = uCamera.viewInverse * vec4(normalize(target.xyz * 1.0 - vec3(offset, 0)), 0); + vec4 direction = uCamera.viewInverse * + vec4(normalize(target.xyz * 1.0 - vec3(offset, 0)), 0); vec3 radiance = vec3(0.0); prd.throughput = vec3(1.0); for (uint bb = 0; bb < bounceCount; ++bb) { - traceRayEXT(topLevelAS, gl_RayFlagsOpaqueEXT, cullMask, 0, 0, 0, origin.xyz, uCamera.near, direction.xyz, uCamera.far, 0); + traceRayEXT(topLevelAS, gl_RayFlagsOpaqueEXT, cullMask, 0, 0, 0, + origin.xyz, uCamera.near, direction.xyz, uCamera.far, 0); radiance += prd.radiance; // abort if the ray is either invalid or didn't hit anything const float t = prd.t; // if (t < 0.0 || prd.scatterDirection.w <= 0.0) break; - if (t < 0.0) break; + if (t < 0.0) + break; // move the ray based on the bsdf direction origin = origin + t * direction; diff --git a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-miss.rmiss b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-miss.rmiss index f4d0bdf5a1..52a5d3a6e8 100755 --- a/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-miss.rmiss +++ b/src/run/cloud_picture/domain_layer/domain/shader/ray_tracing/ray-miss.rmiss @@ -9,7 +9,7 @@ layout(location = 0) rayPayloadInEXT hitPayload prd; void main() { - prd.throughput = vec3(0); + prd.throughput = vec3(0); prd.radiance = vec3(0.15); prd.t = -1.0; - } +} diff --git a/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/PointsGeometryCPRepo.re b/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/PointsGeometryCPRepo.re index 120395187e..117cbfe27b 100755 --- a/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/PointsGeometryCPRepo.re +++ b/src/run/cloud_picture/domain_layer/repo/scene/component/geometry/PointsGeometryCPRepo.re @@ -82,3 +82,11 @@ let getNormalsOffset = () => { let getIndicesOffset = () => { CPRepo.getExnGeometry().indicesOffset; }; + +let getCopyUsedIndicesTypeArr = () => { + Js.Typed_array.Uint32Array.slice( + ~start=0, + ~end_=getIndicesOffset(), + getIndicesTypeArr(), + ); +}; diff --git a/test/construct/unit/scene/component/geometry/PlaneGeometry_test.re b/test/construct/unit/scene/component/geometry/PlaneGeometry_test.re new file mode 100644 index 0000000000..41f5c0a731 --- /dev/null +++ b/test/construct/unit/scene/component/geometry/PlaneGeometry_test.re @@ -0,0 +1,70 @@ +open Wonder_jest; + +open Js.Typed_array; + +open GeometryRunAPI; + +let _ = + describe("plane geometry", () => { + open Expect; + open! Expect.Operators; + open Sinon; + + let sandbox = getSandboxDefaultVal(); + + beforeEach(() => { + sandbox := createSandbox(); + TestTool.init(~sandbox, ()); + }); + afterEach(() => restoreSandbox(refJsObjToSandbox(sandbox^))); + + describe("createPlaneGeometry", () => + test("create a new geometry which is just index(int)", () => { + let geometry = createPlaneGeometry()->ResultTool.getExnSuccessValue; + + ( + getVertices(geometry) + ->ResultTool.getExnSuccessValue + ->VerticesVO.value, + getNormals(geometry) + ->ResultTool.getExnSuccessValue + ->NormalsVO.value, + getIndices(geometry) + ->ResultTool.getExnSuccessValue + ->IndicesVO.value, + ) + |> expect + == ( + Float32Array.make([| + 1.0, + 0.0, + (-1.0), + 1.0, + 0.0, + 1.0, + (-1.0), + 0.0, + 1.0, + (-1.0), + 0.0, + (-1.0), + |]), + Float32Array.make([| + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + |]), + Uint32Array.make([|2, 1, 0, 0, 3, 2|]), + ); + }) + ); + }); diff --git a/test/run/cloud_picture/integration/endRenderCPJob_test.re b/test/run/cloud_picture/integration/endRenderCPJob_test.re index d727e3200c..76eaf88c05 100755 --- a/test/run/cloud_picture/integration/endRenderCPJob_test.re +++ b/test/run/cloud_picture/integration/endRenderCPJob_test.re @@ -52,25 +52,14 @@ let _ = }); testPromise("poll events", () => { let (window, swapChain) = _prepare(); - let pollEventsStubData = - createEmptyStub(refJsObjToSandbox(sandbox^)) - ->SinonCPTool.createTwoArgsEmptyStubData; + let pollEvents = createEmptyStub(refJsObjToSandbox(sandbox^)); - WebGPUDependencyTool.build( - ~sandbox, - ~pollEvents=pollEventsStubData->SinonCPTool.getDpFunc, - (), - ) + WebGPUDependencyTool.build(~sandbox, ~pollEvents, ()) ->WebGPUDependencyTool.set; DirectorCPTool.initAndRender( ~handleSuccessFunc= - () => { - pollEventsStubData - ->SinonCPTool.getStub - ->expect - ->SinonCPTool.toCalledWith(((), window)) - }, + () => {pollEvents->expect->SinonCPTool.toCalledWith([|window|])}, (), ); }); diff --git a/test/run/cloud_picture/integration/initPathTracingCPJob_test.re b/test/run/cloud_picture/integration/initPathTracingCPJob_test.re index f64a575804..d44a5b88f8 100755 --- a/test/run/cloud_picture/integration/initPathTracingCPJob_test.re +++ b/test/run/cloud_picture/integration/initPathTracingCPJob_test.re @@ -608,178 +608,4 @@ let _ = }); }); }); - - describe("build buffer data and set to po", () => { - let _test = - ( - ~getBufferSizeFunc, - ~makeTypeArrFunc, - ~setCountFunc, - ~getBufferDataFunc, - ) => { - let _prepare = sandbox => { - let ((device, queue), _) = _prepare(sandbox); - let count = 3; - setCountFunc(count); - - (device, count); - }; - - testPromise("create buffer", () => { - let (device, count) = _prepare(sandbox); - let buffer = WebGPUDependencyTool.createBufferObject(); - let createBufferStubData = - createEmptyStub(refJsObjToSandbox(sandbox^)) - ->SinonCPTool.returns(buffer) - ->SinonCPTool.createTwoArgsEmptyStubData; - let copy_dst = 2; - let storage = 3; - WebGPUDependencyTool.build( - ~sandbox, - ~createBuffer=createBufferStubData->SinonCPTool.getDpFunc, - ~storage_bufferUsage=storage, - ~copy_dst_bufferUsage=copy_dst, - (), - ) - ->WebGPUDependencyTool.set; - - DirectorCPTool.init( - ~handleSuccessFunc= - () => { - let (buffer, bufferSize, _) = getBufferDataFunc(); - - ( - bufferSize, - createBufferStubData - ->SinonCPTool.getStub - ->SinonCPTool.calledWithArg2( - {"size": bufferSize, "usage": copy_dst lor storage}, - device, - ), - ) - ->expect - == (getBufferSizeFunc(count), true); - }, - (), - ); - }); - - testPromise("create type arr", () => { - let (device, count) = _prepare(sandbox); - - DirectorCPTool.init( - ~handleSuccessFunc= - () => { - let (_, _, typeArr) = getBufferDataFunc(); - - typeArr->expect == makeTypeArrFunc(count); - }, - (), - ); - }); - }; - - describe("build scene desc buffer data and set to po", () => { - _test( - ~getBufferSizeFunc= - count => - (4 + 12 + 16) - * count - * Js.Typed_array.Float32Array._BYTES_PER_ELEMENT, - ~makeTypeArrFunc= - count => - ((4 + 12 + 16) * count)->Js.Typed_array.Float32Array.fromLength, - ~setCountFunc=POConfigCPTool.setTransformCount, - ~getBufferDataFunc=PathTracingPassCPTool.getSceneDescBufferData, - ) - }); - - describe("build point index buffer data and set to po", () => { - _test( - ~getBufferSizeFunc= - count => 2 * count * Js.Typed_array.Uint32Array._BYTES_PER_ELEMENT, - ~makeTypeArrFunc= - count => (2 * count)->Js.Typed_array.Uint32Array.fromLength, - ~setCountFunc=POConfigCPTool.setGeometryCount, - ~getBufferDataFunc=PathTracingPassCPTool.getPointIndexBufferData, - ) - }); - - describe("build vertex buffer data and set to po", () => { - _test( - ~getBufferSizeFunc= - count => - 4 * 2 * count * Js.Typed_array.Float32Array._BYTES_PER_ELEMENT, - ~makeTypeArrFunc= - count => (4 * 2 * count)->Js.Typed_array.Float32Array.fromLength, - ~setCountFunc=POConfigCPTool.setGeometryPointCount, - ~getBufferDataFunc=PathTracingPassCPTool.getVertexBufferData, - ) - }); - - describe("build index buffer data and set to po", () => { - let _prepare = sandbox => { - let ((device, queue), _) = _prepare(sandbox); - let count = 3; - POConfigCPTool.setGeometryPointCount(count); - - (device, count); - }; - - testPromise("create buffer", () => { - let (device, count) = _prepare(sandbox); - let buffer = WebGPUDependencyTool.createBufferObject(); - let createBufferStubData = - createEmptyStub(refJsObjToSandbox(sandbox^)) - ->SinonCPTool.returns(buffer) - ->SinonCPTool.createTwoArgsEmptyStubData; - let copy_dst = 2; - let storage = 3; - WebGPUDependencyTool.build( - ~sandbox, - ~createBuffer=createBufferStubData->SinonCPTool.getDpFunc, - ~storage_bufferUsage=storage, - ~copy_dst_bufferUsage=copy_dst, - (), - ) - ->WebGPUDependencyTool.set; - - DirectorCPTool.init( - ~handleSuccessFunc= - () => { - let (buffer, bufferSize) = - PathTracingPassCPTool.getIndexBufferData(); - - ( - bufferSize, - createBufferStubData - ->SinonCPTool.getStub - ->SinonCPTool.calledWithArg2( - {"size": bufferSize, "usage": copy_dst lor storage}, - device, - ), - ) - ->expect - == ( - 1 * count * Js.Typed_array.Uint32Array._BYTES_PER_ELEMENT, - true, - ); - }, - (), - ); - }); - }); - - describe("build pbr material buffer data and set to po", () => { - _test( - ~getBufferSizeFunc= - count => - (4 + 4) * count * Js.Typed_array.Float32Array._BYTES_PER_ELEMENT, - ~makeTypeArrFunc= - count => ((4 + 4) * count)->Js.Typed_array.Float32Array.fromLength, - ~setCountFunc=POConfigCPTool.setPBRMaterialCount, - ~getBufferDataFunc=PathTracingPassCPTool.getPBRMaterialBufferData, - ) - }); - }); }); diff --git a/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re b/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re index ba10a49bb2..f27bb3a351 100644 --- a/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re +++ b/test/run/cloud_picture/integration/updatePathTracingCPJob_test.re @@ -738,7 +738,7 @@ let _ = }); }); - describe("update all path tracing's buffer data", () => { + describe("build and set all path tracing's buffer data", () => { let _prepare = () => { let (device, queue) = _prepare(); let ( @@ -758,12 +758,77 @@ let _ = ); let _ = TransformCPTool.setTwoTransformsData(gameObject1, gameObject2); - (); + + device; + }; + + let _testCreateBuffer = (~getBufferSizeFunc, ~getBufferDataFunc) => { + testPromise("create buffer", () + => { + let device = _prepare(); + let buffer = WebGPUDependencyTool.createBufferObject(); + let createBufferStubData = + createEmptyStub(refJsObjToSandbox(sandbox^)) + ->SinonCPTool.returns(buffer) + ->SinonCPTool.createTwoArgsEmptyStubData; + let copy_dst = 2; + let storage = 3; + WebGPUDependencyTool.build( + ~sandbox, + ~createBuffer=createBufferStubData->SinonCPTool.getDpFunc, + ~storage_bufferUsage=storage, + ~copy_dst_bufferUsage=copy_dst, + (), + ) + ->WebGPUDependencyTool.set; + + DirectorCPTool.initAndUpdate( + ~handleSuccessFunc= + () => { + let (buffer, bufferSize, _) = getBufferDataFunc(); + + ( + bufferSize, + createBufferStubData + ->SinonCPTool.getStub + ->SinonCPTool.calledWithArg2( + {"size": bufferSize, "usage": copy_dst lor storage}, + device, + ), + ) + ->expect + == (getBufferSizeFunc(), true); + }, + (), + ); + }); + // testPromise("create type arr", () => { + // let device = _prepare(); + // DirectorCPTool.init( + // ~handleSuccessFunc= + // () => { + // let (_, _, typeArr) = getBufferDataFunc(); + // typeArr->expect == makeTypeArrFunc(); + // }, + // (), + // ); + // }); }; - describe("update scene desc buffer data", () => { - beforeEach(() => { - TestCPTool.updateBufferCount(~transformCount=2, ()) + describe("build and set scene desc buffer data", () => { + // beforeEach(() => { + // // TestCPTool.updateBufferCount(~transformCount=2, ()) + // }); + + describe("build scene desc buffer data", () => { + _testCreateBuffer( + ~getBufferSizeFunc= + () => + (4 + 12 + 16) + * 2 + * Js.Typed_array.Float32Array._BYTES_PER_ELEMENT, + ~getBufferDataFunc=PathTracingPassCPTool.getSceneDescBufferData, + ) }); testPromise( @@ -799,18 +864,18 @@ let _ = 0.05230407789349556, (-0.03489949554204941), 0., - 0., (-0.10343948006629944), 1.997018575668335, - 0., 0.03488355129957199, 0., 0.10727924853563309, + (-0.046806808561086655), + 2.997715950012207, 0., 0., + 1., 0., - 0., - 0., + 1., 1., 1., 0., @@ -831,18 +896,18 @@ let _ = 2.462019205093384, (-0.8682408928871155), 0., - 0., (-4.832844257354736), 8.703600883483887, - 0., 0.9438963532447815, 0., 5.9284281730651855, + 0.10258530080318451, + 29.40821647644043, 0., + 2., + 1., 0., - 0., - 0., - 0., + 1., |]); }, (), @@ -882,9 +947,17 @@ let _ = }); }); - describe("update point index buffer data", () => { - beforeEach(() => { - TestCPTool.updateBufferCount(~geometryCount=2, ()) + describe("build and set point index buffer data", () => { + // beforeEach(() => { + // TestCPTool.updateBufferCount(~geometryCount=2, ()) + // }); + + describe("build point index buffer data", () => { + _testCreateBuffer( + ~getBufferSizeFunc= + () => 2 * 2 * Js.Typed_array.Uint32Array._BYTES_PER_ELEMENT, + ~getBufferDataFunc=PathTracingPassCPTool.getPointIndexBufferData, + ) }); testPromise( @@ -899,7 +972,7 @@ let _ = PathTracingPassCPTool.getPointIndexBufferData(); typeArr->expect - == Js.Typed_array.Uint32Array.make([|0, 0, 24, 3|]); + == Js.Typed_array.Uint32Array.make([|0, 0, 3, 3|]); }, (), ); @@ -937,152 +1010,171 @@ let _ = }); }); - describe("update vertex buffer data", () => { - beforeEach(() => { - TestCPTool.updateBufferCount( - ~geometryCount=2, - ~geometryPointCount=10, - (), + describe("build and set vertex buffer data", () => { + // beforeEach(() => { + // TestCPTool.updateBufferCount( + // ~geometryCount=2, + // ~geometryPointCount=100, + // (), + // ) + // }); + + describe("build vertex buffer data", () => { + _testCreateBuffer( + ~getBufferSizeFunc= + () => 56 * Js.Typed_array.Float32Array._BYTES_PER_ELEMENT, + ~getBufferDataFunc=PathTracingPassCPTool.getVertexBufferData, ) }); testPromise( - "set each render geometry's vertices, normals to buffer data", () => { - let _ = _prepare(); - - DirectorCPTool.initAndUpdate( - ~handleSuccessFunc= - () => { - let (_, _, typeArr) = - PathTracingPassCPTool.getVertexBufferData(); - - typeArr->expect - == Js.Typed_array.Float32Array.make([| - 10., - 10., - 11., - 0., - 1., - 2., - 3., - 0., - 1.5, - 2., - 3., - 0., - 2., - 1.5, - 3., - 0., - 2.5, - 2., - 3.5, - 0., - 3., - 3.5, - 4.5, - 0., - 20., - 10., - 11., - 0., - 2., - (-1.), - 3.5, - 0., - 1.5, - 3., - 1., - 0., - 2., - 1., - 3.5, - 0., - 2.5, - 2.5, - (-1.5), - 0., - 3., - 5.5, - (-2.5), - 0., - 2., - 3., - 10., - 0., - (-1.), - 2., - 3., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - |]); - }, - (), - ); - }); - testPromise("set buffer's data", () => { - let _ = _prepare(); - let setSubFloat32DataStubData = - createEmptyStub(refJsObjToSandbox(sandbox^)) - ->SinonCPTool.createThreeArgsEmptyStubData; - WebGPUDependencyTool.build( - ~sandbox, - ~setSubFloat32Data= - setSubFloat32DataStubData->SinonCPTool.getDpFunc, - (), - ) - ->WebGPUDependencyTool.set; + "set each render geometry's vertices, normals to buffer data and set buffer's data", + () => { + let _ = _prepare(); + let setSubFloat32DataStubData = + createEmptyStub(refJsObjToSandbox(sandbox^)) + ->SinonCPTool.createThreeArgsEmptyStubData; + WebGPUDependencyTool.build( + ~sandbox, + ~setSubFloat32Data= + setSubFloat32DataStubData->SinonCPTool.getDpFunc, + (), + ) + ->WebGPUDependencyTool.set; - DirectorCPTool.initAndUpdate( - ~handleSuccessFunc= - () => { - let (buffer, _, typeArr) = - PathTracingPassCPTool.getVertexBufferData(); + DirectorCPTool.initAndUpdate( + ~handleSuccessFunc= + () => { + let (buffer, _, _) = + PathTracingPassCPTool.getVertexBufferData(); - setSubFloat32DataStubData - ->SinonCPTool.getStub - ->expect - ->SinonCPTool.toCalledWith(( - 0, - typeArr, - buffer->StorageBufferVO.value, - )); - }, - (), - ); - }); + setSubFloat32DataStubData + ->SinonCPTool.getStub + ->expect + ->SinonCPTool.toCalledWith(( + 0, + Js.Typed_array.Float32Array.make([| + 10., + 10., + 11., + 0., + 1., + 2., + 3., + 0., + 1.5, + 2., + 3., + 0., + 2., + 1.5, + 3., + 0., + 2.5, + 2., + 3.5, + 0., + 3., + 3.5, + 4.5, + 0., + 20., + 10., + 11., + 0., + 2., + (-1.), + 3.5, + 0., + 1.5, + 3., + 1., + 0., + 2., + 1., + 3.5, + 0., + 2.5, + 2.5, + (-1.5), + 0., + 3., + 5.5, + (-2.5), + 0., + 2., + 3., + 10., + 0., + (-1.), + 2., + 3., + 0., + |]), + buffer->StorageBufferVO.value, + )); + }, + (), + ); + }, + ); }); - describe("update index buffer data", () => { - beforeEach(() => { - TestCPTool.updateBufferCount( - ~geometryCount=2, - ~geometryPointCount=10, - (), - ) + describe("build and set index buffer data", () => { + // beforeEach(() => { + // TestCPTool.updateBufferCount( + // ~geometryCount=2, + // ~geometryPointCount=100, + // (), + // ) + // }); + + describe("build index buffer data", () => { + // let _prepare = sandbox => { + // let ((device, queue), _) = _prepare(sandbox); + // let count = 3; + // POConfigCPTool.setGeometryPointCount(count); + // (device, count); + // }; + testPromise("create buffer", () => { + let device = _prepare(); + let buffer = WebGPUDependencyTool.createBufferObject(); + let createBufferStubData = + createEmptyStub(refJsObjToSandbox(sandbox^)) + ->SinonCPTool.returns(buffer) + ->SinonCPTool.createTwoArgsEmptyStubData; + let copy_dst = 2; + let storage = 3; + WebGPUDependencyTool.build( + ~sandbox, + ~createBuffer=createBufferStubData->SinonCPTool.getDpFunc, + ~storage_bufferUsage=storage, + ~copy_dst_bufferUsage=copy_dst, + (), + ) + ->WebGPUDependencyTool.set; + + DirectorCPTool.initAndUpdate( + ~handleSuccessFunc= + () => { + let (buffer, bufferSize) = + PathTracingPassCPTool.getIndexBufferData(); + + ( + bufferSize, + createBufferStubData + ->SinonCPTool.getStub + ->SinonCPTool.calledWithArg2( + {"size": bufferSize, "usage": copy_dst lor storage}, + device, + ), + ) + ->expect + == (9 * Js.Typed_array.Uint32Array._BYTES_PER_ELEMENT, true); + }, + (), + ); + }) }); testPromise( @@ -1111,32 +1203,7 @@ let _ = ->expect ->SinonCPTool.toCalledWith(( 0, - Uint32Array.make([| - 2, - 1, - 0, - 2, - 0, - 1, - 3, - 1, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - |]), + Uint32Array.make([|2, 1, 0, 2, 0, 1, 3, 1, 2|]), buffer->StorageBufferVO.value, )); }, @@ -1146,9 +1213,18 @@ let _ = ); }); - describe("update pbr material buffer data", () => { - beforeEach(() => { - TestCPTool.updateBufferCount(~pbrMaterialCount=3, ()) + describe("build and set pbr material buffer data", () => { + // beforeEach(() => { + // TestCPTool.updateBufferCount(~pbrMaterialCount=3, ()) + // }); + + describe("build pbr material buffer data", () => { + _testCreateBuffer( + ~getBufferSizeFunc= + count => + (4 + 4) * 2 * Js.Typed_array.Float32Array._BYTES_PER_ELEMENT, + ~getBufferDataFunc=PathTracingPassCPTool.getPBRMaterialBufferData, + ) }); testPromise( @@ -1180,14 +1256,6 @@ let _ = 1.5, 1., 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., - 0., |]); }, (), @@ -1561,6 +1629,8 @@ let _ = + 1 * Uint32Array._BYTES_PER_ELEMENT + 1 + * Float32Array._BYTES_PER_ELEMENT + + 1 * Float32Array._BYTES_PER_ELEMENT, ); }, diff --git a/test/run/cloud_picture/tool/PathTracingPassCPTool.re b/test/run/cloud_picture/tool/PathTracingPassCPTool.re index 9ea58d2d38..6843b9f41a 100755 --- a/test/run/cloud_picture/tool/PathTracingPassCPTool.re +++ b/test/run/cloud_picture/tool/PathTracingPassCPTool.re @@ -37,7 +37,8 @@ let createAndSetPipeline = () => { }; let buildAndSetAllBufferData = device => { - InitPathTracingCPJobEntity._buildAndSetAllBufferData(device); + UpdatePathTracingCPJobEntity._buildAndSetAllBufferData(device) + ->ResultTool.getExnSuccessValueIgnore; }; let createAndSetShaderBindingTable = () => {