mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-10 21:27:22 +02:00
Merge branch 'gpu-error-tweak' into overlay
This commit is contained in:
commit
d9452cfd2e
8 changed files with 76 additions and 35 deletions
|
@ -12,6 +12,8 @@
|
||||||
#include "GLBackendShared.h"
|
#include "GLBackendShared.h"
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
|
using namespace gpu;
|
||||||
|
|
||||||
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
|
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
|
||||||
{
|
{
|
||||||
(&::gpu::GLBackend::do_draw),
|
(&::gpu::GLBackend::do_draw),
|
||||||
|
@ -141,6 +143,14 @@ bool GLBackend::checkGLError(const char* name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GLBackend::checkGLErrorDebug(const char* name) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
checkGLError(name);
|
||||||
|
#else
|
||||||
|
Q_UNUSED(name);
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void GLBackend::syncCache() {
|
void GLBackend::syncCache() {
|
||||||
syncTransformStateCache();
|
syncTransformStateCache();
|
||||||
|
|
|
@ -49,6 +49,9 @@ public:
|
||||||
|
|
||||||
static bool checkGLError(const char* name = nullptr);
|
static bool checkGLError(const char* name = nullptr);
|
||||||
|
|
||||||
|
// Only checks in debug builds
|
||||||
|
static bool checkGLErrorDebug(const char* name = nullptr);
|
||||||
|
|
||||||
static bool makeProgram(Shader& shader, const Shader::BindingSet& bindings = Shader::BindingSet());
|
static bool makeProgram(Shader& shader, const Shader::BindingSet& bindings = Shader::BindingSet());
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "GPULogging.h"
|
#include "GPULogging.h"
|
||||||
#include "GLBackendShared.h"
|
#include "GLBackendShared.h"
|
||||||
|
|
||||||
|
using namespace gpu;
|
||||||
|
|
||||||
GLBackend::GLFramebuffer::GLFramebuffer() {}
|
GLBackend::GLFramebuffer::GLFramebuffer() {}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,7 @@
|
||||||
|
|
||||||
#include "Batch.h"
|
#include "Batch.h"
|
||||||
|
|
||||||
using namespace gpu;
|
static const GLenum _primitiveToGLmode[gpu::NUM_PRIMITIVES] = {
|
||||||
|
|
||||||
static const GLenum _primitiveToGLmode[NUM_PRIMITIVES] = {
|
|
||||||
GL_POINTS,
|
GL_POINTS,
|
||||||
GL_LINES,
|
GL_LINES,
|
||||||
GL_LINE_STRIP,
|
GL_LINE_STRIP,
|
||||||
|
@ -30,7 +28,7 @@ static const GLenum _primitiveToGLmode[NUM_PRIMITIVES] = {
|
||||||
GL_QUAD_STRIP,
|
GL_QUAD_STRIP,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GLenum _elementTypeToGLType[NUM_TYPES]= {
|
static const GLenum _elementTypeToGLType[gpu::NUM_TYPES] = {
|
||||||
GL_FLOAT,
|
GL_FLOAT,
|
||||||
GL_INT,
|
GL_INT,
|
||||||
GL_UNSIGNED_INT,
|
GL_UNSIGNED_INT,
|
||||||
|
@ -49,10 +47,8 @@ static const GLenum _elementTypeToGLType[NUM_TYPES]= {
|
||||||
GL_UNSIGNED_BYTE
|
GL_UNSIGNED_BYTE
|
||||||
};
|
};
|
||||||
|
|
||||||
#if _DEBUG
|
// Stupid preprocessor trick to turn the line macro into a string
|
||||||
#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError(__FUNCTION__)
|
#define CHECK_GL_ERROR_HELPER(x) #x
|
||||||
#else
|
#define CHECK_GL_ERROR() gpu::GLBackend::checkGLErrorDebug(__FUNCTION__ ":" CHECK_GL_ERROR_HELPER(__LINE__))
|
||||||
#define CHECK_GL_ERROR() false
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "GPULogging.h"
|
#include "GPULogging.h"
|
||||||
#include "GLBackendShared.h"
|
#include "GLBackendShared.h"
|
||||||
|
|
||||||
|
using namespace gpu;
|
||||||
|
|
||||||
GLBackend::GLTexture::GLTexture() :
|
GLBackend::GLTexture::GLTexture() :
|
||||||
_storageStamp(0),
|
_storageStamp(0),
|
||||||
|
|
|
@ -384,10 +384,12 @@ bool OctreePacketData::appendValue(const glm::vec3& value) {
|
||||||
bool OctreePacketData::appendValue(const QVector<glm::vec3>& value) {
|
bool OctreePacketData::appendValue(const QVector<glm::vec3>& value) {
|
||||||
uint16_t qVecSize = value.size();
|
uint16_t qVecSize = value.size();
|
||||||
bool success = appendValue(qVecSize);
|
bool success = appendValue(qVecSize);
|
||||||
success = append((const unsigned char*)value.constData(), qVecSize * sizeof(glm::vec3));
|
|
||||||
if (success) {
|
if (success) {
|
||||||
_bytesOfValues += qVecSize * sizeof(glm::vec3);
|
success = append((const unsigned char*)value.constData(), qVecSize * sizeof(glm::vec3));
|
||||||
_totalBytesOfValues += qVecSize * sizeof(glm::vec3);
|
if (success) {
|
||||||
|
_bytesOfValues += qVecSize * sizeof(glm::vec3);
|
||||||
|
_totalBytesOfValues += qVecSize * sizeof(glm::vec3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,35 +13,61 @@
|
||||||
#include "SharedLogging.h"
|
#include "SharedLogging.h"
|
||||||
#include "VariantMapToScriptValue.h"
|
#include "VariantMapToScriptValue.h"
|
||||||
|
|
||||||
|
|
||||||
|
QScriptValue variantToScriptValue(QVariant& qValue, QScriptEngine& scriptEngine) {
|
||||||
|
switch(qValue.type()) {
|
||||||
|
case QVariant::Bool:
|
||||||
|
return qValue.toBool();
|
||||||
|
break;
|
||||||
|
case QVariant::Int:
|
||||||
|
return qValue.toInt();
|
||||||
|
break;
|
||||||
|
case QVariant::Double:
|
||||||
|
return qValue.toDouble();
|
||||||
|
break;
|
||||||
|
case QVariant::String: {
|
||||||
|
return scriptEngine.newVariant(qValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QVariant::Map: {
|
||||||
|
QVariantMap childMap = qValue.toMap();
|
||||||
|
return variantMapToScriptValue(childMap, scriptEngine);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case QVariant::List: {
|
||||||
|
QVariantList childList = qValue.toList();
|
||||||
|
return variantListToScriptValue(childList, scriptEngine);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
qCDebug(shared) << "unhandled QScript type" << qValue.type();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QScriptValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QScriptValue variantMapToScriptValue(QVariantMap& variantMap, QScriptEngine& scriptEngine) {
|
QScriptValue variantMapToScriptValue(QVariantMap& variantMap, QScriptEngine& scriptEngine) {
|
||||||
QScriptValue scriptValue = scriptEngine.newObject();
|
QScriptValue scriptValue = scriptEngine.newObject();
|
||||||
|
|
||||||
for (QVariantMap::const_iterator iter = variantMap.begin(); iter != variantMap.end(); ++iter) {
|
for (QVariantMap::const_iterator iter = variantMap.begin(); iter != variantMap.end(); ++iter) {
|
||||||
QString key = iter.key();
|
QString key = iter.key();
|
||||||
QVariant qValue = iter.value();
|
QVariant qValue = iter.value();
|
||||||
|
scriptValue.setProperty(key, variantToScriptValue(qValue, scriptEngine));
|
||||||
switch(qValue.type()) {
|
}
|
||||||
case QVariant::Bool:
|
|
||||||
scriptValue.setProperty(key, qValue.toBool());
|
return scriptValue;
|
||||||
break;
|
}
|
||||||
case QVariant::Int:
|
|
||||||
scriptValue.setProperty(key, qValue.toInt());
|
|
||||||
break;
|
QScriptValue variantListToScriptValue(QVariantList& variantList, QScriptEngine& scriptEngine) {
|
||||||
case QVariant::Double:
|
QScriptValue scriptValue = scriptEngine.newObject();
|
||||||
scriptValue.setProperty(key, qValue.toDouble());
|
|
||||||
break;
|
scriptValue.setProperty("length", variantList.size());
|
||||||
case QVariant::String: {
|
int i = 0;
|
||||||
scriptValue.setProperty(key, scriptEngine.newVariant(qValue));
|
foreach (QVariant v, variantList) {
|
||||||
break;
|
scriptValue.setProperty(i++, variantToScriptValue(v, scriptEngine));
|
||||||
}
|
|
||||||
case QVariant::Map: {
|
|
||||||
QVariantMap childMap = qValue.toMap();
|
|
||||||
scriptValue.setProperty(key, variantMapToScriptValue(childMap, scriptEngine));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
qCDebug(shared) << "unhandled QScript type" << qValue.type();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return scriptValue;
|
return scriptValue;
|
||||||
|
|
|
@ -13,4 +13,6 @@
|
||||||
#include <QScriptValue>
|
#include <QScriptValue>
|
||||||
#include <QScriptEngine>
|
#include <QScriptEngine>
|
||||||
|
|
||||||
|
QScriptValue variantToScriptValue(QVariant& qValue, QScriptEngine& scriptEngine);
|
||||||
QScriptValue variantMapToScriptValue(QVariantMap& variantMap, QScriptEngine& scriptEngine);
|
QScriptValue variantMapToScriptValue(QVariantMap& variantMap, QScriptEngine& scriptEngine);
|
||||||
|
QScriptValue variantListToScriptValue(QVariantList& variantList, QScriptEngine& scriptEngine);
|
||||||
|
|
Loading…
Reference in a new issue