[Mesa-dev] [PATCH 11/18] mesa: Only FRONT_AND_BACK is allowed for PolygonMode in core context
Ian Romanick
idr at freedesktop.org
Fri Aug 24 08:49:10 PDT 2012
From: Ian Romanick <ian.d.romanick at intel.com>
Page 407 (page 423 of the PDF) of the OpenGL 3.0 spec says (in the list
of deprecated functionality):
"Separate polygon draw mode - PolygonMode face values of FRONT and
BACK; polygons are always drawn in the same mode, no matter which
face is being rasterized."
Also modify meta to not use FRONT or BACK in a core context.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/drivers/common/meta.c | 10 ++++++++--
src/mesa/main/polygon.c | 8 ++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 58d6fa6..2332825 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -846,8 +846,14 @@ _mesa_meta_end(struct gl_context *ctx)
}
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);
diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c
index addca02..d7d52da 100644
--- a/src/mesa/main/polygon.c
+++ b/src/mesa/main/polygon.c
@@ -143,6 +143,10 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
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);
@@ -157,6 +161,10 @@ _mesa_PolygonMode( GLenum face, GLenum mode )
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);
--
1.7.6.5
More information about the mesa-dev
mailing list