Skip to content

Commit

Permalink
Debug-assert that there's a renderpass in Flush instead of asserting,…
Browse files Browse the repository at this point in the history
… and skip if not.

buildfix
  • Loading branch information
hrydgard committed May 3, 2023
1 parent c9b7c81 commit c80671d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions GPU/GLES/DrawEngineGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,20 @@ void DrawEngineGLES::Invalidate(InvalidationCallbackFlags flags) {
void DrawEngineGLES::DoFlush() {
PROFILE_THIS_SCOPE("flush");
FrameData &frameData = frameData_[render_->GetCurFrame()];

// Attempt to gather some information (asserts now upload the game name).
_assert_(render_->IsInRenderPass());
VShaderID vsid;

if (!render_->IsInRenderPass()) {
// Something went badly wrong. Try to survive by simply skipping the draw, though.
_dbg_assert_msg_(false, "Trying to DoFlush while not in a render pass. This is bad.");
// can't goto bail here, skips too many variable initializations. So let's wipe the most important stuff.
indexGen.Reset();
decodedVerts_ = 0;
numDrawCalls = 0;
vertexCountInDrawCalls_ = 0;
decodeCounter_ = 0;
dcid_ = 0;
return;
}

bool textureNeedsApply = false;
if (gstate_c.IsDirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS) && !gstate.isModeClear() && gstate.isTextureMapEnabled()) {
Expand All @@ -265,7 +276,6 @@ void DrawEngineGLES::DoFlush() {

GEPrimitiveType prim = prevPrim_;

VShaderID vsid;
Shader *vshader = shaderManager_->ApplyVertexShader(CanUseHardwareTransform(prim), useHWTessellation_, dec_, decOptions_.expandAllWeightsToFloat, decOptions_.applySkinInDecode || !CanUseHardwareTransform(prim), &vsid);

GLRBuffer *vertexBuffer = nullptr;
Expand Down

0 comments on commit c80671d

Please sign in to comment.