Skip to content

Commit

Permalink
Merge pull request #18132 from hrydgard/assorted-fixes-5
Browse files Browse the repository at this point in the history
Add reporting for GLSL shader gen errors
  • Loading branch information
hrydgard committed Sep 11, 2023
2 parents 064532a + 052747a commit 4ffea9f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions GPU/GLES/ShaderManagerGLES.cpp
Expand Up @@ -753,7 +753,7 @@ Shader *ShaderManagerGLES::CompileFragmentShader(FShaderID FSID) {
std::string errorString;
FragmentShaderFlags flags;
if (!GenerateFragmentShader(FSID, codeBuffer_, draw_->GetShaderLanguageDesc(), draw_->GetBugs(), &uniformMask, &flags, &errorString)) {
ERROR_LOG(G3D, "Shader gen error: %s", errorString.c_str());
ERROR_LOG_REPORT(G3D, "FS shader gen error: %s (%s: %08x:%08x)", errorString.c_str(), "GLES", FSID.d[0], FSID.d[1]);
return nullptr;
}
_assert_msg_(strlen(codeBuffer_) < CODE_BUFFER_SIZE, "FS length error: %d", (int)strlen(codeBuffer_));
Expand All @@ -769,7 +769,7 @@ Shader *ShaderManagerGLES::CompileVertexShader(VShaderID VSID) {
std::string errorString;
VertexShaderFlags flags;
if (!GenerateVertexShader(VSID, codeBuffer_, draw_->GetShaderLanguageDesc(), draw_->GetBugs(), &attrMask, &uniformMask, &flags, &errorString)) {
ERROR_LOG(G3D, "Shader gen error: %s", errorString.c_str());
ERROR_LOG_REPORT(G3D, "VS shader gen error: %s (%s: %08x:%08x)", errorString.c_str(), "GLES", VSID.d[0], VSID.d[1]);
return nullptr;
}
_assert_msg_(strlen(codeBuffer_) < CODE_BUFFER_SIZE, "VS length error: %d", (int)strlen(codeBuffer_));
Expand Down Expand Up @@ -1099,7 +1099,7 @@ bool ShaderManagerGLES::ContinuePrecompile(float sliceTime) {
}

Shader *vs = CompileVertexShader(id);
if (vs->Failed()) {
if (!vs || vs->Failed()) {
// Give up on using the cache, just bail. We can't safely create the fallback shaders here
// without trying to deduce the vertType from the VSID.
ERROR_LOG(G3D, "Failed to compile a vertex shader loading from cache. Skipping rest of shader cache.");
Expand Down
6 changes: 3 additions & 3 deletions GPU/Vulkan/ShaderManagerVulkan.cpp
Expand Up @@ -591,7 +591,7 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) {
uint64_t uniformMask = 0;
VertexShaderFlags flags;
if (!GenerateVertexShader(id, codeBuffer_, compat_, draw_->GetBugs(), &attributeMask, &uniformMask, &flags, &genErrorString)) {
WARN_LOG(G3D, "Failed to generate vertex shader during cache load");
ERROR_LOG(G3D, "Failed to generate vertex shader during cache load");
// We just ignore this one and carry on.
failCount++;
continue;
Expand Down Expand Up @@ -619,7 +619,7 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) {
uint64_t uniformMask = 0;
FragmentShaderFlags flags;
if (!GenerateFragmentShader(id, codeBuffer_, compat_, draw_->GetBugs(), &uniformMask, &flags, &genErrorString)) {
WARN_LOG(G3D, "Failed to generate fragment shader during cache load");
ERROR_LOG(G3D, "Failed to generate fragment shader during cache load");
// We just ignore this one and carry on.
failCount++;
continue;
Expand All @@ -643,7 +643,7 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) {
}
std::string genErrorString;
if (!GenerateGeometryShader(id, codeBuffer_, compat_, draw_->GetBugs(), &genErrorString)) {
WARN_LOG(G3D, "Failed to generate geometry shader during cache load");
ERROR_LOG(G3D, "Failed to generate geometry shader during cache load");
// We just ignore this one and carry on.
failCount++;
continue;
Expand Down
5 changes: 4 additions & 1 deletion UI/MiscScreens.cpp
Expand Up @@ -334,6 +334,7 @@ void DrawBackground(UIContext &dc, float alpha, float x, float y, float z) {

if (bgTexture != nullptr) {
dc.Flush();
dc.Begin();
dc.GetDrawContext()->BindTexture(0, bgTexture->GetTexture());
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, bgColor);

Expand All @@ -342,7 +343,9 @@ void DrawBackground(UIContext &dc, float alpha, float x, float y, float z) {
} else {
// I_BG original color: 0xFF754D24
ImageID img = ImageID("I_BG");
ui_draw2d.DrawImageStretch(img, dc.GetBounds(), bgColor & dc.theme->backgroundColor);
dc.Begin();
dc.Draw()->DrawImageStretch(img, dc.GetBounds(), bgColor & dc.theme->backgroundColor);
dc.Flush();
}

#if PPSSPP_PLATFORM(IOS)
Expand Down

0 comments on commit 4ffea9f

Please sign in to comment.