Skip to content

Commit

Permalink
feat(cloud-picture): add UpdateTextureArrayCPJobEntity job
Browse files Browse the repository at this point in the history
  • Loading branch information
yyc-git committed Sep 27, 2020
1 parent a228e8d commit 584b815
Show file tree
Hide file tree
Showing 19 changed files with 517 additions and 19 deletions.
4 changes: 4 additions & 0 deletions src/construct/application_layer/asset/AssetApService.re
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ let loadImages = imageDataList => {
}),
);
};

let getImageData = id => {
OperateImageDoService.getData(id);
};
16 changes: 16 additions & 0 deletions src/construct/application_layer/scene/PBRMaterialApService.re
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,34 @@ let setMetalness = (material, metalness) => {
OperatePBRMaterialDoService.setMetalness(material, metalness);
};

let getDiffuseMapImageId = material => {
OperatePBRMaterialDoService.getDiffuseMapImageId(material);
};

let setDiffuseMapImageId = (material, id) => {
OperatePBRMaterialDoService.setDiffuseMapImageId(material, id);
};

let getMetalRoughnessMapImageId = material => {
OperatePBRMaterialDoService.getMetalRoughnessMapImageId(material);
};

let setMetalRoughnessMapImageId = (material, id) => {
OperatePBRMaterialDoService.setMetalRoughnessMapImageId(material, id);
};

let getEmissionMapImageId = material => {
OperatePBRMaterialDoService.getEmissionMapImageId(material);
};

let setEmissionMapImageId = (material, id) => {
OperatePBRMaterialDoService.setEmissionMapImageId(material, id);
};

let getNormalMapImageId = material => {
OperatePBRMaterialDoService.getNormalMapImageId(material);
};

let setNormalMapImageId = (material, id) => {
OperatePBRMaterialDoService.setNormalMapImageId(material, id);
};
27 changes: 27 additions & 0 deletions src/construct/domain_layer/dependency/interface/IWebGPUCoreDp.re
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ type shaderStage = {

type bufferUsage = {
storage: bufferUsageObject,
sampled: bufferUsageObject,
uniform: bufferUsageObject,
indirect: bufferUsageObject,
vertex: bufferUsageObject,
Expand Down Expand Up @@ -425,6 +426,30 @@ type passEncoder = {
compute: passEncoderCompute,
};

type bufferCopyView = {
.
"buffer": bufferObject,
"bytesPerRow": int,
"arrayLayer": int,
"mipLevel": int,
"imageHeight": int,
};

type origin3D = {
.
"x": int,
"y": int,
"z": int,
};

type textureCopyView = {
.
"texture": textureObject,
"arrayLayer": int,
"mipLevel": int,
"origin": origin3D,
};

type commandEncoder = {
beginRenderPass:
(passEncoderRenderDescriptor, commandEncoderObject) =>
Expand All @@ -433,6 +458,8 @@ type commandEncoder = {
(passEncoderComputeDescriptor, commandEncoderObject) =>
passEncoderComputeObject,
finish: commandEncoderObject => commandBufferObject,
copyBufferToTexture:
(bufferCopyView, textureCopyView, extend3D, commandEncoderObject) => unit,
};

type device = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ type shaderStage = {

type bufferUsage = {
storage: bufferUsageObject,
sampled: bufferUsageObject,
uniform: bufferUsageObject,
indirect: bufferUsageObject,
vertex: bufferUsageObject,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let getData = id => {
DpContainer.unsafeGetImageRepoDp().getData(id->ImageIdVO.value)
->OptionSt.fromNullable;
};
37 changes: 35 additions & 2 deletions src/construct/domain_layer/library/structure/ListSt.re
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,33 @@ let rec traverseResultM = (list, f) => {
};
};

let traverseResultMi = (list, f) => {
// define the monadic functions
let (>>=) = (x, f) => Result.bind(x, f);

let retn = Result.succeed;

// define a "cons" function
let cons = (head, tail) => [head, ...tail];

let rec _traverse = (list, i, f) => {
// loop through the list
switch (list) {
| [] =>
// if empty, lift [] to a Result
retn([])
| [head, ...tail] =>
// otherwise lift the head to a Result using f
// then lift the tail to a Result using traverse
// then cons the head and tail and return it
f(i, head)
>>= (h => _traverse(tail, i->succ, f) >>= (t => retn(cons(h, t))))
};
};

_traverse(list, 0, f);
};

let rec traverseReduceResultM =
(list: list('a), param: 'b, f: ('b, 'a) => Result.t2('b))
: Result.t2('b) => {
Expand Down Expand Up @@ -67,6 +94,8 @@ let reduce = Belt.List.reduce;

let forEach = Belt.List.forEach;

let forEachi = Belt.List.forEachWithIndex;

let push = (list, value) => {
list->Belt.List.concat([value]);
};
Expand All @@ -87,14 +116,14 @@ let getLast = list => {
list->nth(length(list) - 1);
};

let removeDuplicateItems = list => {
let removeDuplicateItemsU = (list, buildKeyFunc) => {
let arr = list->toArray;

let resultArr = [||];
let map = MutableHashMap.createEmpty();
for (i in 0 to Js.Array.length(arr) - 1) {
let item = Array.unsafe_get(arr, i);
let key = Js.Int.toString(item);
let key = buildKeyFunc(item);
switch (MutableHashMap.get(map, key)) {
| None =>
Js.Array.push(item, resultArr) |> ignore;
Expand All @@ -104,3 +133,7 @@ let removeDuplicateItems = list => {
};
resultArr->fromArray;
};

let removeDuplicateItems = list => {
removeDuplicateItemsU(list, Js.Int.toString);
};
4 changes: 4 additions & 0 deletions src/construct/external_layer/api/run/domain/AssetRunAPI.re
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
let loadImages = imageDataList => {
AssetApService.loadImages(imageDataList);
};

let getImageData = id => {
AssetApService.getImageData(id);
};
16 changes: 16 additions & 0 deletions src/construct/external_layer/api/run/domain/PBRMaterialRunAPI.re
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,34 @@ let setMetalness = (material, metalness) => {
PBRMaterialApService.setMetalness(material, metalness);
};

let getDiffuseMapImageId = material => {
PBRMaterialApService.getDiffuseMapImageId(material);
};

let setDiffuseMapImageId = (material, id) => {
PBRMaterialApService.setDiffuseMapImageId(material, id);
};

let getMetalRoughnessMapImageId = material => {
PBRMaterialApService.getMetalRoughnessMapImageId(material);
};

let setMetalRoughnessMapImageId = (material, id) => {
PBRMaterialApService.setMetalRoughnessMapImageId(material, id);
};

let getEmissionMapImageId = material => {
PBRMaterialApService.getEmissionMapImageId(material);
};

let setEmissionMapImageId = (material, id) => {
PBRMaterialApService.setEmissionMapImageId(material, id);
};

let getNormalMapImageId = material => {
PBRMaterialApService.getNormalMapImageId(material);
};

let setNormalMapImageId = (material, id) => {
PBRMaterialApService.setNormalMapImageId(material, id);
};
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ let _convertVertexStartIndexFromAlignedInPOToInVertexBufferData =
)
)
},
DpContainer.unsafeGetOtherConfigDp().getIsDebug(),
OtherConfigDpRunAPI.unsafeGet().getIsDebug(),
)
->Result.mapSuccess(() => {vertexStartIndex / 3});
};
Expand Down
Loading

0 comments on commit 584b815

Please sign in to comment.