diff options
author | Brian Paul <[email protected]> | 2001-06-26 01:32:48 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-06-26 01:32:48 +0000 |
commit | 8c2f6c5059a60d845716277973c826f4069926e6 (patch) | |
tree | 75f91539198cc4b27464469231ca0eb734dc5abc /src/mesa/main | |
parent | 657323bf03a575bf40cff83119f201a9dcd1478e (diff) |
added GL_IBM_rasterpos_clip extension
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/attrib.c | 8 | ||||
-rw-r--r-- | src/mesa/main/context.c | 3 | ||||
-rw-r--r-- | src/mesa/main/drawpix.c | 20 | ||||
-rw-r--r-- | src/mesa/main/enable.c | 29 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 3 | ||||
-rw-r--r-- | src/mesa/main/get.c | 42 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 5 | ||||
-rw-r--r-- | src/mesa/main/rastpos.c | 24 |
8 files changed, 116 insertions, 18 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 22dad13e920..e75751d5fcf 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.52 2001/06/18 17:26:08 brianp Exp $ */ +/* $Id: attrib.c,v 1.53 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -219,6 +219,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; attr->Normalize = ctx->Transform.Normalize; + attr->RasterPositionUnclipped = ctx->Transform.RasterPositionUnclipped; attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; attr->PointSmooth = ctx->Point.SmoothFlag; attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; @@ -440,7 +441,6 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) } TEST_AND_UPDATE(ctx->Color.AlphaEnabled, enable->AlphaTest, GL_ALPHA_TEST); - TEST_AND_UPDATE(ctx->Transform.Normalize, enable->AutoNormal, GL_NORMALIZE); TEST_AND_UPDATE(ctx->Color.BlendEnabled, enable->Blend, GL_BLEND); for (i=0;i<MAX_CLIP_PLANES;i++) { @@ -499,9 +499,13 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) GL_MAP2_VERTEX_3); TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, GL_MAP2_VERTEX_4); + TEST_AND_UPDATE(ctx->Eval.AutoNormal, enable->AutoNormal, GL_AUTO_NORMAL); TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, GL_RESCALE_NORMAL_EXT); + TEST_AND_UPDATE(ctx->Transform.RasterPositionUnclipped, + enable->RasterPositionUnclipped, + GL_RASTER_POSITION_UNCLIPPED_IBM); TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 63c30f2ee5d..444789a817e 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1,4 +1,4 @@ -/* $Id: context.c,v 1.143 2001/06/13 14:56:14 brianp Exp $ */ +/* $Id: context.c,v 1.144 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1141,6 +1141,7 @@ init_attrib_groups( GLcontext *ctx ) ctx->Transform.MatrixMode = GL_MODELVIEW; ctx->Transform.Normalize = GL_FALSE; ctx->Transform.RescaleNormals = GL_FALSE; + ctx->Transform.RasterPositionUnclipped = GL_FALSE; for (i=0;i<MAX_CLIP_PLANES;i++) { ctx->Transform.ClipEnabled[i] = GL_FALSE; ASSIGN_4V( ctx->Transform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 ); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 963eb06b44d..7d29257c497 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -1,4 +1,4 @@ -/* $Id: drawpix.c,v 1.54 2001/06/18 17:26:08 brianp Exp $ */ +/* $Id: drawpix.c,v 1.55 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -64,9 +64,13 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, _mesa_update_state(ctx); } +#if 1 x = IROUND(ctx->Current.RasterPos[0]); y = IROUND(ctx->Current.RasterPos[1]); - +#else + x = IFLOOR(ctx->Current.RasterPos[0]); + y = IFLOOR(ctx->Current.RasterPos[1]); +#endif ctx->OcclusionResult = GL_TRUE; ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type, &ctx->Unpack, pixels); @@ -142,9 +146,13 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, if (!ctx->Current.RasterPosValid) { return; } +#if 1 destx = IROUND(ctx->Current.RasterPos[0]); desty = IROUND(ctx->Current.RasterPos[1]); - +#else + destx = IFLOOR(ctx->Current.RasterPos[0]); + desty = IFLOOR(ctx->Current.RasterPos[1]); +#endif ctx->OcclusionResult = GL_TRUE; ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty, @@ -187,9 +195,13 @@ _mesa_Bitmap( GLsizei width, GLsizei height, if (ctx->RenderMode==GL_RENDER) { if (bitmap) { +#if 0 GLint x = (GLint) ( (ctx->Current.RasterPos[0] - xorig) + 0.0F ); GLint y = (GLint) ( (ctx->Current.RasterPos[1] - yorig) + 0.0F ); - +#else + GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig); + GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig); +#endif if (ctx->NewState) { _mesa_update_state(ctx); } diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 4516f48f840..a1adf1de821 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -1,4 +1,4 @@ -/* $Id: enable.c,v 1.49 2001/05/29 15:23:48 brianp Exp $ */ +/* $Id: enable.c,v 1.50 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -743,7 +743,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.Enabled = state; - ctx->NewState |= _NEW_MULTISAMPLE; break; case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB: if (!ctx->Extensions.ARB_multisample) { @@ -754,7 +753,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleAlphaToCoverage = state; - ctx->NewState |= _NEW_MULTISAMPLE; break; case GL_SAMPLE_ALPHA_TO_ONE_ARB: if (!ctx->Extensions.ARB_multisample) { @@ -765,7 +763,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleAlphaToOne = state; - ctx->NewState |= _NEW_MULTISAMPLE; break; case GL_SAMPLE_COVERAGE_ARB: if (!ctx->Extensions.ARB_multisample) { @@ -776,7 +773,6 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleCoverage = state; - ctx->NewState |= _NEW_MULTISAMPLE; break; case GL_SAMPLE_COVERAGE_INVERT_ARB: if (!ctx->Extensions.ARB_multisample) { @@ -787,7 +783,18 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) return; FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE); ctx->Multisample.SampleCoverageInvert = state; - ctx->NewState |= _NEW_MULTISAMPLE; + break; + + /* GL_IBM_rasterpos_clip */ + case GL_RASTER_POSITION_UNCLIPPED_IBM: + if (!ctx->Extensions.IBM_rasterpos_clip) { + _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable"); + return; + } + if (ctx->Transform.RasterPositionUnclipped == state) + return; + FLUSH_VERTICES(ctx, _NEW_TRANSFORM); + ctx->Transform.RasterPositionUnclipped = state; break; /* GL_MESA_sprite_point */ @@ -1092,6 +1099,16 @@ _mesa_IsEnabled( GLenum cap ) return GL_FALSE; } + /* GL_IBM_rasterpos_clip */ + case GL_RASTER_POSITION_UNCLIPPED_IBM: + if (ctx->Extensions.IBM_rasterpos_clip) { + return ctx->Transform.RasterPositionUnclipped; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); + return GL_FALSE; + } + /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: return ctx->Point.SpriteMode; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 169ae2d44ae..3c710f11959 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -1,4 +1,4 @@ -/* $Id: extensions.c,v 1.62 2001/06/15 14:18:46 brianp Exp $ */ +/* $Id: extensions.c,v 1.63 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -98,6 +98,7 @@ static struct { { ON, "GL_EXT_vertex_array", 0 }, { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) }, { OFF, "GL_HP_occlusion_test", F(HP_occlusion_test) }, + { ON, "GL_IBM_rasterpos_clip", F(IBM_rasterpos_clip) }, { OFF, "GL_INGR_blend_func_separate", F(INGR_blend_func_separate) }, { OFF, "GL_MESA_packed_depth_stencil", 0 }, { OFF, "GL_MESA_resize_buffers", F(MESA_resize_buffers) }, diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 58e1605fb2f..9c44eb60243 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1,4 +1,4 @@ -/* $Id: get.c,v 1.64 2001/06/20 18:54:43 brianp Exp $ */ +/* $Id: get.c,v 1.65 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1335,6 +1335,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) return; } + /* GL_IBM_rasterpos_clip */ + case GL_RASTER_POSITION_UNCLIPPED_IBM: + if (ctx->Extensions.IBM_rasterpos_clip) { + *params = ctx->Transform.RasterPositionUnclipped; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBoolean"); + return; + } + /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: if (ctx->Extensions.MESA_sprite_point) { @@ -2615,6 +2625,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) return; } + /* GL_IBM_rasterpos_clip */ + case GL_RASTER_POSITION_UNCLIPPED_IBM: + if (ctx->Extensions.IBM_rasterpos_clip) { + *params = (GLdouble) ctx->Transform.RasterPositionUnclipped; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + return; + } + /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: if (ctx->Extensions.MESA_sprite_point) { @@ -3869,6 +3889,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) return; } + /* GL_IBM_rasterpos_clip */ + case GL_RASTER_POSITION_UNCLIPPED_IBM: + if (ctx->Extensions.IBM_rasterpos_clip) { + *params = (GLfloat) ctx->Transform.RasterPositionUnclipped; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatn"); + return; + } + /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: if (ctx->Extensions.MESA_sprite_point) { @@ -5172,6 +5202,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) return; } + /* GL_IBM_rasterpos_clip */ + case GL_RASTER_POSITION_UNCLIPPED_IBM: + if (ctx->Extensions.IBM_rasterpos_clip) { + *params = (GLint) ctx->Transform.RasterPositionUnclipped; + } + else { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + return; + } + /* GL_MESA_sprite_point */ case GL_SPRITE_POINT_MESA: if (ctx->Extensions.MESA_sprite_point) { diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 80a8022f120..b9e1778cc8d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.46 2001/06/13 14:56:14 brianp Exp $ */ +/* $Id: mtypes.h,v 1.47 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -381,6 +381,7 @@ struct gl_enable_attrib { GLboolean SampleAlphaToOne; /* GL_ARB_multisample */ GLboolean SampleCoverage; /* GL_ARB_multisample */ GLboolean SampleCoverageInvert; /* GL_ARB_multisample */ + GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ GLuint Texture[MAX_TEXTURE_UNITS]; GLuint TexGen[MAX_TEXTURE_UNITS]; }; @@ -951,6 +952,7 @@ struct gl_transform_attrib { GLubyte _AnyClip; /* How many ClipEnabled? */ GLboolean Normalize; /* Normalize all normals? */ GLboolean RescaleNormals; /* GL_EXT_rescale_normal */ + GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ }; @@ -1226,6 +1228,7 @@ struct gl_extensions { GLboolean EXT_texture_lod_bias; GLboolean EXT_vertex_array_set; GLboolean HP_occlusion_test; + GLboolean IBM_rasterpos_clip; GLboolean INGR_blend_func_separate; GLboolean MESA_window_pos; GLboolean MESA_resize_buffers; diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index adc81ed4785..c4f87c2ba4f 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -1,4 +1,4 @@ -/* $Id: rastpos.c,v 1.26 2001/06/18 17:26:08 brianp Exp $ */ +/* $Id: rastpos.c,v 1.27 2001/06/26 01:32:48 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -66,6 +66,20 @@ viewclip_point( const GLfloat v[] ) } +/* As above, but only clip test against far/near Z planes */ +static GLuint +viewclip_point_z( const GLfloat v[] ) +{ + if (v[2] > v[3] || v[2] < -v[3] ) { + return 0; + } + else { + return 1; + } +} + + + /* * Clip a point against the user clipping planes. * Input: v - vertex-vector describing the point to clip. @@ -292,7 +306,13 @@ raster_pos4f(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) TRANSFORM_POINT( clip, ctx->ProjectionMatrix.m, eye ); /* clip to view volume */ - if (viewclip_point( clip )==0) { + if (ctx->Transform.RasterPositionUnclipped) { + /* GL_IBM_rasterpos_clip: only clip against Z */ + if (viewclip_point_z(clip) == 0) + ctx->Current.RasterPosValid = GL_FALSE; + } + else if (viewclip_point(clip) == 0) { + /* Normal OpenGL behaviour */ ctx->Current.RasterPosValid = GL_FALSE; return; } |