Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e3dc026

Browse files
committed
started invalidating mipmaps
1 parent 9c8ce04 commit e3dc026

File tree

7 files changed

+22
-0
lines changed

7 files changed

+22
-0
lines changed

impeller/core/texture.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,8 @@ bool Texture::NeedsMipmapGeneration() const {
8686
return !mipmap_generated_ && desc_.mip_count > 1;
8787
}
8888

89+
void Texture::InvalidateMipmap() {
90+
mipmap_generated_ = false;
91+
}
92+
8993
} // namespace impeller

impeller/core/texture.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class Texture {
4747

4848
bool NeedsMipmapGeneration() const;
4949

50+
void InvalidateMipmap();
51+
5052
protected:
5153
explicit Texture(TextureDescriptor desc);
5254

impeller/entity/contents/filters/filter_contents.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ std::shared_ptr<FilterContents> FilterContents::MakeDirectionalGaussianBlur(
5050
return blur;
5151
}
5252

53+
#define IMPELLER_ENABLE_NEW_GAUSSIAN_FILTER 1
54+
5355
std::shared_ptr<FilterContents> FilterContents::MakeGaussianBlur(
5456
const FilterInput::Ref& input,
5557
Sigma sigma_x,

impeller/entity/contents/filters/gaussian_blur_filter_contents.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ std::optional<Entity> GaussianBlurFilterContents::RenderFilter(
288288
}
289289

290290
if (input_snapshot.value().texture->NeedsMipmapGeneration()) {
291+
FML_LOG(ERROR) << "should generate mipmap";
291292
std::shared_ptr<CommandBuffer> mip_cmd_buffer =
292293
renderer.GetContext()->CreateCommandBuffer();
293294
std::shared_ptr<BlitPass> blit_pass = mip_cmd_buffer->CreateBlitPass();

impeller/entity/entity_pass.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,13 @@ bool EntityPass::Render(ContentContext& renderer,
346346
renderer, root_render_target.GetRenderTargetSize(), /*mip_count=*/4,
347347
GetClearColorOrDefault(render_target.GetRenderTargetSize()));
348348

349+
offscreen_target.GetRenderTarget()
350+
.GetRenderTargetTexture()
351+
->InvalidateMipmap();
352+
FML_LOG(ERROR)
353+
<< "invalidating mips: "
354+
<< offscreen_target.GetRenderTarget().GetRenderTargetTexture();
355+
349356
if (!OnRender(renderer, // renderer
350357
capture, // capture
351358
offscreen_target.GetRenderTarget()

impeller/renderer/backend/metal/texture_mtl.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ new TextureMTL(
139139
return false;
140140
}
141141

142+
FML_LOG(ERROR) << "mipmap generated";
143+
142144
[encoder generateMipmapsForTexture:texture];
143145
mipmap_generated_ = true;
144146

impeller/renderer/render_target.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ RenderTarget RenderTarget::CreateOffscreenMSAA(
314314
color0_resolve_tex_desc.mip_count = mip_count;
315315

316316
auto color0_resolve_tex = allocator.CreateTexture(color0_resolve_tex_desc);
317+
if (mip_count > 1) {
318+
FML_LOG(ERROR) << "created mip resolve texture: " << color0_resolve_tex
319+
<< " " << mip_count;
320+
}
317321
if (!color0_resolve_tex) {
318322
VALIDATION_LOG << "Could not create color texture.";
319323
return {};

0 commit comments

Comments
 (0)