mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
softpipe: enable new blend functionality
works with tests/drawbuffers2
This commit is contained in:
parent
5fae36147e
commit
df4395198c
2 changed files with 21 additions and 18 deletions
|
|
@ -224,7 +224,8 @@ logicop_quad(struct quad_stage *qs,
|
|||
static void
|
||||
blend_quad(struct quad_stage *qs,
|
||||
float (*quadColor)[4],
|
||||
float (*dest)[4])
|
||||
float (*dest)[4],
|
||||
unsigned cbuf)
|
||||
{
|
||||
static const float zero[4] = { 0, 0, 0, 0 };
|
||||
static const float one[4] = { 1, 1, 1, 1 };
|
||||
|
|
@ -234,7 +235,7 @@ blend_quad(struct quad_stage *qs,
|
|||
/*
|
||||
* Compute src/first term RGB
|
||||
*/
|
||||
switch (softpipe->blend->rt[0].rgb_src_factor) {
|
||||
switch (softpipe->blend->rt[cbuf].rgb_src_factor) {
|
||||
case PIPE_BLENDFACTOR_ONE:
|
||||
VEC4_COPY(source[0], quadColor[0]); /* R */
|
||||
VEC4_COPY(source[1], quadColor[1]); /* G */
|
||||
|
|
@ -384,7 +385,7 @@ blend_quad(struct quad_stage *qs,
|
|||
/*
|
||||
* Compute src/first term A
|
||||
*/
|
||||
switch (softpipe->blend->rt[0].alpha_src_factor) {
|
||||
switch (softpipe->blend->rt[cbuf].alpha_src_factor) {
|
||||
case PIPE_BLENDFACTOR_ONE:
|
||||
VEC4_COPY(source[3], quadColor[3]); /* A */
|
||||
break;
|
||||
|
|
@ -453,7 +454,7 @@ blend_quad(struct quad_stage *qs,
|
|||
/*
|
||||
* Compute dest/second term RGB
|
||||
*/
|
||||
switch (softpipe->blend->rt[0].rgb_dst_factor) {
|
||||
switch (softpipe->blend->rt[cbuf].rgb_dst_factor) {
|
||||
case PIPE_BLENDFACTOR_ONE:
|
||||
/* dest = dest * 1 NO-OP, leave dest as-is */
|
||||
break;
|
||||
|
|
@ -593,7 +594,7 @@ blend_quad(struct quad_stage *qs,
|
|||
/*
|
||||
* Compute dest/second term A
|
||||
*/
|
||||
switch (softpipe->blend->rt[0].alpha_dst_factor) {
|
||||
switch (softpipe->blend->rt[cbuf].alpha_dst_factor) {
|
||||
case PIPE_BLENDFACTOR_ONE:
|
||||
/* dest = dest * 1 NO-OP, leave dest as-is */
|
||||
break;
|
||||
|
|
@ -656,7 +657,7 @@ blend_quad(struct quad_stage *qs,
|
|||
/*
|
||||
* Combine RGB terms
|
||||
*/
|
||||
switch (softpipe->blend->rt[0].rgb_func) {
|
||||
switch (softpipe->blend->rt[cbuf].rgb_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */
|
||||
VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */
|
||||
|
|
@ -689,7 +690,7 @@ blend_quad(struct quad_stage *qs,
|
|||
/*
|
||||
* Combine A terms
|
||||
*/
|
||||
switch (softpipe->blend->rt[0].alpha_func) {
|
||||
switch (softpipe->blend->rt[cbuf].alpha_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */
|
||||
break;
|
||||
|
|
@ -711,26 +712,24 @@ blend_quad(struct quad_stage *qs,
|
|||
}
|
||||
|
||||
static void
|
||||
colormask_quad(struct quad_stage *qs,
|
||||
colormask_quad(unsigned colormask,
|
||||
float (*quadColor)[4],
|
||||
float (*dest)[4])
|
||||
{
|
||||
struct softpipe_context *softpipe = qs->softpipe;
|
||||
|
||||
/* R */
|
||||
if (!(softpipe->blend->rt[0].colormask & PIPE_MASK_R))
|
||||
if (!(colormask & PIPE_MASK_R))
|
||||
COPY_4V(quadColor[0], dest[0]);
|
||||
|
||||
/* G */
|
||||
if (!(softpipe->blend->rt[0].colormask & PIPE_MASK_G))
|
||||
if (!(colormask & PIPE_MASK_G))
|
||||
COPY_4V(quadColor[1], dest[1]);
|
||||
|
||||
/* B */
|
||||
if (!(softpipe->blend->rt[0].colormask & PIPE_MASK_B))
|
||||
if (!(colormask & PIPE_MASK_B))
|
||||
COPY_4V(quadColor[2], dest[2]);
|
||||
|
||||
/* A */
|
||||
if (!(softpipe->blend->rt[0].colormask & PIPE_MASK_A))
|
||||
if (!(colormask & PIPE_MASK_A))
|
||||
COPY_4V(quadColor[3], dest[3]);
|
||||
}
|
||||
|
||||
|
|
@ -773,12 +772,12 @@ blend_fallback(struct quad_stage *qs,
|
|||
if (blend->logicop_enable) {
|
||||
logicop_quad( qs, quadColor, dest );
|
||||
}
|
||||
else if (blend->rt[0].blend_enable) {
|
||||
blend_quad( qs, quadColor, dest );
|
||||
else if (blend->rt[cbuf].blend_enable) {
|
||||
blend_quad( qs, quadColor, dest, cbuf );
|
||||
}
|
||||
|
||||
if (blend->rt[0].colormask != 0xf)
|
||||
colormask_quad( qs, quadColor, dest );
|
||||
if (blend->rt[cbuf].colormask != 0xf)
|
||||
colormask_quad( blend->rt[cbuf].colormask, quadColor, dest);
|
||||
|
||||
/* Output color values
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -91,6 +91,10 @@ softpipe_get_param(struct pipe_screen *screen, int param)
|
|||
return 1;
|
||||
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
|
||||
return 1;
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
return 1;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue