Skip to content

Commit

Permalink
Add asserts to avoid loading into the MSAA sidecar texture (google#2998)
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado authored Aug 25, 2020
1 parent 44f4061 commit 49cfbe7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions filament/backend/src/metal/MetalHandles.mm
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,10 @@ static MTLPixelFormat decidePixelFormat(id<MTLDevice> device, TextureFormat form
params.clearColor.r, params.clearColor.g, params.clearColor.b, params.clearColor.a);

if (multisampledColor[i]) {
// We're rendering into our temporary MSAA texture and doing an automatic resolve.
// We should not be attempting to load anything into the MSAA texture.
assert(descriptor.colorAttachments[i].loadAction != MTLLoadActionLoad);

descriptor.colorAttachments[i].texture = multisampledColor[i];
descriptor.colorAttachments[i].level = 0;
descriptor.colorAttachments[i].slice = 0;
Expand All @@ -579,6 +583,10 @@ static MTLPixelFormat decidePixelFormat(id<MTLDevice> device, TextureFormat form
descriptor.depthAttachment.clearDepth = params.clearDepth;

if (multisampledDepth) {
// We're rendering into our temporary MSAA texture and doing an automatic resolve.
// We should not be attempting to load anything into the MSAA texture.
assert(descriptor.depthAttachment.loadAction != MTLLoadActionLoad);

descriptor.depthAttachment.texture = multisampledDepth;
descriptor.depthAttachment.level = 0;
descriptor.depthAttachment.slice = 0;
Expand Down
3 changes: 3 additions & 0 deletions filament/src/fg/FrameGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ void FrameGraph::export_graphviz(utils::io::ostream& out, const char* viewName)
auto rendertarget = subresource->asRenderTargetResourceEntry();
if (rendertarget) {
out << ", " << "RenderTarget";
if (rendertarget->descriptor.samples > 1) {
out << " MS";
}
}
out << "\", style=filled, fillcolor="
<< ((subresource->imported) ?
Expand Down

0 comments on commit 49cfbe7

Please sign in to comment.