mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-24 08:39:51 +00:00
Don't crash on post-shader compile errors.
This commit is contained in:
parent
29dd284372
commit
e54107033d
@ -34,6 +34,8 @@
|
||||
#include "GPU/GLES/TextureCache.h"
|
||||
#include "GPU/GLES/ShaderManager.h"
|
||||
|
||||
#include "UI/OnScreenDisplay.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#if defined(USING_GLES2)
|
||||
@ -168,9 +170,14 @@ void FramebufferManager::SetNumExtraFBOs(int num) {
|
||||
|
||||
void FramebufferManager::CompileDraw2DProgram() {
|
||||
if (!draw2dprogram_) {
|
||||
draw2dprogram_ = glsl_create_source(basic_vs, tex_fs);
|
||||
glsl_bind(draw2dprogram_);
|
||||
glUniform1i(draw2dprogram_->sampler0, 0);
|
||||
std::string errorString;
|
||||
draw2dprogram_ = glsl_create_source(basic_vs, tex_fs, &errorString);
|
||||
if (!draw2dprogram_) {
|
||||
ERROR_LOG_REPORT(G3D, "Failed to compile draw2dprogram! This shouldn't happen.\n%s", errorString.c_str());
|
||||
} else {
|
||||
glsl_bind(draw2dprogram_);
|
||||
glUniform1i(draw2dprogram_->sampler0, 0);
|
||||
}
|
||||
|
||||
SetNumExtraFBOs(0);
|
||||
|
||||
@ -180,9 +187,19 @@ void FramebufferManager::CompileDraw2DProgram() {
|
||||
}
|
||||
|
||||
if (shaderInfo) {
|
||||
postShaderProgram_ = glsl_create(shaderInfo->vertexShaderFile.c_str(), shaderInfo->fragmentShaderFile.c_str());
|
||||
postShaderProgram_ = glsl_create(shaderInfo->vertexShaderFile.c_str(), shaderInfo->fragmentShaderFile.c_str(), &errorString);
|
||||
if (!postShaderProgram_) {
|
||||
ERROR_LOG(G3D, "Failed to build post-processing program");
|
||||
// DO NOT turn this into a report, as it will pollute our logs with all kinds of
|
||||
// user shader experiments.
|
||||
ERROR_LOG(G3D, "Failed to build post-processing program from %s and %s!\n%s", shaderInfo->vertexShaderFile.c_str(), shaderInfo->fragmentShaderFile.c_str(), errorString.c_str());
|
||||
// let's show the first line of the error string as an OSM.
|
||||
for (int i = 0; i < errorString.size(); i++) {
|
||||
if (errorString[i] == '\n') {
|
||||
errorString = errorString.substr(0, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
osm.Show("Post-shader error: " + errorString + " ...", 10.0f, 0xFF3090FF);
|
||||
usePostShader_ = false;
|
||||
} else {
|
||||
glsl_bind(postShaderProgram_);
|
||||
|
@ -28,10 +28,19 @@ restart:
|
||||
float y = 10.0f;
|
||||
// Then draw them all.
|
||||
for (auto iter = messages_.begin(); iter != messages_.end(); ++iter) {
|
||||
float alpha = (iter->endTime - time_now_d()) * 4;
|
||||
if (alpha > 1.0) alpha = 1.0;
|
||||
if (alpha < 0.0) alpha = 0.0;
|
||||
draw.DrawTextShadow(UBUNTU24, iter->text.c_str(), dp_xres / 2, y, colorAlpha(iter->color, alpha), ALIGN_TOP | ALIGN_HCENTER);
|
||||
float alpha = (iter->endTime - time_now_d()) * 4.0f;
|
||||
if (alpha > 1.0) alpha = 1.0f;
|
||||
if (alpha < 0.0) alpha = 0.0f;
|
||||
// Messages that are wider than the screen are left-aligned instead of centered.
|
||||
float tw, th;
|
||||
draw.MeasureText(UBUNTU24, iter->text.c_str(), &tw, &th);
|
||||
float x = dp_xres / 2;
|
||||
int align = ALIGN_TOP | ALIGN_HCENTER;
|
||||
if (tw > dp_xres) {
|
||||
align = ALIGN_TOP | ALIGN_LEFT;
|
||||
x = 2;
|
||||
}
|
||||
draw.DrawTextShadow(UBUNTU24, iter->text.c_str(), x, y, colorAlpha(iter->color, alpha), align);
|
||||
y += h;
|
||||
}
|
||||
}
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit a25169dc4c6a2e26c16b26faa0b37bb474c0d37e
|
||||
Subproject commit d19cef23951ce6e9ff8402f9fa1b9304e940805b
|
Loading…
Reference in New Issue
Block a user