Skip to content

HLSL requires the number of samples for a MS texture as part of the type? #1445

@ben-clayton

Description

@ben-clayton

According to https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-to-type:

Multisampled objects (Texture2DMS and Texture2DMSArray) require the texture size to be explicitly stated and expressed as the number of samples.
Object2 [<Type, Samples>] Name;

Later it gives an example:

Texture2DMS <float4, 128> MyMSTex;

However, WGSL does not currently include the number of samples in the texture_multisampled_* types.

It seems that DXC actually treats the number of samples argument as optional, but it's I've not found any documentation to explain what omitting the number of samples means.

The DXIL output for Texture2DMS<float4> and Texture2DMS<float4, 8> is clearly different, so it seems this information is being preserved by DXC.

If the number of samples is required to function properly, we may need to change the spec to include this as part of the type, or we'll have to inject this information into the shader at pipeline creation time.

Microsoft folks - are you able to provide any information on whether this template argument is required, and what the behaviour is if omitted?

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions