Open shenzhuxi opened 2 years ago
Thanks for the report. Can you tell me the compiler version that you are using on your Raspberry Pi?
Package: gcc Version: 4:10.2.1-1+rpi1 Priority: optional Section: devel Source: gcc-defaults (1.190+rpi1) Maintainer: Debian GCC Maintainers debian-gcc@lists.debian.org Installed-Size: 46.1 kB Provides: c-compiler, gcc-arm-linux-gnueabihf (= 4:10.2.1-1+rpi1) Depends: cpp (= 4:10.2.1-1+rpi1), gcc-10 (>= 10.2.1-3~)
Package: g++ Version: 4:10.2.1-1+rpi1 Priority: optional Section: devel Source: gcc-defaults (1.190+rpi1) Maintainer: Debian GCC Maintainers debian-gcc@lists.debian.org Installed-Size: 15.4 kB Provides: c++-compiler, g++-arm-linux-gnueabihf (= 4:10.2.1-1+rpi1) Depends: cpp (= 4:10.2.1-1+rpi1), gcc (= 4:10.2.1-1+rpi1), g++-10 (>= 10.2.1-3~), gcc-10 (>= 10.2.1-3~)
Package: cmake Version: 3.18.4-2+rpt1+rpi1 Priority: optional Section: devel Maintainer: Debian CMake Team pkg-cmake-team@lists.alioth.debian.org Installed-Size: 18.3 MB Depends: cmake-data (= 3.18.4-2+rpt1+rpi1), procps, libarchive13 (>= 3.3.3), libc6 (>= 2.28), libcurl4 (>= 7.16.2), libexpat1 (>= 2.0.1), libgcc-s1 (>= 3.5), libjsoncpp24 (>= 1.9.4), librhash0 (>= 1.2.6), libstdc++6 (>= 9), libuv1 (>= 1.11.0), zlib1g (>= 1:1.2.3.3)
Package: make Version: 4.3-4.1
I just finished building on Raspberry with "make linux" by following https://github.com/tangrams/tangram-es/tree/main/platforms/linux and adding "-latomic" to https://github.com/tangrams/tangram-es/blob/main/platforms/linux/config.cmake.
Two variables GLintptr and GLsizeiptr need to be renamed to avoid the name conflicts.
diff --git a/core/src/gl.h b/core/src/gl.h
index 91810b55..3ce36315 100644
--- a/core/src/gl.h
+++ b/core/src/gl.h
@@ -8,8 +8,8 @@ typedef signed long int GLintptr;
typedef signed long int GLsizeiptr;
#else
#include <stddef.h>
-typedef ptrdiff_t GLsizeiptr;
-typedef ptrdiff_t GLintptr;
+typedef ptrdiff_t GLsizeiptr2;
+typedef ptrdiff_t GLintptr2;
#endif
/*
@@ -323,8 +323,8 @@ struct GL {
static void bindBuffer(GLenum target, GLuint buffer);
static void deleteBuffers(GLsizei n, const GLuint *buffers);
static void genBuffers(GLsizei n, GLuint *buffers);
- static void bufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage);
- static void bufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+ static void bufferData(GLenum target, GLsizeiptr2 size, const void *data, GLenum usage);
+ static void bufferSubData(GLenum target, GLintptr2 offset, GLsizeiptr2 size, const void *data);
// Framebuffers
static void bindFramebuffer(GLenum target, GLuint framebuffer);
diff --git a/core/src/gl/mesh.cpp b/core/src/gl/mesh.cpp
index 2410dacf..6facf952 100644
--- a/core/src/gl/mesh.cpp
+++ b/core/src/gl/mesh.cpp
@@ -254,7 +254,7 @@ size_t MeshBase::compileIndices(const std::vector<std::pair<uint32_t, uint32_t>>
return _offset + src;
}
-void MeshBase::setDirty(GLintptr _byteOffset, GLsizei _byteSize) {
+void MeshBase::setDirty(GLintptr2 _byteOffset, GLsizei _byteSize) {
if (!m_dirty) {
m_dirty = true;
diff --git a/core/src/gl/mesh.h b/core/src/gl/mesh.h
index 2cfc72bf..12439eef 100644
--- a/core/src/gl/mesh.h
+++ b/core/src/gl/mesh.h
@@ -104,12 +104,12 @@ protected:
RenderState* m_rs = nullptr;
GLsizei m_dirtySize;
- GLintptr m_dirtyOffset;
+ GLintptr2 m_dirtyOffset;
size_t compileIndices(const std::vector<std::pair<uint32_t, uint32_t>>& _offsets,
const std::vector<uint16_t>& _indices, size_t _offset);
- void setDirty(GLintptr _byteOffset, GLsizei _byteSize);
+ void setDirty(GLintptr2 _byteOffset, GLsizei _byteSize);
};
template<class T>
diff --git a/platforms/common/platform_gl.cpp b/platforms/common/platform_gl.cpp
index 93c46004..7271c033 100644
--- a/platforms/common/platform_gl.cpp
+++ b/platforms/common/platform_gl.cpp
@@ -142,10 +142,10 @@ void GL::deleteBuffers(GLsizei n, const GLuint *buffers) {
void GL::genBuffers(GLsizei n, GLuint *buffers) {
GL_CHECK(glGenBuffers(n, buffers));
}
-void GL::bufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) {
+void GL::bufferData(GLenum target, GLsizeiptr2 size, const void *data, GLenum usage) {
GL_CHECK(glBufferData(target, size, data, usage));
}
-void GL::bufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data) {
+void GL::bufferSubData(GLenum target, GLintptr2 offset, GLsizeiptr2 size, const void *data) {
GL_CHECK(glBufferSubData(target, offset, size, data));
}
void GL::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
But the performance is quite bad. I guess that's because OpenGL can't run as fast as OpenGL ES on Raspberry Pi.
2314.patch.txt Here is the patch fixed the the most problems except this bit:
/usr/bin/ld: CMakeFiles/tangram.dir/platforms/common/platform_gl.cpp.o: in function `Tangram::GL::mapBuffer(unsigned int, unsigned int)':
platform_gl.cpp:(.text+0x134): undefined reference to `glMapBufferOES'
/usr/bin/ld: CMakeFiles/tangram.dir/platforms/common/platform_gl.cpp.o: in function `Tangram::GL::unmapBuffer(unsigned int)':
platform_gl.cpp:(.text+0x144): undefined reference to `glUnmapBufferOES'
collect2: error: ld returned 1 exit status
gmake[3]: *** [CMakeFiles/tangram.dir/build.make:202: tangram] Error 1
gmake[3]: Leaving directory '/home/pi/Documents/tangram-es/build/rpi'
gmake[2]: *** [CMakeFiles/Makefile2:340: CMakeFiles/tangram.dir/all] Error 2
gmake[2]: Leaving directory '/home/pi/Documents/tangram-es/build/rpi'
gmake[1]: *** [Makefile:171: all] Error 2
gmake[1]: Leaving directory '/home/pi/Documents/tangram-es/build/rpi'
make: *** [Makefile:251: rpi] Error 2
After "sudo rpi-update" update the firmware, this bit has been fixed in https://github.com/tangrams/tangram-es/blob/main/platforms/rpi/config.cmake by using
target_link_libraries(tangram
PRIVATE
tangram-core
${FONTCONFIG_LDFLAGS}
curl
pthread
rt
/opt/vc/lib/libbcm_host.so
/opt/vc/lib/libbrcmEGL.so
/opt/vc/lib/libbrcmGLESv2.so
/opt/vc/lib/libvchiq_arm.so
/opt/vc/lib/libvcos.so
-latomic
)
After built it successfully, I got the same "* failed to add service - already in use?" issue here https://github.com/tangrams/tangram-es/issues/2214 when run it.
TO REPRODUCE THE ISSUE, FOLLOW THESE STEPS:
RESULT:
EXPECTED RESULT:
There is no problem to build the main branch on Windows 10 with cmake -S . -B .\build -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="\scripts\buildsystems\vcpkg.cmake"
ENVIRONMENT:
OTHER:
It will be also good to add "sudo apt-get install libgles2-mesa-dev" to https://github.com/tangrams/tangram-es/tree/main/platforms/rpi.
I don't think "Visual Studio 16 2019" can be downloaded from https://visualstudio.microsoft.com/downloads/ and it will be good to update https://github.com/tangrams/tangram-es/tree/main/platforms/windows with:
cmake -S . -B .\build -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="\scripts\buildsystems\vcpkg.cmake"