mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 17:20:10 +01:00
pan/bi: Schedule around blend shader register clobbering
By software ABI, a blend shader is permitted to clobber registers R0-R15. The scheduler needs to be aware of this, to avoid moving a write to one of these registers past the BLEND itself. Otherwise the schedule is invalid. This bug affects GLES3.0, but is rare enough in practice that we had missed it. It requires a fragment shader to write to multiple render targets with attached blend shaders, and have temporaries register allocated to R0-R15 that are not read by the blend shader, but are sunk past the BLEND instruction by the scheduler. Prevents a regression when switching boolean representations on: dEQP-GLES31.functional.shaders.builtin_functions.integer.uaddcarry.uvec4_lowp_fragment Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14577>
This commit is contained in:
parent
77a1514a37
commit
b8d37eb1bb
1 changed files with 16 additions and 4 deletions
|
|
@ -197,7 +197,7 @@ bi_is_sched_barrier(bi_instr *I)
|
|||
}
|
||||
|
||||
static void
|
||||
bi_create_dependency_graph(struct bi_worklist st, bool inorder)
|
||||
bi_create_dependency_graph(struct bi_worklist st, bool inorder, bool is_blend)
|
||||
{
|
||||
struct util_dynarray last_read[64], last_write[64];
|
||||
|
||||
|
|
@ -262,6 +262,17 @@ bi_create_dependency_graph(struct bi_worklist st, bool inorder)
|
|||
}
|
||||
}
|
||||
|
||||
/* Blend shaders are allowed to clobber R0-R15. Treat these
|
||||
* registers like extra destinations for scheduling purposes.
|
||||
*/
|
||||
if (ins->op == BI_OPCODE_BLEND && !is_blend) {
|
||||
for (unsigned c = 0; c < 16; ++c) {
|
||||
add_dependency(last_read, c, i, st.dependents, st.dep_counts);
|
||||
add_dependency(last_write, c, i, st.dependents, st.dep_counts);
|
||||
mark_access(last_write, c, i);
|
||||
}
|
||||
}
|
||||
|
||||
bi_foreach_src(ins, s) {
|
||||
if (ins->src[s].type != BI_INDEX_REGISTER) continue;
|
||||
|
||||
|
|
@ -414,7 +425,7 @@ bi_flatten_block(bi_block *block, unsigned *len)
|
|||
*/
|
||||
|
||||
static struct bi_worklist
|
||||
bi_initialize_worklist(bi_block *block, bool inorder)
|
||||
bi_initialize_worklist(bi_block *block, bool inorder, bool is_blend)
|
||||
{
|
||||
struct bi_worklist st = { };
|
||||
st.instructions = bi_flatten_block(block, &st.count);
|
||||
|
|
@ -425,7 +436,7 @@ bi_initialize_worklist(bi_block *block, bool inorder)
|
|||
st.dependents = calloc(st.count, sizeof(st.dependents[0]));
|
||||
st.dep_counts = calloc(st.count, sizeof(st.dep_counts[0]));
|
||||
|
||||
bi_create_dependency_graph(st, inorder);
|
||||
bi_create_dependency_graph(st, inorder, is_blend);
|
||||
st.worklist = calloc(BITSET_WORDS(st.count), sizeof(BITSET_WORD));
|
||||
|
||||
for (unsigned i = 0; i < st.count; ++i) {
|
||||
|
|
@ -1801,7 +1812,8 @@ bi_schedule_block(bi_context *ctx, bi_block *block)
|
|||
|
||||
/* Copy list to dynamic array */
|
||||
struct bi_worklist st = bi_initialize_worklist(block,
|
||||
bifrost_debug & BIFROST_DBG_INORDER);
|
||||
bifrost_debug & BIFROST_DBG_INORDER,
|
||||
ctx->inputs->is_blend);
|
||||
|
||||
if (!st.count) {
|
||||
bi_free_worklist(st);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue