diff --git a/build-android/known_good.json b/build-android/known_good.json index b3dab92da83..76d50f09082 100755 --- a/build-android/known_good.json +++ b/build-android/known_good.json @@ -22,7 +22,7 @@ "name": "SPIRV-Tools", "url": "https://github.com/KhronosGroup/SPIRV-Tools.git", "sub_dir": "shaderc/third_party/spirv-tools", - "commit": "04cdb2d344706052c7a2d359294e830ebac63e74" + "commit": "870fd1e17aff8ede9aa12e647754780067306fe6" }, { "name": "SPIRV-Headers", diff --git a/scripts/known_good.json b/scripts/known_good.json index 4708daf77b3..77ac1557aa1 100755 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -40,7 +40,7 @@ "-DSPIRV_SKIP_TESTS=ON", "-DSPIRV_SKIP_EXECUTABLES=ON" ], - "commit": "04cdb2d344706052c7a2d359294e830ebac63e74" + "commit": "870fd1e17aff8ede9aa12e647754780067306fe6" }, { "name": "SPIRV-Reflect", @@ -48,7 +48,7 @@ "sub_dir": "SPIRV-Reflect", "install_dir": "SPIRV-Reflect", "build_step": "skip", - "commit": "87442baff70befd0523a0e7148fc4e68b71f4bb9", + "commit": "8f91541618da0c756a556f00fde722fae0c1b412", "optional": [ "tests" ] diff --git a/tests/spirv_hopper/pass_through_shaders.cpp b/tests/spirv_hopper/pass_through_shaders.cpp index f04c51252a3..e6ffd17b5df 100644 --- a/tests/spirv_hopper/pass_through_shaders.cpp +++ b/tests/spirv_hopper/pass_through_shaders.cpp @@ -16,6 +16,10 @@ static constexpr bool IsFloatFormat(SpvReflectFormat format) { switch (format) { + case SPV_REFLECT_FORMAT_R16_SFLOAT: + case SPV_REFLECT_FORMAT_R16G16_SFLOAT: + case SPV_REFLECT_FORMAT_R16G16B16_SFLOAT: + case SPV_REFLECT_FORMAT_R16G16B16A16_SFLOAT: case SPV_REFLECT_FORMAT_R32_SFLOAT: case SPV_REFLECT_FORMAT_R32G32_SFLOAT: case SPV_REFLECT_FORMAT_R32G32B32_SFLOAT: @@ -52,6 +56,10 @@ std::string Hopper::GetTypeDescription(SpvReflectTypeDescription& description, S } } + const bool isSigned = (description.traits.numeric.scalar.signedness != 0); + const bool is32Bit = (description.traits.numeric.scalar.width == 32); + const std::string width = is32Bit ? "" : std::to_string(description.traits.numeric.scalar.width); + switch (description.op) { case SpvOp::SpvOpTypeBool: { type += "bool"; @@ -59,19 +67,22 @@ std::string Hopper::GetTypeDescription(SpvReflectTypeDescription& description, S } case SpvOp::SpvOpTypeFloat: { type += "float"; + type += is32Bit ? "" : (width + "_t"); break; } case SpvOp::SpvOpTypeInt: { - if (description.traits.numeric.scalar.signedness == 0) { - type += "u"; - } + type += !isSigned ? "u" : ""; type += "int"; + type += is32Bit ? "" : (width + "_t"); break; } case SpvOp::SpvOpTypeVector: { if (!IsFloatFormat(format)) { - type += (description.traits.numeric.scalar.signedness == 0) ? "u" : "i"; + type += isSigned ? "i" : "u"; + } else if (!is32Bit) { + type += "f"; } + type += is32Bit ? "" : width; type += "vec"; const uint32_t component_count = description.traits.numeric.vector.component_count; type += std::to_string(component_count); @@ -146,6 +157,11 @@ bool Hopper::CreatePassThroughVertex() { BuildOrderedVariableMap(input_variables, variable_ordered_map); std::string shader = "#version 450\n"; + // Add extensions regardless, keeps things simple + shader += "#extension GL_EXT_shader_explicit_arithmetic_types: enable\n"; + shader += "#extension GL_EXT_shader_16bit_storage: enable\n"; + shader += "#extension GL_EXT_shader_8bit_storage: enable\n"; + for (auto entry : variable_ordered_map) { const SpvReflectInterfaceVariable& variable = *entry.second; if (IsBuiltinType(variable)) {