vkd3d-shader/dxil: Support minimum precision.
Merge request reports
Activity
Once the backend supports minimum precision, hardware with 16-bit support will theoretically produce results matching SM 5. Checking for native 16-bit support should tell us when to expect different results. Ideally shader runner could check for either SM < 6 or native 16-bit, but that sounds a bit too complicated.
added 5 commits
- 22c53b79 - tests/shader-runner: Run Shader Model 6 tests in the crossbuild.
- 1b3d5a08 - tests/shader-runner: Add tests for minimum-precision constants.
- f13d0336 - vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function.
- 5df6075c - vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
- a1acb8a9 - vkd3d-shader/dxil: Support 16-bit types.
Toggle commit listadded 4 commits
- 933f1e50 - tests/shader-runner: Add tests for minimum-precision constants.
- 21c6f92e - vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function.
- 9f91e75b - vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
- fd9578ba - vkd3d-shader/dxil: Support 16-bit types.
Toggle commit list-#if defined(SONAME_LIBDXCOMPILER) && !defined(VKD3D_CROSSTEST) +#if defined(SONAME_LIBDXCOMPILER) || defined(VKD3D_CROSSTEST)
Should that just be "#if defined(SONAME_LIBDXCOMPILER)"? We could perhaps consider defining SONAME_LIBDXCOMPILER to "dxcompiler.dll" if it isn't already defined and we have VKD3D_CROSSTEST, but in principle I don't think VKD3D_CROSSTEST needs special handling here.
I made this change so runner crosstests can be run in a Visual Studio command prompt, where dxcompiler.dll is in the path.
SONAME_LIBDXCOMPILER
is already defined even for crosstests, and there's no way to tell at compile time what its value should actually be for crosstest builds.It's convenient to have this work if dxcompiler.dll is available. It has no effect otherwise.
The part I don't like is that this means that in the CI the tests can silently pass if for some reason
dxcompiler.dll
is not available (which is currently the case for our CI, yes, but that can be improved in the future, and now that you remind me I could make so that the future is next week). How hard would it be to explicitly specify the DXC DLL at configuration time and have the shader runner emit a failure if the DLL is specified at configuration time but not found at runtime? It's ok for me to still look for the DLL if it wasn't explicitly requested at configuration time and do not fail it it's not found.Well, thinking again I can probably make this change myself when I add the DXC DLL to the CI. So as long as you don't object to the change above when I do it there is no need for you to do it now.
added 28 commits
-
faeb54e1...f96a7918 - 23 commits from branch
wine:master
- 34f36b14 - tests/shader-runner: Run Shader Model 6 tests in the crossbuild.
- aed1e6ed - tests/shader-runner: Add tests for minimum-precision constants.
- 6d3a648d - vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function.
- c67fe062 - vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
- 9d4c5680 - vkd3d-shader/dxil: Support 16-bit types.
Toggle commit list-
faeb54e1...f96a7918 - 23 commits from branch
- Resolved by Giovanni Mascellani
3719 else 3720 { 3721 /* Nan -- preserve sign and significand bits */ 3722 return s | 0x7f800000u | (m << 13); 3723 } 3724 } 3725 3726 /* Normalized number */ 3727 e += 127u - 15u; 3728 m <<= 13; 3729 3730 /* Assemble s, e and m. */ 3731 return s | (e << 23) | m; 3732 } 3733 3734 static uint32_t convert_raw_constant32(struct spirv_compiler *compiler, changed this line in version 11 of the diff
3708 ++e; 3709 m &= ~0x400u; 3710 } 3711 } 3712 else if (e == 31u) 3713 { 3714 if (!m) 3715 { 3716 /* Positive or negative infinity */ 3717 return s | 0x7f800000u; 3718 } 3719 else 3720 { 3721 /* Nan -- preserve sign and significand bits */ 3722 return s | 0x7f800000u | (m << 13); 3723 } changed this line in version 11 of the diff
3679 3681 type_id, vector1_id, vector2_id, components, component_count); 3680 3682 } 3681 3683 3684 /* Based on the implementation in the OpenGL Mathematics library. */ 3685 static uint32_t half_to_float(uint16_t value) 3686 { 3687 uint32_t s = (value & 0x8000) << 16; My understanding is that's undefined behaviour if
value
represents a negative number:value
has typeuint16_t
, the constant0x8000
has typeint
, so the type ofvalue & 0x8000
isint
(because the entire range ofuint16_t
fits anint
). And left shifting a bit to the sign bit is undefined behaviour. This can be fixed by using0x8000u
.changed this line in version 11 of the diff
added 4 commits
- a1304cf4 - tests/shader-runner: Add tests for minimum-precision constants.
- 4a2b597f - vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function.
- ac29fa23 - vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
- c383969e - vkd3d-shader/dxil: Support 16-bit types.
Toggle commit listI made this change so runner crosstests can be run in a Visual Studio command prompt, where dxcompiler.dll is in the path.
SONAME_LIBDXCOMPILER
is already defined even for crosstests, and there's no way to tell at compile time what its value should actually be for crosstest builds.Right, I overlooked that the issue here is that we may want to use e.g. "libdxcompiler.so" for the regular build and "dxcompiler.dll" for the cross build. It turns out that in principle e.g. the Vulkan runner would have that issue as well, but conveniently the Vulkan runner can't work for cross builds.
In any case, something along the lines of Giovanni's proposal seems reasonable to me.
mentioned in merge request !514 (merged)
added 38 commits
-
a3ca3204...50cebc72 - 34 commits from branch
wine:master
- 78acb843 - tests/shader-runner: Add tests for minimum-precision constants.
- a24dec88 - vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function.
- 30651b67 - vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
- 03828744 - vkd3d-shader/dxil: Support 16-bit types.
Toggle commit list-
a3ca3204...50cebc72 - 34 commits from branch
added 114 commits
-
03828744...14da4df9 - 110 commits from branch
wine:master
- 124bd8ee - tests/shader-runner: Add tests for minimum-precision constants.
- b5237e96 - vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function.
- f548b06b - vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
- 1a2a1db2 - vkd3d-shader/dxil: Support 16-bit types.
Toggle commit list-
03828744...14da4df9 - 110 commits from branch
added 188 commits
-
d4067a74...06ddb10c - 184 commits from branch
wine:master
- 399b125a - tests/shader-runner: Add tests for minimum-precision constants.
- f75953ab - vkd3d-shader/spirv: Introduce a data_type_is_floating_point() helper function.
- fcf93b15 - vkd3d-shader/spirv: Introduce HALF and UINT16 types for minimum precision.
- d17561fc - vkd3d-shader/dxil: Support 16-bit types.
Toggle commit list-
d4067a74...06ddb10c - 184 commits from branch