X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi915%2Fi830_state.c;h=cedc58a2d1cb31956335dd121c6d11a09ccf20c4;hb=e6ec425d6eeac95f466174267b2c18c0bffca3f0;hp=147192adc7a72ef9eb9a24436ee72995c6c74947;hpb=dbf3a15313eed930a3d8fdde12e457259c43651b;p=mesa.git diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index 147192adc7a..cedc58a2d1c 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -30,14 +30,15 @@ #include "main/context.h" #include "main/macros.h" #include "main/enums.h" +#include "main/fbobject.h" #include "main/dd.h" - -#include "texmem.h" +#include "main/state.h" #include "drivers/common/driverfuncs.h" #include "intel_screen.h" #include "intel_batchbuffer.h" +#include "intel_mipmap_tree.h" #include "intel_fbo.h" #include "intel_buffers.h" @@ -234,7 +235,7 @@ i830EvalLogicOpBlendState(struct gl_context * ctx) I830_STATECHANGE(i830, I830_UPLOAD_CTX); - if (RGBA_LOGICOP_ENABLED(ctx)) { + if (ctx->Color.ColorLogicOpEnabled) { i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~(ENABLE_COLOR_BLEND | ENABLE_LOGIC_OP_MASK); i830->state.Ctx[I830_CTXREG_ENABLES_1] |= (DISABLE_COLOR_BLEND | @@ -291,10 +292,10 @@ i830_set_blend_state(struct gl_context * ctx) funcRGB = - SRC_BLND_FACT(intel_translate_blend_factor(ctx->Color.BlendSrcRGB)) - | DST_BLND_FACT(intel_translate_blend_factor(ctx->Color.BlendDstRGB)); + SRC_BLND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].SrcRGB)) + | DST_BLND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].DstRGB)); - switch (ctx->Color.BlendEquationRGB) { + switch (ctx->Color.Blend[0].EquationRGB) { case GL_FUNC_ADD: eqnRGB = BLENDFUNC_ADD; break; @@ -314,15 +315,15 @@ i830_set_blend_state(struct gl_context * ctx) break; default: fprintf(stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB); return; } - funcA = SRC_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.BlendSrcA)) - | DST_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.BlendDstA)); + funcA = SRC_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].SrcA)) + | DST_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].DstA)); - switch (ctx->Color.BlendEquationA) { + switch (ctx->Color.Blend[0].EquationA) { case GL_FUNC_ADD: eqnA = BLENDFUNC_ADD; break; @@ -342,7 +343,7 @@ i830_set_blend_state(struct gl_context * ctx) break; default: fprintf(stderr, "[%s:%u] Invalid alpha blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationA); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA); return; } @@ -436,7 +437,10 @@ i830DepthMask(struct gl_context * ctx, GLboolean flag) struct i830_context *i830 = i830_context(ctx); DBG("%s flag (%d)\n", __FUNCTION__, flag); - + + if (!ctx->DrawBuffer || !ctx->DrawBuffer->Visual.depthBits) + flag = false; + I830_STATECHANGE(i830, I830_UPLOAD_CTX); i830->state.Ctx[I830_CTXREG_ENABLES_2] &= ~ENABLE_DIS_DEPTH_WRITE_MASK; @@ -473,7 +477,7 @@ static void i830PolygonStipple(struct gl_context * ctx, const GLubyte * mask) { struct i830_context *i830 = i830_context(ctx); - const GLubyte *m = mask; + const GLubyte *m; GLubyte p[4]; int i, j, k; int active = (ctx->Polygon.StippleFlag && @@ -485,6 +489,12 @@ i830PolygonStipple(struct gl_context * ctx, const GLubyte * mask) i830->state.Stipple[I830_STPREG_ST1] &= ~ST1_ENABLE; } + /* Use the already unpacked stipple data from the context rather than the + * uninterpreted mask passed in. + */ + mask = (const GLubyte *)ctx->PolygonStipple; + m = mask; + p[0] = mask[12] & 0xf; p[0] |= p[0] << 4; p[1] = mask[8] & 0xf; @@ -536,7 +546,7 @@ i830Scissor(struct gl_context * ctx, GLint x, GLint y, GLsizei w, GLsizei h) DBG("%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h); - if (ctx->DrawBuffer->Name == 0) { + if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) { x1 = x; y1 = ctx->DrawBuffer->Height - (y + h); x2 = x + w - 1; @@ -679,7 +689,7 @@ update_specular(struct gl_context * ctx) I830_STATECHANGE(i830, I830_UPLOAD_CTX); i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_SPEC_ADD_MASK; - if (NEED_SECONDARY_COLOR(ctx)) + if (_mesa_need_secondary_color(ctx)) i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_SPEC_ADD; else i830->state.Ctx[I830_CTXREG_ENABLES_1] |= DISABLE_SPEC_ADD; @@ -795,6 +805,9 @@ i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state) I830_STATECHANGE(i830, I830_UPLOAD_CTX); i830->state.Ctx[I830_CTXREG_ENABLES_1] &= ~ENABLE_DIS_DEPTH_TEST_MASK; + if (!ctx->DrawBuffer || !ctx->DrawBuffer->Visual.depthBits) + state = false; + if (state) i830->state.Ctx[I830_CTXREG_ENABLES_1] |= ENABLE_DEPTH_TEST; else @@ -845,11 +858,11 @@ i830Enable(struct gl_context * ctx, GLenum cap, GLboolean state) case GL_STENCIL_TEST: { - GLboolean hw_stencil = GL_FALSE; + bool hw_stencil = false; if (ctx->DrawBuffer) { struct intel_renderbuffer *irbStencil = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_STENCIL); - hw_stencil = (irbStencil && irbStencil->region); + hw_stencil = (irbStencil && irbStencil->mt); } if (hw_stencil) { I830_STATECHANGE(i830, I830_UPLOAD_CTX); @@ -1088,6 +1101,15 @@ i830_update_provoking_vertex(struct gl_context * ctx) } } +/* Fallback to swrast for select and feedback. + */ +static void +i830RenderMode(struct gl_context *ctx, GLenum mode) +{ + struct intel_context *intel = intel_context(ctx); + FALLBACK(intel, INTEL_FALLBACK_RENDERMODE, (mode != GL_RENDER)); +} + void i830InitStateFuncs(struct dd_function_table *functions) { @@ -1107,6 +1129,7 @@ i830InitStateFuncs(struct dd_function_table *functions) functions->LogicOpcode = i830LogicOp; functions->PointSize = i830PointSize; functions->PolygonStipple = i830PolygonStipple; + functions->RenderMode = i830RenderMode; functions->Scissor = i830Scissor; functions->ShadeModel = i830ShadeModel; functions->StencilFuncSeparate = i830StencilFuncSeparate;