chore: checkpoint current workspace changes
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
@@ -203,6 +204,56 @@ VSOutput MainVS(VSInput input) {
|
||||
ASSERT_TRUE(failures.empty()) << failures.front();
|
||||
}
|
||||
|
||||
TEST(OpenGLShaderCompiler_Test, CompileSpirvShader_GlslOpenGLTarget_SupportsIncludeDirectoriesWithSpaces) {
|
||||
if (!SupportsOpenGLHlslToolchainForTests()) {
|
||||
GTEST_SKIP() << "glslangValidator.exe or spirv-cross.exe was not found.";
|
||||
}
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
const fs::path includeDirectory =
|
||||
fs::temp_directory_path() / "xcengine glslang include regression";
|
||||
std::error_code ec;
|
||||
fs::remove_all(includeDirectory, ec);
|
||||
ec.clear();
|
||||
fs::create_directories(includeDirectory, ec);
|
||||
ASSERT_FALSE(ec) << ec.message();
|
||||
|
||||
const fs::path includeFile = includeDirectory / "shared_include.glsl";
|
||||
{
|
||||
std::ofstream stream(includeFile, std::ios::binary | std::ios::trunc);
|
||||
ASSERT_TRUE(stream.is_open());
|
||||
stream << "const vec4 kOffset = vec4(0.0, 0.0, 0.0, 0.0);\n";
|
||||
}
|
||||
|
||||
static const char* vertexSource = R"(#version 450 core
|
||||
#extension GL_GOOGLE_include_directive : require
|
||||
#include "shared_include.glsl"
|
||||
|
||||
layout(location = 0) in vec4 inPosition;
|
||||
|
||||
void main() {
|
||||
gl_Position = inPosition + kOffset;
|
||||
}
|
||||
)";
|
||||
|
||||
ShaderCompileDesc shaderDesc = {};
|
||||
shaderDesc.source.assign(vertexSource, vertexSource + std::strlen(vertexSource));
|
||||
shaderDesc.sourceLanguage = ShaderLanguage::GLSL;
|
||||
shaderDesc.fileName = L"shader.vert";
|
||||
shaderDesc.includeDirectories.push_back(includeDirectory.wstring());
|
||||
|
||||
CompiledSpirvShader compiledShader = {};
|
||||
std::string errorMessage;
|
||||
EXPECT_TRUE(CompileSpirvShader(
|
||||
shaderDesc,
|
||||
SpirvTargetEnvironment::OpenGL,
|
||||
compiledShader,
|
||||
&errorMessage)) << errorMessage;
|
||||
|
||||
fs::remove_all(includeDirectory, ec);
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, Device_CreatePipelineState_HlslGraphicsShaders_UsesTranspiledHlslPath) {
|
||||
ASSERT_TRUE(GetDevice()->MakeContextCurrent());
|
||||
if (!SupportsOpenGLHlslToolchainForTests()) {
|
||||
|
||||
Reference in New Issue
Block a user