diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index 8364ca30ef..f778b8d451 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -266,9 +266,7 @@ void DrawEngineGLES::Flush() { Shader *vshader = shaderManager_->ApplyVertexShader(useHWTransform, dec_->VertexType(), clipInfoFlags_, &vsid); if (!vshader) { // Both the requested shader and the software transform fallback failed to compile. - // Not much we can do here, let's skip drawing. Note that the failure is cached, so this - // will keep happening for this shader ID - hence the log, or geometry would just silently - // disappear for the rest of the session. + // Not much we can do here, let's skip drawing. Note that the failure is cached. WARN_LOG_N_TIMES(novshader, 5, Log::G3D, "Skipping draw, no vertex shader"); goto bail; } diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 9823b4507d..d1a41862d4 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -886,9 +886,9 @@ struct CacheHeader { uint32_t version; uint32_t useFlags; uint32_t detectFlags; - int numVertexShaders; - int numFragmentShaders; - int numLinkedPrograms; + uint32_t numVertexShaders; + uint32_t numFragmentShaders; + uint32_t numLinkedPrograms; }; bool ShaderManagerGLES::LoadCacheFlags(File::IOFile &f, DrawEngineGLES *drawEngine) { @@ -942,10 +942,8 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { diskCachePending_.start = time_now_d(); diskCachePending_.Clear(); - // Sanity check the file contents. Note that the counts are signed, so check for negative too - - // otherwise they'd turn into huge sizes in the resize() calls below. - if (header.numFragmentShaders > 1000 || header.numVertexShaders > 1000 || header.numLinkedPrograms > 1000 || - header.numFragmentShaders < 0 || header.numVertexShaders < 0 || header.numLinkedPrograms < 0) { + // Sanity check the file contents. Counts are now unsigned so this is enough. + if (header.numFragmentShaders > 1000 || header.numVertexShaders > 1000 || header.numLinkedPrograms > 1000) { ERROR_LOG(Log::G3D, "Corrupt shader cache file header, aborting."); return false; } @@ -960,8 +958,6 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { return false; } - // Note: ReadArray gets .data(), not &v[0] - the counts can legitimately be zero, - // and indexing an empty vector is UB (and asserts in the debug STL). diskCachePending_.vert.resize(header.numVertexShaders); if (!f.ReadArray(diskCachePending_.vert.data(), header.numVertexShaders)) { diskCachePending_.vert.clear(); diff --git a/GPU/GLES/StencilBufferGLES.cpp b/GPU/GLES/StencilBufferGLES.cpp index 19b94d21bb..be3d713424 100644 --- a/GPU/GLES/StencilBufferGLES.cpp +++ b/GPU/GLES/StencilBufferGLES.cpp @@ -136,8 +136,6 @@ bool FramebufferManagerGLES::ReadbackStencilbuffer(Draw::Framebuffer *fbo, int x draw_->BindSamplerStates(TEX_SLOT_PSP_TEXTURE, 1, &stencilReadbackSampler_); // We must bind the program after starting the render pass. - // Note: scissor to the region we're about to read back, not to (0, 0, w, h) - every caller - // passes (0, 0) today, but with a nonzero origin the copy below would read scissored-away pixels. draw_->SetScissorRect(x, y, w, h); draw_->BindPipeline(stencilReadbackPipeline_);