mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
llvmpipe: force constant interpolation of flatshade colors
Nice speedup for gears.
This commit is contained in:
parent
ad74ea2869
commit
86f450060d
5 changed files with 21 additions and 5 deletions
|
|
@ -316,6 +316,7 @@ pos_update(struct lp_build_interp_soa_context *bld, int quad_index)
|
|||
void
|
||||
lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
|
||||
const struct tgsi_token *tokens,
|
||||
boolean flatshade,
|
||||
LLVMBuilderRef builder,
|
||||
struct lp_type type,
|
||||
LLVMValueRef a0_ptr,
|
||||
|
|
@ -358,7 +359,15 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
|
|||
|
||||
for( attrib = first; attrib <= last; ++attrib ) {
|
||||
bld->mask[1 + attrib] = mask;
|
||||
bld->mode[1 + attrib] = decl->Declaration.Interpolate;
|
||||
|
||||
/* XXX: have mesa set INTERP_CONSTANT in the fragment
|
||||
* shader.
|
||||
*/
|
||||
if (decl->Semantic.Name == TGSI_SEMANTIC_COLOR &&
|
||||
flatshade)
|
||||
bld->mode[1 + attrib] = TGSI_INTERPOLATE_CONSTANT;
|
||||
else
|
||||
bld->mode[1 + attrib] = decl->Declaration.Interpolate;
|
||||
}
|
||||
|
||||
bld->num_attribs = MAX2(bld->num_attribs, 1 + last + 1);
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ struct lp_build_interp_soa_context
|
|||
void
|
||||
lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld,
|
||||
const struct tgsi_token *tokens,
|
||||
boolean flatshade,
|
||||
LLVMBuilderRef builder,
|
||||
struct lp_type type,
|
||||
LLVMValueRef a0_ptr,
|
||||
|
|
|
|||
|
|
@ -66,12 +66,12 @@ struct lp_fragment_shader;
|
|||
|
||||
struct lp_fragment_shader_variant_key
|
||||
{
|
||||
enum pipe_format zsbuf_format;
|
||||
unsigned nr_cbufs;
|
||||
|
||||
struct pipe_depth_state depth;
|
||||
struct pipe_alpha_state alpha;
|
||||
struct pipe_blend_state blend;
|
||||
enum pipe_format zsbuf_format;
|
||||
unsigned nr_cbufs:8;
|
||||
unsigned flatshade:1;
|
||||
|
||||
struct {
|
||||
ubyte colormask;
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe )
|
|||
if (llvmpipe->dirty & (LP_NEW_FS |
|
||||
LP_NEW_BLEND |
|
||||
LP_NEW_DEPTH_STENCIL_ALPHA |
|
||||
LP_NEW_RASTERIZER |
|
||||
LP_NEW_SAMPLER |
|
||||
LP_NEW_TEXTURE))
|
||||
llvmpipe_update_fs( llvmpipe );
|
||||
|
|
|
|||
|
|
@ -718,7 +718,10 @@ generate_fragment(struct llvmpipe_context *lp,
|
|||
|
||||
generate_pos0(builder, x, y, &x0, &y0);
|
||||
|
||||
lp_build_interp_soa_init(&interp, shader->base.tokens, builder, fs_type,
|
||||
lp_build_interp_soa_init(&interp,
|
||||
shader->base.tokens,
|
||||
key->flatshade,
|
||||
builder, fs_type,
|
||||
a0_ptr, dadx_ptr, dady_ptr,
|
||||
x0, y0);
|
||||
|
||||
|
|
@ -958,6 +961,8 @@ make_variant_key(struct llvmpipe_context *lp,
|
|||
key->alpha.func = lp->depth_stencil->alpha.func;
|
||||
/* alpha.ref_value is passed in jit_context */
|
||||
|
||||
key->flatshade = lp->rasterizer->flatshade;
|
||||
|
||||
if (lp->framebuffer.nr_cbufs) {
|
||||
memcpy(&key->blend, lp->blend, sizeof key->blend);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue