merge from upstream

This commit is contained in:
Seth Alves 2015-04-27 09:57:36 -07:00
commit 2cdbe8bf7b
33 changed files with 577 additions and 569 deletions

View file

@ -48,7 +48,7 @@ if (WIN32)
elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) 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-long-long -pedantic")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas") #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) endif(WIN32)
if (NOT MSVC12) if (NOT MSVC12)

View file

@ -33,7 +33,7 @@ DomainServerWebSessionData::DomainServerWebSessionData(const QJsonObject& userOb
} }
} }
DomainServerWebSessionData::DomainServerWebSessionData(const DomainServerWebSessionData& otherSessionData) { DomainServerWebSessionData::DomainServerWebSessionData(const DomainServerWebSessionData& otherSessionData) : QObject() {
_username = otherSessionData._username; _username = otherSessionData._username;
_roles = otherSessionData._roles; _roles = otherSessionData._roles;
} }

View file

@ -50,7 +50,7 @@ public:
TreeNodeScript(const QString& localPath, const QString& fullPath, ScriptOrigin origin); TreeNodeScript(const QString& localPath, const QString& fullPath, ScriptOrigin origin);
const QString& getLocalPath() { return _localPath; } const QString& getLocalPath() { return _localPath; }
const QString& getFullPath() { return _fullPath; }; const QString& getFullPath() { return _fullPath; };
const ScriptOrigin getOrigin() { return _origin; }; ScriptOrigin getOrigin() { return _origin; };
private: private:
QString _localPath; QString _localPath;

View file

@ -81,7 +81,7 @@ public:
FaceModel& getFaceModel() { return _faceModel; } FaceModel& getFaceModel() { return _faceModel; }
const FaceModel& getFaceModel() const { 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; } float getAverageLoudness() const { return _averageLoudness; }
/// \return the point about which scaling occurs. /// \return the point about which scaling occurs.
glm::vec3 getScalePivot() const; glm::vec3 getScalePivot() const;

View file

@ -91,7 +91,7 @@ void Overlays::renderHUD() {
lodManager->getOctreeSizeScale(), lodManager->getOctreeSizeScale(),
lodManager->getBoundaryLevelAdjust(), lodManager->getBoundaryLevelAdjust(),
RenderArgs::DEFAULT_RENDER_MODE, RenderArgs::MONO, 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) { foreach(Overlay* thisOverlay, _overlaysHUD) {
if (thisOverlay->is3D()) { if (thisOverlay->is3D()) {
@ -126,7 +126,7 @@ void Overlays::renderWorld(bool drawFront, RenderArgs::RenderMode renderMode, Re
lodManager->getOctreeSizeScale(), lodManager->getOctreeSizeScale(),
lodManager->getBoundaryLevelAdjust(), lodManager->getBoundaryLevelAdjust(),
renderMode, renderSide, 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) { foreach(Overlay* thisOverlay, _overlaysWorld) {

View file

@ -64,7 +64,7 @@ AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) :
} }
} }
AudioEffectOptions::AudioEffectOptions(const AudioEffectOptions &other) { AudioEffectOptions::AudioEffectOptions(const AudioEffectOptions &other) : QObject() {
*this = other; *this = other;
} }

View file

@ -393,7 +393,7 @@ void EntityTreeRenderer::render(RenderArgs::RenderMode renderMode,
_viewState->getShadowViewFrustum() : _viewState->getCurrentViewFrustum(); _viewState->getShadowViewFrustum() : _viewState->getCurrentViewFrustum();
RenderArgs args = { this, frustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide, RenderArgs args = { this, frustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide,
renderDebugFlags, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; renderDebugFlags, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
_tree->lockForRead(); _tree->lockForRead();

View file

@ -521,7 +521,7 @@ bool EntityTree::findInSphereOperation(OctreeElement* element, void* extraData)
// NOTE: assumes caller has handled locking // NOTE: assumes caller has handled locking
void EntityTree::findEntities(const glm::vec3& center, float radius, QVector<const EntityItem*>& foundEntities) { void EntityTree::findEntities(const glm::vec3& center, float radius, QVector<const EntityItem*>& foundEntities) {
FindAllNearPointArgs args = { center, radius }; FindAllNearPointArgs args = { center, radius, QVector<const EntityItem*>() };
// NOTE: This should use recursion, since this is a spatial operation // NOTE: This should use recursion, since this is a spatial operation
recurseTreeWithOperation(findInSphereOperation, &args); recurseTreeWithOperation(findInSphereOperation, &args);

View file

@ -133,7 +133,7 @@ bool FBXGeometry::convexHullContains(const glm::vec3& point) const {
auto checkEachPrimitive = [=](FBXMesh& mesh, QVector<int> indices, int primitiveSize) -> bool { auto checkEachPrimitive = [=](FBXMesh& mesh, QVector<int> indices, int primitiveSize) -> bool {
// Check whether the point is "behind" all the primitives. // 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, if (!isPointBehindTrianglesPlane(point,
mesh.vertices[indices[j]], mesh.vertices[indices[j]],
mesh.vertices[indices[j + 1]], 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 rotationMinX = false, rotationMinY = false, rotationMinZ = false;
bool rotationMaxX = false, rotationMaxY = false, rotationMaxZ = false; bool rotationMaxX = false, rotationMaxY = false, rotationMaxZ = false;
glm::vec3 rotationMin, rotationMax; 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; ExtractedMesh* mesh = NULL;
QVector<ExtractedBlendshape> blendshapes; QVector<ExtractedBlendshape> blendshapes;
foreach (const FBXNode& subobject, object.children) { foreach (const FBXNode& subobject, object.children) {
@ -1685,7 +1686,8 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
textureContent.insert(filename, content); textureContent.insert(filename, content);
} }
} else if (object.name == "Material") { } 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<model::Material>(NULL)};
foreach (const FBXNode& subobject, object.children) { foreach (const FBXNode& subobject, object.children) {
bool properties = false; bool properties = false;
QByteArray propertyName; QByteArray propertyName;

View file

@ -143,7 +143,7 @@ void GLBackend::do_draw(Batch& batch, uint32 paramOffset) {
uint32 startVertex = batch._params[paramOffset + 0]._uint; uint32 startVertex = batch._params[paramOffset + 0]._uint;
glDrawArrays(mode, startVertex, numVertices); glDrawArrays(mode, startVertex, numVertices);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void GLBackend::do_drawIndexed(Batch& batch, uint32 paramOffset) { 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]; GLenum glType = _elementTypeToGLType[_input._indexBufferType];
glDrawElements(mode, numIndices, glType, reinterpret_cast<GLvoid*>(startIndex + _input._indexBufferOffset)); glDrawElements(mode, numIndices, glType, reinterpret_cast<GLvoid*>(startIndex + _input._indexBufferOffset));
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) { void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) {
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void GLBackend::do_drawIndexedInstanced(Batch& batch, uint32 paramOffset) { 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 // 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) { void GLBackend::do_glEnable(Batch& batch, uint32 paramOffset) {
glEnable(batch._params[paramOffset]._uint); glEnable(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glDisable(GLenum cap) { void Batch::_glDisable(GLenum cap) {
@ -201,7 +201,7 @@ void Batch::_glDisable(GLenum cap) {
} }
void GLBackend::do_glDisable(Batch& batch, uint32 paramOffset) { void GLBackend::do_glDisable(Batch& batch, uint32 paramOffset) {
glDisable(batch._params[paramOffset]._uint); glDisable(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glEnableClientState(GLenum array) { void Batch::_glEnableClientState(GLenum array) {
@ -213,7 +213,7 @@ void Batch::_glEnableClientState(GLenum array) {
} }
void GLBackend::do_glEnableClientState(Batch& batch, uint32 paramOffset) { void GLBackend::do_glEnableClientState(Batch& batch, uint32 paramOffset) {
glEnableClientState(batch._params[paramOffset]._uint); glEnableClientState(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glDisableClientState(GLenum array) { void Batch::_glDisableClientState(GLenum array) {
@ -225,7 +225,7 @@ void Batch::_glDisableClientState(GLenum array) {
} }
void GLBackend::do_glDisableClientState(Batch& batch, uint32 paramOffset) { void GLBackend::do_glDisableClientState(Batch& batch, uint32 paramOffset) {
glDisableClientState(batch._params[paramOffset]._uint); glDisableClientState(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glCullFace(GLenum mode) { void Batch::_glCullFace(GLenum mode) {
@ -237,7 +237,7 @@ void Batch::_glCullFace(GLenum mode) {
} }
void GLBackend::do_glCullFace(Batch& batch, uint32 paramOffset) { void GLBackend::do_glCullFace(Batch& batch, uint32 paramOffset) {
glCullFace(batch._params[paramOffset]._uint); glCullFace(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glAlphaFunc(GLenum func, GLclampf ref) { void Batch::_glAlphaFunc(GLenum func, GLclampf ref) {
@ -252,7 +252,7 @@ void GLBackend::do_glAlphaFunc(Batch& batch, uint32 paramOffset) {
glAlphaFunc( glAlphaFunc(
batch._params[paramOffset + 1]._uint, batch._params[paramOffset + 1]._uint,
batch._params[paramOffset + 0]._float); batch._params[paramOffset + 0]._float);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glDepthFunc(GLenum func) { void Batch::_glDepthFunc(GLenum func) {
@ -264,7 +264,7 @@ void Batch::_glDepthFunc(GLenum func) {
} }
void GLBackend::do_glDepthFunc(Batch& batch, uint32 paramOffset) { void GLBackend::do_glDepthFunc(Batch& batch, uint32 paramOffset) {
glDepthFunc(batch._params[paramOffset]._uint); glDepthFunc(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glDepthMask(GLboolean flag) { void Batch::_glDepthMask(GLboolean flag) {
@ -276,7 +276,7 @@ void Batch::_glDepthMask(GLboolean flag) {
} }
void GLBackend::do_glDepthMask(Batch& batch, uint32 paramOffset) { void GLBackend::do_glDepthMask(Batch& batch, uint32 paramOffset) {
glDepthMask(batch._params[paramOffset]._uint); glDepthMask(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glDepthRange(GLfloat zNear, GLfloat zFar) { void Batch::_glDepthRange(GLfloat zNear, GLfloat zFar) {
@ -291,7 +291,7 @@ void GLBackend::do_glDepthRange(Batch& batch, uint32 paramOffset) {
glDepthRange( glDepthRange(
batch._params[paramOffset + 1]._float, batch._params[paramOffset + 1]._float,
batch._params[paramOffset + 0]._float); batch._params[paramOffset + 0]._float);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glBindBuffer(GLenum target, GLuint buffer) { void Batch::_glBindBuffer(GLenum target, GLuint buffer) {
@ -306,7 +306,7 @@ void GLBackend::do_glBindBuffer(Batch& batch, uint32 paramOffset) {
glBindBuffer( glBindBuffer(
batch._params[paramOffset + 1]._uint, batch._params[paramOffset + 1]._uint,
batch._params[paramOffset + 0]._uint); batch._params[paramOffset + 0]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glBindTexture(GLenum target, GLuint texture) { void Batch::_glBindTexture(GLenum target, GLuint texture) {
@ -321,7 +321,7 @@ void GLBackend::do_glBindTexture(Batch& batch, uint32 paramOffset) {
glBindTexture( glBindTexture(
batch._params[paramOffset + 1]._uint, batch._params[paramOffset + 1]._uint,
batch._params[paramOffset + 0]._uint); batch._params[paramOffset + 0]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glActiveTexture(GLenum texture) { void Batch::_glActiveTexture(GLenum texture) {
@ -333,7 +333,7 @@ void Batch::_glActiveTexture(GLenum texture) {
} }
void GLBackend::do_glActiveTexture(Batch& batch, uint32 paramOffset) { void GLBackend::do_glActiveTexture(Batch& batch, uint32 paramOffset) {
glActiveTexture(batch._params[paramOffset]._uint); glActiveTexture(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glDrawBuffers(GLsizei n, const GLenum* bufs) { void Batch::_glDrawBuffers(GLsizei n, const GLenum* bufs) {
@ -348,7 +348,7 @@ void GLBackend::do_glDrawBuffers(Batch& batch, uint32 paramOffset) {
glDrawBuffers( glDrawBuffers(
batch._params[paramOffset + 1]._uint, batch._params[paramOffset + 1]._uint,
(const GLenum*)batch.editData(batch._params[paramOffset + 0]._uint)); (const GLenum*)batch.editData(batch._params[paramOffset + 0]._uint));
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glUseProgram(GLuint program) { void Batch::_glUseProgram(GLuint program) {
@ -365,7 +365,7 @@ void GLBackend::do_glUseProgram(Batch& batch, uint32 paramOffset) {
_pipeline._invalidProgram = false; _pipeline._invalidProgram = false;
glUseProgram(_pipeline._program); glUseProgram(_pipeline._program);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glUniform1f(GLint location, GLfloat v0) { void Batch::_glUniform1f(GLint location, GLfloat v0) {
@ -385,7 +385,7 @@ void GLBackend::do_glUniform1f(Batch& batch, uint32 paramOffset) {
glUniform1f( glUniform1f(
batch._params[paramOffset + 1]._int, batch._params[paramOffset + 1]._int,
batch._params[paramOffset + 0]._float); batch._params[paramOffset + 0]._float);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glUniform2f(GLint location, GLfloat v0, GLfloat v1) { 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 + 2]._int,
batch._params[paramOffset + 1]._float, batch._params[paramOffset + 1]._float,
batch._params[paramOffset + 0]._float); batch._params[paramOffset + 0]._float);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glUniform4fv(GLint location, GLsizei count, const GLfloat* value) { 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, batch._params[paramOffset + 1]._uint,
(const GLfloat*)batch.editData(batch._params[paramOffset + 0]._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) { 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 + 2]._uint,
batch._params[paramOffset + 1]._uint, batch._params[paramOffset + 1]._uint,
(const GLfloat*)batch.editData(batch._params[paramOffset + 0]._uint)); (const GLfloat*)batch.editData(batch._params[paramOffset + 0]._uint));
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glEnableVertexAttribArray(GLint location) { void Batch::_glEnableVertexAttribArray(GLint location) {
@ -453,7 +453,7 @@ void Batch::_glEnableVertexAttribArray(GLint location) {
} }
void GLBackend::do_glEnableVertexAttribArray(Batch& batch, uint32 paramOffset) { void GLBackend::do_glEnableVertexAttribArray(Batch& batch, uint32 paramOffset) {
glEnableVertexAttribArray(batch._params[paramOffset]._uint); glEnableVertexAttribArray(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glDisableVertexAttribArray(GLint location) { void Batch::_glDisableVertexAttribArray(GLint location) {
@ -465,7 +465,7 @@ void Batch::_glDisableVertexAttribArray(GLint location) {
} }
void GLBackend::do_glDisableVertexAttribArray(Batch& batch, uint32 paramOffset) { void GLBackend::do_glDisableVertexAttribArray(Batch& batch, uint32 paramOffset) {
glDisableVertexAttribArray(batch._params[paramOffset]._uint); glDisableVertexAttribArray(batch._params[paramOffset]._uint);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void Batch::_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { 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 + 2]._float,
batch._params[paramOffset + 1]._float, batch._params[paramOffset + 1]._float,
batch._params[paramOffset + 0]._float); batch._params[paramOffset + 0]._float);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }

View file

@ -35,7 +35,7 @@ GLBackend::GLBuffer* GLBackend::syncGPUObject(const Buffer& buffer) {
if (!object) { if (!object) {
object = new GLBuffer(); object = new GLBuffer();
glGenBuffers(1, &object->_buffer); glGenBuffers(1, &object->_buffer);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
Backend::setGPUObject(buffer, object); Backend::setGPUObject(buffer, object);
} }
@ -48,7 +48,7 @@ GLBackend::GLBuffer* GLBackend::syncGPUObject(const Buffer& buffer) {
object->_stamp = buffer.getSysmem().getStamp(); object->_stamp = buffer.getSysmem().getStamp();
object->_size = buffer.getSysmem().getSize(); object->_size = buffer.getSysmem().getSize();
//} //}
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
return object; return object;
} }

View file

@ -83,7 +83,7 @@ void GLBackend::updateInput() {
glDisableVertexAttribArray(i); glDisableVertexAttribArray(i);
} }
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_input._attributeActivation.flip(i); _input._attributeActivation.flip(i);
} }
@ -108,7 +108,7 @@ void GLBackend::updateInput() {
if (_input._buffersState.test(bufferNum) || _input._invalidFormat) { if (_input._buffersState.test(bufferNum) || _input._invalidFormat) {
GLuint vbo = gpu::GLBackend::getBufferID((*buffers[bufferNum])); GLuint vbo = gpu::GLBackend::getBufferID((*buffers[bufferNum]));
glBindBuffer(GL_ARRAY_BUFFER, vbo); glBindBuffer(GL_ARRAY_BUFFER, vbo);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_input._buffersState[bufferNum] = false; _input._buffersState[bufferNum] = false;
for (unsigned int i = 0; i < channel._slots.size(); i++) { for (unsigned int i = 0; i < channel._slots.size(); i++) {
@ -142,7 +142,7 @@ void GLBackend::updateInput() {
glVertexAttribPointer(slot, count, type, isNormalized, stride, glVertexAttribPointer(slot, count, type, isNormalized, stride,
reinterpret_cast<GLvoid*>(pointer)); reinterpret_cast<GLvoid*>(pointer));
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
} }
} }
@ -219,5 +219,5 @@ void GLBackend::do_setIndexBuffer(Batch& batch, uint32 paramOffset) {
} else { } else {
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }

View file

@ -24,7 +24,6 @@ GLBackend::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffe
GLFramebuffer* object = Backend::getGPUObject<GLBackend::GLFramebuffer>(framebuffer); GLFramebuffer* object = Backend::getGPUObject<GLBackend::GLFramebuffer>(framebuffer);
// If GPU object already created and in sync // If GPU object already created and in sync
bool needUpdate = false;
if (object) { if (object) {
return object; return object;
} else if (framebuffer.isEmpty()) { } else if (framebuffer.isEmpty()) {
@ -36,90 +35,90 @@ GLBackend::GLFramebuffer* GLBackend::syncGPUObject(const Framebuffer& framebuffe
if (!object) { if (!object) {
GLuint fbo; GLuint fbo;
glGenFramebuffers(1, &fbo); glGenFramebuffers(1, &fbo);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
glBindFramebuffer(GL_FRAMEBUFFER, fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo);
unsigned int nbColorBuffers = 0; unsigned int nbColorBuffers = 0;
GLenum colorBuffers[16]; GLenum colorBuffers[16];
if (framebuffer.hasColor()) { if (framebuffer.hasColor()) {
static const GLenum colorAttachments[] = { static const GLenum colorAttachments[] = {
GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT1,
GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT2,
GL_COLOR_ATTACHMENT3, GL_COLOR_ATTACHMENT3,
GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT4,
GL_COLOR_ATTACHMENT5, GL_COLOR_ATTACHMENT5,
GL_COLOR_ATTACHMENT6, GL_COLOR_ATTACHMENT6,
GL_COLOR_ATTACHMENT7, GL_COLOR_ATTACHMENT7,
GL_COLOR_ATTACHMENT8, GL_COLOR_ATTACHMENT8,
GL_COLOR_ATTACHMENT9, GL_COLOR_ATTACHMENT9,
GL_COLOR_ATTACHMENT10, GL_COLOR_ATTACHMENT10,
GL_COLOR_ATTACHMENT11, GL_COLOR_ATTACHMENT11,
GL_COLOR_ATTACHMENT12, GL_COLOR_ATTACHMENT12,
GL_COLOR_ATTACHMENT13, GL_COLOR_ATTACHMENT13,
GL_COLOR_ATTACHMENT14, GL_COLOR_ATTACHMENT14,
GL_COLOR_ATTACHMENT15 }; GL_COLOR_ATTACHMENT15 };
int unit = 0; int unit = 0;
for (auto& b : framebuffer.getRenderBuffers()) { for (auto& b : framebuffer.getRenderBuffers()) {
auto surface = b._texture; auto surface = b._texture;
if (surface) { if (surface) {
auto gltexture = GLBackend::syncGPUObject(*surface); auto gltexture = GLBackend::syncGPUObject(*surface);
if (gltexture) { if (gltexture) {
glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D, gltexture->_texture, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, colorAttachments[unit], GL_TEXTURE_2D, gltexture->_texture, 0);
} }
colorBuffers[nbColorBuffers] = colorAttachments[unit]; colorBuffers[nbColorBuffers] = colorAttachments[unit];
nbColorBuffers++; nbColorBuffers++;
unit++; unit++;
} }
} }
} }
if (framebuffer.hasDepthStencil()) { if (framebuffer.hasDepthStencil()) {
auto surface = framebuffer.getDepthStencilBuffer(); auto surface = framebuffer.getDepthStencilBuffer();
if (surface) { if (surface) {
auto gltexture = GLBackend::syncGPUObject(*surface); auto gltexture = GLBackend::syncGPUObject(*surface);
if (gltexture) { if (gltexture) {
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, gltexture->_texture, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, gltexture->_texture, 0);
} }
} }
} }
// Last but not least, define where we draw // Last but not least, define where we draw
if (nbColorBuffers > 0) { if (nbColorBuffers > 0) {
glDrawBuffers(nbColorBuffers, colorBuffers); glDrawBuffers(nbColorBuffers, colorBuffers);
} else { } else {
glDrawBuffer( GL_NONE ); glDrawBuffer( GL_NONE );
} }
// Now check for completness // Now check for completness
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
bool result = false; bool result = false;
switch (status) { switch (status) {
case GL_FRAMEBUFFER_COMPLETE : case GL_FRAMEBUFFER_COMPLETE :
// Success ! // Success !
result = true; result = true;
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT : case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT :
qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT."; qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT.";
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT :
qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT."; qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT.";
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER : case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER :
qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER."; qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER.";
break; break;
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER : case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER :
qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER."; qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER.";
break; break;
case GL_FRAMEBUFFER_UNSUPPORTED : case GL_FRAMEBUFFER_UNSUPPORTED :
qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_UNSUPPORTED."; qCDebug(gpulogging) << "GLFramebuffer::syncGPUObject : Framebuffer not valid, GL_FRAMEBUFFER_UNSUPPORTED.";
break; break;
} }
if (!result && fbo) { if (!result && fbo) {
glDeleteFramebuffers( 1, &fbo ); glDeleteFramebuffers( 1, &fbo );
return nullptr; return nullptr;
} }
@ -154,4 +153,4 @@ void GLBackend::do_setFramebuffer(Batch& batch, uint32 paramOffset) {
_output._framebuffer = framebuffer; _output._framebuffer = framebuffer;
} }
} }

View file

@ -103,7 +103,7 @@ void GLBackend::do_setPipeline(Batch& batch, uint32 paramOffset) {
// THis should be done on Pipeline::update... // THis should be done on Pipeline::update...
if (_pipeline._invalidProgram) { if (_pipeline._invalidProgram) {
glUseProgram(_pipeline._program); glUseProgram(_pipeline._program);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._invalidProgram = false; _pipeline._invalidProgram = false;
} }
} }
@ -122,7 +122,7 @@ void GLBackend::updatePipeline() {
if (_pipeline._invalidProgram) { if (_pipeline._invalidProgram) {
// doing it here is aproblem for calls to glUniform.... so will do it on assing... // doing it here is aproblem for calls to glUniform.... so will do it on assing...
glUseProgram(_pipeline._program); glUseProgram(_pipeline._program);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._invalidProgram = false; _pipeline._invalidProgram = false;
} }
@ -164,7 +164,7 @@ void GLBackend::do_setUniformBuffer(Batch& batch, uint32 paramOffset) {
// GLuint bo = getBufferID(*uniformBuffer); // GLuint bo = getBufferID(*uniformBuffer);
//glUniformBufferEXT(_shader._program, slot, bo); //glUniformBufferEXT(_shader._program, slot, bo);
#endif #endif
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void GLBackend::do_setUniformTexture(Batch& batch, uint32 paramOffset) { void GLBackend::do_setUniformTexture(Batch& batch, uint32 paramOffset) {
@ -175,6 +175,6 @@ void GLBackend::do_setUniformTexture(Batch& batch, uint32 paramOffset) {
glActiveTexture(GL_TEXTURE0 + slot); glActiveTexture(GL_TEXTURE0 + slot);
glBindTexture(GL_TEXTURE_2D, to); glBindTexture(GL_TEXTURE_2D, to);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }

View file

@ -458,7 +458,7 @@ void GLBackend::getCurrentGLState(State::Data& state) {
| (mask[3] ? State::WRITE_ALPHA : 0); | (mask[3] ? State::WRITE_ALPHA : 0);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
void GLBackend::syncPipelineStateCache() { void GLBackend::syncPipelineStateCache() {
@ -485,7 +485,7 @@ void GLBackend::do_setStateFillMode(int32 mode) {
if (_pipeline._stateCache.fillMode != mode) { if (_pipeline._stateCache.fillMode != mode) {
static GLenum GL_FILL_MODES[] = { GL_POINT, GL_LINE, GL_FILL }; static GLenum GL_FILL_MODES[] = { GL_POINT, GL_LINE, GL_FILL };
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL_MODES[mode]); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL_MODES[mode]);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.fillMode = State::FillMode(mode); _pipeline._stateCache.fillMode = State::FillMode(mode);
} }
@ -501,7 +501,7 @@ void GLBackend::do_setStateCullMode(int32 mode) {
glEnable(GL_CULL_FACE); glEnable(GL_CULL_FACE);
glCullFace(GL_CULL_MODES[mode]); glCullFace(GL_CULL_MODES[mode]);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.cullMode = State::CullMode(mode); _pipeline._stateCache.cullMode = State::CullMode(mode);
} }
@ -511,7 +511,7 @@ void GLBackend::do_setStateFrontFaceClockwise(bool isClockwise) {
if (_pipeline._stateCache.frontFaceClockwise != isClockwise) { if (_pipeline._stateCache.frontFaceClockwise != isClockwise) {
static GLenum GL_FRONT_FACES[] = { GL_CCW, GL_CW }; static GLenum GL_FRONT_FACES[] = { GL_CCW, GL_CW };
glFrontFace(GL_FRONT_FACES[isClockwise]); glFrontFace(GL_FRONT_FACES[isClockwise]);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.frontFaceClockwise = isClockwise; _pipeline._stateCache.frontFaceClockwise = isClockwise;
} }
@ -524,7 +524,7 @@ void GLBackend::do_setStateDepthClipEnable(bool enable) {
} else { } else {
glDisable(GL_DEPTH_CLAMP); glDisable(GL_DEPTH_CLAMP);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.depthClipEnable = enable; _pipeline._stateCache.depthClipEnable = enable;
} }
@ -537,7 +537,7 @@ void GLBackend::do_setStateScissorEnable(bool enable) {
} else { } else {
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.scissorEnable = enable; _pipeline._stateCache.scissorEnable = enable;
} }
@ -550,7 +550,7 @@ void GLBackend::do_setStateMultisampleEnable(bool enable) {
} else { } else {
glDisable(GL_MULTISAMPLE); glDisable(GL_MULTISAMPLE);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.multisampleEnable = enable; _pipeline._stateCache.multisampleEnable = enable;
} }
@ -565,7 +565,7 @@ void GLBackend::do_setStateAntialiasedLineEnable(bool enable) {
glDisable(GL_POINT_SMOOTH); glDisable(GL_POINT_SMOOTH);
glDisable(GL_LINE_SMOOTH); glDisable(GL_LINE_SMOOTH);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.antialisedLineEnable = enable; _pipeline._stateCache.antialisedLineEnable = enable;
} }
@ -637,7 +637,7 @@ void GLBackend::do_setStateStencil(State::StencilActivation activation, State::S
} else { } else {
glDisable(GL_STENCIL_TEST); glDisable(GL_STENCIL_TEST);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.stencilActivation = activation; _pipeline._stateCache.stencilActivation = activation;
_pipeline._stateCache.stencilTestFront = frontTest; _pipeline._stateCache.stencilTestFront = frontTest;
@ -652,7 +652,7 @@ void GLBackend::do_setStateAlphaToCoverageEnable(bool enable) {
} else { } else {
glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE); glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE);
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
_pipeline._stateCache.alphaToCoverageEnable = enable; _pipeline._stateCache.alphaToCoverageEnable = enable;
} }
} }
@ -684,7 +684,7 @@ void GLBackend::do_setStateBlend(State::BlendFunction function) {
GL_MAX }; GL_MAX };
glBlendEquationSeparate(GL_BLEND_OPS[function.getOperationColor()], GL_BLEND_OPS[function.getOperationAlpha()]); glBlendEquationSeparate(GL_BLEND_OPS[function.getOperationColor()], GL_BLEND_OPS[function.getOperationAlpha()]);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
static GLenum BLEND_ARGS[] = { static GLenum BLEND_ARGS[] = {
GL_ZERO, GL_ZERO,
@ -706,7 +706,7 @@ void GLBackend::do_setStateBlend(State::BlendFunction function) {
glBlendFuncSeparate(BLEND_ARGS[function.getSourceColor()], BLEND_ARGS[function.getDestinationColor()], glBlendFuncSeparate(BLEND_ARGS[function.getSourceColor()], BLEND_ARGS[function.getDestinationColor()],
BLEND_ARGS[function.getSourceAlpha()], BLEND_ARGS[function.getDestinationAlpha()]); BLEND_ARGS[function.getSourceAlpha()], BLEND_ARGS[function.getDestinationAlpha()]);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} else { } else {
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
@ -735,5 +735,5 @@ void GLBackend::do_setStateBlendFactor(Batch& batch, uint32 paramOffset) {
batch._params[paramOffset + 3]._float); batch._params[paramOffset + 3]._float);
glBlendColor(factor.x, factor.y, factor.z, factor.w); glBlendColor(factor.x, factor.y, factor.z, factor.w);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }

View file

@ -176,9 +176,10 @@ public:
texel.internalFormat = GL_DEPTH_COMPONENT24; texel.internalFormat = GL_DEPTH_COMPONENT24;
break; break;
} }
case gpu::NUM_TYPES: case gpu::NUM_TYPES: { // quiet compiler
Q_UNREACHABLE(); Q_UNREACHABLE();
} }
}
break; break;
default: default:
qCDebug(gpulogging) << "Unknown combination of texel format"; qCDebug(gpulogging) << "Unknown combination of texel format";
@ -281,7 +282,7 @@ GLBackend::GLTexture* GLBackend::syncGPUObject(const Texture& texture) {
if (!object) { if (!object) {
object = new GLTexture(); object = new GLTexture();
glGenTextures(1, &object->_texture); glGenTextures(1, &object->_texture);
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
Backend::setGPUObject(texture, object); Backend::setGPUObject(texture, object);
} }
@ -365,7 +366,7 @@ GLBackend::GLTexture* GLBackend::syncGPUObject(const Texture& texture) {
default: default:
qCDebug(gpulogging) << "GLBackend::syncGPUObject(const Texture&) case for Texture Type " << texture.getType() << " not supported"; qCDebug(gpulogging) << "GLBackend::syncGPUObject(const Texture&) case for Texture Type " << texture.getType() << " not supported";
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
return object; return object;
} }
@ -388,42 +389,42 @@ void GLBackend::syncSampler(const Sampler& sampler, Texture::Type type, GLTextur
if (!object) return; if (!object) return;
if (!object->_texture) return; if (!object->_texture) return;
class GLFilterMode { class GLFilterMode {
public: public:
GLint minFilter; GLint minFilter;
GLint magFilter; GLint magFilter;
}; };
static const GLFilterMode filterModes[] = { static const GLFilterMode filterModes[] = {
{GL_NEAREST, GL_NEAREST}, //FILTER_MIN_MAG_POINT, {GL_NEAREST, GL_NEAREST}, //FILTER_MIN_MAG_POINT,
{GL_NEAREST, GL_LINEAR}, //FILTER_MIN_POINT_MAG_LINEAR, {GL_NEAREST, GL_LINEAR}, //FILTER_MIN_POINT_MAG_LINEAR,
{GL_LINEAR, GL_NEAREST}, //FILTER_MIN_LINEAR_MAG_POINT, {GL_LINEAR, GL_NEAREST}, //FILTER_MIN_LINEAR_MAG_POINT,
{GL_LINEAR, GL_LINEAR}, //FILTER_MIN_MAG_LINEAR, {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_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_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_NEAREST, GL_LINEAR}, //FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT,
{GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR}, //FILTER_MIN_POINT_MAG_MIP_LINEAR, {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_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_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_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_MIN_MAG_MIP_LINEAR,
{GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR} //FILTER_ANISOTROPIC, {GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR} //FILTER_ANISOTROPIC,
}; };
auto fm = filterModes[sampler.getFilter()]; auto fm = filterModes[sampler.getFilter()];
glTexParameteri(object->_target, GL_TEXTURE_MIN_FILTER, fm.minFilter); glTexParameteri(object->_target, GL_TEXTURE_MIN_FILTER, fm.minFilter);
glTexParameteri(object->_target, GL_TEXTURE_MAG_FILTER, fm.magFilter); glTexParameteri(object->_target, GL_TEXTURE_MAG_FILTER, fm.magFilter);
static const GLenum comparisonFuncs[] = { static const GLenum comparisonFuncs[] = {
GL_NEVER, GL_NEVER,
GL_LESS, GL_LESS,
GL_EQUAL, GL_EQUAL,
GL_LEQUAL, GL_LEQUAL,
GL_GREATER, GL_GREATER,
GL_NOTEQUAL, GL_NOTEQUAL,
GL_GEQUAL, GL_GEQUAL,
GL_ALWAYS }; GL_ALWAYS };
if (sampler.doComparison()) { if (sampler.doComparison()) {
glTexParameteri(object->_target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE); glTexParameteri(object->_target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
@ -432,22 +433,22 @@ void GLBackend::syncSampler(const Sampler& sampler, Texture::Type type, GLTextur
glTexParameteri(object->_target, GL_TEXTURE_COMPARE_MODE, GL_NONE); glTexParameteri(object->_target, GL_TEXTURE_COMPARE_MODE, GL_NONE);
} }
static const GLenum wrapModes[] = { static const GLenum wrapModes[] = {
GL_REPEAT, // WRAP_REPEAT, GL_REPEAT, // WRAP_REPEAT,
GL_MIRRORED_REPEAT, // WRAP_MIRROR, GL_MIRRORED_REPEAT, // WRAP_MIRROR,
GL_CLAMP_TO_EDGE, // WRAP_CLAMP, GL_CLAMP_TO_EDGE, // WRAP_CLAMP,
GL_CLAMP_TO_BORDER, // WRAP_BORDER, GL_CLAMP_TO_BORDER, // WRAP_BORDER,
GL_MIRROR_CLAMP_TO_EDGE_EXT }; // WRAP_MIRROR_ONCE, 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_S, wrapModes[sampler.getWrapModeU()]);
glTexParameteri(object->_target, GL_TEXTURE_WRAP_T, wrapModes[sampler.getWrapModeV()]); glTexParameteri(object->_target, GL_TEXTURE_WRAP_T, wrapModes[sampler.getWrapModeV()]);
glTexParameteri(object->_target, GL_TEXTURE_WRAP_R, wrapModes[sampler.getWrapModeW()]); 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();
} }

View file

@ -109,7 +109,7 @@ void GLBackend::updateTransform() {
} }
glLoadMatrixf(reinterpret_cast< const GLfloat* >(&_transform._projection)); glLoadMatrixf(reinterpret_cast< const GLfloat* >(&_transform._projection));
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
if (_transform._invalidModel || _transform._invalidView) { if (_transform._invalidModel || _transform._invalidView) {
@ -141,7 +141,7 @@ void GLBackend::updateTransform() {
// glLoadIdentity(); // glLoadIdentity();
} }
} }
CHECK_GL_ERROR(); (void) CHECK_GL_ERROR();
} }
#endif #endif

View file

@ -41,7 +41,7 @@ public:
State(); State();
virtual ~State(); virtual ~State();
const Stamp getStamp() const { return _stamp; } Stamp getStamp() const { return _stamp; }
typedef ::gpu::ComparisonFunction ComparisonFunction; typedef ::gpu::ComparisonFunction ComparisonFunction;

View file

@ -101,9 +101,9 @@ public:
uint32 getNumAttributes() const { return _attributes.size(); } uint32 getNumAttributes() const { return _attributes.size(); }
const AttributeMap& getAttributes() const { return _attributes; } 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 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; } uint32 getElementTotalSize() const { return _elementTotalSize; }

View file

@ -1,354 +1,354 @@
// //
// Texture.cpp // Texture.cpp
// libraries/gpu/src/gpu // libraries/gpu/src/gpu
// //
// Created by Sam Gateau on 1/17/2015. // Created by Sam Gateau on 1/17/2015.
// Copyright 2014 High Fidelity, Inc. // Copyright 2014 High Fidelity, Inc.
// //
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#include "Texture.h" #include "Texture.h"
#include <math.h> #include <math.h>
#include <QDebug> #include <QDebug>
using namespace gpu; using namespace gpu;
Texture::Pixels::Pixels(const Element& format, Size size, const Byte* bytes) : Texture::Pixels::Pixels(const Element& format, Size size, const Byte* bytes) :
_sysmem(size, bytes), _sysmem(size, bytes),
_format(format), _format(format),
_isGPULoaded(false) { _isGPULoaded(false) {
} }
Texture::Pixels::~Pixels() { Texture::Pixels::~Pixels() {
} }
void Texture::Storage::assignTexture(Texture* texture) { void Texture::Storage::assignTexture(Texture* texture) {
_texture = texture; _texture = texture;
} }
Stamp Texture::Storage::getStamp(uint16 level) const { Stamp Texture::Storage::getStamp(uint16 level) const {
PixelsPointer mip = getMip(level); PixelsPointer mip = getMip(level);
if (mip) { if (mip) {
return mip->_sysmem.getStamp(); return mip->_sysmem.getStamp();
} }
return 0; return 0;
} }
void Texture::Storage::reset() { void Texture::Storage::reset() {
_mips.clear(); _mips.clear();
} }
Texture::PixelsPointer Texture::Storage::editMip(uint16 level) { Texture::PixelsPointer Texture::Storage::editMip(uint16 level) {
if (level < _mips.size()) { if (level < _mips.size()) {
return _mips[level]; return _mips[level];
} }
return PixelsPointer(); return PixelsPointer();
} }
const Texture::PixelsPointer Texture::Storage::getMip(uint16 level) const { const Texture::PixelsPointer Texture::Storage::getMip(uint16 level) const {
if (level < _mips.size()) { if (level < _mips.size()) {
return _mips[level]; return _mips[level];
} }
return PixelsPointer(); return PixelsPointer();
} }
void Texture::Storage::notifyGPULoaded(uint16 level) const { void Texture::Storage::notifyGPULoaded(uint16 level) const {
PixelsPointer mip = getMip(level); PixelsPointer mip = getMip(level);
if (mip) { if (mip) {
mip->_isGPULoaded = true; mip->_isGPULoaded = true;
mip->_sysmem.resize(0); mip->_sysmem.resize(0);
} }
} }
bool Texture::Storage::isMipAvailable(uint16 level) const { bool Texture::Storage::isMipAvailable(uint16 level) const {
PixelsPointer mip = getMip(level); PixelsPointer mip = getMip(level);
return (mip && mip->_sysmem.getSize()); return (mip && mip->_sysmem.getSize());
} }
bool Texture::Storage::allocateMip(uint16 level) { bool Texture::Storage::allocateMip(uint16 level) {
bool changed = false; bool changed = false;
if (level >= _mips.size()) { if (level >= _mips.size()) {
_mips.resize(level+1, PixelsPointer()); _mips.resize(level+1, PixelsPointer());
changed = true; changed = true;
} }
if (!_mips[level]) { if (!_mips[level]) {
_mips[level] = PixelsPointer(new Pixels()); _mips[level] = PixelsPointer(new Pixels());
changed = true; changed = true;
} }
return changed; return changed;
} }
bool Texture::Storage::assignMipData(uint16 level, const Element& format, Size size, const Byte* bytes) { bool Texture::Storage::assignMipData(uint16 level, const Element& format, Size size, const Byte* bytes) {
// Ok we should be able to do that... // Ok we should be able to do that...
allocateMip(level); allocateMip(level);
auto mip = _mips[level]; auto mip = _mips[level];
mip->_format = format; mip->_format = format;
Size allocated = mip->_sysmem.setData(size, bytes); Size allocated = mip->_sysmem.setData(size, bytes);
mip->_isGPULoaded = false; mip->_isGPULoaded = false;
return allocated == size; return allocated == size;
} }
Texture* Texture::create1D(const Element& texelFormat, uint16 width, const Sampler& sampler) { Texture* Texture::create1D(const Element& texelFormat, uint16 width, const Sampler& sampler) {
return create(TEX_1D, texelFormat, width, 1, 1, 1, 1, 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) { Texture* Texture::create2D(const Element& texelFormat, uint16 width, uint16 height, const Sampler& sampler) {
return create(TEX_2D, texelFormat, width, height, 1, 1, 1, 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) { 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); return create(TEX_3D, texelFormat, width, height, depth, 1, 1, sampler);
} }
Texture* Texture::createCube(const Element& texelFormat, uint16 width, const Sampler& sampler) { Texture* Texture::createCube(const Element& texelFormat, uint16 width, const Sampler& sampler) {
return create(TEX_CUBE, texelFormat, width, width, 1, 1, 1, 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* Texture::create(Type type, const Element& texelFormat, uint16 width, uint16 height, uint16 depth, uint16 numSamples, uint16 numSlices, const Sampler& sampler)
{ {
Texture* tex = new Texture(); Texture* tex = new Texture();
tex->_storage.reset(new Storage()); tex->_storage.reset(new Storage());
tex->_storage->_texture = tex; tex->_storage->_texture = tex;
tex->_type = type; tex->_type = type;
tex->_maxMip = 0; tex->_maxMip = 0;
tex->resize(type, texelFormat, width, height, depth, numSamples, numSlices); tex->resize(type, texelFormat, width, height, depth, numSamples, numSlices);
tex->_sampler = sampler; tex->_sampler = sampler;
return tex; return tex;
} }
Texture* Texture::createFromStorage(Storage* storage) { Texture* Texture::createFromStorage(Storage* storage) {
Texture* tex = new Texture(); Texture* tex = new Texture();
tex->_storage.reset(storage); tex->_storage.reset(storage);
storage->assignTexture(tex); storage->assignTexture(tex);
return tex; return tex;
} }
Texture::Texture(): Texture::Texture():
Resource(), Resource(),
_storage(), _storage(),
_stamp(0), _stamp(0),
_size(0), _size(0),
_width(1), _width(1),
_height(1), _height(1),
_depth(1), _depth(1),
_numSamples(1), _numSamples(1),
_numSlices(1), _numSlices(1),
_maxMip(0), _maxMip(0),
_type(TEX_1D), _type(TEX_1D),
_autoGenerateMips(false), _autoGenerateMips(false),
_defined(false) _defined(false)
{ {
} }
Texture::~Texture() Texture::~Texture()
{ {
} }
Texture::Size Texture::resize(Type type, const Element& texelFormat, uint16 width, uint16 height, uint16 depth, uint16 numSamples, uint16 numSlices) { 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) { if (width && height && depth && numSamples && numSlices) {
bool changed = false; bool changed = false;
if ( _type != type) { if ( _type != type) {
_type = type; _type = type;
changed = true; changed = true;
} }
if (_numSlices != numSlices) { if (_numSlices != numSlices) {
_numSlices = numSlices; _numSlices = numSlices;
changed = true; changed = true;
} }
numSamples = evalNumSamplesUsed(numSamples); numSamples = evalNumSamplesUsed(numSamples);
if ((_type >= TEX_2D) && (_numSamples != numSamples)) { if ((_type >= TEX_2D) && (_numSamples != numSamples)) {
_numSamples = numSamples; _numSamples = numSamples;
changed = true; changed = true;
} }
if (_width != width) { if (_width != width) {
_width = width; _width = width;
changed = true; changed = true;
} }
if ((_type >= TEX_2D) && (_height != height)) { if ((_type >= TEX_2D) && (_height != height)) {
_height = height; _height = height;
changed = true; changed = true;
} }
if ((_type >= TEX_3D) && (_depth != depth)) { if ((_type >= TEX_3D) && (_depth != depth)) {
_depth = depth; _depth = depth;
changed = true; changed = true;
} }
// Evaluate the new size with the new format // Evaluate the new size with the new format
const int DIM_SIZE[] = {1, 1, 1, 6}; const int DIM_SIZE[] = {1, 1, 1, 6};
uint32_t size = DIM_SIZE[_type] *_width * _height * _depth * _numSamples * texelFormat.getSize(); uint32_t size = DIM_SIZE[_type] *_width * _height * _depth * _numSamples * texelFormat.getSize();
// If size change then we need to reset // If size change then we need to reset
if (changed || (size != getSize())) { if (changed || (size != getSize())) {
_size = size; _size = size;
_storage->reset(); _storage->reset();
_stamp++; _stamp++;
} }
// TexelFormat might have change, but it's mostly interpretation // TexelFormat might have change, but it's mostly interpretation
if (texelFormat != _texelFormat) { if (texelFormat != _texelFormat) {
_texelFormat = texelFormat; _texelFormat = texelFormat;
_stamp++; _stamp++;
} }
// Here the Texture has been fully defined from the gpu point of view (size and format) // Here the Texture has been fully defined from the gpu point of view (size and format)
_defined = true; _defined = true;
} else { } else {
_stamp++; _stamp++;
} }
return _size; return _size;
} }
Texture::Size Texture::resize1D(uint16 width, uint16 numSamples) { Texture::Size Texture::resize1D(uint16 width, uint16 numSamples) {
return resize(TEX_1D, getTexelFormat(), width, 1, 1, numSamples, 1); return resize(TEX_1D, getTexelFormat(), width, 1, 1, numSamples, 1);
} }
Texture::Size Texture::resize2D(uint16 width, uint16 height, uint16 numSamples) { Texture::Size Texture::resize2D(uint16 width, uint16 height, uint16 numSamples) {
return resize(TEX_2D, getTexelFormat(), width, height, 1, numSamples, 1); return resize(TEX_2D, getTexelFormat(), width, height, 1, numSamples, 1);
} }
Texture::Size Texture::resize3D(uint16 width, uint16 height, uint16 depth, uint16 numSamples) { Texture::Size Texture::resize3D(uint16 width, uint16 height, uint16 depth, uint16 numSamples) {
return resize(TEX_3D, getTexelFormat(), width, height, depth, numSamples, 1); return resize(TEX_3D, getTexelFormat(), width, height, depth, numSamples, 1);
} }
Texture::Size Texture::resizeCube(uint16 width, uint16 numSamples) { Texture::Size Texture::resizeCube(uint16 width, uint16 numSamples) {
return resize(TEX_CUBE, getTexelFormat(), width, 1, 1, numSamples, 1); return resize(TEX_CUBE, getTexelFormat(), width, 1, 1, numSamples, 1);
} }
Texture::Size Texture::reformat(const Element& texelFormat) { Texture::Size Texture::reformat(const Element& texelFormat) {
return resize(_type, texelFormat, getWidth(), getHeight(), getDepth(), getNumSamples(), getNumSlices()); return resize(_type, texelFormat, getWidth(), getHeight(), getDepth(), getNumSamples(), getNumSlices());
} }
bool Texture::isColorRenderTarget() const { bool Texture::isColorRenderTarget() const {
return (_texelFormat.getSemantic() == gpu::RGBA); return (_texelFormat.getSemantic() == gpu::RGBA);
} }
bool Texture::isDepthStencilRenderTarget() const { bool Texture::isDepthStencilRenderTarget() const {
return (_texelFormat.getSemantic() == gpu::DEPTH) || (_texelFormat.getSemantic() == gpu::DEPTH_STENCIL); return (_texelFormat.getSemantic() == gpu::DEPTH) || (_texelFormat.getSemantic() == gpu::DEPTH_STENCIL);
} }
uint16 Texture::evalDimNumMips(uint16 size) { uint16 Texture::evalDimNumMips(uint16 size) {
double largerDim = size; double largerDim = size;
double val = log(largerDim)/log(2.0); double val = log(largerDim)/log(2.0);
return 1 + (uint16) val; return 1 + (uint16) val;
} }
// The number mips that the texture could have if all existed // The number mips that the texture could have if all existed
// = log2(max(width, height, depth)) // = log2(max(width, height, depth))
uint16 Texture::evalNumMips() const { uint16 Texture::evalNumMips() const {
double largerDim = std::max(std::max(_width, _height), _depth); double largerDim = std::max(std::max(_width, _height), _depth);
double val = log(largerDim)/log(2.0); double val = log(largerDim)/log(2.0);
return 1 + (uint16) val; return 1 + (uint16) val;
} }
uint16 Texture::maxMip() const { uint16 Texture::maxMip() const {
return _maxMip; return _maxMip;
} }
bool Texture::assignStoredMip(uint16 level, const Element& format, Size size, const Byte* bytes) { bool Texture::assignStoredMip(uint16 level, const Element& format, Size size, const Byte* bytes) {
// Check that level accessed make sense // Check that level accessed make sense
if (level != 0) { if (level != 0) {
if (_autoGenerateMips) { if (_autoGenerateMips) {
return false; return false;
} }
if (level >= evalNumMips()) { if (level >= evalNumMips()) {
return false; return false;
} }
} }
// THen check that the mem buffer passed make sense with its format // THen check that the mem buffer passed make sense with its format
Size expectedSize = evalStoredMipSize(level, format); Size expectedSize = evalStoredMipSize(level, format);
if (size == expectedSize) { if (size == expectedSize) {
_storage->assignMipData(level, format, size, bytes); _storage->assignMipData(level, format, size, bytes);
_stamp++; _stamp++;
return true; return true;
} else if (size > expectedSize) { } else if (size > expectedSize) {
// NOTE: We are facing this case sometime because apparently QImage (from where we get the bits) is generating images // 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. // 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) // We should probably consider something a bit more smart to get the correct result but for now (UI elements)
// it seems to work... // it seems to work...
_storage->assignMipData(level, format, size, bytes); _storage->assignMipData(level, format, size, bytes);
_stamp++; _stamp++;
return true; return true;
} }
return false; return false;
} }
uint16 Texture::autoGenerateMips(uint16 maxMip) { uint16 Texture::autoGenerateMips(uint16 maxMip) {
_autoGenerateMips = true; _autoGenerateMips = true;
_maxMip = std::min((uint16) (evalNumMips() - 1), maxMip); _maxMip = std::min((uint16) (evalNumMips() - 1), maxMip);
_stamp++; _stamp++;
return _maxMip; return _maxMip;
} }
uint16 Texture::getStoredMipWidth(uint16 level) const { uint16 Texture::getStoredMipWidth(uint16 level) const {
PixelsPointer mip = accessStoredMip(level); PixelsPointer mip = accessStoredMip(level);
if (mip && mip->_sysmem.getSize()) { if (mip && mip->_sysmem.getSize()) {
return evalMipWidth(level); return evalMipWidth(level);
} }
return 0; return 0;
} }
uint16 Texture::getStoredMipHeight(uint16 level) const { uint16 Texture::getStoredMipHeight(uint16 level) const {
PixelsPointer mip = accessStoredMip(level); PixelsPointer mip = accessStoredMip(level);
if (mip && mip->_sysmem.getSize()) { if (mip && mip->_sysmem.getSize()) {
return evalMipHeight(level); return evalMipHeight(level);
} }
return 0; return 0;
} }
uint16 Texture::getStoredMipDepth(uint16 level) const { uint16 Texture::getStoredMipDepth(uint16 level) const {
PixelsPointer mip = accessStoredMip(level); PixelsPointer mip = accessStoredMip(level);
if (mip && mip->_sysmem.getSize()) { if (mip && mip->_sysmem.getSize()) {
return evalMipDepth(level); return evalMipDepth(level);
} }
return 0; return 0;
} }
uint32 Texture::getStoredMipNumTexels(uint16 level) const { uint32 Texture::getStoredMipNumTexels(uint16 level) const {
PixelsPointer mip = accessStoredMip(level); PixelsPointer mip = accessStoredMip(level);
if (mip && mip->_sysmem.getSize()) { if (mip && mip->_sysmem.getSize()) {
return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level); return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level);
} }
return 0; return 0;
} }
uint32 Texture::getStoredMipSize(uint16 level) const { uint32 Texture::getStoredMipSize(uint16 level) const {
PixelsPointer mip = accessStoredMip(level); PixelsPointer mip = accessStoredMip(level);
if (mip && mip->_sysmem.getSize()) { if (mip && mip->_sysmem.getSize()) {
return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level) * getTexelFormat().getSize(); return evalMipWidth(level) * evalMipHeight(level) * evalMipDepth(level) * getTexelFormat().getSize();
} }
return 0; return 0;
} }
uint16 Texture::evalNumSamplesUsed(uint16 numSamplesTried) { uint16 Texture::evalNumSamplesUsed(uint16 numSamplesTried) {
uint16 sample = numSamplesTried; uint16 sample = numSamplesTried;
if (numSamplesTried <= 1) if (numSamplesTried <= 1)
sample = 1; sample = 1;
else if (numSamplesTried < 4) else if (numSamplesTried < 4)
sample = 2; sample = 2;
else if (numSamplesTried < 8) else if (numSamplesTried < 8)
sample = 4; sample = 4;
else if (numSamplesTried < 16) else if (numSamplesTried < 16)
sample = 8; sample = 8;
else else
sample = 8; sample = 8;
return sample; return sample;
} }
void Texture::setSampler(const Sampler& sampler) { void Texture::setSampler(const Sampler& sampler) {
_sampler = sampler; _sampler = sampler;
_samplerStamp++; _samplerStamp++;

View file

@ -151,8 +151,8 @@ public:
Texture& operator=(const Texture& buf); // deep copy of the sysmem texture Texture& operator=(const Texture& buf); // deep copy of the sysmem texture
~Texture(); ~Texture();
const Stamp getStamp() const { return _stamp; } Stamp getStamp() const { return _stamp; }
const Stamp getDataStamp(uint16 level = 0) const { return _storage->getStamp(level); } Stamp getDataStamp(uint16 level = 0) const { return _storage->getStamp(level); }
// The size in bytes of data stored in the texture // The size in bytes of data stored in the texture
Size getSize() const { return _size; } Size getSize() const { return _size; }
@ -264,7 +264,7 @@ public:
// Own sampler // Own sampler
void setSampler(const Sampler& sampler); void setSampler(const Sampler& sampler);
const Sampler& getSampler() const { return _sampler; } const Sampler& getSampler() const { return _sampler; }
const Stamp getSamplerStamp() const { return _samplerStamp; } Stamp getSamplerStamp() const { return _samplerStamp; }
protected: protected:
std::unique_ptr< Storage > _storage; std::unique_ptr< Storage > _storage;

View file

@ -97,7 +97,7 @@ const Box Mesh::evalPartBounds(int partStart, int partEnd, Boxes& bounds) const
auto vertices = &_vertexBuffer.get<Vec3>((*part)._baseVertex); auto vertices = &_vertexBuffer.get<Vec3>((*part)._baseVertex);
for (;index != endIndex; index++) { for (;index != endIndex; index++) {
// skip primitive restart indices // skip primitive restart indices
if ((*index) != PRIMITIVE_RESTART_INDEX) { if ((*index) != (uint) PRIMITIVE_RESTART_INDEX) {
partBound += vertices[(*index)]; partBound += vertices[(*index)];
} }
} }

View file

@ -17,7 +17,9 @@
#include "NetworkLogging.h" #include "NetworkLogging.h"
#include "DataServerAccountInfo.h" #include "DataServerAccountInfo.h"
#ifndef __GNUC__
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
DataServerAccountInfo::DataServerAccountInfo() : DataServerAccountInfo::DataServerAccountInfo() :
_accessToken(), _accessToken(),
@ -33,7 +35,7 @@ DataServerAccountInfo::DataServerAccountInfo() :
} }
DataServerAccountInfo::DataServerAccountInfo(const DataServerAccountInfo& otherInfo) { DataServerAccountInfo::DataServerAccountInfo(const DataServerAccountInfo& otherInfo) : QObject() {
_accessToken = otherInfo._accessToken; _accessToken = otherInfo._accessToken;
_username = otherInfo._username; _username = otherInfo._username;
_xmppPassword = otherInfo._xmppPassword; _xmppPassword = otherInfo._xmppPassword;

View file

@ -33,6 +33,7 @@ HifiSockAddr::HifiSockAddr(const QHostAddress& address, quint16 port) :
} }
HifiSockAddr::HifiSockAddr(const HifiSockAddr& otherSockAddr) : HifiSockAddr::HifiSockAddr(const HifiSockAddr& otherSockAddr) :
QObject(),
_address(otherSockAddr._address), _address(otherSockAddr._address),
_port(otherSockAddr._port) _port(otherSockAddr._port)
{ {

View file

@ -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; _uuid = otherPeer._uuid;
_publicSocket = otherPeer._publicSocket; _publicSocket = otherPeer._publicSocket;
_localSocket = otherPeer._localSocket; _localSocket = otherPeer._localSocket;

View file

@ -31,7 +31,7 @@ OAuthAccessToken::OAuthAccessToken(const QJsonObject& jsonObject) :
} }
OAuthAccessToken::OAuthAccessToken(const OAuthAccessToken& otherToken) { OAuthAccessToken::OAuthAccessToken(const OAuthAccessToken& otherToken) : QObject() {
token = otherToken.token; token = otherToken.token;
refreshToken = otherToken.refreshToken; refreshToken = otherToken.refreshToken;
expiryTimestamp = otherToken.expiryTimestamp; expiryTimestamp = otherToken.expiryTimestamp;

View file

@ -18,7 +18,9 @@
#include "NetworkLogging.h" #include "NetworkLogging.h"
#include "RSAKeypairGenerator.h" #include "RSAKeypairGenerator.h"
#ifndef __GNUC__
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
RSAKeypairGenerator::RSAKeypairGenerator(QObject* parent) : RSAKeypairGenerator::RSAKeypairGenerator(QObject* parent) :
QObject(parent) QObject(parent)

View file

@ -168,7 +168,7 @@ void OctreeRenderer::render(RenderArgs::RenderMode renderMode,
RenderArgs::RenderSide renderSide, RenderArgs::RenderSide renderSide,
RenderArgs::DebugFlags renderDebugFlags) { RenderArgs::DebugFlags renderDebugFlags) {
RenderArgs args = { this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide, RenderArgs args = { this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, renderSide,
renderDebugFlags, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; renderDebugFlags, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
if (_tree) { if (_tree) {
_tree->lockForRead(); _tree->lockForRead();
_tree->recurseTreeWithOperation(renderOperation, &args); _tree->recurseTreeWithOperation(renderOperation, &args);

View file

@ -1796,7 +1796,9 @@ NetworkGeometry::NetworkGeometry(const QUrl& url, const QSharedPointer<NetworkGe
if (url.isEmpty()) { if (url.isEmpty()) {
// make the minimal amount of dummy geometry to satisfy Model // make the minimal amount of dummy geometry to satisfy Model
FBXJoint joint = { false, QVector<int>(), -1 }; FBXJoint joint = { false, QVector<int>(), -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.joints.append(joint);
_geometry.leftEyeJointIndex = -1; _geometry.leftEyeJointIndex = -1;
_geometry.rightEyeJointIndex = -1; _geometry.rightEyeJointIndex = -1;

View file

@ -256,7 +256,7 @@ void JointState::setVisibleRotationInConstrainedFrame(const glm::quat& targetRot
_visibleRotation = parentRotation * _fbxJoint->preRotation * _visibleRotationInConstrainedFrame * _fbxJoint->postRotation; _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; glm::quat defaultRotation = _fbxJoint->rotation;
return glm::abs(rotation.x - defaultRotation.x) < tolerance && return glm::abs(rotation.x - defaultRotation.x) < tolerance &&
glm::abs(rotation.y - defaultRotation.y) < tolerance && glm::abs(rotation.y - defaultRotation.y) < tolerance &&

View file

@ -88,7 +88,7 @@ public:
const glm::quat& getRotationInConstrainedFrame() const { return _rotationInConstrainedFrame; } const glm::quat& getRotationInConstrainedFrame() const { return _rotationInConstrainedFrame; }
const glm::quat& getVisibleRotationInConstrainedFrame() const { return _visibleRotationInConstrainedFrame; } 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; glm::quat getDefaultRotationInParentFrame() const;
const glm::vec3& getDefaultTranslationInConstrainedFrame() const; const glm::vec3& getDefaultTranslationInConstrainedFrame() const;

View file

@ -38,7 +38,7 @@ public:
push(glm::mat4()); push(glm::mat4());
} }
explicit MatrixStack(const MatrixStack & other) { explicit MatrixStack(const MatrixStack & other) : std::stack<glm::mat4>() {
*((std::stack<glm::mat4>*)this) = *((std::stack<glm::mat4>*)&other); *((std::stack<glm::mat4>*)this) = *((std::stack<glm::mat4>*)&other);
} }

View file

@ -46,7 +46,7 @@ public:
void setConvexHulls(const QVector<QVector<glm::vec3>>& points); void setConvexHulls(const QVector<QVector<glm::vec3>>& points);
void setCapsuleY(float radius, float halfHeight); void setCapsuleY(float radius, float halfHeight);
const int getType() const { return _type; } int getType() const { return _type; }
const glm::vec3& getHalfExtents() const { return _halfExtents; } const glm::vec3& getHalfExtents() const { return _halfExtents; }