diff options
author | Marek Olšák <[email protected]> | 2015-10-04 00:33:11 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2015-10-09 22:02:18 +0200 |
commit | c04e91a0e9abb424cb68c7e310ca9e5adf7f7be8 (patch) | |
tree | a683abd79600d5f2eb8b1d32a9ce93d216c668f4 /src/mesa | |
parent | 941721ee2a90811b225db3241e280ea4ab27ea40 (diff) |
st/mesa: use TGSI utility to emulate features for FS variants
Reviewed-by: Dave Airlie <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Tested-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 6ace35295a2..bf6b492e80b 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -620,8 +620,7 @@ st_translate_fragment_program(struct st_context *st, interpLocation[slot] = TGSI_INTERPOLATE_LOC_CENTER; if (stfp->Base.Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID | - SYSTEM_BIT_SAMPLE_POS) || - key->persample_shading) + SYSTEM_BIT_SAMPLE_POS)) interpLocation[slot] = TGSI_INTERPOLATE_LOC_SAMPLE; switch (attr) { @@ -861,7 +860,7 @@ st_translate_fragment_program(struct st_context *st, NULL, fs_output_semantic_name, fs_output_semantic_index, FALSE, - key->clamp_color ); + false); else st_translate_mesa_program(st->ctx, TGSI_PROCESSOR_FRAGMENT, @@ -878,10 +877,26 @@ st_translate_fragment_program(struct st_context *st, outputMapping, fs_output_semantic_name, fs_output_semantic_index, FALSE, - key->clamp_color); + false); - variant->tgsi.tokens = ureg_get_tokens( ureg, NULL ); - ureg_destroy( ureg ); + variant->tgsi.tokens = ureg_get_tokens(ureg, NULL); + ureg_destroy(ureg); + + /* Emulate features. */ + if (key->clamp_color || key->persample_shading) { + const struct tgsi_token *tokens; + unsigned flags = + (key->clamp_color ? TGSI_EMU_CLAMP_COLOR_OUTPUTS : 0) | + (key->persample_shading ? TGSI_EMU_FORCE_PERSAMPLE_INTERP : 0); + + tokens = tgsi_emulate(variant->tgsi.tokens, flags); + + if (tokens) { + tgsi_free_tokens(variant->tgsi.tokens); + variant->tgsi.tokens = tokens; + } else + fprintf(stderr, "mesa: cannot emulate deprecated features\n"); + } if (ST_DEBUG & DEBUG_TGSI) { tgsi_dump(variant->tgsi.tokens, 0/*TGSI_DUMP_VERBOSE*/); |