mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 17:20:21 +01:00
read-only mirror of https://gitlab.freedesktop.org/mesa/mesa
The two representations are *always* used for `load_const`, but when inlining the value as SSA source, use just a single terse representation. The choice between integer or float is based on the result of nir_gather_ssa_types(), with a bias for integer when in doubt. Also remove extra comment `/* */` syntax since the value is already enclosed by parenthesis. --- For illustration, here's some instructions from crucible test func.shader.averageRounded.uint64_t with NIR_DEBUG=print_consts: BEFORE: ``` vec1 32 con ssa_23 = load_const (0xfffffffc = -nan) vec1 32 div ssa_24 = iand ssa_13, ssa_23 /*(0xfffffffc = -nan)*/ vec1 32 con ssa_25 = load_const (0x00000024 = 0.000000) vec1 32 con ssa_26 = intrinsic load_ubo (ssa_1 /*(0x00000002 = 0.000000)*/, ssa_25 /*(0x00000024 = 0.000000)*/) (access=0, align_mul=1073741824, align_offset=36, range_base=0, range=-1) vec1 32 con ssa_27 = load_const (0x00000008 = 0.000000) vec1 32 con ssa_28 = load_const (0x00000007 = 0.000000) vec1 32 con ssa_29 = iand ssa_4.y, ssa_1 /*(0x00000002 = 0.000000)*/ vec1 32 con ssa_30 = ishl ssa_29, ssa_28 /*(0x00000007 = 0.000000)*/ vec1 32 con ssa_31 = load_const (0x7b000808 = 664776890994587263929995856502063104.000000) vec1 32 con ssa_32 = ior ssa_31 /*(0x7b000808 = 664776890994587263929995856502063104.000000)*/, ssa_30 ``` AFTER: ``` vec1 32 con ssa_23 = load_const (0xfffffffc = -nan) vec1 32 div ssa_24 = iand ssa_13, ssa_23 (0xfffffffc) vec1 32 con ssa_25 = load_const (0x00000024 = 0.000000) vec1 32 con ssa_26 = intrinsic load_ubo (ssa_1 (0x2), ssa_25 (0x24)) (access=0, align_mul=1073741824, align_offset=36, range_base=0, range=-1) vec1 32 con ssa_27 = load_const (0x00000008 = 0.000000) vec1 32 con ssa_28 = load_const (0x00000007 = 0.000000) vec1 32 con ssa_29 = iand ssa_4.y, ssa_1 (0x2) vec1 32 con ssa_30 = ishl ssa_29, ssa_28 (0x7) vec1 32 con ssa_31 = load_const (0x7b000808 = 664776890994587263929995856502063104.000000) vec1 32 con ssa_32 = ior ssa_31 (0x7b000808), ssa_30 ``` and some instructions from crucible test func.gs.basic with NIR_DEBUG=print_consts, now showing float representation being selected: BEFORE: ``` vec4 32 ssa_10 = load_const (0x3e4ccccd, 0x3e4ccccd, 0x00000000, 0x00000000) = (0.200000, 0.200000, 0.000000, 0.000000) vec4 32 ssa_9 = intrinsic load_deref (ssa_42) (access=0) vec4 32 ssa_11 = fadd ssa_9, ssa_10 /*(0x3e4ccccd, 0x3e4ccccd, 0x00000000, 0x00000000) = (0.200000, 0.200000, 0.000000, 0.000000)*/ ``` AFTER: ``` vec4 32 ssa_10 = load_const (0x3e4ccccd, 0x3e4ccccd, 0x00000000, 0x00000000) = (0.200000, 0.200000, 0.000000, 0.000000) vec4 32 ssa_9 = intrinsic load_deref (ssa_42) (access=0) vec4 32 ssa_11 = fadd ssa_9, ssa_10 (0.200000, 0.200000, 0.000000, 0.000000) ``` Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Acked-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23562> |
||
|---|---|---|
| .ci-farms | ||
| .ci-farms-disabled | ||
| .github/workflows | ||
| .gitlab | ||
| .gitlab-ci | ||
| android | ||
| bin | ||
| build-support | ||
| docs | ||
| include | ||
| src | ||
| subprojects | ||
| .clang-format | ||
| .clang-format-ignore | ||
| .clang-format-include | ||
| .dir-locals.el | ||
| .editorconfig | ||
| .gitattributes | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .graphqlrc.yml | ||
| .mailmap | ||
| CODEOWNERS | ||
| meson.build | ||
| meson_options.txt | ||
| README.rst | ||
| VERSION | ||
`Mesa <https://mesa3d.org>`_ - The 3D Graphics Library ====================================================== Source ------ This repository lives at https://gitlab.freedesktop.org/mesa/mesa. Other repositories are likely forks, and code found there is not supported. Build & install --------------- You can find more information in our documentation (`docs/install.rst <https://mesa3d.org/install.html>`_), but the recommended way is to use Meson (`docs/meson.rst <https://mesa3d.org/meson.html>`_): .. code-block:: sh $ mkdir build $ cd build $ meson .. $ sudo ninja install Support ------- Many Mesa devs hang on IRC; if you're not sure which channel is appropriate, you should ask your question on `OFTC's #dri-devel <irc://irc.oftc.net/dri-devel>`_, someone will redirect you if necessary. Remember that not everyone is in the same timezone as you, so it might take a while before someone qualified sees your question. To figure out who you're talking to, or which nick to ping for your question, check out `Who's Who on IRC <https://dri.freedesktop.org/wiki/WhosWho/>`_. The next best option is to ask your question in an email to the mailing lists: `mesa-dev\@lists.freedesktop.org <https://lists.freedesktop.org/mailman/listinfo/mesa-dev>`_ Bug reports ----------- If you think something isn't working properly, please file a bug report (`docs/bugs.rst <https://mesa3d.org/bugs.html>`_). Contributing ------------ Contributions are welcome, and step-by-step instructions can be found in our documentation (`docs/submittingpatches.rst <https://mesa3d.org/submittingpatches.html>`_). Note that Mesa uses gitlab for patches submission, review and discussions.