Bug 225842 - [ANGLE Metal] Support provoking vertex emulation, pass fragmentOutput tests
Summary: [ANGLE Metal] Support provoking vertex emulation, pass fragmentOutput tests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kyle Piddington
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-14 22:04 PDT by Kyle Piddington
Modified: 2021-05-19 12:06 PDT (History)
5 users (show)

See Also:


Attachments
Patch (135.45 KB, patch)
2021-05-14 23:23 PDT, Kyle Piddington
no flags Details | Formatted Diff | Diff
Patch (134.92 KB, patch)
2021-05-17 09:19 PDT, Kyle Piddington
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (134.92 KB, patch)
2021-05-17 09:30 PDT, Kyle Piddington
dino: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for Landing (134.72 KB, patch)
2021-05-18 14:09 PDT, Kyle Piddington
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle Piddington 2021-05-14 22:04:21 PDT
[ANGLE Metal] Support provoking vertex emulation, pass fragmentOutput tests
Comment 1 Kyle Piddington 2021-05-14 23:23:49 PDT
Created attachment 428719 [details]
Patch
Comment 2 EWS Watchlist 2021-05-14 23:25:09 PDT
Note that there are important steps to take when updating ANGLE. See https://trac.webkit.org/wiki/UpdatingANGLE
Comment 3 Dean Jackson 2021-05-15 11:26:25 PDT
Comment on attachment 428719 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=428719&action=review

> Source/ThirdParty/ANGLE/ChangeLog:10
> +        Add support for provoking vertex emulation. Metal only supports using the first vertex
> +        Of a primitive as a provoking vertex. To adapt, rewrite the index buffer on the fly when provoking Vertex support is required. This method does *not* rewrite any primitives that would be 
> +        Culled by primitive restart, such as simple triangles and lines, but should rewrite line and tri paths.

The capitalisation is a bit weird here.

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm:620
> +        if(drawIdxBuffer == nullptr)

If this is ANGLE style that's fine, but if not we typically just do (!drawIdxBuffer) in WebKit.

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ContextMtl.mm:637
> +    

Intentional?

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProgramMtl.mm:498
> +  

Intentional?

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProvokingVertexHelper.h:36
> +    mtl::BufferRef  preconditionIndexBuffer(ContextMtl * context,
> +                                                                   mtl::BufferRef indexBuffer,
> +                                                                   size_t indexCount,
> +                                                                   size_t indexOffset,
> +                                                                   bool primitiveRestartEnabled,
> +                                                                   gl::PrimitiveMode primitiveMode,
> +                                                                   gl::DrawElementsType elementsType,
> +                                                                   size_t & outIndexcount,
> +                                                                   gl::PrimitiveMode & outPrimitiveMode);

Are these indented too much?

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProvokingVertexHelper.mm:146
> +}
> +
> +
> +
> +void ProvokingVertexHelper::ensureCommandBufferReady()
> +{
> +    if (!mCommandBuffer.valid())
> +    {
> +        mCommandBuffer.restart();
> +    }
> +    ASSERT(mCommandBuffer.valid());
> +}
> +
> +
> +
> +static uint buildIndexBufferKey(const mtl::ProvokingVertexComputePipelineDesc &pipelineDesc)

I guess the extra empty lines will be caught when upstreaming to ANGLE.

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/ProvokingVertexHelper.mm:160
> +            indexBufferKey |= MtlFixIndexBufferKeyUint16 <<     MtlFixIndexBufferKeyInShift;
> +            indexBufferKey |= MtlFixIndexBufferKeyUint16 << MtlFixIndexBufferKeyOutShift;
> +            break;
> +        case gl::DrawElementsType::UnsignedInt:
> +            indexBufferKey |= MtlFixIndexBufferKeyUint32 <<     MtlFixIndexBufferKeyInShift;
> +            indexBufferKey |= MtlFixIndexBufferKeyUint32 << MtlFixIndexBufferKeyOutShift;

The KeyInShift identation is wrong.

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc:2881
> +        {

Can we add comments with the name of the buffer mode here and below?

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc:3001
> +            break;

Indentation is off.

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/shaders/rewrite_indices.metal:40
> +        }
> +        if(indexBufferIsUint32)

else if

> Source/ThirdParty/ANGLE/src/libANGLE/renderer/metal/shaders/rewrite_indices.metal:99
> +            break;

And here (and below in this function).
Comment 4 Kyle Piddington 2021-05-17 09:19:01 PDT
Created attachment 428837 [details]
Patch
Comment 5 Kyle Piddington 2021-05-17 09:30:37 PDT
Created attachment 428840 [details]
Patch
Comment 6 EWS 2021-05-17 17:36:32 PDT
commit-queue failed to commit attachment 428840 [details] to WebKit repository. To retry, please set cq+ flag again.
Comment 7 Kyle Piddington 2021-05-18 14:09:45 PDT
Created attachment 428979 [details]
Patch for Landing
Comment 8 EWS 2021-05-19 12:05:39 PDT
Committed r277741 (237913@main): <https://commits.webkit.org/237913@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 428979 [details].
Comment 9 Radar WebKit Bug Importer 2021-05-19 12:06:40 PDT
<rdar://problem/78217333>