Update the rounding modes to match the spec.
The spec was clarified that a value of .5 rounds towards the even value. This matches the HLSL `round` method. This CL updates SPIR-V to use the `RoundEven` GLSL450 call and the `rint` MSL call so they match the spec requirements. Change-Id: I97ce2e29b9639ad72b6846b32dbe3abb8d9f6cff Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/42421 Auto-Submit: dan sinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
parent
eb496d0a4d
commit
8feb9b847f
|
@ -817,7 +817,6 @@ std::string GeneratorImpl::generate_builtin_name(
|
|||
case semantic::IntrinsicType::kNormalize:
|
||||
case semantic::IntrinsicType::kPow:
|
||||
case semantic::IntrinsicType::kReflect:
|
||||
case semantic::IntrinsicType::kRound:
|
||||
case semantic::IntrinsicType::kSelect:
|
||||
case semantic::IntrinsicType::kSin:
|
||||
case semantic::IntrinsicType::kSinh:
|
||||
|
@ -899,6 +898,9 @@ std::string GeneratorImpl::generate_builtin_name(
|
|||
case semantic::IntrinsicType::kReverseBits:
|
||||
out += "reverse_bits";
|
||||
break;
|
||||
case semantic::IntrinsicType::kRound:
|
||||
out += "rint";
|
||||
break;
|
||||
case semantic::IntrinsicType::kSmoothStep:
|
||||
out += "smoothstep";
|
||||
break;
|
||||
|
|
|
@ -85,7 +85,7 @@ INSTANTIATE_TEST_SUITE_P(MslGeneratorImplTest,
|
|||
MslImportData{"length", "length"},
|
||||
MslImportData{"log", "log"},
|
||||
MslImportData{"log2", "log2"},
|
||||
MslImportData{"round", "round"},
|
||||
MslImportData{"round", "rint"},
|
||||
MslImportData{"sign", "sign"},
|
||||
MslImportData{"sin", "sin"},
|
||||
MslImportData{"sinh", "sinh"},
|
||||
|
|
|
@ -271,7 +271,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||
"metal::reflect"},
|
||||
IntrinsicData{IntrinsicType::kReverseBits, ParamType::kU32,
|
||||
"metal::reverse_bits"},
|
||||
IntrinsicData{IntrinsicType::kRound, ParamType::kU32, "metal::round"},
|
||||
IntrinsicData{IntrinsicType::kRound, ParamType::kU32, "metal::rint"},
|
||||
IntrinsicData{IntrinsicType::kSelect, ParamType::kF32, "metal::select"},
|
||||
IntrinsicData{IntrinsicType::kSign, ParamType::kF32, "metal::sign"},
|
||||
IntrinsicData{IntrinsicType::kSin, ParamType::kF32, "metal::sin"},
|
||||
|
|
|
@ -266,7 +266,7 @@ uint32_t intrinsic_to_glsl_method(const semantic::Intrinsic* intrinsic) {
|
|||
case IntrinsicType::kReflect:
|
||||
return GLSLstd450Reflect;
|
||||
case IntrinsicType::kRound:
|
||||
return GLSLstd450Round;
|
||||
return GLSLstd450RoundEven;
|
||||
case IntrinsicType::kSign:
|
||||
return GLSLstd450FSign;
|
||||
case IntrinsicType::kSin:
|
||||
|
|
|
@ -479,7 +479,7 @@ OpName %7 "a_func"
|
|||
%7 = OpFunction %6 None %5
|
||||
%8 = OpLabel
|
||||
%11 = OpLoad %3 %1
|
||||
%9 = OpExtInst %3 %10 Round %11
|
||||
%9 = OpExtInst %3 %10 RoundEven %11
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
)");
|
||||
|
@ -563,7 +563,7 @@ INSTANTIATE_TEST_SUITE_P(IntrinsicBuilderTest,
|
|||
"InverseSqrt"},
|
||||
IntrinsicData{"log", "Log"},
|
||||
IntrinsicData{"log2", "Log2"},
|
||||
IntrinsicData{"round", "Round"},
|
||||
IntrinsicData{"round", "RoundEven"},
|
||||
IntrinsicData{"sign", "FSign"},
|
||||
IntrinsicData{"sin", "Sin"},
|
||||
IntrinsicData{"sinh", "Sinh"},
|
||||
|
|
Loading…
Reference in New Issue