if (last_key->half_precision != key->half_precision)
ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
- if (last_key->alpha != key->alpha)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
-
fd3_ctx->last_key = *key;
}
}
/* do binning pass first: */
.binning_pass = true,
.color_two_side = ctx->rasterizer ? ctx->rasterizer->light_twoside : false,
- .alpha = util_format_is_alpha(pipe_surface_format(pfb->cbufs[0])),
// TODO set .half_precision based on render target format,
// ie. float16 and smaller use half, float32 use full..
.half_precision = !!(fd_mesa_debug & FD_DBG_FRAGHALF),
color_regid = ir3_find_output_regid(fp,
ir3_semantic_name(TGSI_SEMANTIC_COLOR, 0));
+ if (util_format_is_alpha(emit->format))
+ color_regid += 3;
+
/* we could probably divide this up into things that need to be
* emitted if frag-prog is dirty vs if vert-prog is dirty..
*/
if (last_key->half_precision != key->half_precision)
ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
- if (last_key->alpha != key->alpha)
- ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
-
if (last_key->rasterflat != key->rasterflat)
ctx->prog.dirty |= FD_SHADER_DIRTY_FP;
/* do binning pass first: */
.binning_pass = true,
.color_two_side = ctx->rasterizer ? ctx->rasterizer->light_twoside : false,
- .alpha = util_format_is_alpha(pipe_surface_format(pfb->cbufs[0])),
.rasterflat = ctx->rasterizer && ctx->rasterizer->flatshade,
// TODO set .half_precision based on render target format,
// ie. float16 and smaller use half, float32 use full..
.fsaturate_r = fd4_ctx->fsaturate_r,
},
.format = fd4_emit_format(pfb->cbufs[0]),
+ .pformat = pipe_surface_format(pfb->cbufs[0]),
};
unsigned dirty;
const struct pipe_draw_info *info;
struct ir3_shader_key key;
enum a4xx_color_fmt format;
+ enum pipe_format pformat;
uint32_t dirty;
/* cached to avoid repeated lookups of same variants: */
color_regid = ir3_find_output_regid(s[FS].v,
ir3_semantic_name(TGSI_SEMANTIC_COLOR, 0));
+ if (util_format_is_alpha(emit->pformat))
+ color_regid += 3;
+
/* TODO get these dynamically: */
face_regid = s[FS].v->frag_face ? regid(0,0) : regid(63,0);
coord_regid = s[FS].v->frag_coord ? regid(0,0) : regid(63,0);
printf(" --binning-pass - generate binning pass shader (VERT)\n");
printf(" --color-two-side - emulate two-sided color (FRAG)\n");
printf(" --half-precision - use half-precision\n");
- printf(" --alpha - generate render-to-alpha shader (FRAG)\n");
printf(" --saturate-s MASK - bitmask of samplers to saturate S coord\n");
printf(" --saturate-t MASK - bitmask of samplers to saturate T coord\n");
printf(" --saturate-r MASK - bitmask of samplers to saturate R coord\n");
continue;
}
- if (!strcmp(argv[n], "--alpha")) {
- debug_printf(" %s", argv[n]);
- key.alpha = true;
- n++;
- continue;
- }
-
if (!strcmp(argv[n], "--saturate-s")) {
debug_printf(" %s %s", argv[n], argv[n+1]);
key.vsaturate_s = key.fsaturate_s = strtol(argv[n+1], NULL, 0);
block->noutputs = j * 4;
}
- /* for rendering to alpha format, we only need the .w component,
- * and we need it to be in the .x position:
- */
- if (key.alpha) {
- for (i = 0, j = 0; i < so->outputs_count; i++) {
- unsigned name = sem2name(so->outputs[i].semantic);
-
- /* move .w component to .x and discard others: */
- if (name == TGSI_SEMANTIC_COLOR) {
- block->outputs[(i*4)+0] = block->outputs[(i*4)+3];
- block->outputs[(i*4)+1] = NULL;
- block->outputs[(i*4)+2] = NULL;
- block->outputs[(i*4)+3] = NULL;
- }
- }
- }
-
/* if we want half-precision outputs, mark the output registers
* as half:
*/
case SHADER_VERTEX:
key.color_two_side = false;
key.half_precision = false;
- key.alpha = false;
key.rasterflat = false;
if (key.has_per_samp) {
key.fsaturate_s = 0;
*/
unsigned color_two_side : 1;
unsigned half_precision : 1;
- /* For rendering to alpha, we need a bit of special handling
- * since the hw always takes gl_FragColor starting from x
- * component, rather than figuring out to take the w component.
- * We could be more clever and generate variants for other
- * render target formats (ie. luminance formats are xxx1), but
- * let's start with this and see how it goes:
- */
- unsigned alpha : 1;
/* used when shader needs to handle flat varyings (a4xx),
* for TGSI_INTERPOLATE_COLOR:
*/