Merge remote-tracking branch 'origin/master' into feature/statlogs

This commit is contained in:
Matthew Territo
2017-07-05 11:33:05 -06:00
19 changed files with 144 additions and 171 deletions

138
Jenkinsfile vendored
View File

@@ -1,80 +1,80 @@
def modules = [
"base",
"debugging",
"fieldlines",
"galaxy",
"globebrowsing",
"iswa",
"kameleon",
"kameleonvolume",
"multiresvolume",
"newhorizons",
"onscreengui",
"space",
"toyvolume",
"volume"
"base",
"debugging",
"fieldlines",
"galaxy",
"globebrowsing",
"iswa",
"kameleon",
"kameleonvolume",
"multiresvolume",
"newhorizons",
"onscreengui",
"space",
"toyvolume",
"volume"
];
def flags = "-DGHOUL_USE_DEVIL=OFF "
for (module in modules) {
flags += "-DOPENSPACE_OPENSPACE_MODULE_" + module.toUpperCase() + "=ON "
flags += "-DOPENSPACE_OPENSPACE_MODULE_" + module.toUpperCase() + "=ON "
}
echo flags
stage('Build') {
parallel linux: {
node('linux') {
timeout(time: 30, unit: 'MINUTES') {
checkout scm
sh 'git submodule update --init --recursive'
sh '''
mkdir -p build
cd build
cmake .. ''' +
flags + ''' ..
make
'''
}
}
},
windows: {
node('windows') {
timeout(time: 30, unit: 'MINUTES') {
checkout scm
bat '''
git submodule update --init --recursive
if not exist "build" mkdir "build"
cd build
cmake -G "Visual Studio 15 2017 Win64" .. ''' +
flags + ''' ..
msbuild.exe OpenSpace.sln /m:2 /p:Configuration=Debug
'''
}
}
},
osx: {
node('osx') {
timeout(time: 30, unit: 'MINUTES') {
checkout scm
sh 'git submodule update --init --recursive'
sh '''
export PATH=${PATH}:/usr/local/bin:/Applications/CMake.app/Contents/bin
export CMAKE_BUILD_TOOL=/Applications/CMake.app/Contents/bin/CMake
srcDir=$PWD
if [ ! -d ${srcDir} ]; then
mkdir ${srcDir}
fi
if [ ! -d ${srcDir}/build ]; then
mkdir ${srcDir}/build
fi
cd ${srcDir}/build
/Applications/CMake.app/Contents/bin/cmake -G Xcode -D NASM=/usr/local/bin/nasm ${srcDir} .. ''' +
flags + '''
xcodebuild
'''
}
}
}
}
parallel linux: {
node('linux') {
timeout(time: 30, unit: 'MINUTES') {
checkout scm
sh 'git submodule update --init --recursive'
sh '''
mkdir -p build
cd build
cmake .. ''' +
flags + ''' ..
make
'''
}
}
},
windows: {
node('windows') {
timeout(time: 30, unit: 'MINUTES') {
checkout scm
bat '''
git submodule update --init --recursive
if not exist "build" mkdir "build"
cd build
cmake -G "Visual Studio 15 2017 Win64" .. ''' +
flags + ''' ..
msbuild.exe OpenSpace.sln /nologo /verbosity:minimal /m:2 /p:Configuration=Debug
'''
}
}
},
osx: {
node('osx') {
timeout(time: 30, unit: 'MINUTES') {
checkout scm
sh 'git submodule update --init --recursive'
sh '''
export PATH=${PATH}:/usr/local/bin:/Applications/CMake.app/Contents/bin
export CMAKE_BUILD_TOOL=/Applications/CMake.app/Contents/bin/CMake
srcDir=$PWD
if [ ! -d ${srcDir} ]; then
mkdir ${srcDir}
fi
if [ ! -d ${srcDir}/build ]; then
mkdir ${srcDir}/build
fi
cd ${srcDir}/build
/Applications/CMake.app/Contents/bin/cmake -G Xcode -D NASM=/usr/local/bin/nasm ${srcDir} .. ''' +
flags + '''
xcodebuild -quiet
'''
}
}
}
}

View File

@@ -28,7 +28,7 @@
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/assert.h>
#include <ghoul/opengl/ghoul_gl.h>
//#include <ghoul/opengl/ghoul_gl.h>
#include <sgct.h>

View File

@@ -52,19 +52,19 @@ void* PixelBuffer::mapBuffer(Access access) {
return dataPtr;
}
void* PixelBuffer::mapBufferRange(GLintptr offset, GLsizeiptr length, GLbitfield access) {
void* PixelBuffer::mapBufferRange(GLintptr offset, GLsizeiptr length, BufferAccessMask access) {
void* dataPtr = glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, offset, length, access);
_isMapped = dataPtr ? true : false;
return dataPtr;
}
bool PixelBuffer::unMapBuffer() {
bool success = glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
GLboolean success = glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
if (!success) {
LERROR("Unable to unmap pixel buffer, data may be corrupt!");
}
_isMapped = false;
return success;
return success == GL_TRUE;
}
void PixelBuffer::bind() {

View File

@@ -44,26 +44,26 @@ public:
* All kinds of usage for pixel buffer objects as defined by the OpenGL standard.
* See: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glBufferData.xhtml
*/
enum class Usage {
StreamDraw = GL_STREAM_DRAW,
StreamRead = GL_STREAM_READ,
StreamCopy = GL_STREAM_COPY,
StaticDraw = GL_STATIC_DRAW,
StaticRead = GL_STATIC_READ,
StaticCopy = GL_STATIC_COPY,
DynamicDraw = GL_DYNAMIC_DRAW,
DynamicRead = GL_DYNAMIC_READ,
DynamicCopy = GL_DYNAMIC_COPY
};
enum class Usage : std::underlying_type_t<GLenum> {
StreamDraw = static_cast<std::underlying_type_t<GLenum>>(GL_STREAM_DRAW),
StreamRead = static_cast<std::underlying_type_t<GLenum>>(GL_STREAM_READ),
StreamCopy = static_cast<std::underlying_type_t<GLenum>>(GL_STREAM_COPY),
StaticDraw = static_cast<std::underlying_type_t<GLenum>>(GL_STATIC_DRAW),
StaticRead = static_cast<std::underlying_type_t<GLenum>>(GL_STATIC_READ),
StaticCopy = static_cast<std::underlying_type_t<GLenum>>(GL_STATIC_COPY),
DynamicDraw = static_cast<std::underlying_type_t<GLenum>>(GL_DYNAMIC_DRAW),
DynamicRead = static_cast<std::underlying_type_t<GLenum>>(GL_DYNAMIC_READ),
DynamicCopy = static_cast<std::underlying_type_t<GLenum>>(GL_DYNAMIC_COPY)
};
/**
* Access hints for OpenGL buffer mapping
* See: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glMapBuffer.xml
*/
enum class Access {
ReadOnly = GL_READ_ONLY,
WriteOnly = GL_WRITE_ONLY,
ReadWrite = GL_READ_WRITE
enum class Access : std::underlying_type_t<GLenum> {
ReadOnly = static_cast<std::underlying_type_t<GLenum>>(GL_READ_ONLY),
WriteOnly = static_cast<std::underlying_type_t<GLenum>>(GL_WRITE_ONLY),
ReadWrite = static_cast<std::underlying_type_t<GLenum>>(GL_READ_WRITE)
};
/**
@@ -100,7 +100,7 @@ public:
* \returns the DMA address to the mapped buffer. Returns nullptr if the mapping
* failed
*/
void* mapBufferRange(GLintptr offset, GLsizeiptr length, GLbitfield access);
void* mapBufferRange(GLintptr offset, GLsizeiptr length, BufferAccessMask access);
/**
* Maps the default buffer and makes the data available on the GPU

View File

@@ -77,7 +77,7 @@ public:
* is already mapped or if something else failed.
*/
void* mapBufferRange(KeyType key, GLintptr offset, GLsizeiptr length,
GLbitfield access);
BufferAccessMask access);
/**
* Unmaps all buffers in the PixelBufferContainer.

View File

@@ -63,7 +63,7 @@ void* PixelBufferContainer<KeyType>::mapBuffer(KeyType key, PixelBuffer::Access
template <class KeyType>
void* PixelBufferContainer<KeyType>::mapBufferRange(KeyType key, GLintptr offset,
GLsizeiptr length, GLbitfield access)
GLsizeiptr length, BufferAccessMask access)
{
typename std::map<KeyType, int>::const_iterator iter = _indexMap.find(key);
bool notFoundAmongMappedBuffers = iter == _indexMap.end();

View File

@@ -272,8 +272,8 @@ RawTile::ReadError GdalRawTileDataReader::rasterRead(
dataDest += io.write.region.start.x * _initData.bytesPerPixel();
GDALRasterBand* gdalRasterBand = _dataset->GetRasterBand(rasterBand);
CPLErr readError = CE_Failure;
readError = gdalRasterBand->RasterIO(
CPLErr readError = CE_Failure;
readError = gdalRasterBand->RasterIO(
GF_Read,
io.read.region.start.x, // Begin read x
io.read.region.start.y, // Begin read y

View File

@@ -361,7 +361,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
return format;
}
GLuint getOpenGLDataType(GDALDataType gdalType) {
GLenum getOpenGLDataType(GDALDataType gdalType) {
switch (gdalType) {
case GDT_Byte:
return GL_UNSIGNED_BYTE;
@@ -383,7 +383,7 @@ GLuint getOpenGLDataType(GDALDataType gdalType) {
}
}
GDALDataType getGdalDataType(GLuint glType) {
GDALDataType getGdalDataType(GLenum glType) {
switch (glType) {
case GL_UNSIGNED_BYTE:
return GDT_Byte;
@@ -419,7 +419,7 @@ size_t numberOfRasters(ghoul::opengl::Texture::Format format) {
}
}
size_t numberOfBytes(GLuint glType) {
size_t numberOfBytes(GLenum glType) {
switch (glType) {
case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
case GL_BYTE: return sizeof(GLbyte);
@@ -435,7 +435,7 @@ size_t numberOfBytes(GLuint glType) {
}
}
size_t getMaximumValue(GLuint glType) {
size_t getMaximumValue(GLenum glType) {
switch (glType) {
case GL_UNSIGNED_BYTE:
return 1 << 8;
@@ -452,7 +452,7 @@ size_t getMaximumValue(GLuint glType) {
}
}
float interpretFloat(GLuint glType, const char* src) {
float interpretFloat(GLenum glType, const char* src) {
switch (glType) {
case GL_UNSIGNED_BYTE:
return static_cast<float>(*reinterpret_cast<const GLubyte*>(src));
@@ -475,7 +475,7 @@ float interpretFloat(GLuint glType, const char* src) {
}
}
GLint glTextureFormat(GLuint glType, ghoul::opengl::Texture::Format format) {
GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
switch (format) {
case ghoul::opengl::Texture::Format::Red:
switch (glType) {
@@ -494,7 +494,7 @@ GLint glTextureFormat(GLuint glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
return 0;
return GLenum(0);
}
break;
case ghoul::opengl::Texture::Format::RG:
@@ -514,7 +514,7 @@ GLint glTextureFormat(GLuint glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
return 0;
return GLenum(0);
}
break;
case ghoul::opengl::Texture::Format::RGB:
@@ -534,7 +534,7 @@ GLint glTextureFormat(GLuint glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
return 0;
return GLenum(0);
}
break;
case ghoul::opengl::Texture::Format::RGBA:
@@ -554,7 +554,7 @@ GLint glTextureFormat(GLuint glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
return 0;
return GLenum(0);
}
break;
case ghoul::opengl::Texture::Format::BGR:
@@ -574,7 +574,7 @@ GLint glTextureFormat(GLuint glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
return 0;
return GLenum(0);
}
break;
case ghoul::opengl::Texture::Format::BGRA:
@@ -594,12 +594,17 @@ GLint glTextureFormat(GLuint glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
return 0;
return GLenum(0);
}
break;
default:
LERROR("Unknown format for OpenGL texture: " << format);
return 0;
LERROR(
"Unknown format for OpenGL texture: " <<
static_cast<std::underlying_type_t<
ghoul::opengl::Texture::Format>
>(format)
);
return GLenum(0);
break;
}
}

View File

@@ -39,8 +39,8 @@ namespace globebrowsing {
namespace tiledatatype {
#ifdef GLOBEBROWSING_USE_GDAL
GLuint getOpenGLDataType(GDALDataType gdalType);
GDALDataType getGdalDataType(GLuint glType);
GLenum getOpenGLDataType(GDALDataType gdalType);
GDALDataType getGdalDataType(GLenum glType);
TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType);
TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType);
size_t getMaximumValue(GDALDataType gdalType);
@@ -48,11 +48,11 @@ size_t numberOfBytes(GDALDataType gdalType);
float interpretFloat(GDALDataType gdalType, const char* src);
#endif // GLOBEBROWSING_USE_GDAL
GLint glTextureFormat(GLuint glType, ghoul::opengl::Texture::Format format);
GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format);
size_t numberOfRasters(ghoul::opengl::Texture::Format format);
size_t numberOfBytes(GLuint glType);
size_t getMaximumValue(GLuint glType);
float interpretFloat(GLuint glType, const char* src);
size_t numberOfBytes(GLenum glType);
size_t getMaximumValue(GLenum glType);
float interpretFloat(GLenum glType, const char* src);
} // namespace tiledatatype
} // namespace globebrowsing

View File

@@ -33,7 +33,7 @@ namespace globebrowsing {
struct TextureFormat {
ghoul::opengl::Texture::Format ghoulFormat;
GLint glFormat;
GLenum glFormat;
};

View File

@@ -31,7 +31,7 @@ namespace globebrowsing {
const glm::ivec2 TileTextureInitData::tilePixelStartOffset = glm::ivec2(-2);
const glm::ivec2 TileTextureInitData::tilePixelSizeDifference = glm::ivec2(4);
TileTextureInitData::TileTextureInitData(size_t width, size_t height, GLuint glType,
TileTextureInitData::TileTextureInitData(size_t width, size_t height, GLenum glType,
Format textureFormat, ShouldAllocateDataOnCPU shouldAllocateDataOnCPU)
: _glType(glType)
, _ghoulTextureFormat(textureFormat)
@@ -87,7 +87,7 @@ size_t TileTextureInitData::totalNumBytes() const {
return _totalNumBytes;
}
GLuint TileTextureInitData::glType() const {
GLenum TileTextureInitData::glType() const {
return _glType;
}
@@ -95,7 +95,7 @@ TileTextureInitData::Format TileTextureInitData::ghoulTextureFormat() const {
return _ghoulTextureFormat;
}
GLint TileTextureInitData::glTextureFormat() const {
GLenum TileTextureInitData::glTextureFormat() const {
return _glTextureFormat;
}
@@ -120,7 +120,7 @@ void TileTextureInitData::calculateHashKey() {
_hashKey |= _dimensionsWithoutPadding.x;
_hashKey |= _dimensionsWithoutPadding.y << 10;
_hashKey |= _glType << (10 + 16);
_hashKey |= static_cast<std::underlying_type_t<GLenum>>(_glType) << (10 + 16);
_hashKey |= format << (10 + 16 + 4);
};

View File

@@ -44,7 +44,7 @@ public:
using ShouldAllocateDataOnCPU = ghoul::Boolean;
using Format = ghoul::opengl::Texture::Format;
TileTextureInitData(size_t width, size_t height, GLuint glType, Format textureFormat,
TileTextureInitData(size_t width, size_t height, GLenum glType, Format textureFormat,
ShouldAllocateDataOnCPU shouldAllocateDataOnCPU = ShouldAllocateDataOnCPU::No);
TileTextureInitData(const TileTextureInitData& original);
@@ -58,9 +58,9 @@ public:
size_t bytesPerPixel() const;
size_t bytesPerLine() const;
size_t totalNumBytes() const;
GLuint glType() const;
GLenum glType() const;
Format ghoulTextureFormat() const;
GLint glTextureFormat() const;
GLenum glTextureFormat() const;
bool shouldAllocateDataOnCPU() const;
HashKey hashKey() const;
@@ -74,9 +74,9 @@ private:
HashKey _hashKey;
glm::ivec3 _dimensionsWithPadding;
glm::ivec3 _dimensionsWithoutPadding;
GLuint _glType;
GLenum _glType;
Format _ghoulTextureFormat;
GLint _glTextureFormat;
GLenum _glTextureFormat;
size_t _nRasters;
size_t _bytesPerDatum;
size_t _bytesPerPixel;

View File

@@ -913,7 +913,8 @@ bool ProjectionComponent::generateProjectionLayerTexture(const ivec2& size) {
_dilation.stencilTexture = std::make_unique<ghoul::opengl::Texture>(
glm::uvec3(size, 1),
ghoul::opengl::Texture::Format::Red,
ghoul::opengl::Texture::Format::Red
// @TODO: Remove the static cast ---abock
static_cast<GLenum>(ghoul::opengl::Texture::Format::Red)
);
if (_dilation.stencilTexture) {

View File

@@ -285,14 +285,6 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
bool RenderablePlanet::initialize() {
RenderEngine& renderEngine = OsEng.renderEngine();
GLenum err;
while ((err = glGetError()) != GL_NO_ERROR) {
const GLubyte * errString = gluErrorString(err);
std::stringstream ss;
ss << "Checking System State. OpenGL error: " << errString << std::endl;
LERROR(ss.str());
}
if (_programObject == nullptr && _shadowEnabled && _hasNightTexture) {
// shadow program
_programObject = renderEngine.buildRenderProgram(
@@ -325,22 +317,10 @@ bool RenderablePlanet::initialize() {
_programObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
_programObject->setIgnoreUniformLocationError(IgnoreError::Yes);
while ((err = glGetError()) != GL_NO_ERROR) {
const GLubyte * errString = gluErrorString(err);
std::stringstream ss;
ss << "Error after load shading programs. OpenGL error: " << errString << std::endl;
LERROR(ss.str());
}
_geometry->initialize(this);
_programObject->deactivate();
while ((err = glGetError()) != GL_NO_ERROR) {
const GLubyte * errString = gluErrorString(err);
LERROR("Shader Programs Creation. OpenGL error: " << errString);
}
loadTexture();
return isReady();
@@ -553,12 +533,6 @@ void RenderablePlanet::loadTexture() {
}
}
GLenum err;
while ((err = glGetError()) != GL_NO_ERROR) {
const GLubyte * errString = gluErrorString(err);
LERROR("Error after reading color texture. OpenGL error: " << errString);
}
if (_hasNightTexture) {
_nightTexture = nullptr;
if (_nightTexturePath.value() != "") {
@@ -572,11 +546,6 @@ void RenderablePlanet::loadTexture() {
}
}
while ((err = glGetError()) != GL_NO_ERROR) {
const GLubyte * errString = gluErrorString(err);
LERROR("Error after reading night texture. OpenGL error: " << errString);
}
if (_hasHeightTexture) {
_heightMapTexture = nullptr;
if (_heightMapTexturePath.value() != "") {
@@ -589,11 +558,6 @@ void RenderablePlanet::loadTexture() {
}
}
}
while ((err = glGetError()) != GL_NO_ERROR) {
const GLubyte * errString = gluErrorString(err);
LERROR("Error after reading height mapping texture. OpenGL error: " << errString);
}
}
} // namespace openspace

View File

@@ -414,6 +414,10 @@ void OpenSpaceEngine::destroy() {
void OpenSpaceEngine::initialize() {
LTRACE("OpenSpaceEngine::initialize(begin)");
glbinding::Binding::useCurrentContext();
glbinding::Binding::initialize();
// clear the screen so the user don't have to see old buffer contents from the
// graphics card
LDEBUG("Clearing all Windows");
@@ -428,6 +432,7 @@ void OpenSpaceEngine::initialize() {
std::make_unique<ghoul::systemcapabilities::OpenGLCapabilitiesComponent>()
);
// @BUG: This will call OpenGL functions, should it should be in the initializeGL
LDEBUG("Detecting capabilities");
SysCap.detectCapabilities();
@@ -1097,7 +1102,6 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix,
const glm::mat4& viewMatrix,
const glm::mat4& projectionMatrix)
{
bool isGuiWindow = _windowWrapper->hasGuiWindow() ? _windowWrapper->isGuiWindow() : true;
bool showOverlay = isGuiWindow && _windowWrapper->isMaster() && _windowWrapper->isRegularRendering();
// @CLEANUP: Replace the two windows by a single call to whether a gui should be

View File

@@ -22,17 +22,16 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <ghoul/opengl/ghoul_gl.h>
#include "sgct.h"
#include <openspace/engine/wrapper/sgctwindowwrapper.h>
#include "sgct.h"
#undef near
#undef far
namespace {
const char* GuiWindowTag = "GUI";
}
} // namespace
namespace openspace {

View File

@@ -268,8 +268,8 @@ void FramebufferRenderer::updateResolution() {
nullptr
);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, _exitDepthTexture);
@@ -285,8 +285,8 @@ void FramebufferRenderer::updateResolution() {
nullptr
);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
_dirtyResolution = false;
}

View File

@@ -24,7 +24,7 @@
#include <openspace/util/syncbuffer.h>
#include <sgct.h>
#include <sgct/SharedData.h>
namespace openspace {