Skip to content

Commit

Permalink
fix pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
star-e committed Oct 15, 2024
1 parent 9a0c540 commit 4e19ec4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 6 additions & 1 deletion cocos/gfx/base/define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1796,8 +1796,13 @@ export class DescriptorSetInfo {
declare private _token: never; // to make sure all usages must be an instance of this exact class, not assembled from plain object

constructor (
public readonly layout: DescriptorSetLayout = null!,
public layout: DescriptorSetLayout = null!,
) {}

public copy (info: Readonly<DescriptorSetInfo>): DescriptorSetInfo {
this.layout = info.layout;
return this;
}
}

export class PipelineLayoutInfo {
Expand Down
10 changes: 6 additions & 4 deletions cocos/gfx/base/states/texture-barrier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ export class TextureBarrier extends GFXObject {
static computeHash (info: Readonly<TextureBarrierInfo>): number {
let res = `${info.prevAccesses} ${info.nextAccesses}`;
res += info.type;
res += info.baseMipLevel;
res += info.levelCount;
res += info.baseSlice;
res += info.sliceCount;
res += info.range.mipLevel;
res += info.range.levelCount;
res += info.range.firstSlice;
res += info.range.numSlices;
res += info.range.basePlane;
res += info.range.planeCount;
res += info.discardContents;
res += info.srcQueue ? info.srcQueue.type : 0;
res += info.dstQueue ? info.dstQueue.type : 0;
Expand Down
6 changes: 4 additions & 2 deletions native/tools/gfx-define-generator/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ while (structCap) {
// structRE can not reliably extract the correct member declaration range
let memberList = getMemberList(header, structCap.index + structCap[1].length);
// discard pointer signs
memberList = memberList.replace(/\*/g, '');
const memberList2 = memberList.replace(/\*/g, '');
const hasPointer = memberList2 !== memberList;
memberList = memberList2;

let memberCap = structMemberRE.exec(memberList);
while (memberCap) {
Expand All @@ -187,7 +189,7 @@ while (structCap) {
type = type.replace(/(\b)(?:String)(\b)/, '$1string$2');
type = type.replace(/(\b)(?:ccstd::string)(\b)/, '$1string$2');
type = type.replace(/(\b)(?:ccstd::hash_t)(\b)/, '$1number$2');
if (memberCap[1]) {readonly = true;}
if (memberCap[1] && !hasPointer) {readonly = true;}
const isArray = type.endsWith('[]');
const decayedType = isArray ? type.slice(0, -2) : type;

Expand Down

0 comments on commit 4e19ec4

Please sign in to comment.