separate out logging for fbx and gpu libraries

This commit is contained in:
Seth Alves 2015-04-06 16:52:31 -07:00
parent 074e476797
commit 8bd77fbcc7
9 changed files with 152 additions and 93 deletions

View file

@ -29,7 +29,7 @@
#include <Shape.h>
#include "FBXReader.h"
#include "ModelFormatLogging.h"
// TOOL: Uncomment the following line to enable the filtering of all the unkwnon fields of a node so we can break point easily while loading a model with problems...
//#define DEBUG_FBXREADER
@ -650,7 +650,7 @@ public:
void printNode(const FBXNode& node, int indentLevel) {
int indentLength = 2;
QByteArray spaces(indentLevel * indentLength, ' ');
QDebug nodeDebug = qDebug();
QDebug nodeDebug = qDebug(modelformat);
nodeDebug.nospace() << spaces.data() << node.name.data() << ": ";
foreach (const QVariant& property, node.properties) {
@ -912,7 +912,7 @@ ExtractedMesh extractMesh(const FBXNode& object, unsigned int& meshIndex) {
data.attributes.push_back(attrib);
} else {
// WTF same names for different UVs?
qDebug() << "LayerElementUV #" << attrib.index << " is reusing the same name as #" << (*it) << ". Skip this texcoord attribute.";
qCDebug(modelformat) << "LayerElementUV #" << attrib.index << " is reusing the same name as #" << (*it) << ". Skip this texcoord attribute.";
}
}
} else if (child.name == "LayerElementMaterial") {
@ -2132,7 +2132,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
setTangents(extracted.mesh, part.triangleIndices.at(i + 2), part.triangleIndices.at(i));
}
if ((part.triangleIndices.size() % 3) != 0){
qDebug() << "Error in extractFBXGeometry part.triangleIndices.size() is not divisible by three ";
qCDebug(modelformat) << "Error in extractFBXGeometry part.triangleIndices.size() is not divisible by three ";
}
}
}
@ -2153,7 +2153,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
QString jointID = childMap.value(clusterID);
fbxCluster.jointIndex = modelIDs.indexOf(jointID);
if (fbxCluster.jointIndex == -1) {
qDebug() << "Joint not in model list: " << jointID;
qCDebug(modelformat) << "Joint not in model list: " << jointID;
fbxCluster.jointIndex = 0;
}
fbxCluster.inverseBindMatrix = glm::inverse(cluster.transformLink) * modelTransform;
@ -2175,7 +2175,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
FBXCluster cluster;
cluster.jointIndex = modelIDs.indexOf(modelID);
if (cluster.jointIndex == -1) {
qDebug() << "Model not in model list: " << modelID;
qCDebug(modelformat) << "Model not in model list: " << modelID;
cluster.jointIndex = 0;
}
extracted.mesh.clusters.append(cluster);

View file

@ -0,0 +1,14 @@
//
// ModelFormatLogging.cpp
// libraries/fbx/src
//
// Created by Seth Alves on 4/6/15.
// 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 "ModelFormatLogging.h"
Q_LOGGING_CATEGORY(modelformat, "hifi.modelformat")

View file

@ -0,0 +1,14 @@
//
// ModelFormatLogging.h
// libraries/fbx/src
//
// Created by Seth Alves on 4/6/15.
// 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 <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(modelformat)

View file

@ -19,6 +19,7 @@
#include "FBXReader.h"
#include "OBJReader.h"
#include "Shape.h"
#include "ModelFormatLogging.h"
QHash<QString, float> COMMENT_SCALE_HINTS = {{"This file uses centimeters as units", 1.0f / 100.0f},
@ -294,7 +295,7 @@ bool parseOBJGroup(OBJTokenizer &tokenizer, const QVariantHash& mapping,
}
} else {
// something we don't (yet) care about
// qDebug() << "OBJ parser is skipping a line with" << token;
// qCDebug(modelformat) << "OBJ parser is skipping a line with" << token;
tokenizer.skipLine();
}
}
@ -431,7 +432,7 @@ FBXGeometry readOBJ(QIODevice* device, const QVariantHash& mapping) {
}
}
catch(const std::exception& e) {
qDebug() << "something went wrong in OBJ reader";
qCDebug(modelformat) << "something went wrong in OBJ reader";
}
return geometry;
@ -440,73 +441,73 @@ FBXGeometry readOBJ(QIODevice* device, const QVariantHash& mapping) {
void fbxDebugDump(const FBXGeometry& fbxgeo) {
qDebug() << "---------------- fbxGeometry ----------------";
qDebug() << " hasSkeletonJoints =" << fbxgeo.hasSkeletonJoints;
qDebug() << " offset =" << fbxgeo.offset;
qDebug() << " attachments.count() = " << fbxgeo.attachments.count();
qDebug() << " meshes.count() =" << fbxgeo.meshes.count();
qCDebug(modelformat) << "---------------- fbxGeometry ----------------";
qCDebug(modelformat) << " hasSkeletonJoints =" << fbxgeo.hasSkeletonJoints;
qCDebug(modelformat) << " offset =" << fbxgeo.offset;
qCDebug(modelformat) << " attachments.count() = " << fbxgeo.attachments.count();
qCDebug(modelformat) << " meshes.count() =" << fbxgeo.meshes.count();
foreach (FBXMesh mesh, fbxgeo.meshes) {
qDebug() << " vertices.count() =" << mesh.vertices.count();
qDebug() << " normals.count() =" << mesh.normals.count();
qCDebug(modelformat) << " vertices.count() =" << mesh.vertices.count();
qCDebug(modelformat) << " normals.count() =" << mesh.normals.count();
if (mesh.normals.count() == mesh.vertices.count()) {
for (int i = 0; i < mesh.normals.count(); i++) {
qDebug() << " " << mesh.vertices[ i ] << mesh.normals[ i ];
qCDebug(modelformat) << " " << mesh.vertices[ i ] << mesh.normals[ i ];
}
}
qDebug() << " tangents.count() =" << mesh.tangents.count();
qDebug() << " colors.count() =" << mesh.colors.count();
qDebug() << " texCoords.count() =" << mesh.texCoords.count();
qDebug() << " texCoords1.count() =" << mesh.texCoords1.count();
qDebug() << " clusterIndices.count() =" << mesh.clusterIndices.count();
qDebug() << " clusterWeights.count() =" << mesh.clusterWeights.count();
qDebug() << " meshExtents =" << mesh.meshExtents;
qDebug() << " modelTransform =" << mesh.modelTransform;
qDebug() << " parts.count() =" << mesh.parts.count();
qCDebug(modelformat) << " tangents.count() =" << mesh.tangents.count();
qCDebug(modelformat) << " colors.count() =" << mesh.colors.count();
qCDebug(modelformat) << " texCoords.count() =" << mesh.texCoords.count();
qCDebug(modelformat) << " texCoords1.count() =" << mesh.texCoords1.count();
qCDebug(modelformat) << " clusterIndices.count() =" << mesh.clusterIndices.count();
qCDebug(modelformat) << " clusterWeights.count() =" << mesh.clusterWeights.count();
qCDebug(modelformat) << " meshExtents =" << mesh.meshExtents;
qCDebug(modelformat) << " modelTransform =" << mesh.modelTransform;
qCDebug(modelformat) << " parts.count() =" << mesh.parts.count();
foreach (FBXMeshPart meshPart, mesh.parts) {
qDebug() << " quadIndices.count() =" << meshPart.quadIndices.count();
qDebug() << " triangleIndices.count() =" << meshPart.triangleIndices.count();
qDebug() << " diffuseColor =" << meshPart.diffuseColor;
qDebug() << " specularColor =" << meshPart.specularColor;
qDebug() << " emissiveColor =" << meshPart.emissiveColor;
qDebug() << " emissiveParams =" << meshPart.emissiveParams;
qDebug() << " shininess =" << meshPart.shininess;
qDebug() << " opacity =" << meshPart.opacity;
qDebug() << " materialID =" << meshPart.materialID;
qCDebug(modelformat) << " quadIndices.count() =" << meshPart.quadIndices.count();
qCDebug(modelformat) << " triangleIndices.count() =" << meshPart.triangleIndices.count();
qCDebug(modelformat) << " diffuseColor =" << meshPart.diffuseColor;
qCDebug(modelformat) << " specularColor =" << meshPart.specularColor;
qCDebug(modelformat) << " emissiveColor =" << meshPart.emissiveColor;
qCDebug(modelformat) << " emissiveParams =" << meshPart.emissiveParams;
qCDebug(modelformat) << " shininess =" << meshPart.shininess;
qCDebug(modelformat) << " opacity =" << meshPart.opacity;
qCDebug(modelformat) << " materialID =" << meshPart.materialID;
}
qDebug() << " clusters.count() =" << mesh.clusters.count();
qCDebug(modelformat) << " clusters.count() =" << mesh.clusters.count();
foreach (FBXCluster cluster, mesh.clusters) {
qDebug() << " jointIndex =" << cluster.jointIndex;
qDebug() << " inverseBindMatrix =" << cluster.inverseBindMatrix;
qCDebug(modelformat) << " jointIndex =" << cluster.jointIndex;
qCDebug(modelformat) << " inverseBindMatrix =" << cluster.inverseBindMatrix;
}
}
qDebug() << " jointIndices =" << fbxgeo.jointIndices;
qDebug() << " joints.count() =" << fbxgeo.joints.count();
qCDebug(modelformat) << " jointIndices =" << fbxgeo.jointIndices;
qCDebug(modelformat) << " joints.count() =" << fbxgeo.joints.count();
foreach (FBXJoint joint, fbxgeo.joints) {
qDebug() << " isFree =" << joint.isFree;
qDebug() << " freeLineage" << joint.freeLineage;
qDebug() << " parentIndex" << joint.parentIndex;
qDebug() << " distanceToParent" << joint.distanceToParent;
qDebug() << " boneRadius" << joint.boneRadius;
qDebug() << " translation" << joint.translation;
qDebug() << " preTransform" << joint.preTransform;
qDebug() << " preRotation" << joint.preRotation;
qDebug() << " rotation" << joint.rotation;
qDebug() << " postRotation" << joint.postRotation;
qDebug() << " postTransform" << joint.postTransform;
qDebug() << " transform" << joint.transform;
qDebug() << " rotationMin" << joint.rotationMin;
qDebug() << " rotationMax" << joint.rotationMax;
qDebug() << " inverseDefaultRotation" << joint.inverseDefaultRotation;
qDebug() << " inverseBindRotation" << joint.inverseBindRotation;
qDebug() << " bindTransform" << joint.bindTransform;
qDebug() << " name" << joint.name;
qDebug() << " shapePosition" << joint.shapePosition;
qDebug() << " shapeRotation" << joint.shapeRotation;
qDebug() << " shapeType" << joint.shapeType;
qDebug() << " isSkeletonJoint" << joint.isSkeletonJoint;
qCDebug(modelformat) << " isFree =" << joint.isFree;
qCDebug(modelformat) << " freeLineage" << joint.freeLineage;
qCDebug(modelformat) << " parentIndex" << joint.parentIndex;
qCDebug(modelformat) << " distanceToParent" << joint.distanceToParent;
qCDebug(modelformat) << " boneRadius" << joint.boneRadius;
qCDebug(modelformat) << " translation" << joint.translation;
qCDebug(modelformat) << " preTransform" << joint.preTransform;
qCDebug(modelformat) << " preRotation" << joint.preRotation;
qCDebug(modelformat) << " rotation" << joint.rotation;
qCDebug(modelformat) << " postRotation" << joint.postRotation;
qCDebug(modelformat) << " postTransform" << joint.postTransform;
qCDebug(modelformat) << " transform" << joint.transform;
qCDebug(modelformat) << " rotationMin" << joint.rotationMin;
qCDebug(modelformat) << " rotationMax" << joint.rotationMax;
qCDebug(modelformat) << " inverseDefaultRotation" << joint.inverseDefaultRotation;
qCDebug(modelformat) << " inverseBindRotation" << joint.inverseBindRotation;
qCDebug(modelformat) << " bindTransform" << joint.bindTransform;
qCDebug(modelformat) << " name" << joint.name;
qCDebug(modelformat) << " shapePosition" << joint.shapePosition;
qCDebug(modelformat) << " shapeRotation" << joint.shapeRotation;
qCDebug(modelformat) << " shapeType" << joint.shapeType;
qCDebug(modelformat) << " isSkeletonJoint" << joint.isSkeletonJoint;
}
qDebug() << "\n";
qCDebug(modelformat) << "\n";
}

View file

@ -8,6 +8,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "GPULogging.h"
#include "GLBackendShared.h"
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
@ -109,25 +110,25 @@ void GLBackend::checkGLError() {
else {
switch (error) {
case GL_INVALID_ENUM:
qDebug() << "An unacceptable value is specified for an enumerated argument.The offending command is ignored and has no other side effect than to set the error flag.";
qCDebug(gpulogging) << "An unacceptable value is specified for an enumerated argument.The offending command is ignored and has no other side effect than to set the error flag.";
break;
case GL_INVALID_VALUE:
qDebug() << "A numeric argument is out of range.The offending command is ignored and has no other side effect than to set the error flag";
qCDebug(gpulogging) << "A numeric argument is out of range.The offending command is ignored and has no other side effect than to set the error flag";
break;
case GL_INVALID_OPERATION:
qDebug() << "The specified operation is not allowed in the current state.The offending command is ignored and has no other side effect than to set the error flag..";
qCDebug(gpulogging) << "The specified operation is not allowed in the current state.The offending command is ignored and has no other side effect than to set the error flag..";
break;
case GL_INVALID_FRAMEBUFFER_OPERATION:
qDebug() << "The framebuffer object is not complete.The offending command is ignored and has no other side effect than to set the error flag.";
qCDebug(gpulogging) << "The framebuffer object is not complete.The offending command is ignored and has no other side effect than to set the error flag.";
break;
case GL_OUT_OF_MEMORY:
qDebug() << "There is not enough memory left to execute the command.The state of the GL is undefined, except for the state of the error flags, after this error is recorded.";
qCDebug(gpulogging) << "There is not enough memory left to execute the command.The state of the GL is undefined, except for the state of the error flags, after this error is recorded.";
break;
case GL_STACK_UNDERFLOW:
qDebug() << "An attempt has been made to perform an operation that would cause an internal stack to underflow.";
qCDebug(gpulogging) << "An attempt has been made to perform an operation that would cause an internal stack to underflow.";
break;
case GL_STACK_OVERFLOW:
qDebug() << "An attempt has been made to perform an operation that would cause an internal stack to overflow.";
qCDebug(gpulogging) << "An attempt has been made to perform an operation that would cause an internal stack to overflow.";
break;
}
}

View file

@ -8,8 +8,8 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "GPULogging.h"
#include "GLBackendShared.h"
#include "Format.h"
using namespace gpu;
@ -88,7 +88,7 @@ void makeBindings(GLBackend::GLShader* shader) {
GLint linked = 0;
glGetProgramiv(glprogram, GL_LINK_STATUS, &linked);
if (!linked) {
qDebug() << "GLShader::makeBindings - failed to link after assigning slotBindings?";
qCDebug(gpulogging) << "GLShader::makeBindings - failed to link after assigning slotBindings?";
}
// now assign the ubo binding, then DON't relink!
@ -113,7 +113,7 @@ GLBackend::GLShader* compileShader(const Shader& shader) {
// Any GLSLprogram ? normally yes...
const std::string& shaderSource = shader.getSource().getCode();
if (shaderSource.empty()) {
qDebug() << "GLShader::compileShader - no GLSL shader source code ? so failed to create";
qCDebug(gpulogging) << "GLShader::compileShader - no GLSL shader source code ? so failed to create";
return nullptr;
}
@ -124,7 +124,7 @@ GLBackend::GLShader* compileShader(const Shader& shader) {
// Create the shader object
GLuint glshader = glCreateShader(shaderDomain);
if (!glshader) {
qDebug() << "GLShader::compileShader - failed to create the gl shader object";
qCDebug(gpulogging) << "GLShader::compileShader - failed to create the gl shader object";
return nullptr;
}
@ -156,8 +156,8 @@ GLBackend::GLShader* compileShader(const Shader& shader) {
char* temp = new char[infoLength] ;
glGetShaderInfoLog(glshader, infoLength, NULL, temp);
qDebug() << "GLShader::compileShader - failed to compile the gl shader object:";
qDebug() << temp;
qCDebug(gpulogging) << "GLShader::compileShader - failed to compile the gl shader object:";
qCDebug(gpulogging) << temp;
/*
filestream.open("debugshader.glsl.info.txt");
@ -177,7 +177,7 @@ GLBackend::GLShader* compileShader(const Shader& shader) {
// so far so good, program is almost done, need to link:
GLuint glprogram = glCreateProgram();
if (!glprogram) {
qDebug() << "GLShader::compileShader - failed to create the gl shader & gl program object";
qCDebug(gpulogging) << "GLShader::compileShader - failed to create the gl shader & gl program object";
return nullptr;
}
@ -205,8 +205,8 @@ GLBackend::GLShader* compileShader(const Shader& shader) {
char* temp = new char[infoLength] ;
glGetProgramInfoLog(glprogram, infoLength, NULL, temp);
qDebug() << "GLShader::compileShader - failed to LINK the gl program object :";
qDebug() << temp;
qCDebug(gpulogging) << "GLShader::compileShader - failed to LINK the gl program object :";
qCDebug(gpulogging) << temp;
/*
filestream.open("debugshader.glsl.info.txt");
@ -243,7 +243,7 @@ GLBackend::GLShader* compileProgram(const Shader& program) {
for (auto subShader : program.getShaders()) {
GLuint so = GLBackend::getShaderID(subShader);
if (!so) {
qDebug() << "GLShader::compileProgram - One of the shaders of the program is not compiled?";
qCDebug(gpulogging) << "GLShader::compileProgram - One of the shaders of the program is not compiled?";
return nullptr;
}
shaderObjects.push_back(so);
@ -252,7 +252,7 @@ GLBackend::GLShader* compileProgram(const Shader& program) {
// so far so good, program is almost done, need to link:
GLuint glprogram = glCreateProgram();
if (!glprogram) {
qDebug() << "GLShader::compileProgram - failed to create the gl program object";
qCDebug(gpulogging) << "GLShader::compileProgram - failed to create the gl program object";
return nullptr;
}
@ -285,8 +285,8 @@ GLBackend::GLShader* compileProgram(const Shader& program) {
char* temp = new char[infoLength] ;
glGetProgramInfoLog(glprogram, infoLength, NULL, temp);
qDebug() << "GLShader::compileProgram - failed to LINK the gl program object :";
qDebug() << temp;
qCDebug(gpulogging) << "GLShader::compileProgram - failed to LINK the gl program object :";
qCDebug(gpulogging) << temp;
/*
filestream.open("debugshader.glsl.info.txt");

View file

@ -8,6 +8,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "GPULogging.h"
#include "GLBackendShared.h"
@ -48,7 +49,7 @@ public:
texel.internalFormat = GL_DEPTH_COMPONENT;
break;
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
break;
}
@ -66,7 +67,7 @@ public:
texel.internalFormat = GL_DEPTH_STENCIL;
break;
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
break;
@ -83,7 +84,7 @@ public:
texel.internalFormat = GL_RGB;
break;
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
break;
@ -120,13 +121,13 @@ public:
texel.internalFormat = GL_SRGB_ALPHA;
break;
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
break;
}
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
return texel;
} else {
@ -146,7 +147,7 @@ public:
texel.internalFormat = GL_DEPTH_COMPONENT;
break;
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
break;
@ -165,7 +166,7 @@ public:
texel.internalFormat = GL_DEPTH_STENCIL;
break;
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
break;
@ -186,7 +187,7 @@ public:
texel.internalFormat = GL_SRGB; // standard 2.2 gamma correction color
break;
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
break;
}
@ -209,13 +210,13 @@ public:
texel.internalFormat = GL_SRGB_ALPHA; // standard 2.2 gamma correction color
break;
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
break;
}
default:
qDebug() << "Unknown combination of texel format";
qCDebug(gpulogging) << "Unknown combination of texel format";
}
return texel;
}
@ -317,7 +318,7 @@ GLBackend::GLTexture* GLBackend::syncGPUObject(const Texture& texture) {
break;
}
default:
qDebug() << "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();

View file

@ -0,0 +1,14 @@
//
// GPULogging.h
// libraries/GPU/src
//
// Created by Seth Alves on 4/6/15.
// 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 "GPULogging.h"
Q_LOGGING_CATEGORY(gpulogging, "hifi.gpu")

View file

@ -0,0 +1,14 @@
//
// GPULogging.h
// libraries/gpu/src/gpu/
//
// Created by Seth Alves on 4/6/15.
// 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 <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(gpulogging)