[Mesa-dev] [RFC PATCH] mesa/st/cb_clear: in st_Clear also validate the render state (needed by virgl)
Gert Wollny
gert.wollny at collabora.com
Fri May 4 11:36:12 UTC 2018
Am Donnerstag, den 03.05.2018, 19:52 +0200 schrieb Gert Wollny:
> Am Donnerstag, den 03.05.2018, 13:24 -0400 schrieb Ilia Mirkin:
> >
> > The api call is "clear", not "glClear in the context of whatever
> > random GL state there might be". When the gallium clear API is
> > invoked, the bound framebuffer needs to be cleared. This is how the
> > API works, this is how all drivers implement it. It's basically
> > memset(). It doesn't care about rasterizer discard or anything
> > else.
> >
>
> I stand corrected and sorry for the noise.
Actually no:
The OpenGL standard section 14.1 says:
"When enabled, RASTERIZER_DISCARD also causes the Clear and
ClearBuffer* commands to be ignored."
The glClear command has the following call chain:
glClear(...) = _mesa_Clear at mesa/main/clear.c:242
clear(...) at mesa/main/clear.c:221
st_Clear(...) at mesa/state_tracker/st_cb_clear.c:366
clear() takes care of validating the non-driver state changes stored in
ctx->NewState, but changes to RASTERIZER_DISCARD are stored in
ctx->NewDriverState and in this case this refers to the gallium state
tracker and hence st_Clear should also validate the renderer state.
The reason most drivers get away without this validation is that they
use the blitter who also validates the render state befor doing the
actual clear operation.
best,
Gert
More information about the mesa-dev
mailing list