diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/ImageAtomicsFloat.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/ImageAtomicsFloat.cpp new file mode 100644 index 000000000..ff553a2b3 --- /dev/null +++ b/core/libs/prx/libSceAgcDriver/tests/execution/ImageAtomicsFloat.cpp @@ -0,0 +1,546 @@ +#include "prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp" +#include "prx/libSceAgcDriver/Graphics/include/Draw.hpp" +#include "Recompiler.hpp" +#include "VulkanTestDevice.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +using AgcDriver::Graphics::Require; +using ShaderRecompiler::ShaderStage; + +constexpr std::uint32_t MaxLanes = 64; +constexpr std::uint32_t Inputs = 4; +constexpr std::uint32_t Results = 16; +constexpr std::uint32_t Checked = 8; +constexpr std::uint32_t Rows = 800; +constexpr std::uint32_t TextureWidth = 64; +constexpr std::uint32_t TextureHeight = 4; +constexpr std::uint32_t Format32UInt = 20; +constexpr std::uint32_t Type2D = 9; +alignas(256) std::array Buffer{}; +alignas(4096) std::array Texels{}; + +alignas(256) constexpr std::array Code{ + 0x34020084u, 0x34060086u, 0xe0381000u, 0x80000401u, 0xbf8c3f70u, 0xbe8f030bu, 0xbe8e030au, 0xbe8d0309u, + 0xbe8c0308u, 0xbe8b0307u, 0xbe8a0306u, 0xbe890305u, 0xbe880304u, 0x7e100300u, 0x7e120280u, 0x7e3c0304u, + 0xf03c0108u, 0x00021e08u, 0xbf8c3f70u, 0x7e140305u, 0xf0782108u, 0x00020a08u, 0xbf8c3f70u, 0x7e160280u, + 0xf0442108u, 0x00020b08u, 0xbf8c3f70u, 0x7e120281u, 0x7e3c0304u, 0xf03c0108u, 0x00021e08u, 0xbf8c3f70u, + 0x7e180305u, 0xf07c2108u, 0x00020c08u, 0xbf8c3f70u, 0x7e1a0280u, 0xf0442108u, 0x00020d08u, 0xbf8c3f70u, + 0x7e120282u, 0x7e3c0304u, 0xf03c0108u, 0x00021e08u, 0xbf8c3f70u, 0x7e1c0305u, 0x7e1e0306u, 0xf0742308u, + 0x00020e08u, 0xbf8c3f70u, 0x7e200280u, 0xf0442108u, 0x00021008u, 0xbf8c3f70u, 0x7e120283u, 0x7e3c0304u, + 0xf03c0108u, 0x00021e08u, 0xbf8c3f70u, 0x7e220305u, 0xf0780108u, 0x00021108u, 0xbf8c3f70u, 0x7e240280u, + 0xf0442108u, 0x00021208u, 0xbf8c3f70u, 0xe0701400u, 0x80000a03u, 0xe0701404u, 0x80000b03u, 0xe0701408u, + 0x80000c03u, 0xe070140cu, 0x80000d03u, 0xe0701410u, 0x80000e03u, 0xe0701414u, 0x80001003u, 0xe0701418u, + 0x80001103u, 0xe070141cu, 0x80001203u, 0xbf810000u, +}; + +constexpr std::array Values{ + 0x00000000u, 0x80000000u, 0x3f800000u, 0xbf800000u, 0x7f800000u, 0xff800000u, 0x7fc00000u, 0xffc00000u, + 0x7f800001u, 0xff800001u, 0x7fa00000u, 0x00000001u, 0x80000001u, 0x007fffffu, 0x40490fdbu, 0xc0490fdbu, + 0x7f7fffffu, 0x00800000u, 0x7fc00001u, 0x3f800001u, +}; + +constexpr std::array Expected{ + 0x00000000u, 0x00000000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x80000000u, + 0x00000000u, 0x3f800000u, 0x00000000u, 0xbf800000u, 0x00000000u, 0x00000000u, + 0x00000000u, 0x7f800000u, 0x00000000u, 0xff800000u, 0x00000000u, 0x00000000u, + 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, + 0x7fc00001u, 0x7fc00001u, 0x00000000u, 0xffc00001u, 0xffc00001u, 0x00000000u, + 0x7fe00000u, 0x7fe00000u, 0x00000000u, 0x00000000u, 0x00000001u, 0x00000000u, + 0x80000001u, 0x00000000u, 0x00000000u, 0x00000000u, 0x007fffffu, 0x00000000u, + 0x00000000u, 0x40490fdbu, 0x00000000u, 0xc0490fdbu, 0x00000000u, 0x00000000u, + 0x00000000u, 0x7f7fffffu, 0x00000000u, 0x00000000u, 0x00800000u, 0x00000000u, + 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u, 0x3f800001u, 0x00000000u, + 0x80000000u, 0x00000000u, 0x00000000u, 0x80000000u, 0x80000000u, 0x80000000u, + 0x80000000u, 0x3f800000u, 0x80000000u, 0xbf800000u, 0x80000000u, 0x80000000u, + 0x80000000u, 0x7f800000u, 0x80000000u, 0xff800000u, 0x80000000u, 0x80000000u, + 0x80000000u, 0x80000000u, 0x80000000u, 0x80000000u, 0x80000000u, 0x80000000u, + 0x7fc00001u, 0x7fc00001u, 0x80000000u, 0xffc00001u, 0xffc00001u, 0x80000000u, + 0x7fe00000u, 0x7fe00000u, 0x80000000u, 0x80000000u, 0x00000001u, 0x80000000u, + 0x80000001u, 0x80000000u, 0x80000000u, 0x80000000u, 0x007fffffu, 0x80000000u, + 0x80000000u, 0x40490fdbu, 0x80000000u, 0xc0490fdbu, 0x80000000u, 0x80000000u, + 0x80000000u, 0x7f7fffffu, 0x80000000u, 0x80000000u, 0x00800000u, 0x80000000u, + 0x80000000u, 0x80000000u, 0x80000000u, 0x80000000u, 0x3f800001u, 0x80000000u, + 0x00000000u, 0x3f800000u, 0x3f800000u, 0x80000000u, 0x3f800000u, 0x3f800000u, + 0x3f800000u, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0x3f800000u, 0x3f800000u, + 0x3f800000u, 0x7f800000u, 0x3f800000u, 0xff800000u, 0x3f800000u, 0x3f800000u, + 0x3f800000u, 0x3f800000u, 0x3f800000u, 0x3f800000u, 0x3f800000u, 0x3f800000u, + 0x7fc00001u, 0x7fc00001u, 0x3f800000u, 0xffc00001u, 0xffc00001u, 0x3f800000u, + 0x7fe00000u, 0x7fe00000u, 0x3f800000u, 0x00000001u, 0x3f800000u, 0x3f800000u, + 0x80000001u, 0x3f800000u, 0x3f800000u, 0x007fffffu, 0x3f800000u, 0x3f800000u, + 0x3f800000u, 0x40490fdbu, 0x3f800000u, 0xc0490fdbu, 0x3f800000u, 0x3f800000u, + 0x3f800000u, 0x7f7fffffu, 0x3f800000u, 0x00800000u, 0x3f800000u, 0x3f800000u, + 0x3f800000u, 0x3f800000u, 0x3f800000u, 0x3f800000u, 0x3f800001u, 0x3f800000u, + 0xbf800000u, 0x00000000u, 0xbf800000u, 0xbf800000u, 0x80000000u, 0xbf800000u, + 0xbf800000u, 0x3f800000u, 0xbf800000u, 0xbf800000u, 0xbf800000u, 0xbf800000u, + 0xbf800000u, 0x7f800000u, 0xbf800000u, 0xff800000u, 0xbf800000u, 0xbf800000u, + 0xbf800000u, 0xbf800000u, 0xbf800000u, 0xbf800000u, 0xbf800000u, 0xbf800000u, + 0x7fc00001u, 0x7fc00001u, 0xbf800000u, 0xffc00001u, 0xffc00001u, 0xbf800000u, + 0x7fe00000u, 0x7fe00000u, 0xbf800000u, 0xbf800000u, 0x00000001u, 0xbf800000u, + 0xbf800000u, 0x80000001u, 0xbf800000u, 0xbf800000u, 0x007fffffu, 0xbf800000u, + 0xbf800000u, 0x40490fdbu, 0xbf800000u, 0xc0490fdbu, 0xbf800000u, 0xbf800000u, + 0xbf800000u, 0x7f7fffffu, 0xbf800000u, 0xbf800000u, 0x00800000u, 0xbf800000u, + 0xbf800000u, 0xbf800000u, 0xbf800000u, 0xbf800000u, 0x3f800001u, 0xbf800000u, + 0x00000000u, 0x7f800000u, 0x7f800000u, 0x80000000u, 0x7f800000u, 0x7f800000u, + 0x3f800000u, 0x7f800000u, 0x7f800000u, 0xbf800000u, 0x7f800000u, 0x7f800000u, + 0x7f800000u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x7f800000u, 0x7f800000u, + 0x7f800000u, 0x7f800000u, 0x7f800000u, 0x7f800000u, 0x7f800000u, 0x7f800000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800000u, 0xffc00001u, 0xffc00001u, 0x7f800000u, + 0x7fe00000u, 0x7fe00000u, 0x7f800000u, 0x00000001u, 0x7f800000u, 0x7f800000u, + 0x80000001u, 0x7f800000u, 0x7f800000u, 0x007fffffu, 0x7f800000u, 0x7f800000u, + 0x40490fdbu, 0x7f800000u, 0x7f800000u, 0xc0490fdbu, 0x7f800000u, 0x7f800000u, + 0x7f7fffffu, 0x7f800000u, 0x7f800000u, 0x00800000u, 0x7f800000u, 0x7f800000u, + 0x7f800000u, 0x7f800000u, 0x7f800000u, 0x3f800001u, 0x7f800000u, 0x7f800000u, + 0xff800000u, 0x00000000u, 0xff800000u, 0xff800000u, 0x80000000u, 0xff800000u, + 0xff800000u, 0x3f800000u, 0xff800000u, 0xff800000u, 0xbf800000u, 0xff800000u, + 0xff800000u, 0x7f800000u, 0xff800000u, 0xff800000u, 0xff800000u, 0xff800000u, + 0xff800000u, 0xff800000u, 0xff800000u, 0xff800000u, 0xff800000u, 0xff800000u, + 0x7fc00001u, 0x7fc00001u, 0xff800000u, 0xffc00001u, 0xffc00001u, 0xff800000u, + 0x7fe00000u, 0x7fe00000u, 0xff800000u, 0xff800000u, 0x00000001u, 0xff800000u, + 0xff800000u, 0x80000001u, 0xff800000u, 0xff800000u, 0x007fffffu, 0xff800000u, + 0xff800000u, 0x40490fdbu, 0xff800000u, 0xff800000u, 0xc0490fdbu, 0xff800000u, + 0xff800000u, 0x7f7fffffu, 0xff800000u, 0xff800000u, 0x00800000u, 0xff800000u, + 0xff800000u, 0xff800000u, 0xff800000u, 0xff800000u, 0x3f800001u, 0xff800000u, + 0x00000000u, 0x00000000u, 0x7fc00000u, 0x80000000u, 0x80000000u, 0x7fc00000u, + 0x3f800000u, 0x3f800000u, 0x7fc00000u, 0xbf800000u, 0xbf800000u, 0x7fc00000u, + 0x7f800000u, 0x7f800000u, 0x7fc00000u, 0xff800000u, 0xff800000u, 0x7fc00000u, + 0x7fc00000u, 0x7fc00000u, 0x7fc00000u, 0xffc00000u, 0xffc00000u, 0x7fc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7fc00000u, 0xffc00001u, 0xffc00001u, 0x7fc00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fc00000u, 0x00000001u, 0x00000001u, 0x7fc00000u, + 0x80000001u, 0x80000001u, 0x7fc00000u, 0x007fffffu, 0x007fffffu, 0x7fc00000u, + 0x40490fdbu, 0x40490fdbu, 0x7fc00000u, 0xc0490fdbu, 0xc0490fdbu, 0x7fc00000u, + 0x7f7fffffu, 0x7f7fffffu, 0x7fc00000u, 0x00800000u, 0x00800000u, 0x7fc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7fc00000u, 0x3f800001u, 0x3f800001u, 0x7fc00000u, + 0x00000000u, 0x00000000u, 0xffc00000u, 0x80000000u, 0x80000000u, 0xffc00000u, + 0x3f800000u, 0x3f800000u, 0xffc00000u, 0xbf800000u, 0xbf800000u, 0xffc00000u, + 0x7f800000u, 0x7f800000u, 0xffc00000u, 0xff800000u, 0xff800000u, 0xffc00000u, + 0x7fc00000u, 0x7fc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0xffc00000u, 0xffc00001u, 0xffc00001u, 0xffc00000u, + 0x7fe00000u, 0x7fe00000u, 0xffc00000u, 0x00000001u, 0x00000001u, 0xffc00000u, + 0x80000001u, 0x80000001u, 0xffc00000u, 0x007fffffu, 0x007fffffu, 0xffc00000u, + 0x40490fdbu, 0x40490fdbu, 0xffc00000u, 0xc0490fdbu, 0xc0490fdbu, 0xffc00000u, + 0x7f7fffffu, 0x7f7fffffu, 0xffc00000u, 0x00800000u, 0x00800000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0xffc00000u, 0x3f800001u, 0x3f800001u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0x7f800001u, + 0x7fe00000u, 0x7fe00000u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fc00001u, 0x7fc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fc00001u, 0x7fc00001u, 0x7fa00000u, 0xffc00001u, 0xffc00001u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x00000000u, 0x00000001u, 0x00000001u, 0x80000000u, 0x00000001u, 0x00000001u, + 0x00000001u, 0x3f800000u, 0x00000001u, 0xbf800000u, 0x00000001u, 0x00000001u, + 0x00000001u, 0x7f800000u, 0x00000001u, 0xff800000u, 0x00000001u, 0x00000001u, + 0x00000001u, 0x00000001u, 0x00000001u, 0x00000001u, 0x00000001u, 0x00000001u, + 0x7fc00001u, 0x7fc00001u, 0x00000001u, 0xffc00001u, 0xffc00001u, 0x00000001u, + 0x7fe00000u, 0x7fe00000u, 0x00000001u, 0x00000001u, 0x00000001u, 0x00000001u, + 0x80000001u, 0x00000001u, 0x00000001u, 0x00000001u, 0x007fffffu, 0x00000001u, + 0x00000001u, 0x40490fdbu, 0x00000001u, 0xc0490fdbu, 0x00000001u, 0x00000001u, + 0x00000001u, 0x7f7fffffu, 0x00000001u, 0x00000001u, 0x00800000u, 0x00000001u, + 0x00000001u, 0x00000001u, 0x00000001u, 0x00000001u, 0x3f800001u, 0x00000001u, + 0x80000001u, 0x00000000u, 0x80000001u, 0x80000001u, 0x80000000u, 0x80000001u, + 0x80000001u, 0x3f800000u, 0x80000001u, 0xbf800000u, 0x80000001u, 0x80000001u, + 0x80000001u, 0x7f800000u, 0x80000001u, 0xff800000u, 0x80000001u, 0x80000001u, + 0x80000001u, 0x80000001u, 0x80000001u, 0x80000001u, 0x80000001u, 0x80000001u, + 0x7fc00001u, 0x7fc00001u, 0x80000001u, 0xffc00001u, 0xffc00001u, 0x80000001u, + 0x7fe00000u, 0x7fe00000u, 0x80000001u, 0x80000001u, 0x00000001u, 0x80000001u, + 0x80000001u, 0x80000001u, 0x80000001u, 0x80000001u, 0x007fffffu, 0x80000001u, + 0x80000001u, 0x40490fdbu, 0x80000001u, 0xc0490fdbu, 0x80000001u, 0x80000001u, + 0x80000001u, 0x7f7fffffu, 0x80000001u, 0x80000001u, 0x00800000u, 0x80000001u, + 0x80000001u, 0x80000001u, 0x80000001u, 0x80000001u, 0x3f800001u, 0x80000001u, + 0x00000000u, 0x007fffffu, 0x007fffffu, 0x80000000u, 0x007fffffu, 0x007fffffu, + 0x007fffffu, 0x3f800000u, 0x007fffffu, 0xbf800000u, 0x007fffffu, 0x007fffffu, + 0x007fffffu, 0x7f800000u, 0x007fffffu, 0xff800000u, 0x007fffffu, 0x007fffffu, + 0x007fffffu, 0x007fffffu, 0x007fffffu, 0x007fffffu, 0x007fffffu, 0x007fffffu, + 0x7fc00001u, 0x7fc00001u, 0x007fffffu, 0xffc00001u, 0xffc00001u, 0x007fffffu, + 0x7fe00000u, 0x7fe00000u, 0x007fffffu, 0x00000001u, 0x007fffffu, 0x007fffffu, + 0x80000001u, 0x007fffffu, 0x007fffffu, 0x007fffffu, 0x007fffffu, 0x007fffffu, + 0x007fffffu, 0x40490fdbu, 0x007fffffu, 0xc0490fdbu, 0x007fffffu, 0x007fffffu, + 0x007fffffu, 0x7f7fffffu, 0x007fffffu, 0x007fffffu, 0x00800000u, 0x007fffffu, + 0x007fffffu, 0x007fffffu, 0x007fffffu, 0x007fffffu, 0x3f800001u, 0x007fffffu, + 0x00000000u, 0x40490fdbu, 0x40490fdbu, 0x80000000u, 0x40490fdbu, 0x40490fdbu, + 0x3f800000u, 0x40490fdbu, 0x40490fdbu, 0xbf800000u, 0x40490fdbu, 0x40490fdbu, + 0x40490fdbu, 0x7f800000u, 0x40490fdbu, 0xff800000u, 0x40490fdbu, 0x40490fdbu, + 0x40490fdbu, 0x40490fdbu, 0x40490fdbu, 0x40490fdbu, 0x40490fdbu, 0x40490fdbu, + 0x7fc00001u, 0x7fc00001u, 0x40490fdbu, 0xffc00001u, 0xffc00001u, 0x40490fdbu, + 0x7fe00000u, 0x7fe00000u, 0x40490fdbu, 0x00000001u, 0x40490fdbu, 0x40490fdbu, + 0x80000001u, 0x40490fdbu, 0x40490fdbu, 0x007fffffu, 0x40490fdbu, 0x40490fdbu, + 0x40490fdbu, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x40490fdbu, 0x40490fdbu, + 0x40490fdbu, 0x7f7fffffu, 0x40490fdbu, 0x00800000u, 0x40490fdbu, 0x40490fdbu, + 0x40490fdbu, 0x40490fdbu, 0x40490fdbu, 0x3f800001u, 0x40490fdbu, 0x40490fdbu, + 0xc0490fdbu, 0x00000000u, 0xc0490fdbu, 0xc0490fdbu, 0x80000000u, 0xc0490fdbu, + 0xc0490fdbu, 0x3f800000u, 0xc0490fdbu, 0xc0490fdbu, 0xbf800000u, 0xc0490fdbu, + 0xc0490fdbu, 0x7f800000u, 0xc0490fdbu, 0xff800000u, 0xc0490fdbu, 0xc0490fdbu, + 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, + 0x7fc00001u, 0x7fc00001u, 0xc0490fdbu, 0xffc00001u, 0xffc00001u, 0xc0490fdbu, + 0x7fe00000u, 0x7fe00000u, 0xc0490fdbu, 0xc0490fdbu, 0x00000001u, 0xc0490fdbu, + 0xc0490fdbu, 0x80000001u, 0xc0490fdbu, 0xc0490fdbu, 0x007fffffu, 0xc0490fdbu, + 0xc0490fdbu, 0x40490fdbu, 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, + 0xc0490fdbu, 0x7f7fffffu, 0xc0490fdbu, 0xc0490fdbu, 0x00800000u, 0xc0490fdbu, + 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, 0x3f800001u, 0xc0490fdbu, + 0x00000000u, 0x7f7fffffu, 0x7f7fffffu, 0x80000000u, 0x7f7fffffu, 0x7f7fffffu, + 0x3f800000u, 0x7f7fffffu, 0x7f7fffffu, 0xbf800000u, 0x7f7fffffu, 0x7f7fffffu, + 0x7f7fffffu, 0x7f800000u, 0x7f7fffffu, 0xff800000u, 0x7f7fffffu, 0x7f7fffffu, + 0x7f7fffffu, 0x7f7fffffu, 0x7f7fffffu, 0x7f7fffffu, 0x7f7fffffu, 0x7f7fffffu, + 0x7fc00001u, 0x7fc00001u, 0x7f7fffffu, 0xffc00001u, 0xffc00001u, 0x7f7fffffu, + 0x7fe00000u, 0x7fe00000u, 0x7f7fffffu, 0x00000001u, 0x7f7fffffu, 0x7f7fffffu, + 0x80000001u, 0x7f7fffffu, 0x7f7fffffu, 0x007fffffu, 0x7f7fffffu, 0x7f7fffffu, + 0x40490fdbu, 0x7f7fffffu, 0x7f7fffffu, 0xc0490fdbu, 0x7f7fffffu, 0x7f7fffffu, + 0x7f7fffffu, 0x7f7fffffu, 0x7f7fffffu, 0x00800000u, 0x7f7fffffu, 0x7f7fffffu, + 0x7f7fffffu, 0x7f7fffffu, 0x7f7fffffu, 0x3f800001u, 0x7f7fffffu, 0x7f7fffffu, + 0x00000000u, 0x00800000u, 0x00800000u, 0x80000000u, 0x00800000u, 0x00800000u, + 0x00800000u, 0x3f800000u, 0x00800000u, 0xbf800000u, 0x00800000u, 0x00800000u, + 0x00800000u, 0x7f800000u, 0x00800000u, 0xff800000u, 0x00800000u, 0x00800000u, + 0x00800000u, 0x00800000u, 0x00800000u, 0x00800000u, 0x00800000u, 0x00800000u, + 0x7fc00001u, 0x7fc00001u, 0x00800000u, 0xffc00001u, 0xffc00001u, 0x00800000u, + 0x7fe00000u, 0x7fe00000u, 0x00800000u, 0x00000001u, 0x00800000u, 0x00800000u, + 0x80000001u, 0x00800000u, 0x00800000u, 0x007fffffu, 0x00800000u, 0x00800000u, + 0x00800000u, 0x40490fdbu, 0x00800000u, 0xc0490fdbu, 0x00800000u, 0x00800000u, + 0x00800000u, 0x7f7fffffu, 0x00800000u, 0x00800000u, 0x00800000u, 0x00800000u, + 0x00800000u, 0x00800000u, 0x00800000u, 0x00800000u, 0x3f800001u, 0x00800000u, + 0x00000000u, 0x00000000u, 0x7fc00001u, 0x80000000u, 0x80000000u, 0x7fc00001u, + 0x3f800000u, 0x3f800000u, 0x7fc00001u, 0xbf800000u, 0xbf800000u, 0x7fc00001u, + 0x7f800000u, 0x7f800000u, 0x7fc00001u, 0xff800000u, 0xff800000u, 0x7fc00001u, + 0x7fc00000u, 0x7fc00000u, 0x7fc00001u, 0xffc00000u, 0xffc00000u, 0x7fc00001u, + 0x7fc00001u, 0x7fc00001u, 0x7fc00001u, 0xffc00001u, 0xffc00001u, 0x7fc00001u, + 0x7fe00000u, 0x7fe00000u, 0x7fc00001u, 0x00000001u, 0x00000001u, 0x7fc00001u, + 0x80000001u, 0x80000001u, 0x7fc00001u, 0x007fffffu, 0x007fffffu, 0x7fc00001u, + 0x40490fdbu, 0x40490fdbu, 0x7fc00001u, 0xc0490fdbu, 0xc0490fdbu, 0x7fc00001u, + 0x7f7fffffu, 0x7f7fffffu, 0x7fc00001u, 0x00800000u, 0x00800000u, 0x7fc00001u, + 0x7fc00001u, 0x7fc00001u, 0x7fc00001u, 0x3f800001u, 0x3f800001u, 0x7fc00001u, + 0x00000000u, 0x3f800001u, 0x3f800001u, 0x80000000u, 0x3f800001u, 0x3f800001u, + 0x3f800000u, 0x3f800001u, 0x3f800001u, 0xbf800000u, 0x3f800001u, 0x3f800001u, + 0x3f800001u, 0x7f800000u, 0x3f800001u, 0xff800000u, 0x3f800001u, 0x3f800001u, + 0x3f800001u, 0x3f800001u, 0x3f800001u, 0x3f800001u, 0x3f800001u, 0x3f800001u, + 0x7fc00001u, 0x7fc00001u, 0x3f800001u, 0xffc00001u, 0xffc00001u, 0x3f800001u, + 0x7fe00000u, 0x7fe00000u, 0x3f800001u, 0x00000001u, 0x3f800001u, 0x3f800001u, + 0x80000001u, 0x3f800001u, 0x3f800001u, 0x007fffffu, 0x3f800001u, 0x3f800001u, + 0x3f800001u, 0x40490fdbu, 0x3f800001u, 0xc0490fdbu, 0x3f800001u, 0x3f800001u, + 0x3f800001u, 0x7f7fffffu, 0x3f800001u, 0x00800000u, 0x3f800001u, 0x3f800001u, + 0x3f800001u, 0x3f800001u, 0x3f800001u, 0x3f800001u, 0x3f800001u, 0x3f800001u, + 0x00000000u, 0x00000000u, 0x00000000u, 0x80000000u, 0x00000000u, 0x80000000u, + 0x00000000u, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0x00000000u, 0xbf800000u, + 0x00000000u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x00000000u, 0xff800000u, + 0x00000000u, 0x00000000u, 0x7fc00000u, 0x00000000u, 0x00000000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000000u, 0x00000001u, 0x00000001u, + 0x80000001u, 0x00000000u, 0x80000001u, 0x00000000u, 0x007fffffu, 0x007fffffu, + 0x00000000u, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x00000000u, 0xc0490fdbu, + 0x00000000u, 0x7f7fffffu, 0x7f7fffffu, 0x00000000u, 0x00800000u, 0x00800000u, + 0x00000000u, 0x00000000u, 0x7fc00001u, 0x00000000u, 0x3f800001u, 0x3f800001u, + 0x80000000u, 0x00000000u, 0x00000000u, 0x80000000u, 0x80000000u, 0x80000000u, + 0x80000000u, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0x80000000u, 0xbf800000u, + 0x80000000u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x80000000u, 0xff800000u, + 0x80000000u, 0x80000000u, 0x7fc00000u, 0x80000000u, 0x80000000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x80000000u, 0x00000001u, 0x00000001u, + 0x80000001u, 0x80000000u, 0x80000001u, 0x80000000u, 0x007fffffu, 0x007fffffu, + 0x80000000u, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x80000000u, 0xc0490fdbu, + 0x80000000u, 0x7f7fffffu, 0x7f7fffffu, 0x80000000u, 0x00800000u, 0x00800000u, + 0x80000000u, 0x80000000u, 0x7fc00001u, 0x80000000u, 0x3f800001u, 0x3f800001u, + 0x00000000u, 0x3f800000u, 0x00000000u, 0x80000000u, 0x3f800000u, 0x80000000u, + 0x3f800000u, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0x3f800000u, 0xbf800000u, + 0x3f800000u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x3f800000u, 0xff800000u, + 0x3f800000u, 0x3f800000u, 0x7fc00000u, 0x3f800000u, 0x3f800000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000001u, 0x3f800000u, 0x00000001u, + 0x80000001u, 0x3f800000u, 0x80000001u, 0x007fffffu, 0x3f800000u, 0x007fffffu, + 0x3f800000u, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x3f800000u, 0xc0490fdbu, + 0x3f800000u, 0x7f7fffffu, 0x7f7fffffu, 0x00800000u, 0x3f800000u, 0x00800000u, + 0x3f800000u, 0x3f800000u, 0x7fc00001u, 0x3f800000u, 0x3f800001u, 0x3f800001u, + 0xbf800000u, 0x00000000u, 0x00000000u, 0xbf800000u, 0x80000000u, 0x80000000u, + 0xbf800000u, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0xbf800000u, 0xbf800000u, + 0xbf800000u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0xbf800000u, 0xff800000u, + 0xbf800000u, 0xbf800000u, 0x7fc00000u, 0xbf800000u, 0xbf800000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0xbf800000u, 0x00000001u, 0x00000001u, + 0xbf800000u, 0x80000001u, 0x80000001u, 0xbf800000u, 0x007fffffu, 0x007fffffu, + 0xbf800000u, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0xbf800000u, 0xc0490fdbu, + 0xbf800000u, 0x7f7fffffu, 0x7f7fffffu, 0xbf800000u, 0x00800000u, 0x00800000u, + 0xbf800000u, 0xbf800000u, 0x7fc00001u, 0xbf800000u, 0x3f800001u, 0x3f800001u, + 0x00000000u, 0x7f800000u, 0x00000000u, 0x80000000u, 0x7f800000u, 0x80000000u, + 0x3f800000u, 0x7f800000u, 0x3f800000u, 0xbf800000u, 0x7f800000u, 0xbf800000u, + 0x7f800000u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x7f800000u, 0xff800000u, + 0x7f800000u, 0x7f800000u, 0x7fc00000u, 0x7f800000u, 0x7f800000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000001u, 0x7f800000u, 0x00000001u, + 0x80000001u, 0x7f800000u, 0x80000001u, 0x007fffffu, 0x7f800000u, 0x007fffffu, + 0x40490fdbu, 0x7f800000u, 0x40490fdbu, 0xc0490fdbu, 0x7f800000u, 0xc0490fdbu, + 0x7f7fffffu, 0x7f800000u, 0x7f7fffffu, 0x00800000u, 0x7f800000u, 0x00800000u, + 0x7f800000u, 0x7f800000u, 0x7fc00001u, 0x3f800001u, 0x7f800000u, 0x3f800001u, + 0xff800000u, 0x00000000u, 0x00000000u, 0xff800000u, 0x80000000u, 0x80000000u, + 0xff800000u, 0x3f800000u, 0x3f800000u, 0xff800000u, 0xbf800000u, 0xbf800000u, + 0xff800000u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0xff800000u, 0xff800000u, + 0xff800000u, 0xff800000u, 0x7fc00000u, 0xff800000u, 0xff800000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0xff800000u, 0x00000001u, 0x00000001u, + 0xff800000u, 0x80000001u, 0x80000001u, 0xff800000u, 0x007fffffu, 0x007fffffu, + 0xff800000u, 0x40490fdbu, 0x40490fdbu, 0xff800000u, 0xc0490fdbu, 0xc0490fdbu, + 0xff800000u, 0x7f7fffffu, 0x7f7fffffu, 0xff800000u, 0x00800000u, 0x00800000u, + 0xff800000u, 0xff800000u, 0x7fc00001u, 0xff800000u, 0x3f800001u, 0x3f800001u, + 0x00000000u, 0x00000000u, 0x7fc00000u, 0x80000000u, 0x80000000u, 0x7fc00000u, + 0x3f800000u, 0x3f800000u, 0x7fc00000u, 0xbf800000u, 0xbf800000u, 0x7fc00000u, + 0x7f800000u, 0x7f800000u, 0x7fc00000u, 0xff800000u, 0xff800000u, 0x7fc00000u, + 0x7fc00000u, 0x7fc00000u, 0x7fc00000u, 0xffc00000u, 0xffc00000u, 0x7fc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7fc00000u, 0xffc00001u, 0xffc00001u, 0x7fc00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fc00000u, 0x00000001u, 0x00000001u, 0x7fc00000u, + 0x80000001u, 0x80000001u, 0x7fc00000u, 0x007fffffu, 0x007fffffu, 0x7fc00000u, + 0x40490fdbu, 0x40490fdbu, 0x7fc00000u, 0xc0490fdbu, 0xc0490fdbu, 0x7fc00000u, + 0x7f7fffffu, 0x7f7fffffu, 0x7fc00000u, 0x00800000u, 0x00800000u, 0x7fc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7fc00000u, 0x3f800001u, 0x3f800001u, 0x7fc00000u, + 0x00000000u, 0x00000000u, 0xffc00000u, 0x80000000u, 0x80000000u, 0xffc00000u, + 0x3f800000u, 0x3f800000u, 0xffc00000u, 0xbf800000u, 0xbf800000u, 0xffc00000u, + 0x7f800000u, 0x7f800000u, 0xffc00000u, 0xff800000u, 0xff800000u, 0xffc00000u, + 0x7fc00000u, 0x7fc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0xffc00000u, 0xffc00001u, 0xffc00001u, 0xffc00000u, + 0x7fe00000u, 0x7fe00000u, 0xffc00000u, 0x00000001u, 0x00000001u, 0xffc00000u, + 0x80000001u, 0x80000001u, 0xffc00000u, 0x007fffffu, 0x007fffffu, 0xffc00000u, + 0x40490fdbu, 0x40490fdbu, 0xffc00000u, 0xc0490fdbu, 0xc0490fdbu, 0xffc00000u, + 0x7f7fffffu, 0x7f7fffffu, 0xffc00000u, 0x00800000u, 0x00800000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0xffc00000u, 0x3f800001u, 0x3f800001u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0x7f800001u, + 0x7fe00000u, 0x7fe00000u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0x7fc00001u, 0x7fc00001u, 0x7f800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fc00001u, 0x7fc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0xffc00001u, 0xffc00001u, 0xff800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fc00001u, 0x7fc00001u, 0x7fa00000u, 0xffc00001u, 0xffc00001u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, + 0x00000000u, 0x00000001u, 0x00000000u, 0x80000000u, 0x00000001u, 0x80000000u, + 0x00000001u, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0x00000001u, 0xbf800000u, + 0x00000001u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x00000001u, 0xff800000u, + 0x00000001u, 0x00000001u, 0x7fc00000u, 0x00000001u, 0x00000001u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000001u, 0x00000001u, 0x00000001u, + 0x80000001u, 0x00000001u, 0x80000001u, 0x00000001u, 0x007fffffu, 0x007fffffu, + 0x00000001u, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x00000001u, 0xc0490fdbu, + 0x00000001u, 0x7f7fffffu, 0x7f7fffffu, 0x00000001u, 0x00800000u, 0x00800000u, + 0x00000001u, 0x00000001u, 0x7fc00001u, 0x00000001u, 0x3f800001u, 0x3f800001u, + 0x80000001u, 0x00000000u, 0x00000000u, 0x80000001u, 0x80000000u, 0x80000000u, + 0x80000001u, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0x80000001u, 0xbf800000u, + 0x80000001u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x80000001u, 0xff800000u, + 0x80000001u, 0x80000001u, 0x7fc00000u, 0x80000001u, 0x80000001u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x80000001u, 0x00000001u, 0x00000001u, + 0x80000001u, 0x80000001u, 0x80000001u, 0x80000001u, 0x007fffffu, 0x007fffffu, + 0x80000001u, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x80000001u, 0xc0490fdbu, + 0x80000001u, 0x7f7fffffu, 0x7f7fffffu, 0x80000001u, 0x00800000u, 0x00800000u, + 0x80000001u, 0x80000001u, 0x7fc00001u, 0x80000001u, 0x3f800001u, 0x3f800001u, + 0x00000000u, 0x007fffffu, 0x00000000u, 0x80000000u, 0x007fffffu, 0x80000000u, + 0x007fffffu, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0x007fffffu, 0xbf800000u, + 0x007fffffu, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x007fffffu, 0xff800000u, + 0x007fffffu, 0x007fffffu, 0x7fc00000u, 0x007fffffu, 0x007fffffu, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000001u, 0x007fffffu, 0x00000001u, + 0x80000001u, 0x007fffffu, 0x80000001u, 0x007fffffu, 0x007fffffu, 0x007fffffu, + 0x007fffffu, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x007fffffu, 0xc0490fdbu, + 0x007fffffu, 0x7f7fffffu, 0x7f7fffffu, 0x007fffffu, 0x00800000u, 0x00800000u, + 0x007fffffu, 0x007fffffu, 0x7fc00001u, 0x007fffffu, 0x3f800001u, 0x3f800001u, + 0x00000000u, 0x40490fdbu, 0x00000000u, 0x80000000u, 0x40490fdbu, 0x80000000u, + 0x3f800000u, 0x40490fdbu, 0x3f800000u, 0xbf800000u, 0x40490fdbu, 0xbf800000u, + 0x40490fdbu, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x40490fdbu, 0xff800000u, + 0x40490fdbu, 0x40490fdbu, 0x7fc00000u, 0x40490fdbu, 0x40490fdbu, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000001u, 0x40490fdbu, 0x00000001u, + 0x80000001u, 0x40490fdbu, 0x80000001u, 0x007fffffu, 0x40490fdbu, 0x007fffffu, + 0x40490fdbu, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x40490fdbu, 0xc0490fdbu, + 0x40490fdbu, 0x7f7fffffu, 0x7f7fffffu, 0x00800000u, 0x40490fdbu, 0x00800000u, + 0x40490fdbu, 0x40490fdbu, 0x7fc00001u, 0x3f800001u, 0x40490fdbu, 0x3f800001u, + 0xc0490fdbu, 0x00000000u, 0x00000000u, 0xc0490fdbu, 0x80000000u, 0x80000000u, + 0xc0490fdbu, 0x3f800000u, 0x3f800000u, 0xc0490fdbu, 0xbf800000u, 0xbf800000u, + 0xc0490fdbu, 0x7f800000u, 0x7f800000u, 0xff800000u, 0xc0490fdbu, 0xff800000u, + 0xc0490fdbu, 0xc0490fdbu, 0x7fc00000u, 0xc0490fdbu, 0xc0490fdbu, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0xc0490fdbu, 0x00000001u, 0x00000001u, + 0xc0490fdbu, 0x80000001u, 0x80000001u, 0xc0490fdbu, 0x007fffffu, 0x007fffffu, + 0xc0490fdbu, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0xc0490fdbu, 0xc0490fdbu, + 0xc0490fdbu, 0x7f7fffffu, 0x7f7fffffu, 0xc0490fdbu, 0x00800000u, 0x00800000u, + 0xc0490fdbu, 0xc0490fdbu, 0x7fc00001u, 0xc0490fdbu, 0x3f800001u, 0x3f800001u, + 0x00000000u, 0x7f7fffffu, 0x00000000u, 0x80000000u, 0x7f7fffffu, 0x80000000u, + 0x3f800000u, 0x7f7fffffu, 0x3f800000u, 0xbf800000u, 0x7f7fffffu, 0xbf800000u, + 0x7f7fffffu, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x7f7fffffu, 0xff800000u, + 0x7f7fffffu, 0x7f7fffffu, 0x7fc00000u, 0x7f7fffffu, 0x7f7fffffu, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000001u, 0x7f7fffffu, 0x00000001u, + 0x80000001u, 0x7f7fffffu, 0x80000001u, 0x007fffffu, 0x7f7fffffu, 0x007fffffu, + 0x40490fdbu, 0x7f7fffffu, 0x40490fdbu, 0xc0490fdbu, 0x7f7fffffu, 0xc0490fdbu, + 0x7f7fffffu, 0x7f7fffffu, 0x7f7fffffu, 0x00800000u, 0x7f7fffffu, 0x00800000u, + 0x7f7fffffu, 0x7f7fffffu, 0x7fc00001u, 0x3f800001u, 0x7f7fffffu, 0x3f800001u, + 0x00000000u, 0x00800000u, 0x00000000u, 0x80000000u, 0x00800000u, 0x80000000u, + 0x00800000u, 0x3f800000u, 0x3f800000u, 0xbf800000u, 0x00800000u, 0xbf800000u, + 0x00800000u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x00800000u, 0xff800000u, + 0x00800000u, 0x00800000u, 0x7fc00000u, 0x00800000u, 0x00800000u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000001u, 0x00800000u, 0x00000001u, + 0x80000001u, 0x00800000u, 0x80000001u, 0x007fffffu, 0x00800000u, 0x007fffffu, + 0x00800000u, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x00800000u, 0xc0490fdbu, + 0x00800000u, 0x7f7fffffu, 0x7f7fffffu, 0x00800000u, 0x00800000u, 0x00800000u, + 0x00800000u, 0x00800000u, 0x7fc00001u, 0x00800000u, 0x3f800001u, 0x3f800001u, + 0x00000000u, 0x00000000u, 0x7fc00001u, 0x80000000u, 0x80000000u, 0x7fc00001u, + 0x3f800000u, 0x3f800000u, 0x7fc00001u, 0xbf800000u, 0xbf800000u, 0x7fc00001u, + 0x7f800000u, 0x7f800000u, 0x7fc00001u, 0xff800000u, 0xff800000u, 0x7fc00001u, + 0x7fc00000u, 0x7fc00000u, 0x7fc00001u, 0xffc00000u, 0xffc00000u, 0x7fc00001u, + 0x7fc00001u, 0x7fc00001u, 0x7fc00001u, 0xffc00001u, 0xffc00001u, 0x7fc00001u, + 0x7fe00000u, 0x7fe00000u, 0x7fc00001u, 0x00000001u, 0x00000001u, 0x7fc00001u, + 0x80000001u, 0x80000001u, 0x7fc00001u, 0x007fffffu, 0x007fffffu, 0x7fc00001u, + 0x40490fdbu, 0x40490fdbu, 0x7fc00001u, 0xc0490fdbu, 0xc0490fdbu, 0x7fc00001u, + 0x7f7fffffu, 0x7f7fffffu, 0x7fc00001u, 0x00800000u, 0x00800000u, 0x7fc00001u, + 0x7fc00001u, 0x7fc00001u, 0x7fc00001u, 0x3f800001u, 0x3f800001u, 0x7fc00001u, + 0x00000000u, 0x3f800001u, 0x00000000u, 0x80000000u, 0x3f800001u, 0x80000000u, + 0x3f800000u, 0x3f800001u, 0x3f800000u, 0xbf800000u, 0x3f800001u, 0xbf800000u, + 0x3f800001u, 0x7f800000u, 0x7f800000u, 0xff800000u, 0x3f800001u, 0xff800000u, + 0x3f800001u, 0x3f800001u, 0x7fc00000u, 0x3f800001u, 0x3f800001u, 0xffc00000u, + 0x7fc00001u, 0x7fc00001u, 0x7f800001u, 0xffc00001u, 0xffc00001u, 0xff800001u, + 0x7fe00000u, 0x7fe00000u, 0x7fa00000u, 0x00000001u, 0x3f800001u, 0x00000001u, + 0x80000001u, 0x3f800001u, 0x80000001u, 0x007fffffu, 0x3f800001u, 0x007fffffu, + 0x3f800001u, 0x40490fdbu, 0x40490fdbu, 0xc0490fdbu, 0x3f800001u, 0xc0490fdbu, + 0x3f800001u, 0x7f7fffffu, 0x7f7fffffu, 0x00800000u, 0x3f800001u, 0x00800000u, + 0x3f800001u, 0x3f800001u, 0x7fc00001u, 0x3f800001u, 0x3f800001u, 0x3f800001u, +}; + +struct Row { + std::uint32_t initial; + std::uint32_t source; + std::uint32_t comparator; +}; + +Row InputRow(std::uint32_t row) { + const auto initial = Values[row % (Values.size() * Values.size()) / Values.size()]; + const auto source = Values[row % Values.size()]; + return {initial, source, row < Values.size() * Values.size() ? source : initial}; +} + +std::array ExpectedRow(std::uint32_t row) { + const auto input = InputRow(row); + const auto* measured = &Expected[row * 3u]; + return {input.initial, measured[0], input.initial, measured[1], input.initial, measured[2], input.source, measured[0]}; +} + +std::array BufferDescriptor(const void* data, std::uint32_t bytes) { + const auto address = reinterpret_cast(data); + return {static_cast(address), static_cast((address >> 32u) & 0xffffu), bytes, 0x01016facu}; +} + +std::array TextureDescriptor(const void* data) { + const auto address = static_cast(reinterpret_cast(data)); + return { + static_cast(address >> 8u), + static_cast((address >> 40u) & 0xffu) | (Format32UInt << 20u) | (((TextureWidth - 1u) & 3u) << 30u), + ((TextureWidth - 1u) >> 2u) | ((TextureHeight - 1u) << 14u), + 0xfacu | (Type2D << 28u), + 0u, 0u, 0u, 0u, + }; +} + +void Run(AgcDriver::VulkanDevice& device, std::uint32_t waveSize, const ShaderRecompiler::SpirvTarget& target, const char* name) { + const std::span code(Code); + std::vector userData(16, 0u); + const auto buffer = BufferDescriptor(Buffer.data(), static_cast(Buffer.size() * 4u)); + const auto texture = TextureDescriptor(Texels.data()); + std::copy(buffer.begin(), buffer.end(), userData.begin()); + std::copy(texture.begin(), texture.end(), userData.begin() + 4); + const std::array memory{{{reinterpret_cast(code.data()), std::as_bytes(code)}}}; + const ShaderRecompiler::ShaderComputeStageInfo compute{{waveSize, 1, 1}, 0u, {false, false, false}, false, 1}; + ShaderRecompiler::RecompileRequest request{ + {ShaderStage::Compute, reinterpret_cast(code.data()), code, 0, {}}, + {waveSize, 0, userData, compute, std::nullopt, std::nullopt, memory}, + target, + {0, 0, 0, 128} + }; + request.useCache = false; + const auto result = ShaderRecompiler::Recompile(request); + Texels.fill(0xdeadbeefu); + for (std::uint32_t first = 0; first < Rows; first += waveSize) { + Buffer.fill(0xdeadbeefu); + for (std::uint32_t lane = 0; lane < waveSize; ++lane) { + const auto input = InputRow((first + lane) % Rows); + Buffer[lane * Inputs] = input.initial; + Buffer[lane * Inputs + 1u] = input.source; + Buffer[lane * Inputs + 2u] = input.comparator; + Buffer[lane * Inputs + 3u] = 0u; + } + device.Dispatch(result, 1, 1, 1, {}, reinterpret_cast(code.data())); + device.WaitIdle(); + constexpr std::array names{"fmin returned", "fmin texel", "fmax returned", "fmax texel", "fcmpswap returned", "fcmpswap texel", "fmin without glc vdata", "fmin without glc texel"}; + for (std::uint32_t lane = 0; lane < waveSize; ++lane) { + const auto row = (first + lane) % Rows; + const auto expected = ExpectedRow(row); + for (std::uint32_t j = 0; j < Checked; ++j) { + const auto actual = Buffer[MaxLanes * Inputs + lane * Results + j]; + char message[192]; + std::snprintf(message, sizeof(message), "image float atomics %s: row %u %s is 0x%08x, expected 0x%08x", name, row, names[j], actual, expected[j]); + Require(actual == expected[j], message); + } + } + } +} + +} + +int main() { + try { + const auto device = OpenVulkanTestDevice(); + if (!device) return VulkanTestSkipped; + Run(*device, 32, device->Target(), "wave32"); + Run(*device, 64, device->Target(), "wave64"); + Run(*device, 64, device->ComputeTarget(32), "wave64 split"); + std::puts("image float atomics tests passed"); + return 0; + } catch (const std::exception& error) { + std::cerr << error.what() << '\n'; + return 1; + } +} diff --git a/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hpp b/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hpp index 958c9965f..fefa0c3cb 100644 --- a/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hpp +++ b/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hpp @@ -386,6 +386,9 @@ enum class IrOpcode : std::uint16_t { ImageAtomicSMax32, ImageAtomicInc32, ImageAtomicDec32, + ImageAtomicFCmpSwap32, + ImageAtomicFMin32, + ImageAtomicFMax32, GetAttribute, GetInterpolationParameter, SetAttribute, diff --git a/core/shader/recompiler/IntermediateRepresentation/src/IrOpcode.cpp b/core/shader/recompiler/IntermediateRepresentation/src/IrOpcode.cpp index 1199985e0..c9b3e81ab 100644 --- a/core/shader/recompiler/IntermediateRepresentation/src/IrOpcode.cpp +++ b/core/shader/recompiler/IntermediateRepresentation/src/IrOpcode.cpp @@ -427,6 +427,9 @@ constexpr std::array(IrOpcode::Count)> Meta makeMeta("ImageAtomicSMax32", U32, ImageResource, ImageAddress, U32, U1), makeMeta("ImageAtomicInc32", U32, ImageResource, ImageAddress, U32, U1), makeMeta("ImageAtomicDec32", U32, ImageResource, ImageAddress, U32, U1), + makeMeta("ImageAtomicFCmpSwap32", U32, ImageResource, ImageAddress, U32, U32, U1), + makeMeta("ImageAtomicFMin32", U32, ImageResource, ImageAddress, U32, U1), + makeMeta("ImageAtomicFMax32", U32, ImageResource, ImageAddress, U32, U1), makeMeta("GetAttribute", U32, U32, U32), makeMeta("GetInterpolationParameter", U32, U32, U32, U32), makeMeta("SetAttribute", Void, U32x4, U1), @@ -671,6 +674,9 @@ ImageOpcodeInfo ImageOpcodeInfoOf(IrOpcode opcode) { case IrOpcode::ImageAtomicSMax32: case IrOpcode::ImageAtomicInc32: case IrOpcode::ImageAtomicDec32: + case IrOpcode::ImageAtomicFCmpSwap32: + case IrOpcode::ImageAtomicFMin32: + case IrOpcode::ImageAtomicFMax32: return {ImageAccess::Atomic, ImageResourceClass::Storage, false}; default: return {}; diff --git a/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaOpcode.hpp b/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaOpcode.hpp index 715deb82a..5ed43f202 100644 --- a/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaOpcode.hpp +++ b/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaOpcode.hpp @@ -863,6 +863,9 @@ enum class RdnaOpcode : std::uint16_t { ImageAtomicSmax, ImageAtomicInc, ImageAtomicDec, + ImageAtomicFcmpswap, + ImageAtomicFmin, + ImageAtomicFmax, ImageGather4Lz, ImageGather4C, ImageGather4CLz, diff --git a/core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp b/core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp index 57a51166a..e749c8d24 100644 --- a/core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp +++ b/core/shader/recompiler/RdnaDecoder/src/RdnaImageOpDecoder.cpp @@ -95,6 +95,9 @@ constexpr ImageOpcodeInfo imageOpcodes[] = { {0x16u, RdnaOpcode::ImageAtomicSmax, nullptr, 0, false, false, true}, {0x1bu, RdnaOpcode::ImageAtomicInc, nullptr, 0, false, false, true}, {0x1cu, RdnaOpcode::ImageAtomicDec, nullptr, 0, false, false, true}, + {0x1du, RdnaOpcode::ImageAtomicFcmpswap, nullptr, 0, false, false, true}, + {0x1eu, RdnaOpcode::ImageAtomicFmin, nullptr, 0, false, false, true}, + {0x1fu, RdnaOpcode::ImageAtomicFmax, nullptr, 0, false, false, true}, {0x00u, RdnaOpcode::ImageLoad, nullptr, 0, false, false, false}, {0x01u, RdnaOpcode::ImageLoadMip, nullptr, 0, false, false, false}, {0x02u, RdnaOpcode::ImageLoadPck, nullptr, 0, false, false, false}, @@ -292,7 +295,7 @@ RdnaInstruction DecodeRdnaMimg(std::uint32_t programCounter, std::span> 8u) & 15u; - const bool compareSwap = info.opcode == RdnaOpcode::ImageAtomicCmpswap; + const bool compareSwap = info.opcode == RdnaOpcode::ImageAtomicCmpswap || info.opcode == RdnaOpcode::ImageAtomicFcmpswap; if (dmask == 0u || (compareSwap ? dmask != 3u : (info.gather || info.atomic) && !std::has_single_bit(dmask))) { throw std::runtime_error("invalid MIMG data mask"); } diff --git a/core/shader/recompiler/RdnaDecoder/src/RdnaOpcode.cpp b/core/shader/recompiler/RdnaDecoder/src/RdnaOpcode.cpp index 6d1e9548b..4b0069c92 100644 --- a/core/shader/recompiler/RdnaDecoder/src/RdnaOpcode.cpp +++ b/core/shader/recompiler/RdnaDecoder/src/RdnaOpcode.cpp @@ -799,6 +799,9 @@ bool IsImageOpcode(RdnaOpcode opcode) { case RdnaOpcode::ImageAtomicSmax: case RdnaOpcode::ImageAtomicInc: case RdnaOpcode::ImageAtomicDec: + case RdnaOpcode::ImageAtomicFcmpswap: + case RdnaOpcode::ImageAtomicFmin: + case RdnaOpcode::ImageAtomicFmax: case RdnaOpcode::ImageGather4Lz: case RdnaOpcode::ImageGather4C: case RdnaOpcode::ImageGather4CLz: diff --git a/core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp b/core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp index 5efb2d720..efb17a21a 100644 --- a/core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp +++ b/core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hpp @@ -134,6 +134,8 @@ std::uint32_t Binary(SpirvEmitterState& state, std::uint32_t opcode, std::uint32 std::uint32_t Select(SpirvEmitterState& state, std::uint32_t type, std::uint32_t condition, std::uint32_t trueValue, std::uint32_t falseValue); std::uint32_t AtomicIncrement(SpirvEmitterState& state, std::uint32_t old, std::uint32_t limit); std::uint32_t AtomicDecrement(SpirvEmitterState& state, std::uint32_t old, std::uint32_t limit); +std::uint32_t AtomicFloatMinMax(SpirvEmitterState& state, std::uint32_t old, std::uint32_t source, bool maxValue); +std::uint32_t AtomicFloatCompareSwap(SpirvEmitterState& state, std::uint32_t old, std::uint32_t desired, std::uint32_t comparator); template std::uint32_t EmitNative(SpirvEmitterState& state, TArguments... arguments) { diff --git a/core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterInstructions.hpp b/core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterInstructions.hpp index b7bc80580..d89f236b3 100644 --- a/core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterInstructions.hpp +++ b/core/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterInstructions.hpp @@ -335,6 +335,9 @@ void EmitImageAtomicSMin32(SpirvValueEmitContext& ctx, const IrValue& inst); void EmitImageAtomicSMax32(SpirvValueEmitContext& ctx, const IrValue& inst); void EmitImageAtomicInc32(SpirvValueEmitContext& ctx, const IrValue& inst); void EmitImageAtomicDec32(SpirvValueEmitContext& ctx, const IrValue& inst); +void EmitImageAtomicFCmpSwap32(SpirvValueEmitContext& ctx, const IrValue& inst); +void EmitImageAtomicFMin32(SpirvValueEmitContext& ctx, const IrValue& inst); +void EmitImageAtomicFMax32(SpirvValueEmitContext& ctx, const IrValue& inst); void EmitPhi(SpirvValueEmitContext& ctx, const IrValue& inst); void EmitTessellationBase(SpirvValueEmitContext& ctx, const IrValue& inst); void EmitGetThreadBitScalarRegister(SpirvValueEmitContext& ctx, const IrValue& inst); diff --git a/core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp b/core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp index a3b3bab55..eac7c878b 100644 --- a/core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp +++ b/core/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cpp @@ -561,6 +561,9 @@ void EmitDirectInstruction(SpirvValueEmitContext& ctx, const IrValue& inst) { case IrOpcode::ImageAtomicSMax32: return Invoke(EmitImageAtomicSMax32, ctx, inst); case IrOpcode::ImageAtomicInc32: return Invoke(EmitImageAtomicInc32, ctx, inst); case IrOpcode::ImageAtomicDec32: return Invoke(EmitImageAtomicDec32, ctx, inst); + case IrOpcode::ImageAtomicFCmpSwap32: return Invoke(EmitImageAtomicFCmpSwap32, ctx, inst); + case IrOpcode::ImageAtomicFMin32: return Invoke(EmitImageAtomicFMin32, ctx, inst); + case IrOpcode::ImageAtomicFMax32: return Invoke(EmitImageAtomicFMax32, ctx, inst); case IrOpcode::GetAttribute: return Invoke(EmitGetAttribute, ctx, inst); case IrOpcode::GetInterpolationParameter: return Invoke(EmitGetInterpolationParameter, ctx, inst); case IrOpcode::SetAttribute: return Invoke(EmitSetAttribute, ctx, inst); diff --git a/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp b/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp index d797e296f..251b1a045 100644 --- a/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp +++ b/core/shader/recompiler/SpirvBackend/src/SpirvImageEmitter.cpp @@ -757,6 +757,17 @@ void EmitAtomicOp(SpirvValueEmitContext& ctx, const ImageEmitAccess& access) { return opcode == IrOpcode::ImageAtomicInc32 ? AtomicIncrement(state, current, value) : AtomicDecrement(state, current, value); }); } + if (opcode == IrOpcode::ImageAtomicFMin32 || opcode == IrOpcode::ImageAtomicFMax32) { + return AtomicUpdate(state, pointer, ResourceKind::Image, [&](std::uint32_t current) { + return AtomicFloatMinMax(state, current, value, opcode == IrOpcode::ImageAtomicFMax32); + }); + } + if (opcode == IrOpcode::ImageAtomicFCmpSwap32) { + const auto comparator = ctx.Arg(access.inst, 3); + return AtomicUpdate(state, pointer, ResourceKind::Image, [&](std::uint32_t current) { + return AtomicFloatCompareSwap(state, current, value, comparator); + }); + } const auto old = state.module.AllocateId(); if (opcode == IrOpcode::ImageAtomicCmpSwap32) { state.module.AddFunction(spv::OpAtomicCompareExchange, TypeU32(state), old, pointer, ConstantU32(state, spv::ScopeDevice), ConstantU32(state, spv::MemorySemanticsMaskNone), ConstantU32(state, spv::MemorySemanticsMaskNone), value, ctx.Arg(access.inst, 3)); @@ -1042,6 +1053,9 @@ void EmitImage(SpirvValueEmitContext& ctx, const IrValue& inst) { case IrOpcode::ImageAtomicSMax32: case IrOpcode::ImageAtomicInc32: case IrOpcode::ImageAtomicDec32: + case IrOpcode::ImageAtomicFCmpSwap32: + case IrOpcode::ImageAtomicFMin32: + case IrOpcode::ImageAtomicFMax32: EmitAtomicOp(ctx, access); return; default: @@ -1137,6 +1151,18 @@ void EmitImageAtomicDec32(SpirvValueEmitContext& ctx, const IrValue& inst) { EmitImage(ctx, inst); } +void EmitImageAtomicFCmpSwap32(SpirvValueEmitContext& ctx, const IrValue& inst) { + EmitImage(ctx, inst); +} + +void EmitImageAtomicFMin32(SpirvValueEmitContext& ctx, const IrValue& inst) { + EmitImage(ctx, inst); +} + +void EmitImageAtomicFMax32(SpirvValueEmitContext& ctx, const IrValue& inst) { + EmitImage(ctx, inst); +} + void EmitImageBvhIntersectRay(SpirvValueEmitContext& ctx, const IrValue& inst) { auto& state = ctx.state; const auto u32 = TypeU32(state); diff --git a/core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp b/core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp index b997a8eeb..23216880a 100644 --- a/core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp +++ b/core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvMemoryInstructions.cpp @@ -1102,6 +1102,15 @@ std::uint32_t AtomicDecrement(SpirvEmitterState& state, std::uint32_t old, std:: return Select(state, TypeU32(state), wrap, limit, next); } +std::uint32_t AtomicFloatMinMax(SpirvEmitterState& state, std::uint32_t old, std::uint32_t source, bool maxValue) { + return AtomicFloatBits{state, false}.minMax(old, source, maxValue); +} + +std::uint32_t AtomicFloatCompareSwap(SpirvEmitterState& state, std::uint32_t old, std::uint32_t desired, std::uint32_t comparator) { + const AtomicFloatBits bits{state, false}; + return bits.select(bits.equal(old, comparator), desired, old); +} + std::uint32_t EmitReadConst(SpirvValueEmitContext& ctx, const IrValue& inst) { auto& state = ctx.state; if (state.flattenedSrtVariable == 0) { diff --git a/core/shader/recompiler/Translation/src/MemoryInstructions/ImageInstructions.cpp b/core/shader/recompiler/Translation/src/MemoryInstructions/ImageInstructions.cpp index 2346ce083..76cc041ea 100644 --- a/core/shader/recompiler/Translation/src/MemoryInstructions/ImageInstructions.cpp +++ b/core/shader/recompiler/Translation/src/MemoryInstructions/ImageInstructions.cpp @@ -78,7 +78,7 @@ bool TranslationContext::imageAtomic(const RdnaInstruction& inst, IrOpcode opcod const IrU32 value = readU32(inst.destination); IrValue& exec = ir.GetExec(); IrValue* result; - if (opcode == IrOpcode::ImageAtomicCmpSwap32) { + if (opcode == IrOpcode::ImageAtomicCmpSwap32 || opcode == IrOpcode::ImageAtomicFCmpSwap32) { const IrU32 comparator = readU32(offsetOperand(inst.destination, 1u)); result = &ir.Emit(opcode, IrOpcodeType(opcode), {resource, address, &value.Value(), &comparator.Value(), &exec}, flags); } else { diff --git a/core/shader/recompiler/Translation/src/MemoryInstructions/MemoryInstructionDispatch.cpp b/core/shader/recompiler/Translation/src/MemoryInstructions/MemoryInstructionDispatch.cpp index ebb07bb2a..1031f7aa8 100644 --- a/core/shader/recompiler/Translation/src/MemoryInstructions/MemoryInstructionDispatch.cpp +++ b/core/shader/recompiler/Translation/src/MemoryInstructions/MemoryInstructionDispatch.cpp @@ -409,6 +409,12 @@ bool TranslationContext::emitMemory(const RdnaInstruction& inst) { return imageAtomic(inst, IrOpcode::ImageAtomicInc32); case RdnaOpcode::ImageAtomicDec: return imageAtomic(inst, IrOpcode::ImageAtomicDec32); + case RdnaOpcode::ImageAtomicFcmpswap: + return imageAtomic(inst, IrOpcode::ImageAtomicFCmpSwap32); + case RdnaOpcode::ImageAtomicFmin: + return imageAtomic(inst, IrOpcode::ImageAtomicFMin32); + case RdnaOpcode::ImageAtomicFmax: + return imageAtomic(inst, IrOpcode::ImageAtomicFMax32); case RdnaOpcode::ImageLoad: case RdnaOpcode::ImageLoadMip: case RdnaOpcode::ImageLoadPck: