Add GLSL FindILsb, FindUMsb, FindSMsb and InterpolateAtCentroid.

This CL adds the type determination for the GLSL methods FindILsb,
FindUMsb, FindSMsb and InterpolateAtCentroid.

Change-Id: I2b1e9d021e6799ffe6b5b71c5cca947b8e6ccfa0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22843
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair 2020-06-08 23:48:26 +00:00 committed by dan sinclair
parent ee39225c0b
commit af5df70c7b
2 changed files with 16 additions and 5 deletions

View File

@ -661,6 +661,9 @@ constexpr const GlslData kGlslData[] = {
{"faceforward", 3, GLSLstd450FaceForward,
GlslDataType::kFloatScalarOrVector, 0},
{"fclamp", 3, GLSLstd450FClamp, GlslDataType::kFloatScalarOrVector, 0},
{"findilsb", 1, GLSLstd450FindILsb, GlslDataType::kIntScalarOrVector, 0},
{"findumsb", 1, GLSLstd450FindUMsb, GlslDataType::kIntScalarOrVector, 0},
{"findsmsb", 1, GLSLstd450FindSMsb, GlslDataType::kIntScalarOrVector, 0},
{"floor", 1, GLSLstd450Floor, GlslDataType::kFloatScalarOrVector, 0},
{"fma", 3, GLSLstd450Fma, GlslDataType::kFloatScalarOrVector, 0},
{"fmax", 2, GLSLstd450FMax, GlslDataType::kFloatScalarOrVector, 0},
@ -668,6 +671,8 @@ constexpr const GlslData kGlslData[] = {
{"fmix", 3, GLSLstd450FMix, GlslDataType::kFloatScalarOrVector, 0},
{"fract", 1, GLSLstd450Fract, GlslDataType::kFloatScalarOrVector, 0},
{"fsign", 1, GLSLstd450FSign, GlslDataType::kFloatScalarOrVector, 0},
{"interpolateatcentroid", 1, GLSLstd450InterpolateAtCentroid,
GlslDataType::kFloatScalarOrVector, 0},
{"inversesqrt", 1, GLSLstd450InverseSqrt,
GlslDataType::kFloatScalarOrVector, 0},
{"length", 1, GLSLstd450Length, GlslDataType::kFloatScalarOrVector, 0},

View File

@ -1859,7 +1859,9 @@ INSTANTIATE_TEST_SUITE_P(
GLSLData{"log2", GLSLstd450Log2},
GLSLData{"sqrt", GLSLstd450Sqrt},
GLSLData{"inversesqrt", GLSLstd450InverseSqrt},
GLSLData{"normalize", GLSLstd450Normalize}));
GLSLData{"normalize", GLSLstd450Normalize},
GLSLData{"interpolateatcentroid",
GLSLstd450InterpolateAtCentroid}));
TEST_F(TypeDeterminerTest, ImportData_Length_Scalar) {
ast::type::F32Type f32;
@ -2890,10 +2892,14 @@ TEST_P(ImportData_Int_SingleParamTest, Error_MultipleParams) {
param.name + ". Expected 1 got 3");
}
INSTANTIATE_TEST_SUITE_P(TypeDeterminerTest,
ImportData_Int_SingleParamTest,
testing::Values(GLSLData{"sabs", GLSLstd450SAbs},
GLSLData{"ssign", GLSLstd450SSign}));
INSTANTIATE_TEST_SUITE_P(
TypeDeterminerTest,
ImportData_Int_SingleParamTest,
testing::Values(GLSLData{"sabs", GLSLstd450SAbs},
GLSLData{"ssign", GLSLstd450SSign},
GLSLData{"findilsb", GLSLstd450FindILsb},
GLSLData{"findumsb", GLSLstd450FindUMsb},
GLSLData{"findsmsb", GLSLstd450FindSMsb}));
using ImportData_Int_TwoParamTest = TypeDeterminerTestWithParam<GLSLData>;
TEST_P(ImportData_Int_TwoParamTest, Scalar_Signed) {