Skip to content

Commit

Permalink
Don't use immutable textures for mipmap generation
Browse files Browse the repository at this point in the history
  • Loading branch information
StrandedKitty committed Dec 28, 2023
1 parent 06a5d64 commit b5370df
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
14 changes: 6 additions & 8 deletions src/app/render/PassManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export default class PassManager {
mipmaps: false
}),
clearValue: {r: 0, g: 0, b: 0, a: 1},
loadOp: RendererTypes.AttachmentLoadOp.Load,
loadOp: RendererTypes.AttachmentLoadOp.Clear,
storeOp: RendererTypes.AttachmentStoreOp.Store
}, {
texture: new TextureResourceDescriptor({
Expand All @@ -245,7 +245,7 @@ export default class PassManager {
mipmaps: false
}),
clearValue: {r: 0, g: 0, b: 0, a: 1},
loadOp: RendererTypes.AttachmentLoadOp.Load,
loadOp: RendererTypes.AttachmentLoadOp.Clear,
storeOp: RendererTypes.AttachmentStoreOp.Store
}, {
texture: new TextureResourceDescriptor({
Expand All @@ -258,7 +258,7 @@ export default class PassManager {
mipmaps: false
}),
clearValue: {r: 0, g: 0, b: 0, a: 0},
loadOp: RendererTypes.AttachmentLoadOp.Load,
loadOp: RendererTypes.AttachmentLoadOp.Clear,
storeOp: RendererTypes.AttachmentStoreOp.Store
}, {
texture: new TextureResourceDescriptor({
Expand All @@ -271,7 +271,7 @@ export default class PassManager {
mipmaps: false
}),
clearValue: {r: 0, g: 0, b: 0, a: 0},
loadOp: RendererTypes.AttachmentLoadOp.Load,
loadOp: RendererTypes.AttachmentLoadOp.Clear,
storeOp: RendererTypes.AttachmentStoreOp.Store
}, {
texture: new TextureResourceDescriptor({
Expand All @@ -284,7 +284,7 @@ export default class PassManager {
mipmaps: false
}),
clearValue: {r: 0, g: 0, b: 0, a: 0},
loadOp: RendererTypes.AttachmentLoadOp.Load,
loadOp: RendererTypes.AttachmentLoadOp.Clear,
storeOp: RendererTypes.AttachmentStoreOp.Store
}, {
texture: new TextureResourceDescriptor({
Expand All @@ -297,7 +297,7 @@ export default class PassManager {
mipmaps: false
}),
clearValue: {r: 0, g: 0, b: 0, a: 0},
loadOp: RendererTypes.AttachmentLoadOp.Load,
loadOp: RendererTypes.AttachmentLoadOp.Clear,
storeOp: RendererTypes.AttachmentStoreOp.Store
}
],
Expand Down Expand Up @@ -996,8 +996,6 @@ export default class PassManager {
magFilter: RendererTypes.MagFilter.Nearest,
wrap: RendererTypes.TextureWrap.ClampToEdge,
mipmaps: true,
isImmutable: true,
immutableLevels: 6
}),
clearValue: {r: 0, g: 0, b: 0, a: 0},
loadOp: RendererTypes.AttachmentLoadOp.Load,
Expand Down
6 changes: 4 additions & 2 deletions src/app/render/passes/TerrainTexturesPass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ export default class TerrainTexturesPass extends Pass<{
}
}

this.renderer.useMaterial(this.heightDownscaleMaterial);
heightTex.generateMipmaps();

/*this.renderer.useMaterial(this.heightDownscaleMaterial);
for (let layer = 0; layer < 2; layer++) {
if (!heightLoadersUpdateFlags[layer]) {
Expand Down Expand Up @@ -254,7 +256,7 @@ export default class TerrainTexturesPass extends Pass<{
heightTex.baseLevel = 0;
heightTex.maxLevel = 10000;
heightTex.updateBaseAndMaxLevel();
heightTex.updateBaseAndMaxLevel();*/

this.renderer.useMaterial(this.normalMaterial);

Expand Down
5 changes: 4 additions & 1 deletion src/lib/renderer/webgl2-renderer/WebGL2Framebuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ export default class WebGL2Framebuffer {
case RendererTypes.TextureFormat.RGBA8Unorm:
this.gl.clearBufferfv(WebGL2Constants.COLOR, drawBuffer, WebGL2Framebuffer.clearValueToTypedArray(Float32Array, clearValue));
return;
case RendererTypes.TextureFormat.RGB8Unorm:
this.gl.clearBufferfv(WebGL2Constants.COLOR, drawBuffer, WebGL2Framebuffer.clearValueToTypedArray(Float32Array, clearValue));
return;
case RendererTypes.TextureFormat.R8Unorm:
this.gl.clearBufferfv(WebGL2Constants.COLOR, drawBuffer, WebGL2Framebuffer.clearValueToTypedArray(Float32Array, clearValue));
return;
Expand All @@ -272,7 +275,7 @@ export default class WebGL2Framebuffer {
this.gl.clearBufferfv(WebGL2Constants.COLOR, drawBuffer, WebGL2Framebuffer.clearValueToTypedArray(Float32Array, clearValue));
return;
case RendererTypes.TextureFormat.R32Uint:
this.gl.clearBufferfv(WebGL2Constants.COLOR, drawBuffer, WebGL2Framebuffer.clearValueToTypedArray(Float32Array, clearValue));
this.gl.clearBufferuiv(WebGL2Constants.COLOR, drawBuffer, WebGL2Framebuffer.clearValueToTypedArray(Uint32Array, clearValue));
return;
}

Expand Down

0 comments on commit b5370df

Please sign in to comment.