}
}
+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
/* 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);
{
printf("Usage: etnaviv_compiler [OPTIONS]... FILE\n");
printf(" --verbose - verbose compiler/debug messages\n");
+ printf(" --frag-rb-swap - swap rb in color output (FRAG)\n");
printf(" --help - show this message\n");
}
continue;
}
+ if (!strcmp(argv[n], "--frag-rb-swap")) {
+ debug_printf(" %s", argv[n]);
+ key.frag_rb_swap = true;
+ n++;
+ continue;
+ }
+
if (!strcmp(argv[n], "--help")) {
print_usage();
return 0;
}
struct etna_shader_key key = {};
+ struct etna_surface *cbuf = etna_surface(pfb->cbufs[0]);
+
+ if (cbuf) {
+ struct etna_resource *res = etna_resource(cbuf->base.texture);
+
+ key.frag_rb_swap = !!translate_rs_format_rb_swap(res->base.format);
+ }
if (!etna_get_vs(ctx, key) || !etna_get_fs(ctx, key)) {
BUG("compiled shaders are not okay");