Skip to content

Limit for the sample count mask#932

Draft
kvark wants to merge 2 commits intogpuweb:mainfrom
kvark:msaa
Draft

Limit for the sample count mask#932
kvark wants to merge 2 commits intogpuweb:mainfrom
kvark:msaa

Conversation

@kvark
Copy link
Contributor

@kvark kvark commented Jul 17, 2020

Related to the investigation in #108
We know that we can universally support MSAA x4, but we'd want to use higher levels if available, too.
This shouldn't be a portability concern, since most applications are written to support various sample counts, so they can trivially adjust to platforms that have different mask than the developers machine.


Preview | Diff

@Kangz
Copy link
Contributor

Kangz commented Jul 17, 2020

At least in Vulkan the sample count, the set of supported sampleCount is per-format. It happens that the Vulkan spec requires that 4 is supported for all formats we care about. How confident are we that for other sampleCount values, Vulkan drivers either support it on all formats, or none?

@kvark
Copy link
Contributor Author

kvark commented Jul 17, 2020

I'd like to be able to reason about the API orthogonally here, i.e. for a format - either it supports multisampling in general or not, and for the sample count - which are supported. But of course, the reality is more complicated.

In D3D12, 128-bit formats may not support MSAA-8x, while other formats guarantee to support it.
In Metal, the sample count support is not per-format, as far as I can see.
And in Vulkan, I don't know how we can reasonably get that information.

Concluding:

  1. it would be nice to get more detailed information on Vulkan MSAA support, but it's not in https://vulkan.gpuinfo.org/ as far as I see
  2. there is a bigger question of how to we define which formats support what kind of stuff
  3. having the limit as in the PR is a good first step in exposing MSAA in a limited way. We can keep thinking about how to expose more of it.

@kainino0x
Copy link
Contributor

So what would this PR mean? That that sample count is supported for all formats? Or that it may be supported for any format?

@kvark
Copy link
Contributor Author

kvark commented Jul 21, 2020

@kainino0x supported for all renderable formats

@Kangz
Copy link
Contributor

Kangz commented Jul 21, 2020

I think that Vulkan and D3D12 might prevent such a semantic (apart for 1 and 4)

@kvark
Copy link
Contributor Author

kvark commented Jul 21, 2020

@Kangz right, so with this semantic we'd expose:

  • on Vulkan: the mask of 5
  • on D3D12: we'd check 128-bit formats for MSAA-8x support, and expose the mask of 13 if all of them do, or 5 otherwise
  • on Metal: the mask built on the supportsTextureSampleCount queries

This is not capturing the full extent of device capabilities, surely. We may need something more detailed, on a per-format basis. But I think this could be a good starting point until we get that more complicated solution in place. If we don't have that mask in the limit, we basically have no way at all to use multi-sampling.

@Kangz
Copy link
Contributor

Kangz commented Jul 21, 2020

If we don't have that mask in the limit, we basically have no way at all to use multi-sampling.

We do, WebGPU guarantees that a sample mask of 4 is allowed (except when explicitly disallowed for compressed and array textures). Am I missing something?

@kvark
Copy link
Contributor Author

kvark commented Jul 21, 2020

We do, WebGPU guarantees that a sample mask of 4 is allowed (except when explicitly disallowed for compressed and array textures). Am I missing something?

We don't have that in the spec today.

@kvark
Copy link
Contributor Author

kvark commented Jul 28, 2020

Marking as "needs investigation" for the limit that @Kangz mentioned about the total byte size of the exported pixel. My hope is that we can have that limit landing orthogonally from MSAA.

@kvark
Copy link
Contributor Author

kvark commented Sep 1, 2020

Updated with the new limit that would let us expose DX12's MSAA capabilities.

The default limit supports MSAA levels of 4 and 1 (non-multisampled), resulting in the mask value of 5.

One mask is [=better=] than the other if it fully includes it.
: <dfn>maxTexelBlockSize</dfn>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
: <dfn>maxTexelBlockSize</dfn>
: <dfn>maxTexelBlockSize</dfn>

One mask is [=better=] than the other if it fully includes it.
: <dfn>maxTexelBlockSize</dfn>
::
Maximum size of a texel block that a texture can have.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Maximum size of a texel block that a texture can have.
Maximum size in bytes of a texel block that a texture can have.

GPUSize32 maxUniformBuffersPerShaderStage = 12;
GPUSize32 maxUniformBufferBindingSize = 16384;
GPUSize64 sampleCountMask = 5;
GPUSize64 maxTexelBlockSize = 64;
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to have confirmation from the D3D12 and Metal team that this is the only additional restriction we can see in the future. Same thing for the Vulkan WG.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yesterday I suggested describing the limit this way in prose (or just not at all for now), but not exposing API surface for it in GPULimits. It doesn't serve any purpose until we have 8x MSAA (the largest texel block size we have right now is 4x rgba32float = 64 bytes). That way we can change how we describe it if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's certainly not the only restriction. I need to see how to fit Metal in there...

@kvark kvark marked this pull request as draft September 15, 2020 14:13
@kdashg
Copy link
Contributor

kdashg commented Jul 30, 2021

@kvark Is this done?

@kvark
Copy link
Contributor Author

kvark commented Aug 4, 2021

I think the consensus here is that we don't have a consensus for how to expose MSAA counts :)
So this isn't done, and we'll need to revisit this, probably shortly after MVP.

@kvark kvark added this to the post-MVP milestone Aug 23, 2021
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
* Adds some device.destroy and lost tests.

- Changes the tests to save the entire lost info interface instead of just the message so that we can identify the reason for device lost and suppress failures when tests expect devices to be destroyed.

Issue: gpuweb/cts#882

* First round comment fixes/revisions.

* Apply suggestions from code review

Co-authored-by: Kai Ninomiya <kainino1@gmail.com>
@kainino0x kainino0x added the api WebGPU API label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api WebGPU API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants