TINYGL: Fix vertice color when clipped and lighting is disabled

longcurrent_color is assigned per vertex, but it is not saved on each
vertex on creation (unlike their "color" attribute, used when lighting
is enabled).
As a consequence, and because rendering happens asynchronously (rather,
following the draw call queue managed by zdirtyrect.cpp when requested
to flip current buffer), longcurrent_color at clipping time can be
different to the one at vertex declaration time, causing color artifacts.

The effect is most noticeable in EMI set shi, in the grog dispenser +
shipyard manager closeup angle, when Guybrush exits the screen by
crossing its right border: dark triangles become visible on his face.

Instead, always use the color attribute, which is already properly
initialised on vertex creation.
This commit is contained in:
Vincent Pelletier 2017-05-12 16:57:35 +00:00
parent 92130c138e
commit a6af3a38a3
7 changed files with 4 additions and 33 deletions

View file

@ -463,7 +463,6 @@ RasterizationDrawCall::RasterizationState RasterizationDrawCall::captureState()
memcpy(state.viewportScaling, c->viewport.scale._v, sizeof(c->viewport.scale._v));
memcpy(state.viewportTranslation, c->viewport.trans._v, sizeof(c->viewport.trans._v));
memcpy(state.currentColor, c->longcurrent_color, sizeof(c->longcurrent_color));
return state;
}
@ -494,7 +493,6 @@ void RasterizationDrawCall::applyState(const RasterizationDrawCall::Rasterizatio
memcpy(c->viewport.scale._v, state.viewportScaling, sizeof(c->viewport.scale._v));
memcpy(c->viewport.trans._v, state.viewportTranslation, sizeof(c->viewport.trans._v));
memcpy(c->longcurrent_color, state.currentColor, sizeof(c->longcurrent_color));
}
void RasterizationDrawCall::execute(const Common::Rect &clippingRectangle, bool restoreState) const {
@ -676,10 +674,6 @@ bool RasterizationDrawCall::RasterizationState::operator==(const RasterizationSt
alphaRefValue == other.alphaRefValue &&
texture == other.texture &&
shadowMaskBuf == other.shadowMaskBuf &&
currentColor[0] == other.currentColor[0] &&
currentColor[1] == other.currentColor[1] &&
currentColor[2] == other.currentColor[2] &&
currentColor[3] == other.currentColor[3] &&
viewportTranslation[0] == other.viewportTranslation[0] &&
viewportTranslation[1] == other.viewportTranslation[1] &&
viewportTranslation[2] == other.viewportTranslation[2] &&