}
if (state & MESA_META_RASTERIZATION) {
- _mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
- _mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
+ /* Core context requires that front and back mode be the same.
+ */
+ if (ctx->API == API_OPENGL_CORE) {
+ _mesa_PolygonMode(GL_FRONT_AND_BACK, save->FrontPolygonMode);
+ } else {
+ _mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode);
+ _mesa_PolygonMode(GL_BACK, save->BackPolygonMode);
+ }
if (ctx->API == API_OPENGL) {
_mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple);
_mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth);
switch (face) {
case GL_FRONT:
+ if (ctx->API == API_OPENGL_CORE) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
+ return;
+ }
if (ctx->Polygon.FrontMode == mode)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);
ctx->Polygon.BackMode = mode;
break;
case GL_BACK:
+ if (ctx->API == API_OPENGL_CORE) {
+ _mesa_error( ctx, GL_INVALID_ENUM, "glPolygonMode(face)" );
+ return;
+ }
if (ctx->Polygon.BackMode == mode)
return;
FLUSH_VERTICES(ctx, _NEW_POLYGON);