Skip to content

Add indirect draw / dispatch - #317

Merged
kainino0x merged 4 commits into
gpuweb:masterfrom
iraiter2:master
Jun 25, 2019
Merged

kainino0x merged 4 commits into
gpuweb:masterfrom
iraiter2:master

Conversation

@iraiter2

@iraiter2 iraiter2 commented Jun 5, 2019 •

Copy link
Copy Markdown
Contributor

Following the investigation at issue #31, we were able to implement indirect draws in dawn. D3D12 / Vulkan / Metal / OpenGL all use the same format for the indirect commands in memory. The only issue we ran into is in OpenGL index buffers can't be bound with an offset (leading to the offset being ignored in indirect indexed draws). However, this was fixable with a compute pass. We are considering implementing validation using compute shaders for indirect calls, and converting normal calls to indirect ones in order to reuse logic and avoid CPU round trips.


Preview | Diff

@kainino0x kainino0x left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

FYI to other reviewers: we'll send more details soon on the validation technique and the thing we mentioned at the end of the last meeting (no-opping invalid draw calls).

@Kangz Kangz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing the addition of an INDIRECT buffer usage I think.

@kvark

kvark commented Jun 5, 2019

Copy link
Copy Markdown
Contributor

Do we have an option of clamping the number of vertices/indices instead of discarding the whole draw call?

@kainino0x

Copy link
Copy Markdown
Contributor

@kvark Possibly, but we're not sure how that would work. Let's discuss further once Idan opens an issue about the topic.

@kvark kvark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to document the alignment of the offset somewhere

@grorg

grorg commented Jun 24, 2019 •

Copy link
Copy Markdown
Contributor

Discussed at 25 Jun 2019 teleconference

@kainino0x

Copy link
Copy Markdown
Contributor

Discussed today. Resolution: Restrict base instance to always be zero (necessary on some Vulkan) for now; then merge. MTLGPUFamilyMac1 does not support indirect draw at all; @litherum will check what devices that includes and we can decide whether it's necessary to move these into an extension.

@kainino0x

Copy link
Copy Markdown
Contributor

Merging per the discussion in the meeting.

@kainino0x
kainino0x merged commit 37e0cfb into gpuweb:master Jun 25, 2019
@litherum

Copy link
Copy Markdown
Contributor

I checked and we have no objections based on device compatibility.

@kainino0x

Copy link
Copy Markdown
Contributor

Looking back at the feature set tables, I may have misread during the meeting (or maybe the PDF changed?): Indirect draw/dispatch is supported on MTLGPUFamilyMac1.

I looked back at an old copy of the feature set tables I still have downloaded from pre-3.0, and it provides more details (unless it's wrong): Only macOS_GPUFamily1_v1 does not support indirect draw/dispatch. If I'm reading the table correctly, that means all hardware supports it, but that macOS 10.11 does not. So it looks like requiring this means we can't support macOS 10.11. (@Kangz, WDYT of that restriction?)

@Kangz

Kangz commented Jul 1, 2019

Copy link
Copy Markdown
Contributor

That's probably ok, but we should check our telemetry data to make sure (I tried but failed to use the site)

@kainino0x

Copy link
Copy Markdown
Contributor

We still have a surprising number of users on 10.11, but it is end-of-lifed, and I strongly suspect that most of those users have hardware that doesn't support Metal at all. Seems OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants