Convert formatted half-float buffer stores from F32

Co-authored-by: TarkusR <90155059+TarkusR@users.noreply.github.com>
This commit is contained in:
nmzik
2026-09-24 07:07:31 +04:00
parent 3bd5de646d
commit a6248c7c7c
3 changed files with 57 additions and 5 deletions
+12 -2
View File
@@ -6711,9 +6711,9 @@ void TestNewShaderRecompilerFormattedStoreUsesRuntimeArrayLengthOnly() {
Check(result.resources.buffers.size() == 1 &&
result.resources.buffers[0].dwords[2] == 5u,
"formatted store test did not preserve descriptor NumRecords");
Check((result.decoded_dump.find("buffer_store_format_x") != std::string::npos),
Check((result.decoded_dump.find("BUFFER_STORE_FORMAT_X") != std::string::npos),
"formatted store regression did not decode buffer_store_format_x");
Check((result.ir_dump.find("typed=0 formatted=1") != std::string::npos),
Check((result.decoded_dump.find("typed=0 formatted=1") != std::string::npos),
"formatted store regression did not preserve formatted metadata");
CheckSpirvBinaryValidates(result.spirv);
@@ -6723,6 +6723,15 @@ void TestNewShaderRecompilerFormattedStoreUsesRuntimeArrayLengthOnly() {
Check(
!SpirvSourceHasInstructionUsing(source, "OpULessThan", "%uint_5"),
"formatted store SPIR-V baked descriptor NumRecords into a store guard");
user_data[1] = 8u << 16u;
user_data[3] = static_cast<uint32_t>(Prospero::BufferFormat::k16_16_16_16Float) << 12u;
options.user_data = user_data;
result = RecompileForTest(shader, options);
Check((DisassembleSpirvBinary(result.spirv).find("PackHalf2x16") !=
std::string::npos),
"formatted half-float store did not convert F32 to F16");
CheckSpirvBinaryValidates(result.spirv);
}
void TestNewShaderRecompilerTypedBufferTranslation() {
@@ -13515,6 +13524,7 @@ int main() {
TestNewShaderRecompilerNativeWideBufferIr();
TestNewShaderRecompilerScalarB64LaneTranslation();
TestNewShaderRecompilerMubufFormatTranslation();
TestNewShaderRecompilerFormattedStoreUsesRuntimeArrayLengthOnly();
TestNewShaderRecompilerTypedBufferTranslation();
TestNewShaderRecompilerDsReadWrite2Translation();
TestNewShaderRecompilerDsWideAndAtomicTranslation();