summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_compiler.c
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2017-03-21 20:00:31 +0100
committerChristian Gmeiner <[email protected]>2017-04-05 19:58:22 +0200
commit7f62ffb68ad1002b6ce7727ce7202de792d53653 (patch)
treef7d70f5199ca3dfcf73974b12a2925918cc6b9fe /src/gallium/drivers/etnaviv/etnaviv_compiler.c
parent8d9a31ef9726192ff8e97f36bc05bb15c037ed27 (diff)
etnaviv: add support for rb swap
If we render to rb swapped format we will create a shader variant doing the involved swizzing in the pixel shader. Signed-off-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_compiler.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_compiler.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
index ce8a651982a..eafb511bb81 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c
@@ -1910,6 +1910,22 @@ etna_compile_add_z_div_if_needed(struct etna_compile *c)
}
}
+static void
+etna_compile_frag_rb_swap(struct etna_compile *c)
+{
+ if (c->info.processor == PIPE_SHADER_FRAGMENT && c->key->frag_rb_swap) {
+ /* find color out */
+ struct etna_reg_desc *color_reg =
+ find_decl_by_semantic(c, TGSI_FILE_OUTPUT, TGSI_SEMANTIC_COLOR, 0);
+
+ emit_inst(c, &(struct etna_inst) {
+ .opcode = INST_OPCODE_MOV,
+ .dst = etna_native_to_dst(color_reg->native, INST_COMPS_X | INST_COMPS_Y | INST_COMPS_Z | INST_COMPS_W),
+ .src[2] = etna_native_to_src(color_reg->native, SWIZZLE(Z, Y, X, W)),
+ });
+ }
+}
+
/** add a NOP to the shader if
* a) the shader is empty
* or
@@ -2412,6 +2428,7 @@ etna_compile_shader(struct etna_shader_variant *v)
/* pass 3: generate instructions */
etna_compile_pass_generate_code(c);
etna_compile_add_z_div_if_needed(c);
+ etna_compile_frag_rb_swap(c);
etna_compile_add_nop_if_needed(c);
etna_compile_fill_in_labels(c);