graphics: support signed 32-bit image atomic descriptors

This commit is contained in:
nmzik
2026-10-12 23:32:19 +02:00
parent 68d7bc94e2
commit aec8c88755
3 changed files with 22 additions and 8 deletions
+18 -6
View File
@@ -37202,7 +37202,7 @@ TestCase ImageStoreAndAtomicUseSeparateBindings() {
return test;
}
TestCase ImageAtomicVariants() {
template <bool signed_format = false> TestCase ImageAtomicVariants() {
using O = ShaderOpcode;
const u32 initial[] = {10, 10, 0xf0f0u, 0xf000u, 0xf00fu};
@@ -37222,7 +37222,10 @@ TestCase ImageAtomicVariants() {
AppendEnd(&code);
TestCase test;
test.name = "ImageAtomicVariants";
test.name = signed_format ? "ImageAtomicSintVariants" : "ImageAtomicVariants";
test.user_data = MakeStorageTextureData(signed_format ? Prospero::BufferFormat::k32SInt
: Prospero::BufferFormat::k32UInt);
test.has_user_data = true;
test.code = code;
test.expected = {10, 10, 0xf0f0u, 0xf000u, 0xf00fu};
test.opcodes = {O::V_MOV_B32, O::IMAGE_ATOMIC_ADD,
@@ -37370,7 +37373,7 @@ TestCase ImageAtomicIntegerGlcAndExec(const ImageAtomicIntegerCase &atomic, bool
return test;
}
template <bool max_value> TestCase ImageAtomicSignedMinMax() {
template <bool max_value, bool signed_format = false> TestCase ImageAtomicSignedMinMax() {
using O = ShaderOpcode;
// Input, old value, signed minimum, signed maximum.
constexpr u32 values[][4] = {
@@ -37383,8 +37386,11 @@ template <bool max_value> TestCase ImageAtomicSignedMinMax() {
{2, 8, 2, 8}, {8, 2, 2, 8},
};
TestCase test;
test.name = max_value ? "ImageAtomicSMaxGlcAndExec" : "ImageAtomicSMinGlcAndExec";
test.user_data = MakeStorageTextureData(Prospero::BufferFormat::k32UInt);
test.name = signed_format
? (max_value ? "ImageAtomicSMaxSintGlcAndExec" : "ImageAtomicSMinSintGlcAndExec")
: (max_value ? "ImageAtomicSMaxGlcAndExec" : "ImageAtomicSMinGlcAndExec");
test.user_data = MakeStorageTextureData(signed_format ? Prospero::BufferFormat::k32SInt
: Prospero::BufferFormat::k32UInt);
test.has_user_data = true;
test.storage_image_r32ui.assign(16, 0);
test.expected_storage_image_r32ui = test.storage_image_r32ui;
@@ -38479,6 +38485,8 @@ std::vector<TestCase> MakeCases() {
AddCase(BufferAtomicAndX2GlcAndExec);
AddCase(ImageAtomicSignedMinMax<false>);
AddCase(ImageAtomicSignedMinMax<true>);
AddCase(ImageAtomicSignedMinMax<false, true>);
AddCase(ImageAtomicSignedMinMax<true, true>);
for (bool decrement : {false, true}) {
for (bool gds : {false, true}) {
cases.push_back(DsBoundedAtomicBoundaries(decrement, gds));
@@ -38569,7 +38577,8 @@ std::vector<TestCase> MakeCases() {
AddCase(ImageAtomicCompareSwapGlcAndExec);
AddCase(ImageAtomicSwapReturnsPreviousTexel);
AddCase(ImageStoreAndAtomicUseSeparateBindings);
AddCase(ImageAtomicVariants);
AddCase(ImageAtomicVariants<>);
AddCase(ImageAtomicVariants<true>);
for (const auto &atomic : ImageAtomicIntegerCases) {
cases.push_back(ImageAtomicIntegerGlcAndExec(atomic, false));
cases.push_back(ImageAtomicIntegerGlcAndExec(atomic, true));
@@ -44385,6 +44394,9 @@ int main(int argc, char **argv) {
RunCase(&vulkan, ImageAtomicCompareSwapGlcAndExec());
RunCase(&vulkan, ImageAtomicSwapReturnsPreviousTexel());
RunCase(&vulkan, ImageAtomicVariants());
RunCase(&vulkan, ImageAtomicVariants<true>());
RunCase(&vulkan, ImageAtomicSignedMinMax<false, true>());
RunCase(&vulkan, ImageAtomicSignedMinMax<true, true>());
return 0;
}
if (argc == 2 && std::strcmp(argv[1], "--image-atomic64-only") == 0) {