mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 20:58:38 +02:00
Merge pull request #4613 from samcake/orange
fix the rendering bug on mac release
This commit is contained in:
commit
52f82b0768
5 changed files with 25 additions and 18 deletions
|
@ -95,35 +95,36 @@ void GLBackend::renderBatch(Batch& batch) {
|
||||||
backend.render(batch);
|
backend.render(batch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::checkGLError() {
|
bool GLBackend::checkGLError(const char* name) {
|
||||||
GLenum error = glGetError();
|
GLenum error = glGetError();
|
||||||
if (!error) {
|
if (!error) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case GL_INVALID_ENUM:
|
case GL_INVALID_ENUM:
|
||||||
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.";
|
qCDebug(gpulogging) << "GLBackend::" << name << ": 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;
|
break;
|
||||||
case GL_INVALID_VALUE:
|
case GL_INVALID_VALUE:
|
||||||
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";
|
qCDebug(gpulogging) << "GLBackend" << name << ": 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;
|
break;
|
||||||
case GL_INVALID_OPERATION:
|
case GL_INVALID_OPERATION:
|
||||||
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..";
|
qCDebug(gpulogging) << "GLBackend" << name << ": 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;
|
break;
|
||||||
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
||||||
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.";
|
qCDebug(gpulogging) << "GLBackend" << name << ": The framebuffer object is not complete.The offending command is ignored and has no other side effect than to set the error flag.";
|
||||||
break;
|
break;
|
||||||
case GL_OUT_OF_MEMORY:
|
case GL_OUT_OF_MEMORY:
|
||||||
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.";
|
qCDebug(gpulogging) << "GLBackend" << name << ": 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;
|
break;
|
||||||
case GL_STACK_UNDERFLOW:
|
case GL_STACK_UNDERFLOW:
|
||||||
qCDebug(gpulogging) << "An attempt has been made to perform an operation that would cause an internal stack to underflow.";
|
qCDebug(gpulogging) << "GLBackend" << name << ": An attempt has been made to perform an operation that would cause an internal stack to underflow.";
|
||||||
break;
|
break;
|
||||||
case GL_STACK_OVERFLOW:
|
case GL_STACK_OVERFLOW:
|
||||||
qCDebug(gpulogging) << "An attempt has been made to perform an operation that would cause an internal stack to overflow.";
|
qCDebug(gpulogging) << "GLBackend" << name << ": An attempt has been made to perform an operation that would cause an internal stack to overflow.";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
|
|
||||||
static void renderBatch(Batch& batch);
|
static void renderBatch(Batch& batch);
|
||||||
|
|
||||||
static void checkGLError();
|
static bool checkGLError(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());
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,9 @@ static const GLenum _elementTypeToGLType[NUM_TYPES]= {
|
||||||
};
|
};
|
||||||
|
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError()
|
#define CHECK_GL_ERROR() ::gpu::GLBackend::checkGLError(__FUNCTION__)
|
||||||
#else
|
#else
|
||||||
#define CHECK_GL_ERROR()
|
#define CHECK_GL_ERROR() false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -598,9 +598,14 @@ void GLBackend::do_setStateDepthTest(State::DepthTest test) {
|
||||||
} else {
|
} else {
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
}
|
}
|
||||||
CHECK_GL_ERROR();
|
if (CHECK_GL_ERROR()) {
|
||||||
|
qDebug() << "DepthTest" << (test.isEnabled() ? "Enabled" : "Disabled")
|
||||||
|
<< "Mask=" << (test.getWriteMask() ? "Write" : "no Write")
|
||||||
|
<< "Func=" << test.getFunction()
|
||||||
|
<< "Raw=" << test.getRaw();
|
||||||
|
}
|
||||||
|
|
||||||
_pipeline._stateCache.depthTest = test;
|
_pipeline._stateCache.depthTest = test;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +717,7 @@ void GLBackend::do_setStateBlend(State::BlendFunction function) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::do_setStateColorWriteMask(uint32 mask) {
|
void GLBackend::do_setStateColorWriteMask(uint32 mask) {
|
||||||
if (_pipeline._stateCache.colorWriteMask = mask) {
|
if (_pipeline._stateCache.colorWriteMask != mask) {
|
||||||
glColorMask(mask & State::ColorMask::WRITE_RED,
|
glColorMask(mask & State::ColorMask::WRITE_RED,
|
||||||
mask & State::ColorMask::WRITE_GREEN,
|
mask & State::ColorMask::WRITE_GREEN,
|
||||||
mask & State::ColorMask::WRITE_BLUE,
|
mask & State::ColorMask::WRITE_BLUE,
|
||||||
|
|
|
@ -127,10 +127,11 @@ public:
|
||||||
|
|
||||||
class DepthTest {
|
class DepthTest {
|
||||||
uint8 _function = LESS;
|
uint8 _function = LESS;
|
||||||
bool _writeMask = true;
|
uint8 _writeMask = true;
|
||||||
bool _enabled = false;
|
uint8 _enabled = false;
|
||||||
|
uint8 _spare;
|
||||||
public:
|
public:
|
||||||
DepthTest(bool enabled, bool writeMask, ComparisonFunction func) :
|
DepthTest(bool enabled = false, bool writeMask = true, ComparisonFunction func = LESS) :
|
||||||
_function(func), _writeMask(writeMask), _enabled(enabled) {}
|
_function(func), _writeMask(writeMask), _enabled(enabled) {}
|
||||||
|
|
||||||
bool isEnabled() const { return _enabled; }
|
bool isEnabled() const { return _enabled; }
|
||||||
|
|
Loading…
Reference in a new issue