switch to the software fallback when an exception occurs on the preview rendering thread
parent
a4e372b88a
commit
f7dfa9d135
|
@ -43,9 +43,16 @@ GLWidget::~GLWidget() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLWidget::onException(const QString &what) {
|
void GLWidget::onException(const QString &what) {
|
||||||
|
QString errorString("A critical exception occurred in the preview rendering thread. "
|
||||||
|
"Please make sure that you are using the most recent graphics drivers. "
|
||||||
|
"Mitsuba will now switch "
|
||||||
|
"to a slow software fallback mode, which only supports "
|
||||||
|
"the rendering preview but no tonemapping and no "
|
||||||
|
"real-time preview/navigation. "
|
||||||
|
"The encountered error was:\n\n%1");
|
||||||
QMessageBox::critical(this, tr("Critical exception"),
|
QMessageBox::critical(this, tr("Critical exception"),
|
||||||
what, QMessageBox::Ok);
|
errorString.arg(what), QMessageBox::Ok);
|
||||||
qApp->exit(-1);
|
m_softwareFallback = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLWidget::initializeGL() {
|
void GLWidget::initializeGL() {
|
||||||
|
@ -130,7 +137,6 @@ void GLWidget::initializeGL() {
|
||||||
" gl_FragColor = vec4(pow(color.rgb, vec3(invGamma)), 1);\n"
|
" gl_FragColor = vec4(pow(color.rgb, vec3(invGamma)), 1);\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
m_reinhardTonemap->setSource(GPUProgram::EVertexProgram,
|
m_reinhardTonemap->setSource(GPUProgram::EVertexProgram,
|
||||||
"void main() {\n"
|
"void main() {\n"
|
||||||
|
@ -681,7 +687,8 @@ void GLWidget::paintGL() {
|
||||||
} else if (m_context->mode == ERender) {
|
} else if (m_context->mode == ERender) {
|
||||||
if (m_framebuffer == NULL ||
|
if (m_framebuffer == NULL ||
|
||||||
m_framebuffer->getBitmap()->getWidth() != m_context->framebuffer->getWidth() ||
|
m_framebuffer->getBitmap()->getWidth() != m_context->framebuffer->getWidth() ||
|
||||||
m_framebuffer->getBitmap()->getHeight() != m_context->framebuffer->getHeight()) {
|
m_framebuffer->getBitmap()->getHeight() != m_context->framebuffer->getHeight() ||
|
||||||
|
(m_softwareFallback && m_framebuffer->getBitmap() != m_fallbackBitmap)) {
|
||||||
if (m_framebuffer)
|
if (m_framebuffer)
|
||||||
m_framebuffer->cleanup();
|
m_framebuffer->cleanup();
|
||||||
if (!m_softwareFallback) {
|
if (!m_softwareFallback) {
|
||||||
|
|
|
@ -92,6 +92,9 @@ void PreviewThread::quit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewThread::setSceneContext(SceneContext *context, bool swapContext, bool motion) {
|
void PreviewThread::setSceneContext(SceneContext *context, bool swapContext, bool motion) {
|
||||||
|
if (!isRunning())
|
||||||
|
return;
|
||||||
|
|
||||||
std::vector<PreviewQueueEntry> temp;
|
std::vector<PreviewQueueEntry> temp;
|
||||||
temp.reserve(m_bufferCount);
|
temp.reserve(m_bufferCount);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue