diff --git a/doomsday/cmake/Config.cmake b/doomsday/cmake/Config.cmake index 2751d8dc3e..dd16ad2aa5 100644 --- a/doomsday/cmake/Config.cmake +++ b/doomsday/cmake/Config.cmake @@ -46,6 +46,8 @@ elseif (APPLE) include (PlatformMacx) elseif (WIN32) include (PlatformWindows) +elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND EXISTS /opt/vc/include/bcm_host.h) + include (PlatformRaspberryPi) else () include (PlatformUnix) endif () diff --git a/doomsday/cmake/PlatformRaspberryPi.cmake b/doomsday/cmake/PlatformRaspberryPi.cmake new file mode 100644 index 0000000000..32d2e7b467 --- /dev/null +++ b/doomsday/cmake/PlatformRaspberryPi.cmake @@ -0,0 +1,47 @@ +# Raspberry Pi (no X11) +include (PlatformGenericUnix) + +set (RASPBERRYPI YES) +set (DE_PLATFORM_SUFFIX raspi) +set (DE_AMETHYST_PLATFORM UNIX) + +set (DE_BASE_DIR "" CACHE STRING "Base directory path (defaults to {prefix}/${DE_INSTALL_DATA_DIR})") +set (DE_LIBRARY_DIR "" CACHE STRING "Plugin directory path (defaults to {prefix}/${DE_INSTALL_PLUGIN_DIR})") + +add_definitions ( + -DDE_RASPBERRYPI + -D__USE_BSD + -D_GNU_SOURCE=1 + -DDE_PLATFORM_ID="source" +) + +if (CMAKE_COMPILER_IS_GNUCXX) + set (cxxOpts + -Wno-psabi + ) + foreach (cxxOpt ${cxxOpts}) + append_unique (CMAKE_CXX_FLAGS ${cxxOpt}) + endforeach (cxxOpt) + + # The tree FRE optimization causes crashes with GCC 6 (Yakkety). + append_unique (CMAKE_CXX_FLAGS_RELEASE -fno-tree-fre) + append_unique (CMAKE_CXX_FLAGS_RELWITHDEBINFO -fno-tree-fre) + append_unique (CMAKE_CXX_FLAGS_MINSIZEREL -fno-tree-fre) +endif () + +# All symbols are hidden by default. +append_unique (CMAKE_C_FLAGS "-fvisibility=hidden") +append_unique (CMAKE_CXX_FLAGS "-fvisibility=hidden") + +# Broadcom Videocore IV OpenGL ES library. +if (NOT TARGET bcm) + add_library (bcm INTERFACE) + target_link_libraries (bcm INTERFACE + -L/opt/vc/lib + /opt/vc/lib/libGLESv2_static.a + brcmEGL + brcmGLESv2 + vcos + m + ) +endif () diff --git a/doomsday/cmake/PlatformUnix.cmake b/doomsday/cmake/PlatformUnix.cmake index eb9c5e9535..798fbb06d0 100644 --- a/doomsday/cmake/PlatformUnix.cmake +++ b/doomsday/cmake/PlatformUnix.cmake @@ -29,7 +29,7 @@ else () endif () if (CMAKE_COMPILER_IS_GNUCXX) - foreach (cxxOpt -Wno-deprecated-copy;-Wno-class-memaccess;-Wno-address-of-packed-member) + foreach (cxxOpt -Wno-deprecated-copy;-Wno-class-memaccess;-Wno-address-of-packed-member;-Wno-psabi) append_unique (CMAKE_CXX_FLAGS ${cxxOpt}) endforeach (cxxOpt) diff --git a/doomsday/libs/core/CMakeLists.txt b/doomsday/libs/core/CMakeLists.txt index 9f1a20754c..0eedd1b633 100644 --- a/doomsday/libs/core/CMakeLists.txt +++ b/doomsday/libs/core/CMakeLists.txt @@ -88,6 +88,7 @@ if (UNIX AND NOT APPLE) -DDE_BASE_DIR="${baseDir}" -DDE_LIBRARY_DIR="${libDir}" ) + target_link_libraries (libcore PRIVATE atomic) endif () if (WIN32) # timeBeginPeriod, timeEndPeriod diff --git a/doomsday/libs/doomsday/src/filesys/zip.cpp b/doomsday/libs/doomsday/src/filesys/zip.cpp index 6d44364df1..611e1be7d4 100644 --- a/doomsday/libs/doomsday/src/filesys/zip.cpp +++ b/doomsday/libs/doomsday/src/filesys/zip.cpp @@ -627,7 +627,7 @@ size_t Zip::readLump(int lumpIndex, uint8_t *buffer, size_t startOffset, LOGDEV_RES_XVERBOSE("\"%s:%s\" (%u bytes%s) [%u +%u]", NativePath(composePath()).pretty() << NativePath(lumpFile.composePath()).pretty() - << (unsigned long) lumpFile.size() + << dsize(lumpFile.size()) << (lumpFile.isCompressed()? ", compressed" : "") << startOffset << length); diff --git a/doomsday/libs/gui/CMakeLists.txt b/doomsday/libs/gui/CMakeLists.txt index 50d154cde2..d84320ff54 100644 --- a/doomsday/libs/gui/CMakeLists.txt +++ b/doomsday/libs/gui/CMakeLists.txt @@ -38,29 +38,36 @@ deng_merge_sources (text src/text/*.cpp) deng_merge_sources (vr src/vr/*.cpp) deng_merge_sources (widgets src/widgets/*.cpp) -list (APPEND SOURCES src/dialogs/filedialog_${DE_PLATFORM_SUFFIX}) +if (DE_X11 OR RASPBERRYPI) + list (APPEND SOURCES src/dialogs/filedialog_generic.cpp) +else () + list (APPEND SOURCES src/dialogs/filedialog_${DE_PLATFORM_SUFFIX}) +endif () deng_add_library (libgui ${SOURCES} ${HEADERS}) if (DE_OPENGL_API STREQUAL "3.3") target_compile_definitions (libgui PUBLIC -DDE_OPENGL=330) message (STATUS "Using OpenGL 3.3") + set (DE_HAVE_OPENGL_ES NO) elseif (DE_OPENGL_API STREQUAL "GLES3") target_compile_definitions (libgui PUBLIC -DDE_OPENGL_ES=30) message (STATUS "Using OpenGL ES 3.0") + set (DE_HAVE_OPENGL_ES YES) elseif (DE_OPENGL_API STREQUAL "GLES2") target_compile_definitions (libgui PUBLIC -DDE_OPENGL_ES=20) message (STATUS "Using OpenGL ES 2.0") + set (DE_HAVE_OPENGL_ES YES) else () message (FATAL_ERROR "Invalid value for OpenGL API: ${DE_OPENGL_API}") endif () # Link libraries. deng_link_libraries (libgui PUBLIC DengCore) -target_link_libraries (libgui - PUBLIC glbinding::glbinding - PRIVATE SDL2 stb assimp -) +target_link_libraries (libgui PRIVATE SDL2 stb assimp) +if (NOT DE_HAVE_OPENGL_ES) + target_link_libraries (libgui PUBLIC glbinding::glbinding) +endif () if (WIN32) target_link_libraries (libgui PUBLIC opengl32.lib) # Direct2D was used for DPI information. @@ -77,6 +84,9 @@ elseif (APPLE) link_framework (libgui PRIVATE Cocoa) link_framework (libgui PRIVATE OpenGL) endif () +if (RASPBERRYPI) + target_link_libraries (libgui PRIVATE bcm) +endif () deng_deploy_library (libgui DengGui) diff --git a/doomsday/libs/gui/include/de/graphics/glbuffer.h b/doomsday/libs/gui/include/de/graphics/glbuffer.h index 1ad38f7952..e418e5867a 100644 --- a/doomsday/libs/gui/include/de/graphics/glbuffer.h +++ b/doomsday/libs/gui/include/de/graphics/glbuffer.h @@ -358,7 +358,9 @@ class LIBGUI_PUBLIC GLBuffer : public Asset enum Type { VertexArray, // array buffer, or an array buffer with element array buffer +#if defined (DE_HAVE_TEXTURE_BUFFER) Texture, // texture buffer +#endif }; public: diff --git a/doomsday/libs/gui/include/de/graphics/glframebuffer.h b/doomsday/libs/gui/include/de/graphics/glframebuffer.h index 12c810c0da..a0d1202231 100644 --- a/doomsday/libs/gui/include/de/graphics/glframebuffer.h +++ b/doomsday/libs/gui/include/de/graphics/glframebuffer.h @@ -45,15 +45,19 @@ class LIBGUI_PUBLIC GLFramebuffer : public Asset enum Flag { Color0 = 0x001, ///< Target has a color attachment. +#if defined (DE_HAVE_COLOR_ATTACHMENTS) Color1 = 0x002, Color2 = 0x004, Color3 = 0x008, +#endif Depth = 0x100, ///< Target has a depth attachment. Stencil = 0x200, ///< Target has a stencil attachment. Changed = 0x1000, ///< Draw/clear has occurred on the target. +#if defined (DE_HAVE_COLOR_ATTACHMENTS) ColorAny = Color0 | Color1 | Color2 | Color3, +#endif ColorDepth = Color0 | Depth, ColorDepthStencil = Color0 | Depth | Stencil, ColorStencil = Color0 | Stencil, @@ -138,18 +142,22 @@ class LIBGUI_PUBLIC GLFramebuffer : public Asset * Reconfigures the render target with two textures, one for the color * values and one for depth/stencil values. * - * If @a colorTex or @a depthStencilTex is omitted, a renderbuffer will be - * created in its place (depending on @a missingRenderBuffers). + * If @a colorTex, @a depthTex, or @a stencilTex is omitted, a renderbuffer + * will be created in its place (depending on @a missingRenderBuffers). + * @a depthTex and @a stencilTex can point to the same texture, in which + * case a combined depth/stencil attachment is used. * * Any previous attachments are released. * * @param colorTex Texture for color values. - * @param depthStencilTex Texture for depth/stencil values. + * @param depthTex Texture for depth values. + * @param stencilTex Texture for stencil values. * @param missingRenderBuffers Create renderbuffers for attachments where * texture has not been specified. */ void configure(GLTexture *colorTex, - GLTexture *depthStencilTex, + GLTexture *depthTex, + GLTexture *stencilTex, Flags missingRenderBuffers = ColorDepthStencil); /** @@ -159,12 +167,14 @@ class LIBGUI_PUBLIC GLFramebuffer : public Asset * created in its place (depending on @a missingRenderBuffers). * * @param colorTextures Textures for color attachments. - * @param depthStencilTex Texture for depth/stencil values. + * @param depthTex Texture for depth values. + * @param stencilTex Texture for stencil values. * @param missingRenderBuffers Create renderbuffers for attachments where * texture has not been specified. */ void configure(const List &colorTextures, - GLTexture * depthStencilTex, + GLTexture * depthTex, + GLTexture * stencilTex, Flags missingRenderBuffers = ColorDepthStencil); /** diff --git a/doomsday/libs/gui/include/de/graphics/opengl.h b/doomsday/libs/gui/include/de/graphics/opengl.h index 1f0654103f..773f066f9b 100644 --- a/doomsday/libs/gui/include/de/graphics/opengl.h +++ b/doomsday/libs/gui/include/de/graphics/opengl.h @@ -30,12 +30,6 @@ # include # include using namespace gl33core; -//# include -//# include -//# define QOpenGLFunctions_Doomsday QOpenGLFunctions_3_3_Core -//# ifndef GL_VERSION_3_3 -//# error "OpenGL 3.3 (or newer) headers not found" -//# endif # define DE_HAVE_TIMER_QUERY #elif (DE_OPENGL_ES == 30) @@ -44,9 +38,7 @@ using namespace gl33core; # define QOpenGLFunctions_Doomsday QOpenGLExtraFunctions #elif (DE_OPENGL_ES == 20) -# include -# include -# define QOpenGLFunctions_Doomsday QOpenGLFunctions +# include #endif // Defined in GLES2. @@ -58,6 +50,9 @@ using namespace gl33core; # define DE_HAVE_VAOS # define DE_HAVE_INSTANCES # define DE_HAVE_BLIT_FRAMEBUFFER +# define DE_HAVE_COLOR_ATTACHMENTS +# define DE_HAVE_DEPTH_STENCIL_ATTACHMENT +# define DE_HAVE_TEXTURE_BUFFER #endif #endif // LIBGUI_GRAPHICS_OPENGL_H diff --git a/doomsday/libs/gui/src/dialogs/filedialog_x11.cpp b/doomsday/libs/gui/src/dialogs/filedialog_generic.cpp similarity index 98% rename from doomsday/libs/gui/src/dialogs/filedialog_x11.cpp rename to doomsday/libs/gui/src/dialogs/filedialog_generic.cpp index f3d037a7e9..d86b826073 100644 --- a/doomsday/libs/gui/src/dialogs/filedialog_x11.cpp +++ b/doomsday/libs/gui/src/dialogs/filedialog_generic.cpp @@ -1,4 +1,4 @@ -/** @file filedialog_x11.cpp Native file chooser dialog. +/** @file filedialog_generic.cpp File chooser dialog using Doomsday widgets. * * @authors Copyright (c) 2019 Jaakko Keränen * diff --git a/doomsday/libs/gui/src/graphics/glbuffer.cpp b/doomsday/libs/gui/src/graphics/glbuffer.cpp index 5513075411..ced4330811 100644 --- a/doomsday/libs/gui/src/graphics/glbuffer.cpp +++ b/doomsday/libs/gui/src/graphics/glbuffer.cpp @@ -140,7 +140,9 @@ DE_PIMPL(GLBuffer) Impl(Public *i, Type type) : Base(i) +#if defined (DE_HAVE_TEXTURE_BUFFER) , bufferType(type == Texture? GL_TEXTURE_BUFFER : GL_ARRAY_BUFFER) +#endif {} ~Impl() @@ -215,15 +217,28 @@ DE_PIMPL(GLBuffer) { switch (u) { - case Static: return GL_STATIC_DRAW; - case StaticRead: return GL_STATIC_READ; - case StaticCopy: return GL_STATIC_COPY; - case Dynamic: return GL_DYNAMIC_DRAW; - case DynamicRead: return GL_DYNAMIC_READ; - case DynamicCopy: return GL_DYNAMIC_COPY; - case Stream: return GL_STREAM_DRAW; - case StreamRead: return GL_STREAM_READ; - case StreamCopy: return GL_STREAM_COPY; +#if defined (DE_OPENGL) + case Static: return GL_STATIC_DRAW; + case StaticRead: return GL_STATIC_READ; + case StaticCopy: return GL_STATIC_COPY; + case Dynamic: return GL_DYNAMIC_DRAW; + case DynamicRead: return GL_DYNAMIC_READ; + case DynamicCopy: return GL_DYNAMIC_COPY; + case Stream: return GL_STREAM_DRAW; + case StreamRead: return GL_STREAM_READ; + case StreamCopy: return GL_STREAM_COPY; +#endif +#if defined (DE_OPENGL_ES) + case Static: return GL_STATIC_DRAW; + case StaticRead: return GL_STATIC_DRAW; + case StaticCopy: return GL_STATIC_DRAW; + case Dynamic: return GL_DYNAMIC_DRAW; + case DynamicRead: return GL_DYNAMIC_DRAW; + case DynamicCopy: return GL_DYNAMIC_DRAW; + case Stream: return GL_STREAM_DRAW; + case StreamRead: return GL_STREAM_DRAW; + case StreamCopy: return GL_STREAM_DRAW; +#endif } DE_ASSERT_FAIL("Invalid glUsage"); return GL_STATIC_DRAW; @@ -520,12 +535,13 @@ void GLBuffer::draw(const DrawRanges *ranges) const { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, d->idxName); DE_ASSERT(GLProgram::programInUse()->validate()); +#if defined (DE_OPENGL) if (drawRanges.size() == 1) { glDrawElements(d->prim, - drawRanges.count[0], - GL_UNSIGNED_SHORT, - reinterpret_cast(dintptr(drawRanges.first[0] * 2))); + drawRanges.count[0], + GL_UNSIGNED_SHORT, + reinterpret_cast(dintptr(drawRanges.first[0] * 2))); LIBGUI_ASSERT_GL_OK(); } else @@ -537,20 +553,32 @@ void GLBuffer::draw(const DrawRanges *ranges) const } glMultiDrawElements(d->prim, - drawRanges.count.data(), - GL_UNSIGNED_SHORT, - indices, + drawRanges.count.data(), + GL_UNSIGNED_SHORT, + indices, GLsizei(drawRanges.size())); LIBGUI_ASSERT_GL_OK(); delete [] indices; } +#endif +#if defined (DE_OPENGL_ES) + for (duint i = 0; i < drawRanges.size(); ++i) + { + glDrawElements(d->prim, + drawRanges.count[i], + GL_UNSIGNED_SHORT, + reinterpret_cast(dintptr(drawRanges.first[i] * 2))); + LIBGUI_ASSERT_GL_OK(); + } +#endif glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } else { DE_ASSERT(GLProgram::programInUse()->validate()); +#if defined (DE_OPENGL) if (drawRanges.size() == 1) { glDrawArrays(d->prim, drawRanges.first[0], drawRanges.count[0]); @@ -564,6 +592,14 @@ void GLBuffer::draw(const DrawRanges *ranges) const GLsizei(drawRanges.size())); LIBGUI_ASSERT_GL_OK(); } +#endif +#if defined (DE_OPENGL_ES) + for (duint i = 0; i < drawRanges.size(); ++i) + { + glDrawArrays(d->prim, drawRanges.first[i], drawRanges.count[i]); + LIBGUI_ASSERT_GL_OK(); + } +#endif } ++drawCounter; diff --git a/doomsday/libs/gui/src/graphics/glframebuffer.cpp b/doomsday/libs/gui/src/graphics/glframebuffer.cpp index 453246f4be..5f9e731abb 100644 --- a/doomsday/libs/gui/src/graphics/glframebuffer.cpp +++ b/doomsday/libs/gui/src/graphics/glframebuffer.cpp @@ -33,14 +33,22 @@ namespace de { static const Vec2ui nullSize; static GLuint defaultFramebuffer = 0; +#if defined (DE_HAVE_COLOR_ATTACHMENTS) +static const int MAX_COLOR_ATTACHMENTS = 4; +#else +static const int MAX_COLOR_ATTACHMENTS = 1; +#endif + DE_PIMPL(GLFramebuffer) , DE_OBSERVES(Asset, Deletion) { enum AttachmentId { ColorBuffer0, +#if defined (DE_HAVE_COLOR_ATTACHMENTS) ColorBuffer1, ColorBuffer2, ColorBuffer3, +#endif DepthBuffer, StencilBuffer, DepthStencilBuffer, @@ -54,6 +62,7 @@ DE_PIMPL(GLFramebuffer) case GL_COLOR_ATTACHMENT0: return ColorBuffer0; +#if defined (DE_HAVE_COLOR_ATTACHMENTS) case GL_COLOR_ATTACHMENT1: return ColorBuffer1; @@ -62,6 +71,7 @@ DE_PIMPL(GLFramebuffer) case GL_COLOR_ATTACHMENT3: return ColorBuffer3; +#endif case GL_DEPTH_ATTACHMENT: return DepthBuffer; @@ -69,8 +79,10 @@ DE_PIMPL(GLFramebuffer) case GL_STENCIL_ATTACHMENT: return StencilBuffer; +#if defined (DE_HAVE_DEPTH_STENCIL_ATTACHMENT) case GL_DEPTH_STENCIL_ATTACHMENT: return DepthStencilBuffer; +#endif default: DE_ASSERT_FAIL("Invalid GLFramebuffer attachment"); @@ -85,12 +97,16 @@ DE_PIMPL(GLFramebuffer) DE_ASSERT(!flags.testFlag(ColorDepthStencil)); return flags == Color0? GL_COLOR_ATTACHMENT0 : +#if defined (DE_HAVE_COLOR_ATTACHMENTS) flags == Color1? GL_COLOR_ATTACHMENT1 : flags == Color2? GL_COLOR_ATTACHMENT2 : flags == Color3? GL_COLOR_ATTACHMENT3 : - flags == Depth? GL_DEPTH_ATTACHMENT : +#endif +#if defined (DE_HAVE_DEPTH_STENCIL_ATTACHMENT) + flags == DepthStencil? GL_DEPTH_STENCIL_ATTACHMENT : +#endif flags == Stencil? GL_STENCIL_ATTACHMENT : - GL_DEPTH_STENCIL_ATTACHMENT; + GL_DEPTH_ATTACHMENT; } GLuint fbo; @@ -158,6 +174,7 @@ DE_PIMPL(GLFramebuffer) { return ColorBuffer0; } +#if defined (DE_HAVE_COLOR_ATTACHMENTS) if (flags == Color1) { return ColorBuffer1; @@ -170,6 +187,7 @@ DE_PIMPL(GLFramebuffer) { return ColorBuffer3; } +#endif if (flags == Depth) { return DepthBuffer; @@ -187,9 +205,9 @@ DE_PIMPL(GLFramebuffer) } int colorAttachmentCount() const - { + { int count = 0; - for (int i = 0; i < 4; ++i) + for (int i = 0; i < MAX_COLOR_ATTACHMENTS; ++i) { if (flags & (Color0 << i)) count++; } @@ -235,7 +253,7 @@ DE_PIMPL(GLFramebuffer) DE_ASSERT(tex.isReady()); if (tex.isCubeMap()) { - glFramebufferTexture(GL_FRAMEBUFFER, attachment, tex.glName(), level); + glFramebufferTexture(FRAMEBUFFER_GL, attachment, tex.glName(), level); } else { @@ -307,8 +325,10 @@ DE_PIMPL(GLFramebuffer) attachTexture(*texture, textureAttachment == Color0? GL_COLOR_ATTACHMENT0 : textureAttachment == Depth? GL_DEPTH_ATTACHMENT : - textureAttachment == Stencil? GL_STENCIL_ATTACHMENT : - GL_DEPTH_STENCIL_ATTACHMENT); +#if defined (DE_HAVE_DEPTH_STENCIL_ATTACHMENT) + textureAttachment == DepthStencil? GL_DEPTH_STENCIL_ATTACHMENT : +#endif + GL_STENCIL_ATTACHMENT); } if (size != nullSize) // A non-default target: size must be specified. @@ -336,6 +356,7 @@ DE_PIMPL(GLFramebuffer) glBindRenderbuffer(GL_RENDERBUFFER, 0); } +#if defined (DE_HAVE_DEPTH_STENCIL_ATTACHMENT) void allocDepthStencilRenderBuffers() { if (flags.testFlag(DepthStencil) && !flags.testFlag(SeparateDepthAndStencil) && @@ -362,6 +383,7 @@ DE_PIMPL(GLFramebuffer) #endif } } +#endif // DE_HAVE_DEPTH_STENCIL_ATTACHMENT void deallocRenderBuffers() { @@ -592,19 +614,28 @@ void GLFramebuffer::configure(const Vec2ui &size, Flags flags, int sampleCount) } void GLFramebuffer::configure(GLTexture *colorTex, - GLTexture *depthStencilTex, + GLTexture *depthTex, + GLTexture *stencilTex, Flags missingRenderBuffers) { - configure(List({colorTex}), depthStencilTex, missingRenderBuffers); + configure(List({colorTex}), depthTex, stencilTex, missingRenderBuffers); } void GLFramebuffer::configure(const List &colorTextures, - GLTexture * depthStencilTex, + GLTexture * depthTex, + GLTexture * stencilTex, Flags missingRenderBuffers) { - LOG_AS("GLFramebuffer"); + LOG_AS("GLFramebuffer"); DE_ASSERT(colorTextures.size() >= 1); + + GLTexture *depthStencilTex = (depthTex && stencilTex && depthTex == stencilTex ? + depthTex : nullptr); + +#if !defined (DE_HAVE_DEPTH_STENCIL_ATTACHMENT) + DE_ASSERT(depthStencilTex == nullptr); +#endif d->deallocAndReset(); @@ -619,6 +650,19 @@ void GLFramebuffer::configure(const List &colorTextures, d->flags |= DepthStencil; d->size = depthStencilTex->size(); } + else + { + if (depthTex) + { + d->flags |= Depth; + d->size = depthTex->size(); + } + if (stencilTex) + { + d->flags |= Stencil; + d->size = stencilTex->size(); + } + } d->allocFBO(); @@ -635,6 +679,7 @@ void GLFramebuffer::configure(const List &colorTextures, d->attachRenderbuffer(Impl::ColorBuffer0, GL_RGBA8, GL_COLOR_ATTACHMENT0); } +#if defined (DE_HAVE_DEPTH_STENCIL_ATTACHMENT) // The depth attachment. if (depthStencilTex) { @@ -647,6 +692,29 @@ void GLFramebuffer::configure(const List &colorTextures, d->attachRenderbuffer( Impl::DepthStencilBuffer, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL_ATTACHMENT); } +#else + if (depthTex) + { + DE_ASSERT(depthTex->isReady()); + DE_ASSERT(d->size == depthTex->size()); + d->attachTexture(*depthTex, GL_DEPTH_ATTACHMENT); + } + else if (missingRenderBuffers & Depth) + { + d->attachRenderBuffer(Impl::DepthBuffer, GL_DEPTH24_OES, GL_DEPTH_ATTACHMENT); + } + + if (stencilTex) + { + DE_ASSERT(stencilTex->isReady()); + DE_ASSERT(d->size == stencilTex->size()); + d->attachTexture(*stencilTex, GL_STENCIL_ATTACHMENT); + } + else if (missingRenderBuffers & Stencil) + { + d->attachRenderBuffer(Impl::StencilBuffer, GL_RED, GL_STENCIL_ATTACHMENT); + } +#endif LIBGUI_ASSERT_GL_OK(); @@ -879,9 +947,9 @@ void GLFramebuffer::blit(GLFramebuffer &dest, Flags attachments, gfx::Filter fil #else - qDebug() << "need to implement glBlitFramebuffer:" << glName() << "->" << dest.glName(); - qDebug() << "\t- from texture:" << attachedTexture(Color); - qDebug() << "\t- to texture:" << dest.attachedTexture(Color); + debug("[GLFramebuffer] TODO: need to implement glBlitFramebuffer: %u -> %u", glName(), dest.glName()); + debug("\t- from texture: %d", attachedTexture(Color0)); + debug("\t- to texture: %d", dest.attachedTexture(Color0)); #endif @@ -915,8 +983,8 @@ void GLFramebuffer::blit(gfx::Filter filtering) const #else - qDebug() << "need to implement glBlitFramebuffer:" << glName() << "-> 0"; - qDebug() << "\t- texture:" << attachedTexture(Color); + debug("[GLFramebuffer] TODO: need to implement glBlitFramebuffer: %u -> 0", glName()); + debug("\t- texture: %d", attachedTexture(Color0)); #endif diff --git a/doomsday/libs/gui/src/graphics/glinfo.cpp b/doomsday/libs/gui/src/graphics/glinfo.cpp index 6fc2c02ab6..e0e2060b48 100644 --- a/doomsday/libs/gui/src/graphics/glinfo.cpp +++ b/doomsday/libs/gui/src/graphics/glinfo.cpp @@ -27,8 +27,10 @@ #include #include -#include -#include +#if (DE_OPENGL == 330) +# include +# include +#endif #if defined(DE_DEBUG) //# define DE_ENABLE_OPENGL_DEBUG_LOGGER @@ -263,8 +265,9 @@ DE_PIMPL_NOREF(GLInfo) //, public QOpenGLFunctions_Doomsday if (inited) return; - #if defined (DE_OPENGL_ES) +#if defined (DE_OPENGL_ES) { + /* initializeOpenGLFunctions(); static OpenGLFeature const requiredFeatures[] = @@ -287,8 +290,9 @@ DE_PIMPL_NOREF(GLInfo) //, public QOpenGLFunctions_Doomsday // String("%1").arg(feature)); } } + */ } - #else +#elif defined (DE_OPENGL) { try { @@ -305,7 +309,7 @@ DE_PIMPL_NOREF(GLInfo) //, public QOpenGLFunctions_Doomsday "Failed to initialize OpenGL: " + std::string(x.what())); } } - #endif +#endif inited = true; @@ -318,44 +322,7 @@ DE_PIMPL_NOREF(GLInfo) //, public QOpenGLFunctions_Doomsday ext.NV_texture_barrier = query("GL_NV_texture_barrier"); ext.KHR_debug = query("GL_KHR_debug"); - // #ifdef WIN32 - // { - // //ext.Windows_ARB_multisample = query("WGL_ARB_multisample"); - // ext.Windows_EXT_swap_control = query("WGL_EXT_swap_control"); - - // if (ext.Windows_EXT_swap_control) - // { - // wglSwapIntervalEXT = de::function_cast - // (wglGetProcAddress("wglSwapIntervalEXT")); - // } - // } - // #endif - -// #ifdef DE_X11 -// { -// ext.X11_EXT_swap_control = query("GLX_EXT_swap_control"); -// ext.X11_SGI_swap_control = query("GLX_SGI_swap_control"); -// ext.X11_MESA_swap_control = query("GLX_MESA_swap_control"); - -// if (ext.X11_EXT_swap_control) -// { -// glXSwapIntervalEXT = de::function_cast -// (glXGetProcAddress(reinterpret_cast("glXSwapIntervalEXT"))); -// } -// if (ext.X11_SGI_swap_control) -// { -// glXSwapIntervalSGI = de::function_cast -// (glXGetProcAddress(reinterpret_cast("glXSwapIntervalSGI"))); -// } -// if (ext.X11_MESA_swap_control) -// { -// glXSwapIntervalMESA = de::function_cast -// (glXGetProcAddress(reinterpret_cast("glXSwapIntervalMESA"))); -// } -// } -// #endif - - #ifdef DE_ENABLE_OPENGL_DEBUG_LOGGER +#if defined (DE_ENABLE_OPENGL_DEBUG_LOGGER) { gl::glDebugMessageCallback(debugMessageCallback, nullptr); glEnable(gl::GL_DEBUG_OUTPUT_SYNCHRONOUS); @@ -370,21 +337,21 @@ DE_PIMPL_NOREF(GLInfo) //, public QOpenGLFunctions_Doomsday debug("[GLInfo] debug output enabled"); } } - #endif +#endif // Limits. glGetIntegerv(GL_MAX_TEXTURE_SIZE, reinterpret_cast(&lim.maxTexSize)); glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, reinterpret_cast(&lim.maxTexUnits)); // at least 16 LIBGUI_ASSERT_GL_OK(); - #if defined (DE_OPENGL) +#if defined (DE_OPENGL) { glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, &lim.smoothLineWidth.start); LIBGUI_ASSERT_GL_OK(); glGetFloatv(GL_SMOOTH_LINE_WIDTH_GRANULARITY, &lim.smoothLineWidthGranularity); LIBGUI_ASSERT_GL_OK(); } - #endif +#endif LIBGUI_ASSERT_GL_OK(); if (ext.EXT_texture_filter_anisotropic)