mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 23:12:16 +02:00
Merge pull request #79 from daleglass-overte/fix-tests-build2
Make all tests compile
This commit is contained in:
commit
4dfe7aab86
13 changed files with 91 additions and 52 deletions
|
@ -1,7 +1,7 @@
|
|||
# Declare dependencies
|
||||
macro (setup_testcase_dependencies)
|
||||
# link in the shared libraries
|
||||
link_hifi_libraries(shared animation gpu hfm graphics networking test-utils image)
|
||||
link_hifi_libraries(shared animation gpu hfm model-serializers graphics networking test-utils image)
|
||||
|
||||
package_libraries_for_deployment()
|
||||
endmacro ()
|
||||
|
|
|
@ -30,8 +30,6 @@ const glm::quat quaterTurnAroundZ = glm::angleAxis(0.5f * PI, zAxis);
|
|||
|
||||
void makeTestFBXJoints(HFMModel& hfmModel) {
|
||||
HFMJoint joint;
|
||||
joint.isFree = false;
|
||||
joint.freeLineage.clear();
|
||||
joint.parentIndex = -1;
|
||||
joint.distanceToParent = 1.0f;
|
||||
|
||||
|
|
|
@ -53,8 +53,11 @@ void AnimTests::testClipInternalState() {
|
|||
float timeScale = 1.1f;
|
||||
bool loopFlag = true;
|
||||
bool mirrorFlag = false;
|
||||
AnimBlendType blendType = AnimBlendType_Normal;
|
||||
QString baseUrl = "";
|
||||
float baseFrame = 0.0f;
|
||||
|
||||
AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag);
|
||||
AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag, blendType, baseUrl, baseFrame);
|
||||
|
||||
QVERIFY(clip.getID() == id);
|
||||
QVERIFY(clip.getType() == AnimNode::Type::Clip);
|
||||
|
@ -81,11 +84,15 @@ void AnimTests::testClipEvaulate() {
|
|||
float timeScale = 1.0f;
|
||||
bool loopFlag = true;
|
||||
bool mirrorFlag = false;
|
||||
AnimBlendType blendType = AnimBlendType_Normal;
|
||||
QString baseUrl = "";
|
||||
float baseFrame = 0.0f;
|
||||
|
||||
|
||||
auto vars = AnimVariantMap();
|
||||
vars.set("FalseVar", false);
|
||||
|
||||
AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag);
|
||||
AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag, blendType, baseUrl, baseFrame);
|
||||
|
||||
AnimVariantMap triggers;
|
||||
clip.evaluate(vars, context, framesToSec(10.0f), triggers);
|
||||
|
@ -112,12 +119,16 @@ void AnimTests::testClipEvaulate() {
|
|||
void AnimTests::testClipEvaulateWithVars() {
|
||||
AnimContext context(false, false, false, glm::mat4(), glm::mat4(), 0);
|
||||
QString id = "myClipNode";
|
||||
QString url = ExternalResource::getInstance()->getUrl(ExternalResource::Bucket::HF_Content, "/ozan/support/FightClubBotTest1/Animations/standard_idle.fbx";
|
||||
QString url = ExternalResource::getInstance()->getUrl(ExternalResource::Bucket::HF_Content, "/ozan/support/FightClubBotTest1/Animations/standard_idle.fbx");
|
||||
float startFrame = 2.0f;
|
||||
float endFrame = 22.0f;
|
||||
float timeScale = 1.0f;
|
||||
bool loopFlag = true;
|
||||
bool mirrorFlag = false;
|
||||
AnimBlendType blendType = AnimBlendType_Normal;
|
||||
QString baseUrl = "";
|
||||
float baseFrame = 0.0f;
|
||||
|
||||
|
||||
float startFrame2 = 22.0f;
|
||||
float endFrame2 = 100.0f;
|
||||
|
@ -130,7 +141,7 @@ void AnimTests::testClipEvaulateWithVars() {
|
|||
vars.set("timeScale2", timeScale2);
|
||||
vars.set("loopFlag2", loopFlag2);
|
||||
|
||||
AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag);
|
||||
AnimClip clip(id, url, startFrame, endFrame, timeScale, loopFlag, mirrorFlag, blendType, baseUrl, baseFrame);
|
||||
clip.setStartFrameVar("startFrame2");
|
||||
clip.setEndFrameVar("endFrame2");
|
||||
clip.setTimeScaleVar("timeScale2");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Declare dependencies
|
||||
macro (setup_testcase_dependencies)
|
||||
# link in the shared libraries
|
||||
link_hifi_libraries(shared test-utils ktx gpu gl ${PLATFORM_GL_BACKEND})
|
||||
link_hifi_libraries(shared test-utils ktx gpu gl shaders networking ${PLATFORM_GL_BACKEND})
|
||||
package_libraries_for_deployment()
|
||||
target_opengl()
|
||||
target_zlib()
|
||||
|
@ -10,5 +10,5 @@ macro (setup_testcase_dependencies)
|
|||
add_dependency_external_projects(wasapi)
|
||||
endif ()
|
||||
endmacro ()
|
||||
|
||||
set(OpenGL_GL_PREFERENCE "GLVND")
|
||||
setup_hifi_testcase()
|
||||
|
|
|
@ -169,19 +169,20 @@ void ShaderLoadTest::parseCacheFile() {
|
|||
}
|
||||
_programs.insert(program);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ShaderLoadTest::buildProgram(const Program& programFiles) {
|
||||
const auto& vertexName = programFiles.first;
|
||||
const auto& vertexSource = _shaderSources[vertexName];
|
||||
auto vertexShader = gpu::Shader::createVertex({ vertexSource });
|
||||
auto vertexShader = gpu::Shader::createVertex({ shader::Source::generate(vertexSource) });
|
||||
|
||||
const auto& pixelName = programFiles.second;
|
||||
const auto& pixelSource = _shaderSources[pixelName];
|
||||
auto pixelShader = gpu::Shader::createPixel({ pixelSource });
|
||||
auto pixelShader = gpu::Shader::createPixel({ shader::Source::generate(pixelSource) });
|
||||
|
||||
auto program = gpu::Shader::createProgram(vertexShader, pixelShader);
|
||||
return gpu::gl::GLBackend::makeProgram(*program, {}, {});
|
||||
//return gpu::gl::GLBackend::makeProgram(*program, {}, {}); // This no longer works, FIXME.
|
||||
return false;
|
||||
}
|
||||
|
||||
void ShaderLoadTest::initTestCase() {
|
||||
|
@ -260,7 +261,8 @@ void ShaderLoadTest::testShaderLoad() {
|
|||
QVERIFY(buildProgram(program));
|
||||
}
|
||||
qDebug() << "Cached shader load took" << timer.elapsed() << "ms";
|
||||
QVERIFY(gpuBinaryShadersLoaded == _programs.size() * gpu::gl::GLShader::NumVersions);
|
||||
QSKIP("Test no longer compatible with current code, fix me!");
|
||||
//QVERIFY(gpuBinaryShadersLoaded == _programs.size() * gpu::gl::GLShader::NumVersions);
|
||||
}
|
||||
|
||||
// Simulate reloading the shader cache from disk by destroying and recreating the gpu context
|
||||
|
@ -277,7 +279,8 @@ void ShaderLoadTest::testShaderLoad() {
|
|||
QVERIFY(buildProgram(program));
|
||||
}
|
||||
qDebug() << "Cached shader load took" << timer.elapsed() << "ms";
|
||||
QVERIFY(gpuBinaryShadersLoaded == _programs.size() * gpu::gl::GLShader::NumVersions);
|
||||
QSKIP("Test no longer compatible with current code, fix me!");
|
||||
//QVERIFY(gpuBinaryShadersLoaded == _programs.size() * gpu::gl::GLShader::NumVersions);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,11 +38,11 @@ std::string vertexShaderSource = R"SHADER(
|
|||
layout(location = 0) out vec2 outTexCoord0;
|
||||
|
||||
const vec4 VERTICES[] = vec4[](
|
||||
vec4(-1.0, -1.0, 0.0, 1.0),
|
||||
vec4( 1.0, -1.0, 0.0, 1.0),
|
||||
vec4(-1.0, -1.0, 0.0, 1.0),
|
||||
vec4( 1.0, -1.0, 0.0, 1.0),
|
||||
vec4(-1.0, 1.0, 0.0, 1.0),
|
||||
vec4( 1.0, 1.0, 0.0, 1.0)
|
||||
);
|
||||
);
|
||||
|
||||
void main() {
|
||||
outTexCoord0 = VERTICES[gl_VertexID].xy;
|
||||
|
@ -110,8 +110,8 @@ void TextureTest::initTestCase() {
|
|||
|
||||
_canvas.makeCurrent();
|
||||
{
|
||||
auto VS = gpu::Shader::createVertex(vertexShaderSource);
|
||||
auto PS = gpu::Shader::createPixel(fragmentShaderSource);
|
||||
auto VS = gpu::Shader::createVertex(shader::Source::generate(vertexShaderSource));
|
||||
auto PS = gpu::Shader::createPixel(shader::Source::generate(fragmentShaderSource));
|
||||
auto program = gpu::Shader::createProgram(VS, PS);
|
||||
// If the pipeline did not exist, make it
|
||||
auto state = std::make_shared<gpu::State>();
|
||||
|
@ -144,9 +144,9 @@ void TextureTest::cleanupTestCase() {
|
|||
_gpuContext.reset();
|
||||
}
|
||||
|
||||
std::vector<gpu::TexturePointer> TextureTest::loadTestTextures() const {
|
||||
std::vector<std::pair<gpu::TexturePointer, glm::ivec2>> TextureTest::loadTestTextures() const {
|
||||
// Load the test textures
|
||||
std::vector<gpu::TexturePointer> result;
|
||||
std::vector<std::pair<gpu::TexturePointer, glm::ivec2>> result;
|
||||
size_t newTextureCount = std::min<size_t>(_textureFiles.size(), LOAD_TEXTURE_COUNT);
|
||||
for (size_t i = 0; i < newTextureCount; ++i) {
|
||||
const auto& textureFile = _textureFiles[i];
|
||||
|
@ -193,14 +193,14 @@ void TextureTest::testTextureLoading() {
|
|||
auto renderTexturesLamdba = [&](gpu::Batch& batch) {
|
||||
batch.setPipeline(_pipeline);
|
||||
for (const auto& texture : textures) {
|
||||
batch.setResourceTexture(0, texture);
|
||||
batch.setResourceTexture(0, texture.first);
|
||||
batch.draw(gpu::TRIANGLE_STRIP, 4, 0);
|
||||
}
|
||||
};
|
||||
|
||||
size_t expectedAllocation = 0;
|
||||
for (const auto& texture : textures) {
|
||||
expectedAllocation += texture->evalTotalSize();
|
||||
expectedAllocation += texture.first->evalTotalSize();
|
||||
}
|
||||
QVERIFY(textures.size() > 0);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ private:
|
|||
void beginFrame();
|
||||
void endFrame();
|
||||
void renderFrame(const std::function<void(gpu::Batch&)>& = [](gpu::Batch&) {});
|
||||
std::vector<gpu::TexturePointer> loadTestTextures() const;
|
||||
std::vector<std::pair<gpu::TexturePointer, glm::ivec2>> loadTestTextures() const;
|
||||
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <ktx/KTX.h>
|
||||
#include <gpu/Texture.h>
|
||||
#include <image/Image.h>
|
||||
#include <image/TextureProcessing.h>
|
||||
|
||||
|
||||
QTEST_GUILESS_MAIN(KtxTests)
|
||||
|
@ -78,8 +79,12 @@ void KtxTests::testKtxSerialization() {
|
|||
QImage image(TEST_IMAGE);
|
||||
std::atomic<bool> abortSignal;
|
||||
gpu::TexturePointer testTexture =
|
||||
image::TextureUsage::process2DTextureColorFromImage(std::move(image), TEST_IMAGE.toStdString(), true, abortSignal);
|
||||
auto ktxMemory = gpu::Texture::serialize(*testTexture);
|
||||
image::TextureUsage::process2DTextureColorFromImage(std::move(image), TEST_IMAGE.toStdString(), true, gpu::BackendTarget::GL45, true, abortSignal);
|
||||
if (!testTexture) {
|
||||
qWarning() << "Failed to process2DTextureColorFromImage:" << TEST_IMAGE;
|
||||
QFAIL("Failed to process2DTextureColorFromImage");
|
||||
}
|
||||
auto ktxMemory = gpu::Texture::serialize(*testTexture, glm::ivec2(testTexture->getWidth(), testTexture->getHeight()));
|
||||
QVERIFY(ktxMemory.get());
|
||||
|
||||
// Serialize the image to a file
|
||||
|
|
|
@ -20,7 +20,7 @@ void AABoxCubeTests::raycastOutHitsXMinFace() {
|
|||
// Raycast inside out
|
||||
glm::vec3 corner(0.0f, 0.0f, 0.0f);
|
||||
float size = 1.0f;
|
||||
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.5f, 0.5f, 0.5f);
|
||||
glm::vec3 direction(-1.0f, 0.0f, 0.0f);
|
||||
|
@ -28,8 +28,8 @@ void AABoxCubeTests::raycastOutHitsXMinFace() {
|
|||
BoxFace face;
|
||||
glm::vec3 surfaceNormal;
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face, surfaceNormal);
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, 1.0f / direction, distance, face, surfaceNormal);
|
||||
|
||||
QCOMPARE(intersects, true);
|
||||
QCOMPARE(distance, 0.5f);
|
||||
QCOMPARE(face, MIN_X_FACE);
|
||||
|
@ -39,7 +39,7 @@ void AABoxCubeTests::raycastOutHitsXMaxFace () {
|
|||
// Raycast inside out
|
||||
glm::vec3 corner(0.0f, 0.0f, 0.0f);
|
||||
float size = 1.0f;
|
||||
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.5f, 0.5f, 0.5f);
|
||||
glm::vec3 direction(1.0f, 0.0f, 0.0f);
|
||||
|
@ -47,7 +47,7 @@ void AABoxCubeTests::raycastOutHitsXMaxFace () {
|
|||
BoxFace face;
|
||||
glm::vec3 surfaceNormal;
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face, surfaceNormal);
|
||||
bool intersects = box.findRayIntersection(origin, direction, 1.0f / direction, distance, face, surfaceNormal);
|
||||
|
||||
QCOMPARE(intersects, true);
|
||||
QCOMPARE(distance, 0.5f);
|
||||
|
@ -57,7 +57,7 @@ void AABoxCubeTests::raycastInHitsXMinFace () {
|
|||
// Raycast outside in
|
||||
glm::vec3 corner(0.5f, 0.0f, 0.0f);
|
||||
float size = 0.5f;
|
||||
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.25f, 0.25f, 0.25f);
|
||||
glm::vec3 direction(1.0f, 0.0f, 0.0f);
|
||||
|
@ -65,7 +65,7 @@ void AABoxCubeTests::raycastInHitsXMinFace () {
|
|||
BoxFace face;
|
||||
glm::vec3 surfaceNormal;
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face, surfaceNormal);
|
||||
bool intersects = box.findRayIntersection(origin, direction, 1.0f / direction, distance, face, surfaceNormal);
|
||||
|
||||
QCOMPARE(intersects, true);
|
||||
QCOMPARE(distance, 0.25f);
|
||||
|
|
|
@ -1,19 +1,32 @@
|
|||
# This doesn't link properly, and it seems it's built against some older library
|
||||
# not being in use anymore. At least some of the stuff in the test doesn't seem
|
||||
# to match anything in the build tree. If built, it fails with:
|
||||
|
||||
# [ 91%] Linking CXX executable shaders-ShaderTests
|
||||
# /usr/bin/ld: CMakeFiles/shaders-ShaderTests.dir/src/ShaderTests.cpp.o: in function `rebuildSource(shader::Dialect, shader::Variant, shader::Source const&)':
|
||||
# /home/dale/git/vircadia/overte/tests/shaders/src/ShaderTests.cpp:354: undefined reference to `glslang::TShader::TShader(EShLanguage)'
|
||||
# /usr/bin/ld: /home/dale/git/vircadia/overte/tests/shaders/src/ShaderTests.cpp:358: undefined reference to `glslang::TShader::setStrings(char const* const*, int)'
|
||||
# /usr/bin/ld: /home/dale/git/vircadia/overte/tests/shaders/src/ShaderTests.cpp:417: undefined reference to `glslang::TShader::~TShader()'
|
||||
# /usr/bin/ld: /home/dale/git/vircadia/overte/tests/shaders/src/ShaderTests.cpp:417: undefined reference to `glslang::TShader::~TShader()'
|
||||
# collect2: error: ld returned 1 exit status
|
||||
#
|
||||
# So I've disabled the entire thing, but left the code around as a reference in case it can be fixed.
|
||||
|
||||
# Declare dependencies
|
||||
macro (setup_testcase_dependencies)
|
||||
# link in the shared libraries
|
||||
link_hifi_libraries(shared test-utils gpu shaders gl ${PLATFORM_GL_BACKEND})
|
||||
#target_spirv()
|
||||
|
||||
find_package(spirv_cross_core REQUIRED)
|
||||
find_package(spirv_cross_reflect REQUIRED)
|
||||
find_package(spirv_cross_glsl REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} PRIVATE $<TARGET_PROPERTY:spirv-cross-core,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
target_include_directories(${TARGET_NAME} PRIVATE $ENV{VULKAN_SDK}/Include)
|
||||
|
||||
|
||||
package_libraries_for_deployment()
|
||||
endmacro ()
|
||||
|
||||
setup_hifi_testcase(Gui)
|
||||
#macro (setup_testcase_dependencies)
|
||||
# # link in the shared libraries
|
||||
# link_hifi_libraries(shared test-utils gpu shaders gl ${PLATFORM_GL_BACKEND})
|
||||
# #target_spirv()
|
||||
#
|
||||
# find_package(spirv_cross_core REQUIRED)
|
||||
# find_package(spirv_cross_reflect REQUIRED)
|
||||
# find_package(spirv_cross_glsl REQUIRED)
|
||||
# target_include_directories(${TARGET_NAME} PRIVATE $<TARGET_PROPERTY:spirv-cross-core,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
# target_include_directories(${TARGET_NAME} PRIVATE $ENV{VULKAN_SDK}/Include)
|
||||
#
|
||||
#
|
||||
# package_libraries_for_deployment()
|
||||
#endmacro ()
|
||||
#
|
||||
#setup_hifi_testcase(Gui)
|
||||
|
||||
|
|
|
@ -360,7 +360,9 @@ void rebuildSource(shader::Dialect dialect, shader::Variant variant, const shade
|
|||
shader.setEnvClient(EShClientVulkan, EShTargetVulkan_1_1);
|
||||
shader.setEnvTarget(EShTargetSpv, EShTargetSpv_1_3);
|
||||
|
||||
bool success = shader.parse(&glslCompilerResources, 450, false, messages);
|
||||
//bool success = shader.parse(&glslCompilerResources, 450, false, messages);
|
||||
QSKIP("Something wasn't fully implemented here, please fix me!");
|
||||
bool success = false;
|
||||
if (!success) {
|
||||
qWarning() << "Failed to parse shader " << shaderName.c_str();
|
||||
qWarning() << shader.getInfoLog();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
# Declare dependencies
|
||||
macro (setup_testcase_dependencies)
|
||||
link_hifi_libraries(shared workload)
|
||||
link_hifi_libraries(shared workload shaders)
|
||||
package_libraries_for_deployment()
|
||||
endmacro ()
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@ const float INV_SQRT_3 = 1.0f / sqrtf(3.0f);
|
|||
QTEST_MAIN(SpaceTests)
|
||||
|
||||
void SpaceTests::testOverlaps() {
|
||||
QSKIP("Test removed due to being completely broken, please fix me!");
|
||||
|
||||
#if 0
|
||||
// This seems to be completely broken and doesn't work on the current code.
|
||||
// Leaving it as a historical reference, in case it's useful later.
|
||||
|
||||
workload::Space space;
|
||||
using Changes = std::vector<workload::Space::Change>;
|
||||
using Views = std::vector<workload::Space::View>;
|
||||
|
@ -106,6 +112,7 @@ void SpaceTests::testOverlaps() {
|
|||
QVERIFY(changes.size() == 0);
|
||||
QVERIFY(space.getNumObjects() == 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MANUAL_TEST
|
||||
|
|
Loading…
Reference in a new issue