Skip to content

Commit

Permalink
Merge pull request #55 from AlpineMapsOrg/windows_ci
Browse files Browse the repository at this point in the history
Windows ci works for radix and nucleus tests
  • Loading branch information
adam-ce authored Nov 24, 2023
2 parents ac92ac1 + 1fa1e29 commit b870df9
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 29 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
#os: [ubuntu-latest, windows-latest]
#os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest]
#os: [windows-latest]
build_type: [Release]
include:
#- os: windows-latest
#arch: 'win64_mingw'
#host: 'windows'
- os: windows-latest
arch: 'win64_msvc2019_64'
host: 'windows'
shell: 'powershell'
#shell: 'cmd'
#shell: 'msys2 {0}'
- os: ubuntu-latest
Expand Down Expand Up @@ -74,7 +76,7 @@ jobs:
- name: Build
run: cmake --build ./build

- name: Test on Linux
- name: Unittests on Linux
if: matrix.os == 'ubuntu-latest'
env:
QT_QPA_PLATFORM: xcb
Expand All @@ -86,23 +88,12 @@ jobs:
#Xvfb :1 -screen 0 1024x768x16 &
#./build/unittests/gl_engine/unittests_gl_engine # doesn't work
- name: Test radix on Windows
- name: Unittests on Windows
if: matrix.os == 'windows-latest'
env:
QT_DEBUG_PLUGINS: 1
run: |
./build/alp_external/radix/unittests/unittests_radix.exe
- name: Test nucleus on Windows
if: matrix.os == 'windows-latest'
env:
QT_DEBUG_PLUGINS: 1
run: |
./build/unittests/unittests_nucleus.exe
#./build/unittests/unittests_gl_engine.exe
- name: Test gl_engine on Windows
if: matrix.os == 'windows-latest'
env:
QT_DEBUG_PLUGINS: 1
run: |
./build/unittests/unittests_gl_engine.exe
11 changes: 6 additions & 5 deletions gl_engine/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,17 @@ void Framebuffer::reset_fbo()
QOpenGLExtraFunctions* f = QOpenGLContext::currentContext()->extraFunctions();
//QOpenGLFunctions* f = QOpenGLContext::currentContext()->functions();
f->glBindFramebuffer(GL_FRAMEBUFFER, m_frame_buffer);
unsigned int draw_attachments[m_colour_textures.size()];
for (int i = 0; i < m_colour_textures.size(); i++) {
draw_attachments[i] = GL_COLOR_ATTACHMENT0 + i;
f->glFramebufferTexture2D(GL_FRAMEBUFFER, draw_attachments[i], GL_TEXTURE_2D, m_colour_textures[i]->textureId(), 0);
// unsigned int draw_attachments[m_colour_textures.size()];
std::vector<unsigned> draw_attachments;
for (unsigned i = 0; i < m_colour_textures.size(); i++) {
draw_attachments.push_back(GL_COLOR_ATTACHMENT0 + i);
f->glFramebufferTexture2D(GL_FRAMEBUFFER, draw_attachments.back(), GL_TEXTURE_2D, m_colour_textures[i]->textureId(), 0);
}
if (m_depth_format != DepthFormat::None)
f->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depth_texture->textureId(), 0);

// Tell OpenGL how many attachments to use
f->glDrawBuffers(m_colour_textures.size(), draw_attachments);
f->glDrawBuffers(m_colour_textures.size(), draw_attachments.data());

assert(f->glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
}
Expand Down
10 changes: 6 additions & 4 deletions unittests/gl_engine/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,15 @@ TEST_CASE("gl framebuffer")
}

// Create an array filled with the value 400 for each RG component
GLushort data[width * height * 2];
std::vector<GLushort> data;
data.resize(width * height * 2);
for (int i = 0; i < width * height * 2; i += 2) {
data[i] = 400; // R component
data[i + 1] = 400; // G component
}

// Define the texture image
f->glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16UI, width, height, 0, GL_RG_INTEGER, GL_UNSIGNED_SHORT, data);
f->glTexImage2D(GL_TEXTURE_2D, 0, GL_RG16UI, width, height, 0, GL_RG_INTEGER, GL_UNSIGNED_SHORT, data.data());
error = f->glGetError();
CHECK(error == GL_NO_ERROR);
if (error != GL_NO_ERROR) {
Expand Down Expand Up @@ -170,14 +171,15 @@ TEST_CASE("gl framebuffer")
texture.allocateStorage(QOpenGLTexture::PixelFormat::RG_Integer, QOpenGLTexture::PixelType::UInt16);

// Fill the array with the value 400 for each RG component
GLushort data[width * height * 2];
std::vector<GLushort> data;
data.resize(width * height * 2);
for (int i = 0; i < width * height * 2; i += 2) {
data[i] = 400; // R component
data[i + 1] = 400; // G component
}

// Upload the data to the texture
texture.setData(0, QOpenGLTexture::PixelFormat::RG_Integer, QOpenGLTexture::PixelType::UInt16, data);
texture.setData(0, QOpenGLTexture::PixelFormat::RG_Integer, QOpenGLTexture::PixelType::UInt16, data.data());

// Set the texture parameters
texture.setMinificationFilter(QOpenGLTexture::Nearest);
Expand Down
2 changes: 1 addition & 1 deletion unittests/nucleus/nucleus_tile_scheduler_rate_limiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ constexpr auto timing_multiplicator = 200;
#elif defined __ANDROID__
constexpr auto timing_multiplicator = 50;
#else
constexpr auto timing_multiplicator = 2;
constexpr auto timing_multiplicator = 10;
#endif

TEST_CASE("nucleus/tile_scheduler/rate limiter")
Expand Down
2 changes: 2 additions & 0 deletions unittests/nucleus/nucleus_tile_scheduler_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ std::vector<nucleus::tile_scheduler::tile_types::TileQuad> example_quads_many()

#ifdef __EMSCRIPTEN__
constexpr auto timing_multiplicator = 10;
#elif defined _MSC_VER
constexpr auto timing_multiplicator = 20;
#else
constexpr auto timing_multiplicator = 1;
#endif
Expand Down
2 changes: 2 additions & 0 deletions unittests/nucleus/nucleus_utils_stopwatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#ifdef __EMSCRIPTEN__
constexpr auto timing_multiplicator = 10ll;
#elif defined _MSC_VER
constexpr auto timing_multiplicator = 10ll;
#else
constexpr auto timing_multiplicator = 5ll;
#endif
Expand Down

0 comments on commit b870df9

Please sign in to comment.