protonscr

tests rely on undefined behavior

vkd3dclosed
HansKristian-Work/vkd3d-proton#1831 · opened 2024-01-11 by KonstantinSeurer · updated 2024-01-11 · 2 comments · github
KKonstantinSeurer 2024-01-11 github

Float to integer conversions

The SPIR_V spec states:

Khronos issue #491: For OpConvertFToU and OpConvertFToS, behavior is undefined if Result Type is not wide enough to hold the converted value.

test_shader_instructions expects the conversions to saturate and map NAN to 0. The issue can be reproduced when running on lavapipe.

Texture sampling level selection

The Vulkan spec allows lod=0.5 to be rounded to 1 or 0: https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#textures-image-level-selection with 0 being preferred. test_sample_instructions test 23 expects it to be ceiled.

Ddoitsujin maintainer 2024-01-11 github

As discussed on Discord:

  • Correct ftou/ftoi behaviour would require us to open-code the conversion instructions with at least three OpFCompare+OpSelect, which drivers for hardware that already behaves this way would have to optimize away. This is kind of problematic for common operations like this.
  • Test 23 essentially tests for D3D behaviour, which matches the "alternative" mode in the Vulkan spec. As it stands, we do not have enough control over samplers to enforce this.
KKonstantinSeurer 2024-01-11 github

Makes sense. I will se what I can do on the lavapipe side.

Nothing extracted yet.