diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c index 6f5b5b2b867..4671683c1af 100644 --- a/src/gallium/drivers/lima/lima_draw.c +++ b/src/gallium/drivers/lima/lima_draw.c @@ -681,11 +681,7 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in (stencil[1].valuemask << 24); render->stencil_test = (stencil[0].writemask & 0xff) | (stencil[1].writemask & 0xff) << 8; } - /* TODO: Find out, what (render->stecil_test & 0xffff0000) is. - * 0x00ff0000 is probably (float_to_ubyte(alpha->ref_value) << 16) - * (render->multi_sample & 0x00000007 is probably the compare function - * of glAlphaFunc then. - */ + /* TODO: Find out, what (render->stecil_test & 0xff000000) is */ } else { /* Default values, when stencil is disabled: @@ -700,14 +696,23 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in /* need more investigation */ if (info->mode == PIPE_PRIM_POINTS) - render->multi_sample = 0x0000F007; + render->multi_sample = 0x0000F000; else if (info->mode < PIPE_PRIM_TRIANGLES) - render->multi_sample = 0x0000F407; + render->multi_sample = 0x0000F400; else - render->multi_sample = 0x0000F807; + render->multi_sample = 0x0000F800; if (ctx->framebuffer.base.samples) render->multi_sample |= 0x68; + /* alpha test */ + if (ctx->zsa->base.alpha_enabled) { + render->multi_sample |= ctx->zsa->base.alpha_func; + render->stencil_test |= float_to_ubyte(ctx->zsa->base.alpha_ref_value) << 16; + } else { + /* func = PIPE_FUNC_ALWAYS */ + render->multi_sample |= 0x7; + } + render->shader_address = ctx->fs->bo->va | (((uint32_t *)ctx->fs->bo->map)[0] & 0x1F); @@ -721,7 +726,8 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in if (ctx->blend->base.dither) render->aux1 |= 0x00002000; - if (fs->state.uses_discard) { + if (fs->state.uses_discard || + ctx->zsa->base.alpha_enabled) { early_z = false; pixel_kill = false; } diff --git a/src/gallium/drivers/lima/lima_parser.c b/src/gallium/drivers/lima/lima_parser.c index dd87b4d1b4a..b0a6c86a9e5 100644 --- a/src/gallium/drivers/lima/lima_parser.c +++ b/src/gallium/drivers/lima/lima_parser.c @@ -537,8 +537,10 @@ parse_rsw(FILE *fp, uint32_t *value, int i, uint32_t *helper) (*value & 0x0000ff00) >> 8); /* back writemask */ /* add a few tabs for alignment */ fprintf(fp, "\t\t\t\t\t\t/* %s(2)", render_state_infos[i].info); - fprintf(fp, ": unknown (bits 16-31) 0x%04x */\n", - (*value & 0xffff0000) >> 16); /* unknown, alpha ref_value? */ + fprintf(fp, ": alpha_ref_value: 0x%02x */\n", (*value & 0x00ff0000) >> 16); + fprintf(fp, "\t\t\t\t\t\t/* %s(3)", render_state_infos[i].info); + fprintf(fp, ": unknown (bits 24-31) 0x%02x */\n", + (*value & 0xff000000) >> 24); /* unknown */ break; case 8: /* MULTI SAMPLE */ if ((*value & 0x00000f00) == 0x00000000) @@ -556,6 +558,10 @@ parse_rsw(FILE *fp, uint32_t *value, int i, uint32_t *helper) fprintf(fp, " */\n"); else fprintf(fp, ", UNKNOWN\n"); + fprintf(fp, "\t\t\t\t\t\t/* %s(2)", render_state_infos[i].info); + fprintf(fp, ": alpha_test_func: %d (%s) */\n", + (*value & 0x00000007), + lima_get_compare_func_string((*value & 0x00000007))); /* alpha_test_func */ break; case 9: /* SHADER ADDRESS */ fprintf(fp, ": fs shader @ 0x%08x, first instr length %d */\n", diff --git a/src/gallium/drivers/lima/lima_screen.c b/src/gallium/drivers/lima/lima_screen.c index d6265c539ca..59d41755dc9 100644 --- a/src/gallium/drivers/lima/lima_screen.c +++ b/src/gallium/drivers/lima/lima_screen.c @@ -149,6 +149,8 @@ lima_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 0; case PIPE_CAP_ALPHA_TEST: + return 1; + case PIPE_CAP_FLATSHADE: case PIPE_CAP_TWO_SIDED_COLOR: case PIPE_CAP_CLIP_PLANES: