Skip to content

Commit

Permalink
fix(texture): unable to force destory texture(#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
lslzl3000 committed Dec 12, 2024
1 parent e8257bc commit 3d62dc6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orillusion/core",
"version": "0.8.4",
"version": "0.8.5-dev.1",
"author": "Orillusion",
"description": "Orillusion WebGPU Engine",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src/core/geometry/GeometryVertexBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ export class GeometryVertexBuffer {

}

public destroy(force?: boolean) {
public destroy() {
this.vertexCount = null;
this.geometryType = null;
this._vertexBufferLayouts = null;
this._attributeSlotLayouts = null;
this._attributeLocation = null;

if (this.vertexGPUBuffer)
this.vertexGPUBuffer.destroy(force);
this.vertexGPUBuffer.destroy();
this.vertexGPUBuffer = null;
}
}
2 changes: 1 addition & 1 deletion src/gfx/graphics/webGpu/core/buffer/GPUBufferBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export class GPUBufferBase {
}
}

public destroy(force?: boolean) {
public destroy() {
if (this.memoryNodes) {
this.memoryNodes.forEach((v) => {
v.destroy();
Expand Down
13 changes: 1 addition & 12 deletions src/gfx/graphics/webGpu/shader/RenderShaderPass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -955,17 +955,6 @@ export class RenderShaderPass extends ShaderPassBase {
texture.destroy(force);
} else {
texture.destroy(false);
let table = Reference.getInstance().getReference(texture);
if (table) {
let list = [];
table.forEach((v, k) => {
if (`name` in v) {
list.push(v[`name`]);
} else {
list.push(`NaN`);
}
});
}
}
}
}
Expand All @@ -981,7 +970,7 @@ export class RenderShaderPass extends ShaderPassBase {
this._destFS = null;
this._vsShaderModule = null;
this._fsShaderModule = null;
this.materialDataUniformBuffer.destroy(force);;
this.materialDataUniformBuffer.destroy();;
this.materialDataUniformBuffer = null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/gfx/graphics/webGpu/shader/Shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ export class Shader {
}
}

public destroy() {
this.getDefaultColorShader().destroy();
public destroy(force?: boolean) {
this.getDefaultColorShader().destroy(force);
}

public clone() {
Expand Down
2 changes: 1 addition & 1 deletion src/materials/Material.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class Material {
destroy(force: boolean) {
this.name = null;
this.instanceID = null;
this._shader.destroy();
this._shader.destroy(force);
this._shader = null;
}

Expand Down

0 comments on commit 3d62dc6

Please sign in to comment.