diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_state.c | 2 | ||||
-rw-r--r-- | src/mesa/main/attrib.c | 6 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 2 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 25 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 1 | ||||
-rw-r--r-- | src/mesa/main/get.c | 1 | ||||
-rw-r--r-- | src/mesa/main/get_hash_params.py | 3 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 2 | ||||
-rw-r--r-- | src/mesa/main/polygon.c | 40 | ||||
-rw-r--r-- | src/mesa/main/polygon.h | 3 |
12 files changed, 73 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c index db4915fc753..3aad10ed62e 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c @@ -319,7 +319,7 @@ nouveau_polygon_mode(struct gl_context *ctx, GLenum face, GLenum mode) } static void -nouveau_polygon_offset(struct gl_context *ctx, GLfloat factor, GLfloat units) +nouveau_polygon_offset(struct gl_context *ctx, GLfloat factor, GLfloat units, GLfloat clamp) { context_dirty(ctx, POLYGON_OFFSET); } diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 2ad8439cc29..930ead86ad1 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -712,7 +712,7 @@ static void r200ColorMask( struct gl_context *ctx, */ static void r200PolygonOffset( struct gl_context *ctx, - GLfloat factor, GLfloat units ) + GLfloat factor, GLfloat units, GLfloat clamp ) { r200ContextPtr rmesa = R200_CONTEXT(ctx); const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index f2e8fa7a53f..002fc86f9a4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -520,7 +520,7 @@ static void radeonColorMask( struct gl_context *ctx, */ static void radeonPolygonOffset( struct gl_context *ctx, - GLfloat factor, GLfloat units ) + GLfloat factor, GLfloat units, GLfloat clamp ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); const GLfloat depthScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 4684615a880..07934b9bca0 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1248,8 +1248,10 @@ _mesa_PopAttrib(void) _mesa_FrontFace(polygon->FrontFace); _mesa_PolygonMode(GL_FRONT, polygon->FrontMode); _mesa_PolygonMode(GL_BACK, polygon->BackMode); - _mesa_PolygonOffset(polygon->OffsetFactor, - polygon->OffsetUnits); + _mesa_polygon_offset_clamp(ctx, + polygon->OffsetFactor, + polygon->OffsetUnits, + polygon->OffsetClamp); _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, polygon->SmoothFlag); _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, polygon->StippleFlag); _mesa_set_enable(ctx, GL_CULL_FACE, polygon->CullFlag); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 40f68b4a7fd..ec8662b3089 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -579,7 +579,7 @@ struct dd_function_table { /** Select a polygon rasterization mode */ void (*PolygonMode)(struct gl_context *ctx, GLenum face, GLenum mode); /** Set the scale and units used to calculate depth values */ - void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units); + void (*PolygonOffset)(struct gl_context *ctx, GLfloat factor, GLfloat units, GLfloat clamp); /** Set the polygon stippling pattern */ void (*PolygonStipple)(struct gl_context *ctx, const GLubyte *mask ); /* Specifies the current buffer for reading */ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 44e067b2ae3..025f6abd227 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -484,6 +484,9 @@ typedef enum /* ARB_uniform_buffer_object */ OPCODE_UNIFORM_BLOCK_BINDING, + /* EXT_polygon_offset_clamp */ + OPCODE_POLYGON_OFFSET_CLAMP, + /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, @@ -3191,6 +3194,22 @@ save_PolygonOffsetEXT(GLfloat factor, GLfloat bias) save_PolygonOffset(factor, ctx->DrawBuffer->_DepthMaxF * bias); } +static void GLAPIENTRY +save_PolygonOffsetClampEXT(GLfloat factor, GLfloat units, GLfloat clamp) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET_CLAMP, 3); + if (n) { + n[1].f = factor; + n[2].f = units; + n[3].f = clamp; + } + if (ctx->ExecuteFlag) { + CALL_PolygonOffsetClampEXT(ctx->Exec, (factor, units, clamp)); + } +} static void GLAPIENTRY save_PopAttrib(void) @@ -8124,6 +8143,9 @@ execute_list(struct gl_context *ctx, GLuint list) case OPCODE_POLYGON_OFFSET: CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f)); break; + case OPCODE_POLYGON_OFFSET_CLAMP: + CALL_PolygonOffsetClampEXT(ctx->Exec, (n[1].f, n[2].f, n[3].f)); + break; case OPCODE_POP_ATTRIB: CALL_PopAttrib(ctx->Exec, ()); break; @@ -9683,6 +9705,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_ProgramUniformMatrix4x2fv(table, save_ProgramUniformMatrix4x2fv); SET_ProgramUniformMatrix3x4fv(table, save_ProgramUniformMatrix3x4fv); SET_ProgramUniformMatrix4x3fv(table, save_ProgramUniformMatrix4x3fv); + + /* GL_EXT_polygon_offset_clamp */ + SET_PolygonOffsetClampEXT(table, save_PolygonOffsetClampEXT); } diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index bfe7d991b52..220b220d668 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -234,6 +234,7 @@ static const struct extension extension_table[] = { { "GL_EXT_pixel_buffer_object", o(EXT_pixel_buffer_object), GL, 2004 }, { "GL_EXT_point_parameters", o(EXT_point_parameters), GLL, 1997 }, { "GL_EXT_polygon_offset", o(dummy_true), GLL, 1995 }, + { "GL_EXT_polygon_offset_clamp", o(EXT_polygon_offset_clamp), GL, 2014 }, { "GL_EXT_provoking_vertex", o(EXT_provoking_vertex), GL, 2009 }, { "GL_EXT_rescale_normal", o(dummy_true), GLL, 1997 }, { "GL_EXT_secondary_color", o(dummy_true), GLL, 1999 }, diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 6091efc7fb8..3f9d745161d 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -392,6 +392,7 @@ EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5); EXTRA_EXT(INTEL_performance_query); EXTRA_EXT(ARB_explicit_uniform_location); EXTRA_EXT(ARB_clip_control); +EXTRA_EXT(EXT_polygon_offset_clamp); static const int extra_ARB_color_buffer_float_or_glcore[] = { diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index c487e98befa..1645ebf701d 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -812,6 +812,9 @@ descriptor=[ [ "VIEWPORT_BOUNDS_RANGE", "CONTEXT_FLOAT2(Const.ViewportBounds), extra_ARB_viewport_array" ], [ "LAYER_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), extra_ARB_viewport_array" ], [ "VIEWPORT_INDEX_PROVOKING_VERTEX", "CONTEXT_ENUM(Light.ProvokingVertex), extra_ARB_viewport_array" ], + +# GL_EXT_polygon_offset_clamp + [ "POLYGON_OFFSET_CLAMP_EXT", "CONTEXT_FLOAT(Polygon.OffsetClamp), extra_EXT_polygon_offset_clamp" ], ]} ] diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 81a7c0eb4eb..1c33ef4605b 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1004,6 +1004,7 @@ struct gl_polygon_attrib GLenum CullFaceMode; /**< Culling mode GL_FRONT or GL_BACK */ GLfloat OffsetFactor; /**< Polygon offset factor, from user */ GLfloat OffsetUnits; /**< Polygon offset units, from user */ + GLfloat OffsetClamp; /**< Polygon offset clamp, from user */ GLboolean OffsetPoint; /**< Offset in GL_POINT mode */ GLboolean OffsetLine; /**< Offset in GL_LINE mode */ GLboolean OffsetFill; /**< Offset in GL_FILL mode */ @@ -3813,6 +3814,7 @@ struct gl_extensions GLboolean EXT_packed_float; GLboolean EXT_pixel_buffer_object; GLboolean EXT_point_parameters; + GLboolean EXT_polygon_offset_clamp; GLboolean EXT_provoking_vertex; GLboolean EXT_shader_integer_mix; GLboolean EXT_stencil_two_side; diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index e3b90739d03..a1f0aa02da1 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -235,25 +235,33 @@ _mesa_GetPolygonStipple( GLubyte *dest ) _mesa_GetnPolygonStippleARB(INT_MAX, dest); } - -void GLAPIENTRY -_mesa_PolygonOffset( GLfloat factor, GLfloat units ) +void +_mesa_polygon_offset_clamp(struct gl_context *ctx, + GLfloat factor, GLfloat units, GLfloat clamp) { - GET_CURRENT_CONTEXT(ctx); - - if (MESA_VERBOSE&VERBOSE_API) - _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units); - if (ctx->Polygon.OffsetFactor == factor && - ctx->Polygon.OffsetUnits == units) + ctx->Polygon.OffsetUnits == units && + ctx->Polygon.OffsetClamp == clamp) return; FLUSH_VERTICES(ctx, _NEW_POLYGON); ctx->Polygon.OffsetFactor = factor; ctx->Polygon.OffsetUnits = units; + ctx->Polygon.OffsetClamp = clamp; if (ctx->Driver.PolygonOffset) - ctx->Driver.PolygonOffset( ctx, factor, units ); + ctx->Driver.PolygonOffset( ctx, factor, units, clamp ); +} + +void GLAPIENTRY +_mesa_PolygonOffset( GLfloat factor, GLfloat units ) +{ + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE&VERBOSE_API) + _mesa_debug(ctx, "glPolygonOffset %f %f\n", factor, units); + + _mesa_polygon_offset_clamp(ctx, factor, units, 0.0); } @@ -268,7 +276,18 @@ _mesa_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) void GLAPIENTRY _mesa_PolygonOffsetClampEXT( GLfloat factor, GLfloat units, GLfloat clamp ) { + GET_CURRENT_CONTEXT(ctx); + + if (!ctx->Extensions.EXT_polygon_offset_clamp) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "unsupported function (glPolygonOffsetClampEXT) called"); + return; + } + + if (MESA_VERBOSE&VERBOSE_API) + _mesa_debug(ctx, "glPolygonOffsetClampEXT %f %f %f\n", factor, units, clamp); + _mesa_polygon_offset_clamp(ctx, factor, units, clamp); } @@ -298,6 +317,7 @@ void _mesa_init_polygon( struct gl_context * ctx ) ctx->Polygon.StippleFlag = GL_FALSE; ctx->Polygon.OffsetFactor = 0.0F; ctx->Polygon.OffsetUnits = 0.0F; + ctx->Polygon.OffsetClamp = 0.0F; ctx->Polygon.OffsetPoint = GL_FALSE; ctx->Polygon.OffsetLine = GL_FALSE; ctx->Polygon.OffsetFill = GL_FALSE; diff --git a/src/mesa/main/polygon.h b/src/mesa/main/polygon.h index 6cf14d3e2ac..41344a2ef0c 100644 --- a/src/mesa/main/polygon.h +++ b/src/mesa/main/polygon.h @@ -64,6 +64,9 @@ extern void GLAPIENTRY _mesa_GetPolygonStipple( GLubyte *mask ); extern void +_mesa_polygon_offset_clamp(struct gl_context *ctx, + GLfloat factor, GLfloat units, GLfloat clamp); +extern void _mesa_init_polygon( struct gl_context * ctx ); #endif |