Repository: google/filament
File: filament/backend/src/webgpu/WebGPURenderTarget.cpp (C++)

Code before:
        assert_invariant(defaultColorTextureView);
        mColorAttachmentDesc.push_back({
            .view = defaultColorTextureView,
            .resolveTarget = nullptr,
            .loadOp = WebGPURenderTarget::getLoadOperation(params, TargetBufferFlags::COLOR0),
            .storeOp = WebGPURenderTarget::getStoreOperation(params, TargetBufferFlags::COLOR0),
            .clearValue = {
                .r = params.clearColor.r,
                .g = params.clearColor.g,
                .b = params.clearColor.b,
                .a = params.clearColor.a }});
    } else {
        for (uint32_t i = 0; i < customColorTextureViewCount; ++i) {
            if (customColorTextureViews[i]) {
                mColorAttachmentDesc.push_back({
                    .view = customColorTextureViews[i],
                    .resolveTarget = nullptr, // We handle MSAA on the WebGPU driver's resolve function
                    .loadOp =
                            WebGPURenderTarget::getLoadOperation(params, getTargetBufferFlagsAt(i)),
                    .storeOp = WebGPURenderTarget::getStoreOperation(params,
                            getTargetBufferFlagsAt(i)),
                    .clearValue = {
                        .r = params.clearColor.r,
                        .g = params.clearColor.g,
                        .b = params.clearColor.b,
                        .a = params.clearColor.a }});
            }
        }
    }
    outDescriptor.colorAttachmentCount = mColorAttachmentDesc.size();
    outDescriptor.colorAttachments = mColorAttachmentDesc.data();

    // Depth/Stencil Attachments
    if (mHasDepthStencilAttachment) {
        wgpu::TextureView depthStencilViewToUse{ nullptr };
        if (mDefaultRenderTarget) {
            depthStencilViewToUse = defaultDepthStencilTextureView;
            assert_invariant(depthStencilViewToUse);
        } else {
            if (customDepthStencilTextureView) {
                depthStencilViewToUse = customDepthStencilTextureView;
            }
        }

        if (depthStencilViewToUse) {
            mDepthStencilAttachmentDesc = {};
            mDepthStencilAttachmentDesc.view = depthStencilViewToUse;

            if (hasDepth) {
                mDepthStencilAttachmentDesc.depthLoadOp =
                        depthReadOnly ? wgpu::LoadOp::Undefined

Review comment (suggestion):
nit: again, I suggest a comma after `params.clearColor.a` and the `.clearValue` value (closing curly brace). Then we are not fighting our clang format.

Code after:
    if (mDefaultRenderTarget) {
        assert_invariant(defaultColorTextureView);
        mColorAttachmentDesc.push_back({
            .view = defaultColorTextureView,
            .resolveTarget = nullptr,
            .loadOp = WebGPURenderTarget::getLoadOperation(params, TargetBufferFlags::COLOR0),
            .storeOp = WebGPURenderTarget::getStoreOperation(params, TargetBufferFlags::COLOR0),
            .clearValue = {
                .r = params.clearColor.r,
                .g = params.clearColor.g,
                .b = params.clearColor.b,
                .a = params.clearColor.a,
            },
        });
    } else {
        for (uint32_t i = 0; i < customColorTextureViewCount; ++i) {
            if (customColorTextureViews[i]) {
                mColorAttachmentDesc.push_back({ .view = customColorTextureViews[i],
                    .resolveTarget =
                            nullptr, // We handle MSAA on the WebGPU driver's resolve function
                    .loadOp =
                            WebGPURenderTarget::getLoadOperation(params, getTargetBufferFlagsAt(i)),
                    .storeOp = WebGPURenderTarget::getStoreOperation(params,
                            getTargetBufferFlagsAt(i)),
                    .clearValue = {
                        .r = params.clearColor.r,
                        .g = params.clearColor.g,
                        .b = params.clearColor.b,
                        .a = params.clearColor.a,
                    },
                });
            }
        }
    }
    outDescriptor.colorAttachmentCount = mColorAttachmentDesc.size();
    outDescriptor.colorAttachments = mColorAttachmentDesc.data();

    // Depth/Stencil Attachments
    if (mHasDepthStencilAttachment) {
        wgpu::TextureView depthStencilViewToUse{ nullptr };
        if (mDefaultRenderTarget) {
            depthStencilViewToUse = defaultDepthStencilTextureView;
            assert_invariant(depthStencilViewToUse);
        } else {
            if (customDepthStencilTextureView) {
                depthStencilViewToUse = customDepthStencilTextureView;
            }
        }

        if (depthStencilViewToUse) {
            mDepthStencilAttachmentDesc = {};