From 0fb1a83e3bc4956d12e09c48994430c9b4ee864f Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 25 Apr 2015 09:20:00 -0700 Subject: [PATCH] quiet compiler, remove some trailing control-Ms --- CMakeLists.txt | 2 +- .../src/DomainServerWebSessionData.cpp | 2 +- interface/src/Application.cpp | 2 +- interface/src/ScriptsModel.h | 2 +- interface/src/avatar/Head.h | 2 +- interface/src/ui/ApplicationOverlay.cpp | 2 +- interface/src/ui/overlays/Overlays.cpp | 4 +- libraries/audio/src/AudioEffectOptions.cpp | 2 +- .../src/EntityTreeRenderer.cpp | 2 +- libraries/entities/src/EntityTree.cpp | 2 +- libraries/fbx/src/FBXReader.cpp | 8 +- libraries/gpu/src/gpu/GLBackend.cpp | 50 +- libraries/gpu/src/gpu/GLBackendBuffer.cpp | 4 +- libraries/gpu/src/gpu/GLBackendInput.cpp | 8 +- libraries/gpu/src/gpu/GLBackendOutput.cpp | 172 ++--- libraries/gpu/src/gpu/GLBackendPipeline.cpp | 8 +- libraries/gpu/src/gpu/GLBackendState.cpp | 26 +- libraries/gpu/src/gpu/GLBackendTexture.cpp | 112 +-- libraries/gpu/src/gpu/GLBackendTransform.cpp | 4 +- libraries/gpu/src/gpu/State.h | 2 +- libraries/gpu/src/gpu/Stream.h | 4 +- libraries/gpu/src/gpu/Texture.cpp | 702 +++++++++--------- libraries/gpu/src/gpu/Texture.h | 6 +- libraries/model/src/model/Geometry.cpp | 2 +- .../networking/src/DataServerAccountInfo.cpp | 3 + libraries/networking/src/HifiSockAddr.cpp | 1 + libraries/networking/src/NetworkPeer.cpp | 3 +- libraries/networking/src/OAuthAccessToken.cpp | 2 +- .../networking/src/RSAKeypairGenerator.cpp | 2 + libraries/octree/src/OctreeRenderer.cpp | 2 +- libraries/render-utils/src/GeometryCache.cpp | 4 +- libraries/render-utils/src/JointState.cpp | 2 +- libraries/render-utils/src/JointState.h | 2 +- libraries/render-utils/src/MatrixStack.h | 2 +- libraries/render-utils/src/Model.cpp | 6 +- libraries/shared/src/ShapeInfo.h | 2 +- 36 files changed, 588 insertions(+), 573 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32e79c8443..b271664c35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ if (WIN32) elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic") #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fno-strict-aliasing -ggdb") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-strict-aliasing -Wno-unused-parameter -ggdb") endif(WIN32) if (NOT MSVC12) diff --git a/domain-server/src/DomainServerWebSessionData.cpp b/domain-server/src/DomainServerWebSessionData.cpp index ee32a17570..0a921d65c3 100644 --- a/domain-server/src/DomainServerWebSessionData.cpp +++ b/domain-server/src/DomainServerWebSessionData.cpp @@ -33,7 +33,7 @@ DomainServerWebSessionData::DomainServerWebSessionData(const QJsonObject& userOb } } -DomainServerWebSessionData::DomainServerWebSessionData(const DomainServerWebSessionData& otherSessionData) { +DomainServerWebSessionData::DomainServerWebSessionData(const DomainServerWebSessionData& otherSessionData) : QObject() { _username = otherSessionData._username; _roles = otherSessionData._roles; } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b4d155319d..565aa07332 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1058,7 +1058,7 @@ void Application::keyPressEvent(QKeyEvent* event) { bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier); bool isMeta = event->modifiers().testFlag(Qt::ControlModifier); bool isOption = event->modifiers().testFlag(Qt::AltModifier); - bool isKeypad = event->modifiers().testFlag(Qt::KeypadModifier); + // bool isKeypad = event->modifiers().testFlag(Qt::KeypadModifier); switch (event->key()) { break; case Qt::Key_L: diff --git a/interface/src/ScriptsModel.h b/interface/src/ScriptsModel.h index 914a197201..ae75acfa3b 100644 --- a/interface/src/ScriptsModel.h +++ b/interface/src/ScriptsModel.h @@ -50,7 +50,7 @@ public: TreeNodeScript(const QString& localPath, const QString& fullPath, ScriptOrigin origin); const QString& getLocalPath() { return _localPath; } const QString& getFullPath() { return _fullPath; }; - const ScriptOrigin getOrigin() { return _origin; }; + ScriptOrigin getOrigin() { return _origin; }; private: QString _localPath; diff --git a/interface/src/avatar/Head.h b/interface/src/avatar/Head.h index d6d4cc1352..7ae36675be 100644 --- a/interface/src/avatar/Head.h +++ b/interface/src/avatar/Head.h @@ -81,7 +81,7 @@ public: FaceModel& getFaceModel() { return _faceModel; } const FaceModel& getFaceModel() const { return _faceModel; } - const bool getReturnToCenter() const { return _returnHeadToCenter; } // Do you want head to try to return to center (depends on interface detected) + bool getReturnToCenter() const { return _returnHeadToCenter; } // Do you want head to try to return to center (depends on interface detected) float getAverageLoudness() const { return _averageLoudness; } /// \return the point about which scaling occurs. glm::vec3 getScalePivot() const; diff --git a/interface/src/ui/ApplicationOverlay.cpp b/interface/src/ui/ApplicationOverlay.cpp index 2a8f01aafc..9978a05dac 100644 --- a/interface/src/ui/ApplicationOverlay.cpp +++ b/interface/src/ui/ApplicationOverlay.cpp @@ -257,7 +257,7 @@ void ApplicationOverlay::displayOverlayTexture() { if (_alpha == 0.0f) { return; } - auto glCanvas = Application::getInstance()->getGLWidget(); + // auto glCanvas = Application::getInstance()->getGLWidget(); glMatrixMode(GL_PROJECTION); glPushMatrix(); { glLoadIdentity(); diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 158deb00ff..191f3f4a99 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -91,7 +91,7 @@ void Overlays::renderHUD() { lodManager->getOctreeSizeScale(), lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE, RenderArgs::MONO, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; foreach(Overlay* thisOverlay, _overlaysHUD) { if (thisOverlay->is3D()) { @@ -126,7 +126,7 @@ void Overlays::renderWorld(bool drawFront, RenderArgs::RenderMode renderMode, Re lodManager->getOctreeSizeScale(), lodManager->getBoundaryLevelAdjust(), renderMode, renderSide, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; foreach(Overlay* thisOverlay, _overlaysWorld) { diff --git a/libraries/audio/src/AudioEffectOptions.cpp b/libraries/audio/src/AudioEffectOptions.cpp index 480779afd2..221d70aa75 100644 --- a/libraries/audio/src/AudioEffectOptions.cpp +++ b/libraries/audio/src/AudioEffectOptions.cpp @@ -64,7 +64,7 @@ AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) : } } -AudioEffectOptions::AudioEffectOptions(const AudioEffectOptions &other) { +AudioEffectOptions::AudioEffectOptions(const AudioEffectOptions &other) : QObject() { *this = other; } diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index c744ec0165..029161dec4 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -391,7 +391,7 @@ void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode, RenderArgs::R _viewState->getShadowViewFrustum() : _viewState->getCurrentViewFrustum(); RenderArgs args = { this, frustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; _tree->lockForRead(); diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 5b15aa26b4..a63a7ef7c3 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -521,7 +521,7 @@ bool EntityTree::findInSphereOperation(OctreeElement* element, void* extraData) // NOTE: assumes caller has handled locking void EntityTree::findEntities(const glm::vec3& center, float radius, QVector& foundEntities) { - FindAllNearPointArgs args = { center, radius }; + FindAllNearPointArgs args = { center, radius, QVector() }; // NOTE: This should use recursion, since this is a spatial operation recurseTreeWithOperation(findInSphereOperation, &args); diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 1c89ee4067..ca4ccc294f 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -133,7 +133,7 @@ bool FBXGeometry::convexHullContains(const glm::vec3& point) const { auto checkEachPrimitive = [=](FBXMesh& mesh, QVector indices, int primitiveSize) -> bool { // Check whether the point is "behind" all the primitives. - for (unsigned int j = 0; j < indices.size(); j += primitiveSize) { + for (int j = 0; j < indices.size(); j += primitiveSize) { if (!isPointBehindTrianglesPlane(point, mesh.vertices[indices[j]], mesh.vertices[indices[j + 1]], @@ -1469,7 +1469,8 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, bool rotationMinX = false, rotationMinY = false, rotationMinZ = false; bool rotationMaxX = false, rotationMaxY = false, rotationMaxZ = false; glm::vec3 rotationMin, rotationMax; - FBXModel model = { name, -1 }; + FBXModel model = { name, -1, glm::vec3(), glm::mat4(), glm::quat(), glm::quat(), glm::quat(), + glm::mat4(), glm::vec3(), glm::vec3()}; ExtractedMesh* mesh = NULL; QVector blendshapes; foreach (const FBXNode& subobject, object.children) { @@ -1685,7 +1686,8 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, textureContent.insert(filename, content); } } else if (object.name == "Material") { - Material material = { glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(), 96.0f, 1.0f }; + Material material = { glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(), 96.0f, 1.0f, + QString(""), QSharedPointer(NULL)}; foreach (const FBXNode& subobject, object.children) { bool properties = false; QByteArray propertyName; diff --git a/libraries/gpu/src/gpu/GLBackend.cpp b/libraries/gpu/src/gpu/GLBackend.cpp index c9de132b73..a898c9042b 100644 --- a/libraries/gpu/src/gpu/GLBackend.cpp +++ b/libraries/gpu/src/gpu/GLBackend.cpp @@ -143,7 +143,7 @@ void GLBackend::do_draw(Batch& batch, uint32 paramOffset) { uint32 startVertex = batch._params[paramOffset + 0]._uint; glDrawArrays(mode, startVertex, numVertices); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) { @@ -159,15 +159,15 @@ void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) { GLenum glType = _elementTypeToGLType[_input._indexBufferType]; glDrawElements(mode, numIndices, glType, reinterpret_cast(startIndex + _input._indexBufferOffset)); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) { - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void GLBackend::do_drawIndexedInstanced(Batch& batch, uint32 paramOffset) { - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } // TODO: As long as we have gl calls explicitely issued from interface @@ -189,7 +189,7 @@ void Batch::_glEnable(GLenum cap) { } void GLBackend::do_glEnable(Batch& batch, uint32 paramOffset) { glEnable(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glDisable(GLenum cap) { @@ -201,7 +201,7 @@ void Batch::_glDisable(GLenum cap) { } void GLBackend::do_glDisable(Batch& batch, uint32 paramOffset) { glDisable(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glEnableClientState(GLenum array) { @@ -213,7 +213,7 @@ void Batch::_glEnableClientState(GLenum array) { } void GLBackend::do_glEnableClientState(Batch& batch, uint32 paramOffset) { glEnableClientState(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glDisableClientState(GLenum array) { @@ -225,7 +225,7 @@ void Batch::_glDisableClientState(GLenum array) { } void GLBackend::do_glDisableClientState(Batch& batch, uint32 paramOffset) { glDisableClientState(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glCullFace(GLenum mode) { @@ -237,7 +237,7 @@ void Batch::_glCullFace(GLenum mode) { } void GLBackend::do_glCullFace(Batch& batch, uint32 paramOffset) { glCullFace(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glAlphaFunc(GLenum func, GLclampf ref) { @@ -252,7 +252,7 @@ void GLBackend::do_glAlphaFunc(Batch& batch, uint32 paramOffset) { glAlphaFunc( batch._params[paramOffset + 1]._uint, batch._params[paramOffset + 0]._float); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glDepthFunc(GLenum func) { @@ -264,7 +264,7 @@ void Batch::_glDepthFunc(GLenum func) { } void GLBackend::do_glDepthFunc(Batch& batch, uint32 paramOffset) { glDepthFunc(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glDepthMask(GLboolean flag) { @@ -276,7 +276,7 @@ void Batch::_glDepthMask(GLboolean flag) { } void GLBackend::do_glDepthMask(Batch& batch, uint32 paramOffset) { glDepthMask(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glDepthRange(GLfloat zNear, GLfloat zFar) { @@ -291,7 +291,7 @@ void GLBackend::do_glDepthRange(Batch& batch, uint32 paramOffset) { glDepthRange( batch._params[paramOffset + 1]._float, batch._params[paramOffset + 0]._float); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glBindBuffer(GLenum target, GLuint buffer) { @@ -306,7 +306,7 @@ void GLBackend::do_glBindBuffer(Batch& batch, uint32 paramOffset) { glBindBuffer( batch._params[paramOffset + 1]._uint, batch._params[paramOffset + 0]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glBindTexture(GLenum target, GLuint texture) { @@ -321,7 +321,7 @@ void GLBackend::do_glBindTexture(Batch& batch, uint32 paramOffset) { glBindTexture( batch._params[paramOffset + 1]._uint, batch._params[paramOffset + 0]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glActiveTexture(GLenum texture) { @@ -333,7 +333,7 @@ void Batch::_glActiveTexture(GLenum texture) { } void GLBackend::do_glActiveTexture(Batch& batch, uint32 paramOffset) { glActiveTexture(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glDrawBuffers(GLsizei n, const GLenum* bufs) { @@ -348,7 +348,7 @@ void GLBackend::do_glDrawBuffers(Batch& batch, uint32 paramOffset) { glDrawBuffers( batch._params[paramOffset + 1]._uint, (const GLenum*)batch.editData(batch._params[paramOffset + 0]._uint)); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glUseProgram(GLuint program) { @@ -365,7 +365,7 @@ void GLBackend::do_glUseProgram(Batch& batch, uint32 paramOffset) { _pipeline._invalidProgram = false; glUseProgram(_pipeline._program); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glUniform1f(GLint location, GLfloat v0) { @@ -385,7 +385,7 @@ void GLBackend::do_glUniform1f(Batch& batch, uint32 paramOffset) { glUniform1f( batch._params[paramOffset + 1]._int, batch._params[paramOffset + 0]._float); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glUniform2f(GLint location, GLfloat v0, GLfloat v1) { @@ -402,7 +402,7 @@ void GLBackend::do_glUniform2f(Batch& batch, uint32 paramOffset) { batch._params[paramOffset + 2]._int, batch._params[paramOffset + 1]._float, batch._params[paramOffset + 0]._float); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glUniform4fv(GLint location, GLsizei count, const GLfloat* value) { @@ -421,7 +421,7 @@ void GLBackend::do_glUniform4fv(Batch& batch, uint32 paramOffset) { batch._params[paramOffset + 1]._uint, (const GLfloat*)batch.editData(batch._params[paramOffset + 0]._uint)); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { @@ -441,7 +441,7 @@ void GLBackend::do_glUniformMatrix4fv(Batch& batch, uint32 paramOffset) { batch._params[paramOffset + 2]._uint, batch._params[paramOffset + 1]._uint, (const GLfloat*)batch.editData(batch._params[paramOffset + 0]._uint)); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glEnableVertexAttribArray(GLint location) { @@ -453,7 +453,7 @@ void Batch::_glEnableVertexAttribArray(GLint location) { } void GLBackend::do_glEnableVertexAttribArray(Batch& batch, uint32 paramOffset) { glEnableVertexAttribArray(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glDisableVertexAttribArray(GLint location) { @@ -465,7 +465,7 @@ void Batch::_glDisableVertexAttribArray(GLint location) { } void GLBackend::do_glDisableVertexAttribArray(Batch& batch, uint32 paramOffset) { glDisableVertexAttribArray(batch._params[paramOffset]._uint); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void Batch::_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { @@ -484,6 +484,6 @@ void GLBackend::do_glColor4f(Batch& batch, uint32 paramOffset) { batch._params[paramOffset + 2]._float, batch._params[paramOffset + 1]._float, batch._params[paramOffset + 0]._float); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } diff --git a/libraries/gpu/src/gpu/GLBackendBuffer.cpp b/libraries/gpu/src/gpu/GLBackendBuffer.cpp index 12eab21686..3eeedc5dc3 100755 --- a/libraries/gpu/src/gpu/GLBackendBuffer.cpp +++ b/libraries/gpu/src/gpu/GLBackendBuffer.cpp @@ -35,7 +35,7 @@ GLBackend::GLBuffer* GLBackend::syncGPUObject(const Buffer& buffer) { if (!object) { object = new GLBuffer(); glGenBuffers(1, &object->_buffer); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); Backend::setGPUObject(buffer, object); } @@ -48,7 +48,7 @@ GLBackend::GLBuffer* GLBackend::syncGPUObject(const Buffer& buffer) { object->_stamp = buffer.getSysmem().getStamp(); object->_size = buffer.getSysmem().getSize(); //} - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); return object; } diff --git a/libraries/gpu/src/gpu/GLBackendInput.cpp b/libraries/gpu/src/gpu/GLBackendInput.cpp index 982d2656a0..fcaa28aaaa 100755 --- a/libraries/gpu/src/gpu/GLBackendInput.cpp +++ b/libraries/gpu/src/gpu/GLBackendInput.cpp @@ -83,7 +83,7 @@ void GLBackend::updateInput() { glDisableVertexAttribArray(i); } } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _input._attributeActivation.flip(i); } @@ -108,7 +108,7 @@ void GLBackend::updateInput() { if (_input._buffersState.test(bufferNum) || _input._invalidFormat) { GLuint vbo = gpu::GLBackend::getBufferID((*buffers[bufferNum])); glBindBuffer(GL_ARRAY_BUFFER, vbo); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _input._buffersState[bufferNum] = false; for (unsigned int i = 0; i < channel._slots.size(); i++) { @@ -142,7 +142,7 @@ void GLBackend::updateInput() { glVertexAttribPointer(slot, count, type, isNormalized, stride, reinterpret_cast(pointer)); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } } } @@ -219,5 +219,5 @@ void GLBackend::do_setIndexBuffer(Batch& batch, uint32 paramOffset) { } else { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } diff --git a/libraries/gpu/src/gpu/GLBackendOutput.cpp b/libraries/gpu/src/gpu/GLBackendOutput.cpp index bd8a2ab457..e03ab43962 100755 --- a/libraries/gpu/src/gpu/GLBackendOutput.cpp +++ b/libraries/gpu/src/gpu/GLBackendOutput.cpp @@ -24,7 +24,7 @@ GLBackend::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffe GLFramebuffer* object = Backend::getGPUObject(framebuffer); // If GPU object already created and in sync - bool needUpdate = false; + // bool needUpdate = false; if (object) { return object; } else if (framebuffer.isEmpty()) { @@ -36,90 +36,90 @@ GLBackend::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffe if (!object) { GLuint fbo; glGenFramebuffers(1, &fbo); - CHECK_GL_ERROR(); - - glBindFramebuffer(GL_FRAMEBUFFER, fbo); - - unsigned int nbColorBuffers = 0; - GLenum colorBuffers[16]; - if (framebuffer.hasColor()) { - static const GLenum colorAttachments[] = { - GL_COLOR_ATTACHMENT0, - GL_COLOR_ATTACHMENT1, - GL_COLOR_ATTACHMENT2, - GL_COLOR_ATTACHMENT3, - GL_COLOR_ATTACHMENT4, - GL_COLOR_ATTACHMENT5, - GL_COLOR_ATTACHMENT6, - GL_COLOR_ATTACHMENT7, - GL_COLOR_ATTACHMENT8, - GL_COLOR_ATTACHMENT9, - GL_COLOR_ATTACHMENT10, - GL_COLOR_ATTACHMENT11, - GL_COLOR_ATTACHMENT12, - GL_COLOR_ATTACHMENT13, - GL_COLOR_ATTACHMENT14, - GL_COLOR_ATTACHMENT15 }; - - int unit = 0; - for (auto& b : framebuffer.getRenderBuffers()) { - auto surface = b._texture; - if (surface) { - auto gltexture = GLBackend::syncGPUObject(*surface); - if (gltexture) { - glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D, gltexture->_texture, 0); - } - colorBuffers[nbColorBuffers] = colorAttachments[unit]; - nbColorBuffers++; - unit++; - } - } - } - - if (framebuffer.hasDepthStencil()) { - auto surface = framebuffer.getDepthStencilBuffer(); - if (surface) { - auto gltexture = GLBackend::syncGPUObject(*surface); - if (gltexture) { - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, gltexture->_texture, 0); - } - } - } - - // Last but not least, define where we draw - if (nbColorBuffers > 0) { - glDrawBuffers(nbColorBuffers, colorBuffers); - } else { - glDrawBuffer( GL_NONE ); - } - - // Now check for completness - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - bool result = false; - switch (status) { - case GL_FRAMEBUFFER_COMPLETE : - // Success ! - result = true; - break; - case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT : - qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT."; - break; - case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : - qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT."; - break; - case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER : - qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER."; - break; - case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER : - qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER."; - break; - case GL_FRAMEBUFFER_UNSUPPORTED : - qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_UNSUPPORTED."; - break; - } - if (!result && fbo) { - glDeleteFramebuffers( 1, &fbo ); - return nullptr; + (void) CHECK_GL_ERROR(); + + glBindFramebuffer(GL_FRAMEBUFFER, fbo); + + unsigned int nbColorBuffers = 0; + GLenum colorBuffers[16]; + if (framebuffer.hasColor()) { + static const GLenum colorAttachments[] = { + GL_COLOR_ATTACHMENT0, + GL_COLOR_ATTACHMENT1, + GL_COLOR_ATTACHMENT2, + GL_COLOR_ATTACHMENT3, + GL_COLOR_ATTACHMENT4, + GL_COLOR_ATTACHMENT5, + GL_COLOR_ATTACHMENT6, + GL_COLOR_ATTACHMENT7, + GL_COLOR_ATTACHMENT8, + GL_COLOR_ATTACHMENT9, + GL_COLOR_ATTACHMENT10, + GL_COLOR_ATTACHMENT11, + GL_COLOR_ATTACHMENT12, + GL_COLOR_ATTACHMENT13, + GL_COLOR_ATTACHMENT14, + GL_COLOR_ATTACHMENT15 }; + + int unit = 0; + for (auto& b : framebuffer.getRenderBuffers()) { + auto surface = b._texture; + if (surface) { + auto gltexture = GLBackend::syncGPUObject(*surface); + if (gltexture) { + glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D, gltexture->_texture, 0); + } + colorBuffers[nbColorBuffers] = colorAttachments[unit]; + nbColorBuffers++; + unit++; + } + } + } + + if (framebuffer.hasDepthStencil()) { + auto surface = framebuffer.getDepthStencilBuffer(); + if (surface) { + auto gltexture = GLBackend::syncGPUObject(*surface); + if (gltexture) { + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, gltexture->_texture, 0); + } + } + } + + // Last but not least, define where we draw + if (nbColorBuffers > 0) { + glDrawBuffers(nbColorBuffers, colorBuffers); + } else { + glDrawBuffer( GL_NONE ); + } + + // Now check for completness + GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); + bool result = false; + switch (status) { + case GL_FRAMEBUFFER_COMPLETE : + // Success ! + result = true; + break; + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT : + qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT."; + break; + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : + qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT."; + break; + case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER : + qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER."; + break; + case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER : + qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER."; + break; + case GL_FRAMEBUFFER_UNSUPPORTED : + qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_UNSUPPORTED."; + break; + } + if (!result && fbo) { + glDeleteFramebuffers( 1, &fbo ); + return nullptr; } @@ -154,4 +154,4 @@ void GLBackend::do_setFramebuffer(Batch& batch, uint32 paramOffset) { _output._framebuffer = framebuffer; } } - + diff --git a/libraries/gpu/src/gpu/GLBackendPipeline.cpp b/libraries/gpu/src/gpu/GLBackendPipeline.cpp index d285cdd8d8..48a45ce93f 100755 --- a/libraries/gpu/src/gpu/GLBackendPipeline.cpp +++ b/libraries/gpu/src/gpu/GLBackendPipeline.cpp @@ -103,7 +103,7 @@ void GLBackend::do_setPipeline(Batch& batch, uint32 paramOffset) { // THis should be done on Pipeline::update... if (_pipeline._invalidProgram) { glUseProgram(_pipeline._program); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._invalidProgram = false; } } @@ -122,7 +122,7 @@ void GLBackend::updatePipeline() { if (_pipeline._invalidProgram) { // doing it here is aproblem for calls to glUniform.... so will do it on assing... glUseProgram(_pipeline._program); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._invalidProgram = false; } @@ -164,7 +164,7 @@ void GLBackend::do_setUniformBuffer(Batch& batch, uint32 paramOffset) { // GLuint bo = getBufferID(*uniformBuffer); //glUniformBufferEXT(_shader._program, slot, bo); #endif - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void GLBackend::do_setUniformTexture(Batch& batch, uint32 paramOffset) { @@ -175,6 +175,6 @@ void GLBackend::do_setUniformTexture(Batch& batch, uint32 paramOffset) { glActiveTexture(GL_TEXTURE0 + slot); glBindTexture(GL_TEXTURE_2D, to); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } diff --git a/libraries/gpu/src/gpu/GLBackendState.cpp b/libraries/gpu/src/gpu/GLBackendState.cpp index fb85d30fe2..2d3eacd37f 100644 --- a/libraries/gpu/src/gpu/GLBackendState.cpp +++ b/libraries/gpu/src/gpu/GLBackendState.cpp @@ -458,7 +458,7 @@ void GLBackend::getCurrentGLState(State::Data& state) { | (mask[3] ? State::WRITE_ALPHA : 0); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } void GLBackend::syncPipelineStateCache() { @@ -485,7 +485,7 @@ void GLBackend::do_setStateFillMode(int32 mode) { if (_pipeline._stateCache.fillMode != mode) { static GLenum GL_FILL_MODES[] = { GL_POINT, GL_LINE, GL_FILL }; glPolygonMode(GL_FRONT_AND_BACK, GL_FILL_MODES[mode]); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.fillMode = State::FillMode(mode); } @@ -501,7 +501,7 @@ void GLBackend::do_setStateCullMode(int32 mode) { glEnable(GL_CULL_FACE); glCullFace(GL_CULL_MODES[mode]); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.cullMode = State::CullMode(mode); } @@ -511,7 +511,7 @@ void GLBackend::do_setStateFrontFaceClockwise(bool isClockwise) { if (_pipeline._stateCache.frontFaceClockwise != isClockwise) { static GLenum GL_FRONT_FACES[] = { GL_CCW, GL_CW }; glFrontFace(GL_FRONT_FACES[isClockwise]); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.frontFaceClockwise = isClockwise; } @@ -524,7 +524,7 @@ void GLBackend::do_setStateDepthClipEnable(bool enable) { } else { glDisable(GL_DEPTH_CLAMP); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.depthClipEnable = enable; } @@ -537,7 +537,7 @@ void GLBackend::do_setStateScissorEnable(bool enable) { } else { glDisable(GL_SCISSOR_TEST); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.scissorEnable = enable; } @@ -550,7 +550,7 @@ void GLBackend::do_setStateMultisampleEnable(bool enable) { } else { glDisable(GL_MULTISAMPLE); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.multisampleEnable = enable; } @@ -565,7 +565,7 @@ void GLBackend::do_setStateAntialiasedLineEnable(bool enable) { glDisable(GL_POINT_SMOOTH); glDisable(GL_LINE_SMOOTH); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.antialisedLineEnable = enable; } @@ -637,7 +637,7 @@ void GLBackend::do_setStateStencil(State::StencilActivation activation, State::S } else { glDisable(GL_STENCIL_TEST); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.stencilActivation = activation; _pipeline._stateCache.stencilTestFront = frontTest; @@ -652,7 +652,7 @@ void GLBackend::do_setStateAlphaToCoverageEnable(bool enable) { } else { glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); _pipeline._stateCache.alphaToCoverageEnable = enable; } } @@ -684,7 +684,7 @@ void GLBackend::do_setStateBlend(State::BlendFunction function) { GL_MAX }; glBlendEquationSeparate(GL_BLEND_OPS[function.getOperationColor()], GL_BLEND_OPS[function.getOperationAlpha()]); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); static GLenum BLEND_ARGS[] = { GL_ZERO, @@ -706,7 +706,7 @@ void GLBackend::do_setStateBlend(State::BlendFunction function) { glBlendFuncSeparate(BLEND_ARGS[function.getSourceColor()], BLEND_ARGS[function.getDestinationColor()], BLEND_ARGS[function.getSourceAlpha()], BLEND_ARGS[function.getDestinationAlpha()]); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } else { glDisable(GL_BLEND); } @@ -735,5 +735,5 @@ void GLBackend::do_setStateBlendFactor(Batch& batch, uint32 paramOffset) { batch._params[paramOffset + 3]._float); glBlendColor(factor.x, factor.y, factor.z, factor.w); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } diff --git a/libraries/gpu/src/gpu/GLBackendTexture.cpp b/libraries/gpu/src/gpu/GLBackendTexture.cpp index b8f9ab0bf1..4bb16ba0b8 100755 --- a/libraries/gpu/src/gpu/GLBackendTexture.cpp +++ b/libraries/gpu/src/gpu/GLBackendTexture.cpp @@ -16,8 +16,8 @@ GLBackend::GLTexture::GLTexture() : _storageStamp(0), _contentStamp(0), _texture(0), - _size(0), - _target(GL_TEXTURE_2D) + _target(GL_TEXTURE_2D), + _size(0) {} GLBackend::GLTexture::~GLTexture() { @@ -176,6 +176,10 @@ public: texel.internalFormat = GL_DEPTH_COMPONENT24; break; } + case gpu::NUM_TYPES: { // quiet compiler + assert(false); + break; + } } break; default: @@ -279,7 +283,7 @@ GLBackend::GLTexture* GLBackend::syncGPUObject(const Texture& texture) { if (!object) { object = new GLTexture(); glGenTextures(1, &object->_texture); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); Backend::setGPUObject(texture, object); } @@ -363,7 +367,7 @@ GLBackend::GLTexture* GLBackend::syncGPUObject(const Texture& texture) { default: qCDebug(gpulogging) << "GLBackend::syncGPUObject(const Texture&) case for Texture Type " << texture.getType() << " not supported"; } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); return object; } @@ -386,42 +390,42 @@ void GLBackend::syncSampler(const Sampler& sampler, Texture::Type type, GLTextur if (!object) return; if (!object->_texture) return; - class GLFilterMode { - public: - GLint minFilter; - GLint magFilter; - }; - static const GLFilterMode filterModes[] = { - {GL_NEAREST, GL_NEAREST}, //FILTER_MIN_MAG_POINT, - {GL_NEAREST, GL_LINEAR}, //FILTER_MIN_POINT_MAG_LINEAR, - {GL_LINEAR, GL_NEAREST}, //FILTER_MIN_LINEAR_MAG_POINT, - {GL_LINEAR, GL_LINEAR}, //FILTER_MIN_MAG_LINEAR, - - {GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST}, //FILTER_MIN_MAG_MIP_POINT, - {GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST}, //FILTER_MIN_MAG_MIP_POINT, - {GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST}, //FILTER_MIN_MAG_POINT_MIP_LINEAR, - {GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR}, //FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT, - {GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR}, //FILTER_MIN_POINT_MAG_MIP_LINEAR, - {GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST}, //FILTER_MIN_LINEAR_MAG_MIP_POINT, - {GL_LINEAR_MIPMAP_LINEAR, GL_NEAREST}, //FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR, - {GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR}, //FILTER_MIN_MAG_LINEAR_MIP_POINT, - {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR}, //FILTER_MIN_MAG_MIP_LINEAR, - {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR} //FILTER_ANISOTROPIC, - }; + class GLFilterMode { + public: + GLint minFilter; + GLint magFilter; + }; + static const GLFilterMode filterModes[] = { + {GL_NEAREST, GL_NEAREST}, //FILTER_MIN_MAG_POINT, + {GL_NEAREST, GL_LINEAR}, //FILTER_MIN_POINT_MAG_LINEAR, + {GL_LINEAR, GL_NEAREST}, //FILTER_MIN_LINEAR_MAG_POINT, + {GL_LINEAR, GL_LINEAR}, //FILTER_MIN_MAG_LINEAR, + + {GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST}, //FILTER_MIN_MAG_MIP_POINT, + {GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST}, //FILTER_MIN_MAG_MIP_POINT, + {GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST}, //FILTER_MIN_MAG_POINT_MIP_LINEAR, + {GL_NEAREST_MIPMAP_NEAREST, GL_LINEAR}, //FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT, + {GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR}, //FILTER_MIN_POINT_MAG_MIP_LINEAR, + {GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST}, //FILTER_MIN_LINEAR_MAG_MIP_POINT, + {GL_LINEAR_MIPMAP_LINEAR, GL_NEAREST}, //FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR, + {GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR}, //FILTER_MIN_MAG_LINEAR_MIP_POINT, + {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR}, //FILTER_MIN_MAG_MIP_LINEAR, + {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR} //FILTER_ANISOTROPIC, + }; auto fm = filterModes[sampler.getFilter()]; - glTexParameteri(object->_target, GL_TEXTURE_MIN_FILTER, fm.minFilter); - glTexParameteri(object->_target, GL_TEXTURE_MAG_FILTER, fm.magFilter); + glTexParameteri(object->_target, GL_TEXTURE_MIN_FILTER, fm.minFilter); + glTexParameteri(object->_target, GL_TEXTURE_MAG_FILTER, fm.magFilter); - static const GLenum comparisonFuncs[] = { - GL_NEVER, - GL_LESS, - GL_EQUAL, - GL_LEQUAL, - GL_GREATER, - GL_NOTEQUAL, - GL_GEQUAL, - GL_ALWAYS }; + static const GLenum comparisonFuncs[] = { + GL_NEVER, + GL_LESS, + GL_EQUAL, + GL_LEQUAL, + GL_GREATER, + GL_NOTEQUAL, + GL_GEQUAL, + GL_ALWAYS }; if (sampler.doComparison()) { glTexParameteri(object->_target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE); @@ -430,22 +434,22 @@ void GLBackend::syncSampler(const Sampler& sampler, Texture::Type type, GLTextur glTexParameteri(object->_target, GL_TEXTURE_COMPARE_MODE, GL_NONE); } - static const GLenum wrapModes[] = { - GL_REPEAT, // WRAP_REPEAT, - GL_MIRRORED_REPEAT, // WRAP_MIRROR, - GL_CLAMP_TO_EDGE, // WRAP_CLAMP, - GL_CLAMP_TO_BORDER, // WRAP_BORDER, - GL_MIRROR_CLAMP_TO_EDGE_EXT }; // WRAP_MIRROR_ONCE, - - glTexParameteri(object->_target, GL_TEXTURE_WRAP_S, wrapModes[sampler.getWrapModeU()]); - glTexParameteri(object->_target, GL_TEXTURE_WRAP_T, wrapModes[sampler.getWrapModeV()]); - glTexParameteri(object->_target, GL_TEXTURE_WRAP_R, wrapModes[sampler.getWrapModeW()]); + static const GLenum wrapModes[] = { + GL_REPEAT, // WRAP_REPEAT, + GL_MIRRORED_REPEAT, // WRAP_MIRROR, + GL_CLAMP_TO_EDGE, // WRAP_CLAMP, + GL_CLAMP_TO_BORDER, // WRAP_BORDER, + GL_MIRROR_CLAMP_TO_EDGE_EXT }; // WRAP_MIRROR_ONCE, + + glTexParameteri(object->_target, GL_TEXTURE_WRAP_S, wrapModes[sampler.getWrapModeU()]); + glTexParameteri(object->_target, GL_TEXTURE_WRAP_T, wrapModes[sampler.getWrapModeV()]); + glTexParameteri(object->_target, GL_TEXTURE_WRAP_R, wrapModes[sampler.getWrapModeW()]); + + glTexParameterfv(object->_target, GL_TEXTURE_BORDER_COLOR, (const float*) &sampler.getBorderColor()); + glTexParameteri(object->_target, GL_TEXTURE_BASE_LEVEL, sampler.getMipOffset()); + glTexParameterf(object->_target, GL_TEXTURE_MIN_LOD, (float) sampler.getMinMip()); + glTexParameterf(object->_target, GL_TEXTURE_MAX_LOD, (sampler.getMaxMip() == Sampler::MAX_MIP_LEVEL ? 1000.f : sampler.getMaxMip())); + glTexParameterf(object->_target, GL_TEXTURE_MAX_ANISOTROPY_EXT, sampler.getMaxAnisotropy()); + (void) CHECK_GL_ERROR(); - glTexParameterfv(object->_target, GL_TEXTURE_BORDER_COLOR, (const float*) &sampler.getBorderColor()); - glTexParameteri(object->_target, GL_TEXTURE_BASE_LEVEL, sampler.getMipOffset()); - glTexParameterf(object->_target, GL_TEXTURE_MIN_LOD, (float) sampler.getMinMip()); - glTexParameterf(object->_target, GL_TEXTURE_MAX_LOD, (sampler.getMaxMip() == Sampler::MAX_MIP_LEVEL ? 1000.f : sampler.getMaxMip())); - glTexParameterf(object->_target, GL_TEXTURE_MAX_ANISOTROPY_EXT, sampler.getMaxAnisotropy()); - CHECK_GL_ERROR(); - } diff --git a/libraries/gpu/src/gpu/GLBackendTransform.cpp b/libraries/gpu/src/gpu/GLBackendTransform.cpp index f0318a66aa..88c993985f 100755 --- a/libraries/gpu/src/gpu/GLBackendTransform.cpp +++ b/libraries/gpu/src/gpu/GLBackendTransform.cpp @@ -109,7 +109,7 @@ void GLBackend::updateTransform() { } glLoadMatrixf(reinterpret_cast< const GLfloat* >(&_transform._projection)); - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } if (_transform._invalidModel || _transform._invalidView) { @@ -141,7 +141,7 @@ void GLBackend::updateTransform() { // glLoadIdentity(); } } - CHECK_GL_ERROR(); + (void) CHECK_GL_ERROR(); } #endif diff --git a/libraries/gpu/src/gpu/State.h b/libraries/gpu/src/gpu/State.h index 9307882bab..c9bd38efeb 100755 --- a/libraries/gpu/src/gpu/State.h +++ b/libraries/gpu/src/gpu/State.h @@ -41,7 +41,7 @@ public: State(); virtual ~State(); - const Stamp getStamp() const { return _stamp; } + Stamp getStamp() const { return _stamp; } typedef ::gpu::ComparisonFunction ComparisonFunction; diff --git a/libraries/gpu/src/gpu/Stream.h b/libraries/gpu/src/gpu/Stream.h index b1aaec665f..7cd859cbf5 100644 --- a/libraries/gpu/src/gpu/Stream.h +++ b/libraries/gpu/src/gpu/Stream.h @@ -101,9 +101,9 @@ public: uint32 getNumAttributes() const { return _attributes.size(); } const AttributeMap& getAttributes() const { return _attributes; } - uint8 getNumChannels() const { return _channels.size(); } + uint8 getNumChannels() const { return _channels.size(); } const ChannelMap& getChannels() const { return _channels; } - const Offset getChannelStride(Slot channel) const { return _channels.at(channel)._stride; } + Offset getChannelStride(Slot channel) const { return _channels.at(channel)._stride; } uint32 getElementTotalSize() const { return _elementTotalSize; } diff --git a/libraries/gpu/src/gpu/Texture.cpp b/libraries/gpu/src/gpu/Texture.cpp index 76cac74a59..f73b24411b 100755 --- a/libraries/gpu/src/gpu/Texture.cpp +++ b/libraries/gpu/src/gpu/Texture.cpp @@ -1,354 +1,354 @@ -// -// Texture.cpp -// libraries/gpu/src/gpu -// -// Created by Sam Gateau on 1/17/2015. -// Copyright 2014 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include "Texture.h" -#include -#include - -using namespace gpu; - -Texture::Pixels::Pixels(const Element& format, Size size, const Byte* bytes) : - _sysmem(size, bytes), - _format(format), - _isGPULoaded(false) { -} - -Texture::Pixels::~Pixels() { -} - -void Texture::Storage::assignTexture(Texture* texture) { - _texture = texture; -} - -Stamp Texture::Storage::getStamp(uint16 level) const { - PixelsPointer mip = getMip(level); - if (mip) { - return mip->_sysmem.getStamp(); - } - return 0; -} - -void Texture::Storage::reset() { - _mips.clear(); -} - -Texture::PixelsPointer Texture::Storage::editMip(uint16 level) { - if (level < _mips.size()) { - return _mips[level]; - } - return PixelsPointer(); -} - -const Texture::PixelsPointer Texture::Storage::getMip(uint16 level) const { - if (level < _mips.size()) { - return _mips[level]; - } - return PixelsPointer(); -} - -void Texture::Storage::notifyGPULoaded(uint16 level) const { - PixelsPointer mip = getMip(level); - if (mip) { - mip->_isGPULoaded = true; - mip->_sysmem.resize(0); - } -} - -bool Texture::Storage::isMipAvailable(uint16 level) const { - PixelsPointer mip = getMip(level); - return (mip && mip->_sysmem.getSize()); -} - -bool Texture::Storage::allocateMip(uint16 level) { - bool changed = false; - if (level >= _mips.size()) { - _mips.resize(level+1, PixelsPointer()); - changed = true; - } - - if (!_mips[level]) { - _mips[level] = PixelsPointer(new Pixels()); - changed = true; - } - - return changed; -} - -bool Texture::Storage::assignMipData(uint16 level, const Element& format, Size size, const Byte* bytes) { - // Ok we should be able to do that... - allocateMip(level); - auto mip = _mips[level]; - mip->_format = format; - Size allocated = mip->_sysmem.setData(size, bytes); - mip->_isGPULoaded = false; - - return allocated == size; -} - -Texture* Texture::create1D(const Element& texelFormat, uint16 width, const Sampler& sampler) { - return create(TEX_1D, texelFormat, width, 1, 1, 1, 1, sampler); -} - -Texture* Texture::create2D(const Element& texelFormat, uint16 width, uint16 height, const Sampler& sampler) { - return create(TEX_2D, texelFormat, width, height, 1, 1, 1, sampler); -} - -Texture* Texture::create3D(const Element& texelFormat, uint16 width, uint16 height, uint16 depth, const Sampler& sampler) { - return create(TEX_3D, texelFormat, width, height, depth, 1, 1, sampler); -} - -Texture* Texture::createCube(const Element& texelFormat, uint16 width, const Sampler& sampler) { - return create(TEX_CUBE, texelFormat, width, width, 1, 1, 1, sampler); -} - -Texture* Texture::create(Type type, const Element& texelFormat, uint16 width, uint16 height, uint16 depth, uint16 numSamples, uint16 numSlices, const Sampler& sampler) -{ - Texture* tex = new Texture(); - tex->_storage.reset(new Storage()); - tex->_storage->_texture = tex; - tex->_type = type; - tex->_maxMip = 0; - tex->resize(type, texelFormat, width, height, depth, numSamples, numSlices); - - tex->_sampler = sampler; - - return tex; -} - -Texture* Texture::createFromStorage(Storage* storage) { - Texture* tex = new Texture(); - tex->_storage.reset(storage); - storage->assignTexture(tex); - return tex; -} - -Texture::Texture(): - Resource(), - _storage(), - _stamp(0), - _size(0), - _width(1), - _height(1), - _depth(1), - _numSamples(1), - _numSlices(1), - _maxMip(0), - _type(TEX_1D), - _autoGenerateMips(false), - _defined(false) -{ -} - -Texture::~Texture() -{ -} - -Texture::Size Texture::resize(Type type, const Element& texelFormat, uint16 width, uint16 height, uint16 depth, uint16 numSamples, uint16 numSlices) { - if (width && height && depth && numSamples && numSlices) { - bool changed = false; - - if ( _type != type) { - _type = type; - changed = true; - } - - if (_numSlices != numSlices) { - _numSlices = numSlices; - changed = true; - } - - numSamples = evalNumSamplesUsed(numSamples); - if ((_type >= TEX_2D) && (_numSamples != numSamples)) { - _numSamples = numSamples; - changed = true; - } - - if (_width != width) { - _width = width; - changed = true; - } - - if ((_type >= TEX_2D) && (_height != height)) { - _height = height; - changed = true; - } - - - if ((_type >= TEX_3D) && (_depth != depth)) { - _depth = depth; - changed = true; - } - - // Evaluate the new size with the new format - const int DIM_SIZE[] = {1, 1, 1, 6}; - uint32_t size = DIM_SIZE[_type] *_width * _height * _depth * _numSamples * texelFormat.getSize(); - - // If size change then we need to reset - if (changed || (size != getSize())) { - _size = size; - _storage->reset(); - _stamp++; - } - - // TexelFormat might have change, but it's mostly interpretation - if (texelFormat != _texelFormat) { - _texelFormat = texelFormat; - _stamp++; - } - - // Here the Texture has been fully defined from the gpu point of view (size and format) - _defined = true; - } else { - _stamp++; - } - - return _size; -} - -Texture::Size Texture::resize1D(uint16 width, uint16 numSamples) { - return resize(TEX_1D, getTexelFormat(), width, 1, 1, numSamples, 1); -} -Texture::Size Texture::resize2D(uint16 width, uint16 height, uint16 numSamples) { - return resize(TEX_2D, getTexelFormat(), width, height, 1, numSamples, 1); -} -Texture::Size Texture::resize3D(uint16 width, uint16 height, uint16 depth, uint16 numSamples) { - return resize(TEX_3D, getTexelFormat(), width, height, depth, numSamples, 1); -} -Texture::Size Texture::resizeCube(uint16 width, uint16 numSamples) { - return resize(TEX_CUBE, getTexelFormat(), width, 1, 1, numSamples, 1); -} - -Texture::Size Texture::reformat(const Element& texelFormat) { - return resize(_type, texelFormat, getWidth(), getHeight(), getDepth(), getNumSamples(), getNumSlices()); -} - -bool Texture::isColorRenderTarget() const { - return (_texelFormat.getSemantic() == gpu::RGBA); -} - -bool Texture::isDepthStencilRenderTarget() const { - return (_texelFormat.getSemantic() == gpu::DEPTH) || (_texelFormat.getSemantic() == gpu::DEPTH_STENCIL); -} - -uint16 Texture::evalDimNumMips(uint16 size) { - double largerDim = size; - double val = log(largerDim)/log(2.0); - return 1 + (uint16) val; -} - -// The number mips that the texture could have if all existed -// = log2(max(width, height, depth)) -uint16 Texture::evalNumMips() const { - double largerDim = std::max(std::max(_width, _height), _depth); - double val = log(largerDim)/log(2.0); - return 1 + (uint16) val; -} - -uint16 Texture::maxMip() const { - return _maxMip; -} - -bool Texture::assignStoredMip(uint16 level, const Element& format, Size size, const Byte* bytes) { - // Check that level accessed make sense - if (level != 0) { - if (_autoGenerateMips) { - return false; - } - if (level >= evalNumMips()) { - return false; - } - } - - // THen check that the mem buffer passed make sense with its format - Size expectedSize = evalStoredMipSize(level, format); - if (size == expectedSize) { - _storage->assignMipData(level, format, size, bytes); - _stamp++; - return true; - } else if (size > expectedSize) { - // NOTE: We are facing this case sometime because apparently QImage (from where we get the bits) is generating images - // and alligning the line of pixels to 32 bits. - // We should probably consider something a bit more smart to get the correct result but for now (UI elements) - // it seems to work... - _storage->assignMipData(level, format, size, bytes); - _stamp++; - return true; - } - - return false; -} - -uint16 Texture::autoGenerateMips(uint16 maxMip) { - _autoGenerateMips = true; - _maxMip = std::min((uint16) (evalNumMips() - 1), maxMip); - _stamp++; - return _maxMip; -} - -uint16 Texture::getStoredMipWidth(uint16 level) const { - PixelsPointer mip = accessStoredMip(level); - if (mip && mip->_sysmem.getSize()) { - return evalMipWidth(level); - } - return 0; -} - -uint16 Texture::getStoredMipHeight(uint16 level) const { - PixelsPointer mip = accessStoredMip(level); - if (mip && mip->_sysmem.getSize()) { - return evalMipHeight(level); - } - return 0; -} - -uint16 Texture::getStoredMipDepth(uint16 level) const { - PixelsPointer mip = accessStoredMip(level); - if (mip && mip->_sysmem.getSize()) { - return evalMipDepth(level); - } - return 0; -} - -uint32 Texture::getStoredMipNumTexels(uint16 level) const { - PixelsPointer mip = accessStoredMip(level); - if (mip && mip->_sysmem.getSize()) { - return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level); - } - return 0; -} - -uint32 Texture::getStoredMipSize(uint16 level) const { - PixelsPointer mip = accessStoredMip(level); - if (mip && mip->_sysmem.getSize()) { - return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level) * getTexelFormat().getSize(); - } - return 0; -} - -uint16 Texture::evalNumSamplesUsed(uint16 numSamplesTried) { - uint16 sample = numSamplesTried; - if (numSamplesTried <= 1) - sample = 1; - else if (numSamplesTried < 4) - sample = 2; - else if (numSamplesTried < 8) - sample = 4; - else if (numSamplesTried < 16) - sample = 8; - else - sample = 8; - - return sample; -} - +// +// Texture.cpp +// libraries/gpu/src/gpu +// +// Created by Sam Gateau on 1/17/2015. +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "Texture.h" +#include +#include + +using namespace gpu; + +Texture::Pixels::Pixels(const Element& format, Size size, const Byte* bytes) : + _sysmem(size, bytes), + _format(format), + _isGPULoaded(false) { +} + +Texture::Pixels::~Pixels() { +} + +void Texture::Storage::assignTexture(Texture* texture) { + _texture = texture; +} + +Stamp Texture::Storage::getStamp(uint16 level) const { + PixelsPointer mip = getMip(level); + if (mip) { + return mip->_sysmem.getStamp(); + } + return 0; +} + +void Texture::Storage::reset() { + _mips.clear(); +} + +Texture::PixelsPointer Texture::Storage::editMip(uint16 level) { + if (level < _mips.size()) { + return _mips[level]; + } + return PixelsPointer(); +} + +const Texture::PixelsPointer Texture::Storage::getMip(uint16 level) const { + if (level < _mips.size()) { + return _mips[level]; + } + return PixelsPointer(); +} + +void Texture::Storage::notifyGPULoaded(uint16 level) const { + PixelsPointer mip = getMip(level); + if (mip) { + mip->_isGPULoaded = true; + mip->_sysmem.resize(0); + } +} + +bool Texture::Storage::isMipAvailable(uint16 level) const { + PixelsPointer mip = getMip(level); + return (mip && mip->_sysmem.getSize()); +} + +bool Texture::Storage::allocateMip(uint16 level) { + bool changed = false; + if (level >= _mips.size()) { + _mips.resize(level+1, PixelsPointer()); + changed = true; + } + + if (!_mips[level]) { + _mips[level] = PixelsPointer(new Pixels()); + changed = true; + } + + return changed; +} + +bool Texture::Storage::assignMipData(uint16 level, const Element& format, Size size, const Byte* bytes) { + // Ok we should be able to do that... + allocateMip(level); + auto mip = _mips[level]; + mip->_format = format; + Size allocated = mip->_sysmem.setData(size, bytes); + mip->_isGPULoaded = false; + + return allocated == size; +} + +Texture* Texture::create1D(const Element& texelFormat, uint16 width, const Sampler& sampler) { + return create(TEX_1D, texelFormat, width, 1, 1, 1, 1, sampler); +} + +Texture* Texture::create2D(const Element& texelFormat, uint16 width, uint16 height, const Sampler& sampler) { + return create(TEX_2D, texelFormat, width, height, 1, 1, 1, sampler); +} + +Texture* Texture::create3D(const Element& texelFormat, uint16 width, uint16 height, uint16 depth, const Sampler& sampler) { + return create(TEX_3D, texelFormat, width, height, depth, 1, 1, sampler); +} + +Texture* Texture::createCube(const Element& texelFormat, uint16 width, const Sampler& sampler) { + return create(TEX_CUBE, texelFormat, width, width, 1, 1, 1, sampler); +} + +Texture* Texture::create(Type type, const Element& texelFormat, uint16 width, uint16 height, uint16 depth, uint16 numSamples, uint16 numSlices, const Sampler& sampler) +{ + Texture* tex = new Texture(); + tex->_storage.reset(new Storage()); + tex->_storage->_texture = tex; + tex->_type = type; + tex->_maxMip = 0; + tex->resize(type, texelFormat, width, height, depth, numSamples, numSlices); + + tex->_sampler = sampler; + + return tex; +} + +Texture* Texture::createFromStorage(Storage* storage) { + Texture* tex = new Texture(); + tex->_storage.reset(storage); + storage->assignTexture(tex); + return tex; +} + +Texture::Texture(): + Resource(), + _storage(), + _stamp(0), + _size(0), + _width(1), + _height(1), + _depth(1), + _numSamples(1), + _numSlices(1), + _maxMip(0), + _type(TEX_1D), + _autoGenerateMips(false), + _defined(false) +{ +} + +Texture::~Texture() +{ +} + +Texture::Size Texture::resize(Type type, const Element& texelFormat, uint16 width, uint16 height, uint16 depth, uint16 numSamples, uint16 numSlices) { + if (width && height && depth && numSamples && numSlices) { + bool changed = false; + + if ( _type != type) { + _type = type; + changed = true; + } + + if (_numSlices != numSlices) { + _numSlices = numSlices; + changed = true; + } + + numSamples = evalNumSamplesUsed(numSamples); + if ((_type >= TEX_2D) && (_numSamples != numSamples)) { + _numSamples = numSamples; + changed = true; + } + + if (_width != width) { + _width = width; + changed = true; + } + + if ((_type >= TEX_2D) && (_height != height)) { + _height = height; + changed = true; + } + + + if ((_type >= TEX_3D) && (_depth != depth)) { + _depth = depth; + changed = true; + } + + // Evaluate the new size with the new format + const int DIM_SIZE[] = {1, 1, 1, 6}; + uint32_t size = DIM_SIZE[_type] *_width * _height * _depth * _numSamples * texelFormat.getSize(); + + // If size change then we need to reset + if (changed || (size != getSize())) { + _size = size; + _storage->reset(); + _stamp++; + } + + // TexelFormat might have change, but it's mostly interpretation + if (texelFormat != _texelFormat) { + _texelFormat = texelFormat; + _stamp++; + } + + // Here the Texture has been fully defined from the gpu point of view (size and format) + _defined = true; + } else { + _stamp++; + } + + return _size; +} + +Texture::Size Texture::resize1D(uint16 width, uint16 numSamples) { + return resize(TEX_1D, getTexelFormat(), width, 1, 1, numSamples, 1); +} +Texture::Size Texture::resize2D(uint16 width, uint16 height, uint16 numSamples) { + return resize(TEX_2D, getTexelFormat(), width, height, 1, numSamples, 1); +} +Texture::Size Texture::resize3D(uint16 width, uint16 height, uint16 depth, uint16 numSamples) { + return resize(TEX_3D, getTexelFormat(), width, height, depth, numSamples, 1); +} +Texture::Size Texture::resizeCube(uint16 width, uint16 numSamples) { + return resize(TEX_CUBE, getTexelFormat(), width, 1, 1, numSamples, 1); +} + +Texture::Size Texture::reformat(const Element& texelFormat) { + return resize(_type, texelFormat, getWidth(), getHeight(), getDepth(), getNumSamples(), getNumSlices()); +} + +bool Texture::isColorRenderTarget() const { + return (_texelFormat.getSemantic() == gpu::RGBA); +} + +bool Texture::isDepthStencilRenderTarget() const { + return (_texelFormat.getSemantic() == gpu::DEPTH) || (_texelFormat.getSemantic() == gpu::DEPTH_STENCIL); +} + +uint16 Texture::evalDimNumMips(uint16 size) { + double largerDim = size; + double val = log(largerDim)/log(2.0); + return 1 + (uint16) val; +} + +// The number mips that the texture could have if all existed +// = log2(max(width, height, depth)) +uint16 Texture::evalNumMips() const { + double largerDim = std::max(std::max(_width, _height), _depth); + double val = log(largerDim)/log(2.0); + return 1 + (uint16) val; +} + +uint16 Texture::maxMip() const { + return _maxMip; +} + +bool Texture::assignStoredMip(uint16 level, const Element& format, Size size, const Byte* bytes) { + // Check that level accessed make sense + if (level != 0) { + if (_autoGenerateMips) { + return false; + } + if (level >= evalNumMips()) { + return false; + } + } + + // THen check that the mem buffer passed make sense with its format + Size expectedSize = evalStoredMipSize(level, format); + if (size == expectedSize) { + _storage->assignMipData(level, format, size, bytes); + _stamp++; + return true; + } else if (size > expectedSize) { + // NOTE: We are facing this case sometime because apparently QImage (from where we get the bits) is generating images + // and alligning the line of pixels to 32 bits. + // We should probably consider something a bit more smart to get the correct result but for now (UI elements) + // it seems to work... + _storage->assignMipData(level, format, size, bytes); + _stamp++; + return true; + } + + return false; +} + +uint16 Texture::autoGenerateMips(uint16 maxMip) { + _autoGenerateMips = true; + _maxMip = std::min((uint16) (evalNumMips() - 1), maxMip); + _stamp++; + return _maxMip; +} + +uint16 Texture::getStoredMipWidth(uint16 level) const { + PixelsPointer mip = accessStoredMip(level); + if (mip && mip->_sysmem.getSize()) { + return evalMipWidth(level); + } + return 0; +} + +uint16 Texture::getStoredMipHeight(uint16 level) const { + PixelsPointer mip = accessStoredMip(level); + if (mip && mip->_sysmem.getSize()) { + return evalMipHeight(level); + } + return 0; +} + +uint16 Texture::getStoredMipDepth(uint16 level) const { + PixelsPointer mip = accessStoredMip(level); + if (mip && mip->_sysmem.getSize()) { + return evalMipDepth(level); + } + return 0; +} + +uint32 Texture::getStoredMipNumTexels(uint16 level) const { + PixelsPointer mip = accessStoredMip(level); + if (mip && mip->_sysmem.getSize()) { + return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level); + } + return 0; +} + +uint32 Texture::getStoredMipSize(uint16 level) const { + PixelsPointer mip = accessStoredMip(level); + if (mip && mip->_sysmem.getSize()) { + return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level) * getTexelFormat().getSize(); + } + return 0; +} + +uint16 Texture::evalNumSamplesUsed(uint16 numSamplesTried) { + uint16 sample = numSamplesTried; + if (numSamplesTried <= 1) + sample = 1; + else if (numSamplesTried < 4) + sample = 2; + else if (numSamplesTried < 8) + sample = 4; + else if (numSamplesTried < 16) + sample = 8; + else + sample = 8; + + return sample; +} + void Texture::setSampler(const Sampler& sampler) { _sampler = sampler; _samplerStamp++; diff --git a/libraries/gpu/src/gpu/Texture.h b/libraries/gpu/src/gpu/Texture.h index 1d1e82123a..7bf936958b 100755 --- a/libraries/gpu/src/gpu/Texture.h +++ b/libraries/gpu/src/gpu/Texture.h @@ -151,8 +151,8 @@ public: Texture& operator=(const Texture& buf); // deep copy of the sysmem texture ~Texture(); - const Stamp getStamp() const { return _stamp; } - const Stamp getDataStamp(uint16 level = 0) const { return _storage->getStamp(level); } + Stamp getStamp() const { return _stamp; } + Stamp getDataStamp(uint16 level = 0) const { return _storage->getStamp(level); } // The size in bytes of data stored in the texture Size getSize() const { return _size; } @@ -264,7 +264,7 @@ public: // Own sampler void setSampler(const Sampler& sampler); const Sampler& getSampler() const { return _sampler; } - const Stamp getSamplerStamp() const { return _samplerStamp; } + Stamp getSamplerStamp() const { return _samplerStamp; } protected: std::unique_ptr< Storage > _storage; diff --git a/libraries/model/src/model/Geometry.cpp b/libraries/model/src/model/Geometry.cpp index d5d3ba6c07..156f593421 100755 --- a/libraries/model/src/model/Geometry.cpp +++ b/libraries/model/src/model/Geometry.cpp @@ -97,7 +97,7 @@ const Box Mesh::evalPartBounds(int partStart, int partEnd, Boxes& bounds) const auto vertices = &_vertexBuffer.get((*part)._baseVertex); for (;index != endIndex; index++) { // skip primitive restart indices - if ((*index) != PRIMITIVE_RESTART_INDEX) { + if ((*index) != (uint) PRIMITIVE_RESTART_INDEX) { partBound += vertices[(*index)]; } } diff --git a/libraries/networking/src/DataServerAccountInfo.cpp b/libraries/networking/src/DataServerAccountInfo.cpp index 0df4887b74..b58af5e4e7 100644 --- a/libraries/networking/src/DataServerAccountInfo.cpp +++ b/libraries/networking/src/DataServerAccountInfo.cpp @@ -17,7 +17,9 @@ #include "NetworkLogging.h" #include "DataServerAccountInfo.h" +#ifndef __GNUC__ #pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif DataServerAccountInfo::DataServerAccountInfo() : _accessToken(), @@ -34,6 +36,7 @@ DataServerAccountInfo::DataServerAccountInfo() : } DataServerAccountInfo::DataServerAccountInfo(const DataServerAccountInfo& otherInfo) { + QObject(), _accessToken = otherInfo._accessToken; _username = otherInfo._username; _xmppPassword = otherInfo._xmppPassword; diff --git a/libraries/networking/src/HifiSockAddr.cpp b/libraries/networking/src/HifiSockAddr.cpp index c0fb0ecb69..8a967d7818 100644 --- a/libraries/networking/src/HifiSockAddr.cpp +++ b/libraries/networking/src/HifiSockAddr.cpp @@ -33,6 +33,7 @@ HifiSockAddr::HifiSockAddr(const QHostAddress& address, quint16 port) : } HifiSockAddr::HifiSockAddr(const HifiSockAddr& otherSockAddr) : + QObject(), _address(otherSockAddr._address), _port(otherSockAddr._port) { diff --git a/libraries/networking/src/NetworkPeer.cpp b/libraries/networking/src/NetworkPeer.cpp index c6026b3a23..de1b8f66ba 100644 --- a/libraries/networking/src/NetworkPeer.cpp +++ b/libraries/networking/src/NetworkPeer.cpp @@ -39,8 +39,7 @@ NetworkPeer::NetworkPeer(const QUuid& uuid, const HifiSockAddr& publicSocket, co } -NetworkPeer::NetworkPeer(const NetworkPeer& otherPeer) { - +NetworkPeer::NetworkPeer(const NetworkPeer& otherPeer) : QObject() { _uuid = otherPeer._uuid; _publicSocket = otherPeer._publicSocket; _localSocket = otherPeer._localSocket; diff --git a/libraries/networking/src/OAuthAccessToken.cpp b/libraries/networking/src/OAuthAccessToken.cpp index b8ec58099f..0c14e5e074 100644 --- a/libraries/networking/src/OAuthAccessToken.cpp +++ b/libraries/networking/src/OAuthAccessToken.cpp @@ -31,7 +31,7 @@ OAuthAccessToken::OAuthAccessToken(const QJsonObject& jsonObject) : } -OAuthAccessToken::OAuthAccessToken(const OAuthAccessToken& otherToken) { +OAuthAccessToken::OAuthAccessToken(const OAuthAccessToken& otherToken) : QObject() { token = otherToken.token; refreshToken = otherToken.refreshToken; expiryTimestamp = otherToken.expiryTimestamp; diff --git a/libraries/networking/src/RSAKeypairGenerator.cpp b/libraries/networking/src/RSAKeypairGenerator.cpp index f142ce1831..2368b5e6d2 100644 --- a/libraries/networking/src/RSAKeypairGenerator.cpp +++ b/libraries/networking/src/RSAKeypairGenerator.cpp @@ -18,7 +18,9 @@ #include "NetworkLogging.h" #include "RSAKeypairGenerator.h" +#ifndef __GNUC__ #pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif RSAKeypairGenerator::RSAKeypairGenerator(QObject* parent) : QObject(parent) diff --git a/libraries/octree/src/OctreeRenderer.cpp b/libraries/octree/src/OctreeRenderer.cpp index ae40cbfa15..6629d9ceb7 100644 --- a/libraries/octree/src/OctreeRenderer.cpp +++ b/libraries/octree/src/OctreeRenderer.cpp @@ -166,7 +166,7 @@ bool OctreeRenderer::renderOperation(OctreeElement* element, void* extraData) { void OctreeRenderer::render(RenderArgs::RenderMode renderMode, RenderArgs::RenderSide renderSide) { RenderArgs args = { this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (_tree) { _tree->lockForRead(); _tree->recurseTreeWithOperation(renderOperation, &args); diff --git a/libraries/render-utils/src/GeometryCache.cpp b/libraries/render-utils/src/GeometryCache.cpp index 051cbb0e17..9d71ec5cc2 100644 --- a/libraries/render-utils/src/GeometryCache.cpp +++ b/libraries/render-utils/src/GeometryCache.cpp @@ -1796,7 +1796,9 @@ NetworkGeometry::NetworkGeometry(const QUrl& url, const QSharedPointer(), -1 }; + FBXJoint joint = { false, QVector(), -1, 0.0f, 0.0f, glm::vec3(), glm::mat4(), glm::quat(), glm::quat(), + glm::quat(), glm::mat4(), glm::mat4(), glm::vec3(), glm::vec3(), glm::quat(), glm::quat(), + glm::mat4(), QString(""), glm::vec3(), glm::quat(), SHAPE_TYPE_NONE, false}; _geometry.joints.append(joint); _geometry.leftEyeJointIndex = -1; _geometry.rightEyeJointIndex = -1; diff --git a/libraries/render-utils/src/JointState.cpp b/libraries/render-utils/src/JointState.cpp index cf98d69baa..a82a57f0ed 100644 --- a/libraries/render-utils/src/JointState.cpp +++ b/libraries/render-utils/src/JointState.cpp @@ -256,7 +256,7 @@ void JointState::setVisibleRotationInConstrainedFrame(const glm::quat& targetRot _visibleRotation = parentRotation * _fbxJoint->preRotation * _visibleRotationInConstrainedFrame * _fbxJoint->postRotation; } -const bool JointState::rotationIsDefault(const glm::quat& rotation, float tolerance) const { +bool JointState::rotationIsDefault(const glm::quat& rotation, float tolerance) const { glm::quat defaultRotation = _fbxJoint->rotation; return glm::abs(rotation.x - defaultRotation.x) < tolerance && glm::abs(rotation.y - defaultRotation.y) < tolerance && diff --git a/libraries/render-utils/src/JointState.h b/libraries/render-utils/src/JointState.h index b502083463..363aeecd01 100644 --- a/libraries/render-utils/src/JointState.h +++ b/libraries/render-utils/src/JointState.h @@ -88,7 +88,7 @@ public: const glm::quat& getRotationInConstrainedFrame() const { return _rotationInConstrainedFrame; } const glm::quat& getVisibleRotationInConstrainedFrame() const { return _visibleRotationInConstrainedFrame; } - const bool rotationIsDefault(const glm::quat& rotation, float tolerance = EPSILON) const; + bool rotationIsDefault(const glm::quat& rotation, float tolerance = EPSILON) const; glm::quat getDefaultRotationInParentFrame() const; const glm::vec3& getDefaultTranslationInConstrainedFrame() const; diff --git a/libraries/render-utils/src/MatrixStack.h b/libraries/render-utils/src/MatrixStack.h index 505818fc4a..a71bfcbc4a 100644 --- a/libraries/render-utils/src/MatrixStack.h +++ b/libraries/render-utils/src/MatrixStack.h @@ -38,7 +38,7 @@ public: push(glm::mat4()); } - explicit MatrixStack(const MatrixStack & other) { + explicit MatrixStack(const MatrixStack & other) : std::stack() { *((std::stack*)this) = *((std::stack*)&other); } diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 4bc69f1bea..bcdba0dd42 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -111,7 +111,8 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key, slotBindings.insert(gpu::Shader::Binding(std::string("emissiveMap"), 3)); gpu::ShaderPointer program = gpu::ShaderPointer(gpu::Shader::createProgram(vertexShader, pixelShader)); - bool makeResult = gpu::Shader::makeProgram(*program, slotBindings); + // bool makeResult = + gpu::Shader::makeProgram(*program, slotBindings); auto locations = std::shared_ptr(new Locations()); @@ -139,7 +140,8 @@ void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key, // Good to go add the brand new pipeline auto pipeline = gpu::PipelinePointer(gpu::Pipeline::create(program, state)); - auto it = insert(value_type(key.getRaw(), RenderPipeline(pipeline, locations))); + // auto it = + insert(value_type(key.getRaw(), RenderPipeline(pipeline, locations))); // If not a shadow pass, create the mirror version from the same state, just change the FrontFace if (!key.isShadow()) { diff --git a/libraries/shared/src/ShapeInfo.h b/libraries/shared/src/ShapeInfo.h index 114d209788..0bfc91c9c5 100644 --- a/libraries/shared/src/ShapeInfo.h +++ b/libraries/shared/src/ShapeInfo.h @@ -46,7 +46,7 @@ public: void setConvexHulls(const QVector>& points); void setCapsuleY(float radius, float halfHeight); - const int getType() const { return _type; } + int getType() const { return _type; } const glm::vec3& getHalfExtents() const { return _halfExtents; }