Added GitHub Actions jobs to build with OpenGL ES on Linux GCC.

This commit is contained in:
binary1248 2023-10-06 15:59:27 +02:00 committed by Chris Thrasher
parent fe778028a2
commit 90ebf68ba3
3 changed files with 32 additions and 17 deletions

View File

@ -68,6 +68,12 @@ jobs:
config: { name: Static DRM, flags: -GNinja -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE } config: { name: Static DRM, flags: -GNinja -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE }
- platform: { name: Linux GCC, os: ubuntu-22.04 } - platform: { name: Linux GCC, os: ubuntu-22.04 }
config: { name: Shared DRM, flags: -GNinja -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE } config: { name: Shared DRM, flags: -GNinja -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE }
- platform: { name: Linux GCC, os: ubuntu-22.04 }
config: { name: OpenGL ES, flags: -GNinja -DSFML_OPENGL_ES=ON -DSFML_RUN_DISPLAY_TESTS=ON }
type: { name: Release }
- platform: { name: Linux GCC, os: ubuntu-22.04 }
config: { name: OpenGL ES, flags: -GNinja -DSFML_OPENGL_ES=ON -DSFML_RUN_DISPLAY_TESTS=ON }
type: { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug -DSFML_ENABLE_COVERAGE=TRUE }
- platform: { name: macOS , os: macos-12 } - platform: { name: macOS , os: macos-12 }
config: { name: System Deps, flags: -GNinja -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_SYSTEM_DEPS=TRUE } config: { name: System Deps, flags: -GNinja -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_SYSTEM_DEPS=TRUE }
steps: steps:

View File

@ -341,7 +341,7 @@ bool RenderTextureImplFBO::create(const Vector2u& size, unsigned int textureId,
if (createFrameBuffer()) if (createFrameBuffer())
{ {
// Restore previously bound framebuffer // Restore previously bound framebuffer
glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, frameBuffer)); glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, static_cast<GLuint>(frameBuffer)));
return true; return true;
} }

View File

@ -231,6 +231,12 @@ bool Texture::create(const Vector2u& size)
m_sRgb = false; m_sRgb = false;
} }
#ifndef SFML_OPENGL_ES
const GLint textureWrapParam = m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP);
#else
const GLint textureWrapParam = m_isRepeated ? GL_REPEAT : GLEXT_GL_CLAMP_TO_EDGE;
#endif
// Initialize the texture // Initialize the texture
glCheck(glBindTexture(GL_TEXTURE_2D, m_texture)); glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
glCheck(glTexImage2D(GL_TEXTURE_2D, glCheck(glTexImage2D(GL_TEXTURE_2D,
@ -242,12 +248,8 @@ bool Texture::create(const Vector2u& size)
GL_RGBA, GL_RGBA,
GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE,
nullptr)); nullptr));
glCheck(glTexParameteri(GL_TEXTURE_2D, glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureWrapParam));
GL_TEXTURE_WRAP_S, glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureWrapParam));
m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
glCheck(glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T,
m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_isSmooth ? GL_LINEAR : GL_NEAREST)); glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, m_isSmooth ? GL_LINEAR : GL_NEAREST));
glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_isSmooth ? GL_LINEAR : GL_NEAREST)); glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, m_isSmooth ? GL_LINEAR : GL_NEAREST));
m_cacheId = TextureImpl::getUniqueId(); m_cacheId = TextureImpl::getUniqueId();
@ -388,10 +390,16 @@ Image Texture::copyToImage() const
glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, frameBuffer)); glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, frameBuffer));
glCheck(GLEXT_glFramebufferTexture2D(GLEXT_GL_FRAMEBUFFER, GLEXT_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0)); glCheck(GLEXT_glFramebufferTexture2D(GLEXT_GL_FRAMEBUFFER, GLEXT_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0));
glCheck(glReadPixels(0, 0, m_size.x, m_size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data())); glCheck(glReadPixels(0,
0,
static_cast<GLsizei>(m_size.x),
static_cast<GLsizei>(m_size.y),
GL_RGBA,
GL_UNSIGNED_BYTE,
pixels.data()));
glCheck(GLEXT_glDeleteFramebuffers(1, &frameBuffer)); glCheck(GLEXT_glDeleteFramebuffers(1, &frameBuffer));
glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, previousFrameBuffer)); glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, static_cast<GLuint>(previousFrameBuffer)));
} }
#else #else
@ -745,15 +753,16 @@ void Texture::setRepeated(bool repeated)
} }
} }
#ifndef SFML_OPENGL_ES
const GLint textureWrapParam = m_isRepeated ? GL_REPEAT
: (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP);
#else
const GLint textureWrapParam = m_isRepeated ? GL_REPEAT : GLEXT_GL_CLAMP_TO_EDGE;
#endif
glCheck(glBindTexture(GL_TEXTURE_2D, m_texture)); glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
glCheck( glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, textureWrapParam));
glTexParameteri(GL_TEXTURE_2D, glCheck(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, textureWrapParam));
GL_TEXTURE_WRAP_S,
m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
glCheck(
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T,
m_isRepeated ? GL_REPEAT : (textureEdgeClamp ? GLEXT_GL_CLAMP_TO_EDGE : GLEXT_GL_CLAMP)));
} }
} }
} }