Can you quote the exact spec text that allows this behavior?
The only wording I can see is
If the source formats are floating-point or normalized types, the sample values for each pixel are resolved in an implementation-dependent manner
Which to me reads like the AVERAGE operation can be implemented in many different ways, where rounding isn't quite exact and FP addition ordering is arbitrary, but that doesn't mean that it can just reinterpret the format.
I think this needs a spec clarification if this behavior was really intended.
I believe that CTS commit is too loose and reads too much into "implementation-defined".
fwiw, vk-gl-cts issue which spawned the change in test: https://gitlab.khronos.org/Tracker/vk-gl-cts/-/issues/2584 but it doesn't quote the spec.
The only wording I can see is
If the source formats are floating-point or normalized types, the sample values for each pixel are resolved in an implementation-dependent manner
Yeah, that's the only thing I found.
Opened an issue against the spec: https://gitlab.khronos.org/vulkan/vulkan/-/issues/4181
The spec issue has been resolved. sRGB can be ignored: https://gitlab.khronos.org/vulkan/vulkan/-/merge_requests/7249
I'll prepare a PR that allows results produced by this behavior.
Added a bug_if in PR https://github.com/HansKristian-Work/vkd3d-proton/pull/2432.
Software information
There's a couple of subtests in
test_multisample_resolve_strongly_typedthat fail on Turnip:These subtests render into a 4x MSAA surface, writing
float4(sample_id / 2, sample_id / 2, sample_id / 2, 1.0f)for each sample. vkd3d selects the render pass attachment path for resolution, so a downsampling resolve to 1x MSAA is produced, averaging the four samples in linear RGB to(0.5, 0.5, 0.5, 1.0)before converting that to sRGB, as per requirements for multisample resolves in D3D.Vulkan seems to have more relaxed requirements, allowing weird results. Spec doesn't mention linear RGB being required for renderpass multisample resolves in 8.7. Render Pass Multisample Resolve Operations. For
vkCmdResolveImage, the resolution is still implementation-specific in 20.6. Resolving Multisample Images.CTS corroborates this. Tests covering sRGB downsampling through render pass attachments accept correct results in either linear RGB or sRGB (commit). Not that it makes sense to take downsampling results done in linear RGB and claim them to be sRGB.
In one render mode, Turnip ends up downsampling in linear RGB, so the CTS tests pass, behavior seems spec-compliant but doesn't align with D3D, failing these two tests -- linear RGB
0xff7f7f7fis produced instead of0xffbcbcbcsRGB.System information