diff options
author | Cooper Yuan <[email protected]> | 2009-07-20 17:42:47 +0800 |
---|---|---|
committer | Cooper Yuan <[email protected]> | 2009-07-20 17:42:47 +0800 |
commit | 19249a1ae762c90ab9141fe81da465f13d3376ef (patch) | |
tree | 5deaff981d9d00c77d2bb4d9bae5af48cf6a9c99 /src | |
parent | cf721c8137a0335016d0ec36449819ba80578b7d (diff) |
R6xx/r7xx: Fix line stipple and width issue
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/r600/r700_state.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index dd6ddaff3e4..8946d14057e 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -367,6 +367,19 @@ static void r700UpdateCulling(GLcontext * ctx) } } +static void r700UpdateLineStipple(GLcontext * ctx) +{ + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&R700_CONTEXT(ctx)->hw); + if (ctx->Line.StippleFlag) + { + SETbit(r700->PA_SC_MODE_CNTL.u32All, LINE_STIPPLE_ENABLE_bit); + } + else + { + CLEARbit(r700->PA_SC_MODE_CNTL.u32All, LINE_STIPPLE_ENABLE_bit); + } +} + static void r700Enable(GLcontext * ctx, GLenum cap, GLboolean state) //------------------ { context_t *context = R700_CONTEXT(ctx); @@ -416,6 +429,9 @@ static void r700Enable(GLcontext * ctx, GLenum cap, GLboolean state) //--------- context->radeon.state.scissor.enabled = state; radeonUpdateScissor(ctx); break; + case GL_LINE_STIPPLE: + r700UpdateLineStipple(ctx); + break; default: break; } @@ -589,6 +605,23 @@ static void r700PointSize(GLcontext * ctx, GLfloat size) //------------------- static void r700LineWidth(GLcontext * ctx, GLfloat widthf) //--------------- { + context_t *context = R700_CONTEXT(ctx); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); + uint32_t lineWidth = (uint32_t)((widthf * 0.5) * (1 << 4)); + if (lineWidth > 0xFFFF) + lineWidth = 0xFFFF; + SETfield(r700->PA_SU_LINE_CNTL.u32All,(uint16_t)lineWidth, + PA_SU_LINE_CNTL__WIDTH_shift, PA_SU_LINE_CNTL__WIDTH_mask); +} + +static void r700LineStipple(GLcontext *ctx, GLint factor, GLushort pattern) +{ + context_t *context = R700_CONTEXT(ctx); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); + + SETfield(r700->PA_SC_LINE_STIPPLE.u32All, pattern, LINE_PATTERN_shift, LINE + SETfield(r700->PA_SC_LINE_STIPPLE.u32All, (factor-1), REPEAT_COUNT_shift, REP + SETfield(r700->PA_SC_LINE_STIPPLE.u32All, 1, AUTO_RESET_CNTL_shift, AUTO_RE } static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) //-------------- @@ -1209,6 +1242,7 @@ void r700InitStateFuncs(struct dd_function_table *functions) //----------------- functions->DepthRange = r700DepthRange; functions->PointSize = r700PointSize; functions->LineWidth = r700LineWidth; + functions->LineStipple = r700LineStipple; functions->PolygonOffset = r700PolygonOffset; functions->PolygonMode = r700PolygonMode; |