mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 01:00:10 +01:00
etnaviv: Extend frag_rb_swap for MRTs
We need to handle rb_swap for every color buffer. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26565>
This commit is contained in:
parent
594f38bde6
commit
4e83236ced
3 changed files with 24 additions and 6 deletions
|
|
@ -302,8 +302,10 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
|
|||
.sprite_coord_yinvert = !!ctx->rasterizer->sprite_coord_mode,
|
||||
};
|
||||
|
||||
if (pfb->cbufs[0])
|
||||
key.frag_rb_swap = !!translate_pe_format_rb_swap(pfb->cbufs[0]->format);
|
||||
for (i = 0; i < pfb->nr_cbufs; i++) {
|
||||
if (pfb->cbufs[i])
|
||||
key.frag_rb_swap |= !!translate_pe_format_rb_swap(pfb->cbufs[i]->format) << i;
|
||||
}
|
||||
|
||||
if (!etna_get_vs(ctx, &key) || !etna_get_fs(ctx, &key)) {
|
||||
BUG("compiled shaders are not okay");
|
||||
|
|
|
|||
|
|
@ -26,6 +26,18 @@
|
|||
|
||||
#include "etnaviv_nir.h"
|
||||
|
||||
static inline int
|
||||
color_index_for_location(unsigned location)
|
||||
{
|
||||
assert(location != FRAG_RESULT_COLOR &&
|
||||
"gl_FragColor must be lowered before nir_lower_blend");
|
||||
|
||||
if (location < FRAG_RESULT_DATA0)
|
||||
return -1;
|
||||
else
|
||||
return location - FRAG_RESULT_DATA0;
|
||||
}
|
||||
|
||||
/* io related lowering
|
||||
* run after lower_int_to_float because it adds i2f/f2i ops
|
||||
*/
|
||||
|
|
@ -64,8 +76,12 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
|
|||
|
||||
assert(deref->deref_type == nir_deref_type_var);
|
||||
|
||||
if (deref->var->data.location != FRAG_RESULT_DATA0)
|
||||
break;
|
||||
int rt = color_index_for_location(deref->var->data.location);
|
||||
if (rt == -1)
|
||||
break;
|
||||
|
||||
if (!(v->key.frag_rb_swap & (1 << rt)))
|
||||
break;
|
||||
|
||||
b.cursor = nir_before_instr(instr);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ struct etna_shader_key
|
|||
* Combined Vertex/Fragment shader parameters:
|
||||
*/
|
||||
|
||||
/* do we need to swap rb in frag color? */
|
||||
unsigned frag_rb_swap : 1;
|
||||
/* do we need to swap rb in frag colors? */
|
||||
unsigned frag_rb_swap : PIPE_MAX_COLOR_BUFS;
|
||||
/* do we need to invert front facing value? */
|
||||
unsigned front_ccw : 1;
|
||||
/* do we need to replace glTexCoord.xy ? */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue