Skip to content

Commit

Permalink
feat(api): reallocateCPUMemoryJobAPI add reallocateGeometry api
Browse files Browse the repository at this point in the history
  • Loading branch information
yyc-git committed May 24, 2019
1 parent 22594a6 commit 58f6e1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Index.re
Expand Up @@ -532,6 +532,8 @@ let registerNoWorkerInitJob = JobAPI.registerNoWorkerInitJob;

let resetDisposeCount = ReallocateCPUMemoryJobAPI.resetDisposeCount;

let reallocateGeometry = ReallocateCPUMemoryJobAPI.reallocateGeometry;

let initGeometryBufferData = ReallocateCPUMemoryJobAPI.initGeometryBufferData;

let reAllocateToBuffer = ReallocateCPUMemoryJobAPI.reAllocateToBuffer;
Expand Down
5 changes: 4 additions & 1 deletion src/api/job/ReallocateCPUMemoryJobAPI.re
Expand Up @@ -21,7 +21,7 @@ let reAllocateToBuffer = (newBufferData, state) => {
newBufferData,
RecordGeometryMainService.getRecord(state),
)
|. Some,
->Some,
};

let initGeometryBufferData = ({settingRecord}) => {
Expand All @@ -35,6 +35,9 @@ let initGeometryBufferData = ({settingRecord}) => {
);
};

let reallocateGeometry = (percent, state) =>
ReallocateCPUMemoryJobUtils.reallocateGeometry(percent, state);

let resetDisposeCount = state => {
...state,
geometryRecord:
Expand Down
6 changes: 3 additions & 3 deletions src/job/utils/ReallocateCPUMemoryJobUtils.re
Expand Up @@ -22,7 +22,7 @@ let reallocateGameObjectByDisposeCount =
state;
};

let _reallocateGeometry = ({settingRecord} as state) => {
let reallocateGeometry = (percent, {settingRecord} as state) => {
...state,
geometryRecord:
Some(
Expand All @@ -34,7 +34,7 @@ let _reallocateGeometry = ({settingRecord} as state) => {
settingRecord,
)
|| QueryCPUMemoryService.isGeometryBufferNearlyFull(
0.9,
percent,
geometryRecord,
)) {
geometryRecord.disposeCount = 0;
Expand All @@ -49,4 +49,4 @@ let _reallocateGeometry = ({settingRecord} as state) => {
};

let execJob = state =>
state |> reallocateGameObjectByDisposeCount |> _reallocateGeometry;
state |> reallocateGameObjectByDisposeCount |> reallocateGeometry(0.9);

0 comments on commit 58f6e1c

Please sign in to comment.