Manually merge ClemensRognerSD-dx9-sampler and resolve conflicts.
This commit is contained in:
18
gtests/Hlsl.FromFile.cpp
Normal file → Executable file
18
gtests/Hlsl.FromFile.cpp
Normal file → Executable file
@@ -62,6 +62,7 @@ using HlslVulkan1_1CompileTest = GlslangTest<::testing::TestWithParam<FileNameEn
|
||||
using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslDebugTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
using HlslDX9CompatibleTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
|
||||
|
||||
// Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
|
||||
// to successfully generate both AST and SPIR-V.
|
||||
@@ -106,6 +107,14 @@ TEST_P(HlslDebugTest, FromFile)
|
||||
"/baseResults/", false, true);
|
||||
}
|
||||
|
||||
TEST_P(HlslDX9CompatibleTest, FromFile)
|
||||
{
|
||||
loadFileCompileAndCheckWithOptions(GlobalTestSettings.testRoot, GetParam().fileName, Source::HLSL,
|
||||
Semantics::Vulkan, glslang::EShTargetVulkan_1_0, Target::BothASTAndSpv, true,
|
||||
GetParam().entryPoint, "/baseResults/",
|
||||
EShMessages::EShMsgHlslDX9Compatible);
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
ToSpirv, HlslCompileTest,
|
||||
@@ -457,6 +466,15 @@ INSTANTIATE_TEST_CASE_P(
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
ToSpirv, HlslDX9CompatibleTest,
|
||||
::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
|
||||
{"hlsl.sample.dx9.frag", "main"},
|
||||
{"hlsl.sample.dx9.vert", "main"},
|
||||
}),
|
||||
FileNameAsCustomTestSuffix
|
||||
);
|
||||
// clang-format on
|
||||
|
||||
} // anonymous namespace
|
||||
} // namespace glslangtest
|
||||
|
||||
@@ -460,6 +460,34 @@ public:
|
||||
expectedOutputFname, result.spirvWarningsErrors);
|
||||
}
|
||||
|
||||
void loadFileCompileAndCheckWithOptions(const std::string &testDir,
|
||||
const std::string &testName,
|
||||
Source source,
|
||||
Semantics semantics,
|
||||
glslang::EShTargetClientVersion clientTargetVersion,
|
||||
Target target, bool automap = true, const std::string &entryPointName = "",
|
||||
const std::string &baseDir = "/baseResults/",
|
||||
const EShMessages additionalOptions = EShMessages::EShMsgDefault)
|
||||
{
|
||||
const std::string inputFname = testDir + "/" + testName;
|
||||
const std::string expectedOutputFname = testDir + baseDir + testName + ".out";
|
||||
std::string input, expectedOutput;
|
||||
|
||||
tryLoadFile(inputFname, "input", &input);
|
||||
tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
|
||||
|
||||
EShMessages controls = DeriveOptions(source, semantics, target);
|
||||
controls = static_cast<EShMessages>(controls | additionalOptions);
|
||||
GlslangResult result = compileAndLink(testName, input, entryPointName, controls, clientTargetVersion, false,
|
||||
EShTexSampTransKeep, false, automap);
|
||||
|
||||
// Generate the hybrid output in the way of glslangValidator.
|
||||
std::ostringstream stream;
|
||||
outputResultToStream(&stream, result, controls);
|
||||
|
||||
checkEqAndUpdateIfRequested(expectedOutput, stream.str(), expectedOutputFname);
|
||||
}
|
||||
|
||||
void loadFileCompileFlattenUniformsAndCheck(const std::string& testDir,
|
||||
const std::string& testName,
|
||||
Source source,
|
||||
|
||||
Reference in New Issue
Block a user