mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 19:01:24 +00:00
writer/hlsl: Implement fma()
Change-Id: I30763381bcb0588379e0896f014fa9756b5f3395 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54324 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
35ce0d1993
commit
fe66cbe7bb
@ -528,11 +528,9 @@ bool GeneratorImpl::EmitCall(std::ostream& pre,
|
|||||||
if (auto* intrinsic = call->Target()->As<sem::Intrinsic>()) {
|
if (auto* intrinsic = call->Target()->As<sem::Intrinsic>()) {
|
||||||
if (intrinsic->IsTexture()) {
|
if (intrinsic->IsTexture()) {
|
||||||
return EmitTextureCall(pre, out, expr, intrinsic);
|
return EmitTextureCall(pre, out, expr, intrinsic);
|
||||||
}
|
} else if (intrinsic->Type() == sem::IntrinsicType::kSelect) {
|
||||||
if (intrinsic->Type() == sem::IntrinsicType::kSelect) {
|
|
||||||
return EmitSelectCall(pre, out, expr);
|
return EmitSelectCall(pre, out, expr);
|
||||||
}
|
} else if (intrinsic->Type() == sem::IntrinsicType::kFrexp) {
|
||||||
if (intrinsic->Type() == sem::IntrinsicType::kFrexp) {
|
|
||||||
return EmitFrexpCall(pre, out, expr, intrinsic);
|
return EmitFrexpCall(pre, out, expr, intrinsic);
|
||||||
} else if (intrinsic->Type() == sem::IntrinsicType::kIsNormal) {
|
} else if (intrinsic->Type() == sem::IntrinsicType::kIsNormal) {
|
||||||
return EmitIsNormalCall(pre, out, expr, intrinsic);
|
return EmitIsNormalCall(pre, out, expr, intrinsic);
|
||||||
@ -1177,7 +1175,6 @@ std::string GeneratorImpl::generate_builtin_name(
|
|||||||
case sem::IntrinsicType::kExp:
|
case sem::IntrinsicType::kExp:
|
||||||
case sem::IntrinsicType::kExp2:
|
case sem::IntrinsicType::kExp2:
|
||||||
case sem::IntrinsicType::kFloor:
|
case sem::IntrinsicType::kFloor:
|
||||||
case sem::IntrinsicType::kFma:
|
|
||||||
case sem::IntrinsicType::kFrexp:
|
case sem::IntrinsicType::kFrexp:
|
||||||
case sem::IntrinsicType::kLdexp:
|
case sem::IntrinsicType::kLdexp:
|
||||||
case sem::IntrinsicType::kLength:
|
case sem::IntrinsicType::kLength:
|
||||||
@ -1228,6 +1225,9 @@ std::string GeneratorImpl::generate_builtin_name(
|
|||||||
case sem::IntrinsicType::kFract:
|
case sem::IntrinsicType::kFract:
|
||||||
out = "frac";
|
out = "frac";
|
||||||
break;
|
break;
|
||||||
|
case sem::IntrinsicType::kFma:
|
||||||
|
out = "mad";
|
||||||
|
break;
|
||||||
case sem::IntrinsicType::kFwidth:
|
case sem::IntrinsicType::kFwidth:
|
||||||
case sem::IntrinsicType::kFwidthCoarse:
|
case sem::IntrinsicType::kFwidthCoarse:
|
||||||
case sem::IntrinsicType::kFwidthFine:
|
case sem::IntrinsicType::kFwidthFine:
|
||||||
|
@ -201,7 +201,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
HlslGeneratorImplTest_Import,
|
HlslGeneratorImplTest_Import,
|
||||||
HlslImportData_TripleParamTest,
|
HlslImportData_TripleParamTest,
|
||||||
testing::Values(HlslImportData{"faceForward", "faceforward"},
|
testing::Values(HlslImportData{"faceForward", "faceforward"},
|
||||||
HlslImportData{"fma", "fma"},
|
HlslImportData{"fma", "mad"},
|
||||||
HlslImportData{"clamp", "clamp"},
|
HlslImportData{"clamp", "clamp"},
|
||||||
HlslImportData{"smoothStep", "smoothstep"}));
|
HlslImportData{"smoothStep", "smoothstep"}));
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ INSTANTIATE_TEST_SUITE_P(
|
|||||||
IntrinsicData{IntrinsicType::kFaceForward, ParamType::kF32,
|
IntrinsicData{IntrinsicType::kFaceForward, ParamType::kF32,
|
||||||
"faceforward"},
|
"faceforward"},
|
||||||
IntrinsicData{IntrinsicType::kFloor, ParamType::kF32, "floor"},
|
IntrinsicData{IntrinsicType::kFloor, ParamType::kF32, "floor"},
|
||||||
IntrinsicData{IntrinsicType::kFma, ParamType::kF32, "fma"},
|
IntrinsicData{IntrinsicType::kFma, ParamType::kF32, "mad"},
|
||||||
IntrinsicData{IntrinsicType::kFract, ParamType::kF32, "frac"},
|
IntrinsicData{IntrinsicType::kFract, ParamType::kF32, "frac"},
|
||||||
IntrinsicData{IntrinsicType::kFwidth, ParamType::kF32, "fwidth"},
|
IntrinsicData{IntrinsicType::kFwidth, ParamType::kF32, "fwidth"},
|
||||||
IntrinsicData{IntrinsicType::kFwidthCoarse, ParamType::kF32, "fwidth"},
|
IntrinsicData{IntrinsicType::kFwidthCoarse, ParamType::kF32, "fwidth"},
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
SKIP: FAILED
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Validation Failure:
|
|
||||||
void fma_26a7a9() {
|
void fma_26a7a9() {
|
||||||
float2 res = fma(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
|
float2 res = mad(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
@ -27,21 +22,3 @@ void compute_main() {
|
|||||||
fma_26a7a9();
|
fma_26a7a9();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tint_9GH744:2:16: error: no matching function for call to 'fma'
|
|
||||||
float2 res = fma(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 2>' to 'vector<double, 2>' for 1st argument
|
|
||||||
|
|
||||||
|
|
||||||
tint_9GH744:2:16: error: no matching function for call to 'fma'
|
|
||||||
float2 res = fma(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 2>' to 'vector<double, 2>' for 1st argument
|
|
||||||
|
|
||||||
|
|
||||||
tint_9GH744:2:16: error: no matching function for call to 'fma'
|
|
||||||
float2 res = fma(float2(0.0f, 0.0f), float2(0.0f, 0.0f), float2(0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 2>' to 'vector<double, 2>' for 1st argument
|
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
SKIP: FAILED
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Validation Failure:
|
|
||||||
void fma_6a3283() {
|
void fma_6a3283() {
|
||||||
float4 res = fma(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
|
float4 res = mad(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
@ -27,21 +22,3 @@ void compute_main() {
|
|||||||
fma_6a3283();
|
fma_6a3283();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tint_GZ5kFN:2:16: error: no matching function for call to 'fma'
|
|
||||||
float4 res = fma(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 4>' to 'vector<double, 4>' for 1st argument
|
|
||||||
|
|
||||||
|
|
||||||
tint_GZ5kFN:2:16: error: no matching function for call to 'fma'
|
|
||||||
float4 res = fma(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 4>' to 'vector<double, 4>' for 1st argument
|
|
||||||
|
|
||||||
|
|
||||||
tint_GZ5kFN:2:16: error: no matching function for call to 'fma'
|
|
||||||
float4 res = fma(float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f), float4(0.0f, 0.0f, 0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 4>' to 'vector<double, 4>' for 1st argument
|
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
SKIP: FAILED
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Validation Failure:
|
|
||||||
void fma_c10ba3() {
|
void fma_c10ba3() {
|
||||||
float res = fma(1.0f, 1.0f, 1.0f);
|
float res = mad(1.0f, 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
@ -27,21 +22,3 @@ void compute_main() {
|
|||||||
fma_c10ba3();
|
fma_c10ba3();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tint_tqaLcU:2:15: error: no matching function for call to 'fma'
|
|
||||||
float res = fma(1.0f, 1.0f, 1.0f);
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument
|
|
||||||
|
|
||||||
|
|
||||||
tint_tqaLcU:2:15: error: no matching function for call to 'fma'
|
|
||||||
float res = fma(1.0f, 1.0f, 1.0f);
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument
|
|
||||||
|
|
||||||
|
|
||||||
tint_tqaLcU:2:15: error: no matching function for call to 'fma'
|
|
||||||
float res = fma(1.0f, 1.0f, 1.0f);
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'float' to 'double' for 1st argument
|
|
||||||
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
SKIP: FAILED
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Validation Failure:
|
|
||||||
void fma_e17c5c() {
|
void fma_e17c5c() {
|
||||||
float3 res = fma(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
|
float3 res = mad(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct tint_symbol {
|
struct tint_symbol {
|
||||||
@ -27,21 +22,3 @@ void compute_main() {
|
|||||||
fma_e17c5c();
|
fma_e17c5c();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tint_NJUQps:2:16: error: no matching function for call to 'fma'
|
|
||||||
float3 res = fma(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 3>' to 'vector<double, 3>' for 1st argument
|
|
||||||
|
|
||||||
|
|
||||||
tint_NJUQps:2:16: error: no matching function for call to 'fma'
|
|
||||||
float3 res = fma(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 3>' to 'vector<double, 3>' for 1st argument
|
|
||||||
|
|
||||||
|
|
||||||
tint_NJUQps:2:16: error: no matching function for call to 'fma'
|
|
||||||
float3 res = fma(float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f), float3(0.0f, 0.0f, 0.0f));
|
|
||||||
^~~
|
|
||||||
note: candidate function not viable: no known conversion from 'vector<float, 3>' to 'vector<double, 3>' for 1st argument
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user