Merge commit 'origin/perrtblend'
Conflicts: src/gallium/drivers/softpipe/sp_screen.c src/gallium/include/pipe/p_defines.h
This commit is contained in:
@@ -310,18 +310,21 @@ void cso_destroy_context( struct cso_context *ctx )
|
||||
enum pipe_error cso_set_blend(struct cso_context *ctx,
|
||||
const struct pipe_blend_state *templ)
|
||||
{
|
||||
unsigned hash_key = cso_construct_key((void*)templ, sizeof(struct pipe_blend_state));
|
||||
struct cso_hash_iter iter = cso_find_state_template(ctx->cache,
|
||||
hash_key, CSO_BLEND,
|
||||
(void*)templ);
|
||||
unsigned key_size, hash_key;
|
||||
struct cso_hash_iter iter;
|
||||
void *handle;
|
||||
|
||||
key_size = templ->independent_blend_enable ? sizeof(struct pipe_blend_state) :
|
||||
(char *)&(templ->rt[1]) - (char *)templ;
|
||||
hash_key = cso_construct_key((void*)templ, key_size);
|
||||
iter = cso_find_state_template(ctx->cache, hash_key, CSO_BLEND, (void*)templ);
|
||||
|
||||
if (cso_hash_iter_is_null(iter)) {
|
||||
struct cso_blend *cso = MALLOC(sizeof(struct cso_blend));
|
||||
if (!cso)
|
||||
return PIPE_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
memcpy(&cso->state, templ, sizeof(*templ));
|
||||
memcpy(&cso->state, templ, key_size);
|
||||
cso->data = ctx->pipe->create_blend_state(ctx->pipe, &cso->state);
|
||||
cso->delete_state = (cso_state_callback)ctx->pipe->delete_blend_state;
|
||||
cso->context = ctx->pipe;
|
||||
|
||||
@@ -92,7 +92,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
|
||||
|
||||
/* disabled blending/masking */
|
||||
memset(&ctx->blend, 0, sizeof(ctx->blend));
|
||||
ctx->blend.colormask = PIPE_MASK_RGBA;
|
||||
ctx->blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
|
||||
/* no-op depth/stencil/alpha */
|
||||
memset(&ctx->depthstencil, 0, sizeof(ctx->depthstencil));
|
||||
|
||||
@@ -125,7 +125,7 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
|
||||
memset(&blend, 0, sizeof(blend));
|
||||
ctx->blend_keep_color = pipe->create_blend_state(pipe, &blend);
|
||||
|
||||
blend.colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
ctx->blend_write_color = pipe->create_blend_state(pipe, &blend);
|
||||
|
||||
/* depth stencil alpha state objects */
|
||||
|
||||
@@ -1287,7 +1287,7 @@ util_create_gen_mipmap(struct pipe_context *pipe,
|
||||
|
||||
/* disabled blending/masking */
|
||||
memset(&ctx->blend, 0, sizeof(ctx->blend));
|
||||
ctx->blend.colormask = PIPE_MASK_RGBA;
|
||||
ctx->blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
|
||||
/* no-op depth/stencil/alpha */
|
||||
memset(&ctx->depthstencil, 0, sizeof(ctx->depthstencil));
|
||||
|
||||
@@ -6,9 +6,42 @@ Blend
|
||||
This state controls blending of the final fragments into the target rendering
|
||||
buffers.
|
||||
|
||||
XXX it is unresolved what behavior should result if blend_enable is off.
|
||||
|
||||
Members
|
||||
-------
|
||||
|
||||
XXX undocumented members
|
||||
independent_blend_enable
|
||||
If enabled, blend state is different for each render target, and
|
||||
for each render target set in the respective member of the rt array.
|
||||
If disabled, blend state is the same for all render targets, and only
|
||||
the first member of the rt array contains valid data.
|
||||
logicop_enable
|
||||
Enables logic ops. Cannot be enabled at the same time as blending, and
|
||||
is always the same for all render targets.
|
||||
logicop_func
|
||||
The logic operation to use if logic ops are enabled. One of PIPE_LOGICOP.
|
||||
dither
|
||||
Whether dithering is enabled.
|
||||
rt
|
||||
Contains the per rendertarget blend state.
|
||||
|
||||
per rendertarget members
|
||||
------------------------
|
||||
|
||||
blend_enable
|
||||
If blending is enabled, perform a blend calculation according to blend
|
||||
functions and source/destination factors. Otherwise, the incoming fragment
|
||||
color gets passed unmodified (but colormask still applies).
|
||||
rgb_func
|
||||
The blend function to use for rgb channels. One of PIPE_BLEND.
|
||||
rgb_src_factor
|
||||
The blend source factor to use for rgb channels. One of PIPE_BLENDFACTOR.
|
||||
rgb_dst_factor
|
||||
The blend destination factor to use for rgb channels. One of PIPE_BLENDFACTOR.
|
||||
alpha_func
|
||||
The blend function to use for the alpha channel. One of PIPE_BLEND.
|
||||
alpha_src_factor
|
||||
The blend source factor to use for the alpha channel. One of PIPE_BLENDFACTOR.
|
||||
alpha_dst_factor
|
||||
The blend destination factor to use for alpha channel. One of PIPE_BLENDFACTOR.
|
||||
colormask
|
||||
Bitmask of which channels to write. Combination of PIPE_MASK bits.
|
||||
|
||||
@@ -12,8 +12,6 @@ with the traditional (S, T, R, Q) notation.
|
||||
Members
|
||||
-------
|
||||
|
||||
XXX undocumented compare_mode, compare_func
|
||||
|
||||
wrap_s
|
||||
How to wrap the S coordinate. One of PIPE_TEX_WRAP.
|
||||
wrap_t
|
||||
@@ -27,12 +25,18 @@ min_mip_filter
|
||||
PIPE_TEX_FILTER.
|
||||
mag_img_filter
|
||||
The filter to use when magnifying texels. One of PIPE_TEX_FILTER.
|
||||
compare_mode
|
||||
If set to PIPE_TEX_COMPARE_R_TO_TEXTURE, texture output is computed
|
||||
according to compare_func, using r coord and the texture value as operands.
|
||||
If set to PIPE_TEX_COMPARE_NONE, no comparison calculation is performed.
|
||||
compare_func
|
||||
How the comparison is computed. One of PIPE_FUNC.
|
||||
normalized_coords
|
||||
Whether the texture coordinates are normalized. If normalized, they will
|
||||
always be in [0, 1]. If not, they will be in the range of each dimension
|
||||
of the loaded texture.
|
||||
prefilter
|
||||
XXX From the Doxy, "weird sampling state exposed by some APIs." Refine.
|
||||
Cylindrical texcoord wrap enable per coord. Not exposed by most APIs.
|
||||
lod_bias
|
||||
The bias to apply to the level of detail.
|
||||
min_lod
|
||||
|
||||
@@ -408,7 +408,7 @@ gen_blend(const struct pipe_blend_state *blend,
|
||||
int one_reg = -1;
|
||||
int constR_reg = -1, constG_reg = -1, constB_reg = -1, constA_reg = -1;
|
||||
|
||||
ASSERT(blend->blend_enable);
|
||||
ASSERT(blend->rt[0].blend_enable);
|
||||
|
||||
/* packed RGBA -> float colors */
|
||||
unpack_colors(f, color_format, fbRGBA_reg,
|
||||
@@ -420,7 +420,7 @@ gen_blend(const struct pipe_blend_state *blend,
|
||||
* because in some cases (like PIPE_BLENDFACTOR_ONE and
|
||||
* PIPE_BLENDFACTOR_ZERO) we can avoid doing unnecessary math.
|
||||
*/
|
||||
switch (blend->rgb_src_factor) {
|
||||
switch (blend->rt[0].rgb_src_factor) {
|
||||
case PIPE_BLENDFACTOR_ONE:
|
||||
/* factors = (1,1,1), so term = (R,G,B) */
|
||||
spe_move(f, term1R_reg, fragR_reg);
|
||||
@@ -574,7 +574,7 @@ gen_blend(const struct pipe_blend_state *blend,
|
||||
* the full term A*factor, not just the factor itself, because
|
||||
* in many cases we can avoid doing unnecessary multiplies.
|
||||
*/
|
||||
switch (blend->alpha_src_factor) {
|
||||
switch (blend->rt[0].alpha_src_factor) {
|
||||
case PIPE_BLENDFACTOR_ZERO:
|
||||
/* factor = 0, so term = 0 */
|
||||
spe_load_float(f, term1A_reg, 0.0f);
|
||||
@@ -648,7 +648,7 @@ gen_blend(const struct pipe_blend_state *blend,
|
||||
* the full term (Rfb,Gfb,Bfb)*(factor), not just the factor itself, because
|
||||
* in many cases we can avoid doing unnecessary multiplies.
|
||||
*/
|
||||
switch (blend->rgb_dst_factor) {
|
||||
switch (blend->rt[0].rgb_dst_factor) {
|
||||
case PIPE_BLENDFACTOR_ONE:
|
||||
/* factors = (1,1,1), so term = (Rfb,Gfb,Bfb) */
|
||||
spe_move(f, term2R_reg, fbR_reg);
|
||||
@@ -786,7 +786,7 @@ gen_blend(const struct pipe_blend_state *blend,
|
||||
* the full term Afb*factor, not just the factor itself, because
|
||||
* in many cases we can avoid doing unnecessary multiplies.
|
||||
*/
|
||||
switch (blend->alpha_dst_factor) {
|
||||
switch (blend->rt[0].alpha_dst_factor) {
|
||||
case PIPE_BLENDFACTOR_ONE:
|
||||
/* factor = 1, so term = Afb */
|
||||
spe_move(f, term2A_reg, fbA_reg);
|
||||
@@ -858,7 +858,7 @@ gen_blend(const struct pipe_blend_state *blend,
|
||||
/*
|
||||
* Combine Src/Dest RGB terms as per the blend equation.
|
||||
*/
|
||||
switch (blend->rgb_func) {
|
||||
switch (blend->rt[0].rgb_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
spe_fa(f, fragR_reg, term1R_reg, term2R_reg);
|
||||
spe_fa(f, fragG_reg, term1G_reg, term2G_reg);
|
||||
@@ -891,7 +891,7 @@ gen_blend(const struct pipe_blend_state *blend,
|
||||
/*
|
||||
* Combine Src/Dest A term
|
||||
*/
|
||||
switch (blend->alpha_func) {
|
||||
switch (blend->rt[0].alpha_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
spe_fa(f, fragA_reg, term1A_reg, term2A_reg);
|
||||
break;
|
||||
@@ -2118,7 +2118,7 @@ cell_gen_fragment_function(struct cell_context *cell,
|
||||
spe_comment(f, 0, "Fetch quad colors from tile");
|
||||
spe_lqx(f, fbRGBA_reg, color_tile_reg, quad_offset_reg);
|
||||
|
||||
if (blend->blend_enable) {
|
||||
if (blend->rt[0].blend_enable) {
|
||||
spe_comment(f, 0, "Perform blending");
|
||||
gen_blend(blend, blend_color, f, color_format,
|
||||
fragR_reg, fragG_reg, fragB_reg, fragA_reg, fbRGBA_reg);
|
||||
@@ -2143,9 +2143,9 @@ cell_gen_fragment_function(struct cell_context *cell,
|
||||
gen_logicop(blend, f, rgba_reg, fbRGBA_reg);
|
||||
}
|
||||
|
||||
if (blend->colormask != PIPE_MASK_RGBA) {
|
||||
if (blend->rt[0].colormask != PIPE_MASK_RGBA) {
|
||||
spe_comment(f, 0, "Compute color mask");
|
||||
gen_colormask(f, blend->colormask, color_format, rgba_reg, fbRGBA_reg);
|
||||
gen_colormask(f, blend->rt[0].colormask, color_format, rgba_reg, fbRGBA_reg);
|
||||
}
|
||||
|
||||
/* Mix fragment colors with framebuffer colors using the quad/pixel mask:
|
||||
|
||||
@@ -999,23 +999,23 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
|
||||
/* Does the selected blend mode make use of the source / destination
|
||||
* color (RGB) blend factors?
|
||||
*/
|
||||
boolean need_color_factor = b->blend_enable
|
||||
&& (b->rgb_func != PIPE_BLEND_MIN)
|
||||
&& (b->rgb_func != PIPE_BLEND_MAX);
|
||||
boolean need_color_factor = b->rt[0].blend_enable
|
||||
&& (b->rt[0].rgb_func != PIPE_BLEND_MIN)
|
||||
&& (b->rt[0].rgb_func != PIPE_BLEND_MAX);
|
||||
|
||||
/* Does the selected blend mode make use of the source / destination
|
||||
* alpha blend factors?
|
||||
*/
|
||||
boolean need_alpha_factor = b->blend_enable
|
||||
&& (b->alpha_func != PIPE_BLEND_MIN)
|
||||
&& (b->alpha_func != PIPE_BLEND_MAX);
|
||||
boolean need_alpha_factor = b->rt[0].blend_enable
|
||||
&& (b->rt[0].alpha_func != PIPE_BLEND_MIN)
|
||||
&& (b->rt[0].alpha_func != PIPE_BLEND_MAX);
|
||||
|
||||
|
||||
if (b->blend_enable) {
|
||||
sF[0] = b->rgb_src_factor;
|
||||
if (b->rt[0].blend_enable) {
|
||||
sF[0] = b->rt[0].rgb_src_factor;
|
||||
sF[1] = sF[0];
|
||||
sF[2] = sF[0];
|
||||
switch (b->alpha_src_factor & 0x0f) {
|
||||
switch (b->rt[0].alpha_src_factor & 0x0f) {
|
||||
case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
|
||||
sF[3] = PIPE_BLENDFACTOR_ONE;
|
||||
break;
|
||||
@@ -1023,30 +1023,30 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
|
||||
case PIPE_BLENDFACTOR_DST_COLOR:
|
||||
case PIPE_BLENDFACTOR_CONST_COLOR:
|
||||
case PIPE_BLENDFACTOR_SRC1_COLOR:
|
||||
sF[3] = b->alpha_src_factor + 1;
|
||||
sF[3] = b->rt[0].alpha_src_factor + 1;
|
||||
break;
|
||||
default:
|
||||
sF[3] = b->alpha_src_factor;
|
||||
sF[3] = b->rt[0].alpha_src_factor;
|
||||
}
|
||||
|
||||
dF[0] = b->rgb_dst_factor;
|
||||
dF[0] = b->rt[0].rgb_dst_factor;
|
||||
dF[1] = dF[0];
|
||||
dF[2] = dF[0];
|
||||
switch (b->alpha_dst_factor & 0x0f) {
|
||||
switch (b->rt[0].alpha_dst_factor & 0x0f) {
|
||||
case PIPE_BLENDFACTOR_SRC_COLOR:
|
||||
case PIPE_BLENDFACTOR_DST_COLOR:
|
||||
case PIPE_BLENDFACTOR_CONST_COLOR:
|
||||
case PIPE_BLENDFACTOR_SRC1_COLOR:
|
||||
dF[3] = b->alpha_dst_factor + 1;
|
||||
dF[3] = b->rt[0].alpha_dst_factor + 1;
|
||||
break;
|
||||
default:
|
||||
dF[3] = b->alpha_dst_factor;
|
||||
dF[3] = b->rt[0].alpha_dst_factor;
|
||||
}
|
||||
|
||||
func[0] = b->rgb_func;
|
||||
func[0] = b->rt[0].rgb_func;
|
||||
func[1] = func[0];
|
||||
func[2] = func[0];
|
||||
func[3] = b->alpha_func;
|
||||
func[3] = b->rt[0].alpha_func;
|
||||
} else {
|
||||
sF[0] = PIPE_BLENDFACTOR_ONE;
|
||||
sF[1] = PIPE_BLENDFACTOR_ONE;
|
||||
@@ -1067,7 +1067,7 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
|
||||
/* If alpha writing is enabled and the alpha blend mode requires use of
|
||||
* the alpha factor, calculate the alpha factor.
|
||||
*/
|
||||
if (((b->colormask & 8) != 0) && need_alpha_factor) {
|
||||
if (((b->rt[0].colormask & 8) != 0) && need_alpha_factor) {
|
||||
src_factor[3] = emit_alpha_factor_calculation(f, sF[3], const_color[3],
|
||||
frag[3], pixel[3]);
|
||||
|
||||
@@ -1091,8 +1091,8 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
|
||||
src_factor[2] = dst_factor[3];
|
||||
} else if (need_color_factor) {
|
||||
emit_color_factor_calculation(f,
|
||||
b->rgb_src_factor,
|
||||
b->colormask,
|
||||
b->rt[0].rgb_src_factor,
|
||||
b->rt[0].colormask,
|
||||
frag, pixel, const_color, src_factor);
|
||||
}
|
||||
|
||||
@@ -1111,15 +1111,15 @@ cell_generate_alpha_blend(struct cell_blend_state *cb)
|
||||
dst_factor[2] = src_factor[2];
|
||||
} else if (need_color_factor) {
|
||||
emit_color_factor_calculation(f,
|
||||
b->rgb_dst_factor,
|
||||
b->colormask,
|
||||
b->rt[0].rgb_dst_factor,
|
||||
b->rt[0].colormask,
|
||||
frag, pixel, const_color, dst_factor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
if ((b->colormask & (1U << i)) != 0) {
|
||||
if ((b->rt[0].colormask & (1U << i)) != 0) {
|
||||
emit_blend_calculation(f,
|
||||
func[i], sF[i], dF[i],
|
||||
frag[i], src_factor[i],
|
||||
@@ -1216,7 +1216,7 @@ cell_generate_logic_op(struct spe_function *f,
|
||||
|
||||
/* Short-circuit the noop and invert cases.
|
||||
*/
|
||||
if ((logic_op == PIPE_LOGICOP_NOOP) || (blend->colormask == 0)) {
|
||||
if ((logic_op == PIPE_LOGICOP_NOOP) || (blend->rt[0].colormask == 0)) {
|
||||
spe_bi(f, 0, 0, 0);
|
||||
return;
|
||||
} else if (logic_op == PIPE_LOGICOP_INVERT) {
|
||||
|
||||
@@ -103,13 +103,13 @@ i915_create_blend_state(struct pipe_context *pipe,
|
||||
struct i915_blend_state *cso_data = CALLOC_STRUCT( i915_blend_state );
|
||||
|
||||
{
|
||||
unsigned eqRGB = blend->rgb_func;
|
||||
unsigned srcRGB = blend->rgb_src_factor;
|
||||
unsigned dstRGB = blend->rgb_dst_factor;
|
||||
unsigned eqRGB = blend->rt[0].rgb_func;
|
||||
unsigned srcRGB = blend->rt[0].rgb_src_factor;
|
||||
unsigned dstRGB = blend->rt[0].rgb_dst_factor;
|
||||
|
||||
unsigned eqA = blend->alpha_func;
|
||||
unsigned srcA = blend->alpha_src_factor;
|
||||
unsigned dstA = blend->alpha_dst_factor;
|
||||
unsigned eqA = blend->rt[0].alpha_func;
|
||||
unsigned srcA = blend->rt[0].alpha_src_factor;
|
||||
unsigned dstA = blend->rt[0].alpha_dst_factor;
|
||||
|
||||
/* Special handling for MIN/MAX filter modes handled at
|
||||
* state_tracker level.
|
||||
@@ -146,22 +146,22 @@ i915_create_blend_state(struct pipe_context *pipe,
|
||||
if (blend->dither)
|
||||
cso_data->LIS5 |= S5_COLOR_DITHER_ENABLE;
|
||||
|
||||
if ((blend->colormask & PIPE_MASK_R) == 0)
|
||||
if ((blend->rt[0].colormask & PIPE_MASK_R) == 0)
|
||||
cso_data->LIS5 |= S5_WRITEDISABLE_RED;
|
||||
|
||||
if ((blend->colormask & PIPE_MASK_G) == 0)
|
||||
if ((blend->rt[0].colormask & PIPE_MASK_G) == 0)
|
||||
cso_data->LIS5 |= S5_WRITEDISABLE_GREEN;
|
||||
|
||||
if ((blend->colormask & PIPE_MASK_B) == 0)
|
||||
if ((blend->rt[0].colormask & PIPE_MASK_B) == 0)
|
||||
cso_data->LIS5 |= S5_WRITEDISABLE_BLUE;
|
||||
|
||||
if ((blend->colormask & PIPE_MASK_A) == 0)
|
||||
if ((blend->rt[0].colormask & PIPE_MASK_A) == 0)
|
||||
cso_data->LIS5 |= S5_WRITEDISABLE_ALPHA;
|
||||
|
||||
if (blend->blend_enable) {
|
||||
unsigned funcRGB = blend->rgb_func;
|
||||
unsigned srcRGB = blend->rgb_src_factor;
|
||||
unsigned dstRGB = blend->rgb_dst_factor;
|
||||
if (blend->rt[0].blend_enable) {
|
||||
unsigned funcRGB = blend->rt[0].rgb_func;
|
||||
unsigned srcRGB = blend->rt[0].rgb_src_factor;
|
||||
unsigned dstRGB = blend->rt[0].rgb_dst_factor;
|
||||
|
||||
cso_data->LIS6 |= (S6_CBUF_BLEND_ENABLE |
|
||||
SRC_BLND_FACT(i915_translate_blend_factor(srcRGB)) |
|
||||
|
||||
@@ -118,14 +118,14 @@ static void *brw_create_blend_state( struct pipe_context *pipe,
|
||||
blend->cc2.logicop_enable = 1;
|
||||
blend->cc5.logicop_func = translate_logicop(templ->logicop_func);
|
||||
}
|
||||
else if (templ->blend_enable) {
|
||||
blend->cc6.dest_blend_factor = translate_blend_factor(templ->rgb_dst_factor);
|
||||
blend->cc6.src_blend_factor = translate_blend_factor(templ->rgb_src_factor);
|
||||
blend->cc6.blend_function = translate_blend_equation(templ->rgb_func);
|
||||
else if (templ->rt[0].blend_enable) {
|
||||
blend->cc6.dest_blend_factor = translate_blend_factor(templ->rt[0].rgb_dst_factor);
|
||||
blend->cc6.src_blend_factor = translate_blend_factor(templ->rt[0].rgb_src_factor);
|
||||
blend->cc6.blend_function = translate_blend_equation(templ->rt[0].rgb_func);
|
||||
|
||||
blend->cc5.ia_dest_blend_factor = translate_blend_factor(templ->alpha_dst_factor);
|
||||
blend->cc5.ia_src_blend_factor = translate_blend_factor(templ->alpha_src_factor);
|
||||
blend->cc5.ia_blend_function = translate_blend_equation(templ->alpha_func);
|
||||
blend->cc5.ia_dest_blend_factor = translate_blend_factor(templ->rt[0].alpha_dst_factor);
|
||||
blend->cc5.ia_src_blend_factor = translate_blend_factor(templ->rt[0].alpha_src_factor);
|
||||
blend->cc5.ia_blend_function = translate_blend_equation(templ->rt[0].alpha_func);
|
||||
|
||||
blend->cc3.blend_enable = 1;
|
||||
blend->cc3.ia_blend_enable =
|
||||
@@ -146,10 +146,10 @@ static void *brw_create_blend_state( struct pipe_context *pipe,
|
||||
|
||||
/* Per-surface color mask -- just follow global state:
|
||||
*/
|
||||
blend->ss0.writedisable_red = (templ->colormask & PIPE_MASK_R) ? 0 : 1;
|
||||
blend->ss0.writedisable_green = (templ->colormask & PIPE_MASK_G) ? 0 : 1;
|
||||
blend->ss0.writedisable_blue = (templ->colormask & PIPE_MASK_B) ? 0 : 1;
|
||||
blend->ss0.writedisable_alpha = (templ->colormask & PIPE_MASK_A) ? 0 : 1;
|
||||
blend->ss0.writedisable_red = (templ->rt[0].colormask & PIPE_MASK_R) ? 0 : 1;
|
||||
blend->ss0.writedisable_green = (templ->rt[0].colormask & PIPE_MASK_G) ? 0 : 1;
|
||||
blend->ss0.writedisable_blue = (templ->rt[0].colormask & PIPE_MASK_B) ? 0 : 1;
|
||||
blend->ss0.writedisable_alpha = (templ->rt[0].colormask & PIPE_MASK_A) ? 0 : 1;
|
||||
|
||||
return (void *)blend;
|
||||
}
|
||||
|
||||
@@ -314,9 +314,10 @@ lp_build_blend_aos(LLVMBuilderRef builder,
|
||||
LLVMValueRef dst_term;
|
||||
|
||||
/* FIXME */
|
||||
assert(blend->colormask == 0xf);
|
||||
assert(blend->independent_blend_enable == 0);
|
||||
assert(blend->rt[0].colormask == 0xf);
|
||||
|
||||
if(!blend->blend_enable)
|
||||
if(!blend->rt[0].blend_enable)
|
||||
return src;
|
||||
|
||||
/* It makes no sense to blend unless values are normalized */
|
||||
@@ -333,14 +334,16 @@ lp_build_blend_aos(LLVMBuilderRef builder,
|
||||
* combinations it is possible to reorder the operations and therefore saving
|
||||
* some instructions. */
|
||||
|
||||
src_term = lp_build_blend_factor(&bld, src, blend->rgb_src_factor, blend->alpha_src_factor, alpha_swizzle);
|
||||
dst_term = lp_build_blend_factor(&bld, dst, blend->rgb_dst_factor, blend->alpha_dst_factor, alpha_swizzle);
|
||||
src_term = lp_build_blend_factor(&bld, src, blend->rt[0].rgb_src_factor,
|
||||
blend->rt[0].alpha_src_factor, alpha_swizzle);
|
||||
dst_term = lp_build_blend_factor(&bld, dst, blend->rt[0].rgb_dst_factor,
|
||||
blend->rt[0].alpha_dst_factor, alpha_swizzle);
|
||||
|
||||
lp_build_name(src_term, "src_term");
|
||||
lp_build_name(dst_term, "dst_term");
|
||||
|
||||
if(blend->rgb_func == blend->alpha_func) {
|
||||
return lp_build_blend_func(&bld.base, blend->rgb_func, src_term, dst_term);
|
||||
if(blend->rt[0].rgb_func == blend->rt[0].alpha_func) {
|
||||
return lp_build_blend_func(&bld.base, blend->rt[0].rgb_func, src_term, dst_term);
|
||||
}
|
||||
else {
|
||||
/* Seperate RGB / A functions */
|
||||
@@ -348,8 +351,8 @@ lp_build_blend_aos(LLVMBuilderRef builder,
|
||||
LLVMValueRef rgb;
|
||||
LLVMValueRef alpha;
|
||||
|
||||
rgb = lp_build_blend_func(&bld.base, blend->rgb_func, src_term, dst_term);
|
||||
alpha = lp_build_blend_func(&bld.base, blend->alpha_func, src_term, dst_term);
|
||||
rgb = lp_build_blend_func(&bld.base, blend->rt[0].rgb_func, src_term, dst_term);
|
||||
alpha = lp_build_blend_func(&bld.base, blend->rt[0].alpha_func, src_term, dst_term);
|
||||
|
||||
return lp_build_blend_swizzle(&bld, rgb, alpha, LP_BUILD_BLEND_SWIZZLE_RGBA, alpha_swizzle);
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ lp_build_blend_soa(LLVMBuilderRef builder,
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
if (blend->colormask & (1 << i)) {
|
||||
if (blend->rt[0].colormask & (1 << i)) {
|
||||
if (blend->logicop_enable) {
|
||||
if(!type.floating) {
|
||||
res[i] = lp_build_logicop(builder, blend->logicop_func, src[i], dst[i]);
|
||||
@@ -225,10 +225,10 @@ lp_build_blend_soa(LLVMBuilderRef builder,
|
||||
else
|
||||
res[i] = dst[i];
|
||||
}
|
||||
else if (blend->blend_enable) {
|
||||
unsigned src_factor = i < 3 ? blend->rgb_src_factor : blend->alpha_src_factor;
|
||||
unsigned dst_factor = i < 3 ? blend->rgb_dst_factor : blend->alpha_dst_factor;
|
||||
unsigned func = i < 3 ? blend->rgb_func : blend->alpha_func;
|
||||
else if (blend->rt[0].blend_enable) {
|
||||
unsigned src_factor = i < 3 ? blend->rt[0].rgb_src_factor : blend->rt[0].alpha_src_factor;
|
||||
unsigned dst_factor = i < 3 ? blend->rt[0].rgb_dst_factor : blend->rt[0].alpha_dst_factor;
|
||||
unsigned func = i < 3 ? blend->rt[0].rgb_func : blend->rt[0].alpha_func;
|
||||
boolean func_commutative = lp_build_blend_func_commutative(func);
|
||||
|
||||
/* It makes no sense to blend unless values are normalized */
|
||||
@@ -269,7 +269,7 @@ lp_build_blend_soa(LLVMBuilderRef builder,
|
||||
|
||||
/* See if this function has been previously applied */
|
||||
for(j = 0; j < i; ++j) {
|
||||
unsigned prev_func = j < 3 ? blend->rgb_func : blend->alpha_func;
|
||||
unsigned prev_func = j < 3 ? blend->rt[0].rgb_func : blend->rt[0].alpha_func;
|
||||
unsigned func_reverse = lp_build_blend_func_reverse(func, prev_func);
|
||||
|
||||
if((!func_reverse &&
|
||||
|
||||
@@ -110,6 +110,10 @@ llvmpipe_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 0;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 0;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ generate_blend(const struct pipe_blend_state *blend,
|
||||
lp_build_blend_soa(builder, blend, type, src, dst, con, res);
|
||||
|
||||
for(chan = 0; chan < 4; ++chan) {
|
||||
if(blend->colormask & (1 << chan)) {
|
||||
if(blend->rt[0].colormask & (1 << chan)) {
|
||||
LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), chan, 0);
|
||||
lp_build_name(res[chan], "res.%c", "rgba"[chan]);
|
||||
res[chan] = lp_build_select(&bld, mask, res[chan], dst[chan]);
|
||||
@@ -421,15 +421,15 @@ generate_fragment(struct llvmpipe_context *lp,
|
||||
if(key->blend.logicop_enable) {
|
||||
debug_printf("blend.logicop_func = %u\n", key->blend.logicop_func);
|
||||
}
|
||||
else if(key->blend.blend_enable) {
|
||||
debug_printf("blend.rgb_func = %s\n", debug_dump_blend_func (key->blend.rgb_func, TRUE));
|
||||
debug_printf("rgb_src_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_src_factor, TRUE));
|
||||
debug_printf("rgb_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rgb_dst_factor, TRUE));
|
||||
debug_printf("alpha_func = %s\n", debug_dump_blend_func (key->blend.alpha_func, TRUE));
|
||||
debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_src_factor, TRUE));
|
||||
debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_dst_factor, TRUE));
|
||||
else if(key->blend.rt[0].blend_enable) {
|
||||
debug_printf("blend.rgb_func = %s\n", debug_dump_blend_func (key->blend.rt[0].rgb_func, TRUE));
|
||||
debug_printf("rgb_src_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].rgb_src_factor, TRUE));
|
||||
debug_printf("rgb_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].rgb_dst_factor, TRUE));
|
||||
debug_printf("alpha_func = %s\n", debug_dump_blend_func (key->blend.rt[0].alpha_func, TRUE));
|
||||
debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].alpha_src_factor, TRUE));
|
||||
debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].alpha_dst_factor, TRUE));
|
||||
}
|
||||
debug_printf("blend.colormask = 0x%x\n", key->blend.colormask);
|
||||
debug_printf("blend.colormask = 0x%x\n", key->blend.rt[0].colormask);
|
||||
for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) {
|
||||
if(key->sampler[i].format) {
|
||||
debug_printf("sampler[%u] = \n", i);
|
||||
@@ -780,7 +780,7 @@ make_variant_key(struct llvmpipe_context *lp,
|
||||
for(chan = 0; chan < 4; ++chan) {
|
||||
enum util_format_swizzle swizzle = format_desc->swizzle[chan];
|
||||
if(swizzle > 4)
|
||||
key->blend.colormask &= ~(1 << chan);
|
||||
key->blend.rt[0].colormask &= ~(1 << chan);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,18 +103,18 @@ write_tsv_row(FILE *fp,
|
||||
|
||||
fprintf(fp,
|
||||
"%s\t%s\t%s\t",
|
||||
blend->rgb_func != blend->alpha_func ? "true" : "false",
|
||||
blend->rgb_src_factor != blend->alpha_src_factor ? "true" : "false",
|
||||
blend->rgb_dst_factor != blend->alpha_dst_factor ? "true" : "false");
|
||||
blend->rt[0].rgb_func != blend->rt[0].alpha_func ? "true" : "false",
|
||||
blend->rt[0].rgb_src_factor != blend->rt[0].alpha_src_factor ? "true" : "false",
|
||||
blend->rt[0].rgb_dst_factor != blend->rt[0].alpha_dst_factor ? "true" : "false");
|
||||
|
||||
fprintf(fp,
|
||||
"%s\t%s\t%s\t%s\t%s\t%s\n",
|
||||
debug_dump_blend_func(blend->rgb_func, TRUE),
|
||||
debug_dump_blend_factor(blend->rgb_src_factor, TRUE),
|
||||
debug_dump_blend_factor(blend->rgb_dst_factor, TRUE),
|
||||
debug_dump_blend_func(blend->alpha_func, TRUE),
|
||||
debug_dump_blend_factor(blend->alpha_src_factor, TRUE),
|
||||
debug_dump_blend_factor(blend->alpha_dst_factor, TRUE));
|
||||
debug_dump_blend_func(blend->rt[0].rgb_func, TRUE),
|
||||
debug_dump_blend_factor(blend->rt[0].rgb_src_factor, TRUE),
|
||||
debug_dump_blend_factor(blend->rt[0].rgb_dst_factor, TRUE),
|
||||
debug_dump_blend_func(blend->rt[0].alpha_func, TRUE),
|
||||
debug_dump_blend_factor(blend->rt[0].alpha_src_factor, TRUE),
|
||||
debug_dump_blend_factor(blend->rt[0].alpha_dst_factor, TRUE));
|
||||
|
||||
fflush(fp);
|
||||
}
|
||||
@@ -136,12 +136,12 @@ dump_blend_type(FILE *fp,
|
||||
|
||||
fprintf(fp,
|
||||
" %s=%s %s=%s %s=%s %s=%s %s=%s %s=%s",
|
||||
"rgb_func", debug_dump_blend_func(blend->rgb_func, TRUE),
|
||||
"rgb_src_factor", debug_dump_blend_factor(blend->rgb_src_factor, TRUE),
|
||||
"rgb_dst_factor", debug_dump_blend_factor(blend->rgb_dst_factor, TRUE),
|
||||
"alpha_func", debug_dump_blend_func(blend->alpha_func, TRUE),
|
||||
"alpha_src_factor", debug_dump_blend_factor(blend->alpha_src_factor, TRUE),
|
||||
"alpha_dst_factor", debug_dump_blend_factor(blend->alpha_dst_factor, TRUE));
|
||||
"rgb_func", debug_dump_blend_func(blend->rt[0].rgb_func, TRUE),
|
||||
"rgb_src_factor", debug_dump_blend_factor(blend->rt[0].rgb_src_factor, TRUE),
|
||||
"rgb_dst_factor", debug_dump_blend_factor(blend->rt[0].rgb_dst_factor, TRUE),
|
||||
"alpha_func", debug_dump_blend_func(blend->rt[0].alpha_func, TRUE),
|
||||
"alpha_src_factor", debug_dump_blend_factor(blend->rt[0].alpha_src_factor, TRUE),
|
||||
"alpha_dst_factor", debug_dump_blend_factor(blend->rt[0].alpha_dst_factor, TRUE));
|
||||
|
||||
fprintf(fp, " ...\n");
|
||||
fflush(fp);
|
||||
@@ -400,13 +400,15 @@ compute_blend_ref(const struct pipe_blend_state *blend,
|
||||
double src_term[4];
|
||||
double dst_term[4];
|
||||
|
||||
compute_blend_ref_term(blend->rgb_src_factor, blend->alpha_src_factor, src, src, dst, con, src_term);
|
||||
compute_blend_ref_term(blend->rgb_dst_factor, blend->alpha_dst_factor, dst, src, dst, con, dst_term);
|
||||
compute_blend_ref_term(blend->rt[0].rgb_src_factor, blend->rt[0].alpha_src_factor,
|
||||
src, src, dst, con, src_term);
|
||||
compute_blend_ref_term(blend->rt[0].rgb_dst_factor, blend->rt[0].alpha_dst_factor,
|
||||
dst, src, dst, con, dst_term);
|
||||
|
||||
/*
|
||||
* Combine RGB terms
|
||||
*/
|
||||
switch (blend->rgb_func) {
|
||||
switch (blend->rt[0].rgb_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
ADD_SAT(res[0], src_term[0], dst_term[0]); /* R */
|
||||
ADD_SAT(res[1], src_term[1], dst_term[1]); /* G */
|
||||
@@ -439,7 +441,7 @@ compute_blend_ref(const struct pipe_blend_state *blend,
|
||||
/*
|
||||
* Combine A terms
|
||||
*/
|
||||
switch (blend->alpha_func) {
|
||||
switch (blend->rt[0].alpha_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
ADD_SAT(res[3], src_term[3], dst_term[3]); /* A */
|
||||
break;
|
||||
@@ -805,14 +807,14 @@ test_all(unsigned verbose, FILE *fp)
|
||||
continue;
|
||||
|
||||
memset(&blend, 0, sizeof blend);
|
||||
blend.blend_enable = 1;
|
||||
blend.rgb_func = *rgb_func;
|
||||
blend.rgb_src_factor = *rgb_src_factor;
|
||||
blend.rgb_dst_factor = *rgb_dst_factor;
|
||||
blend.alpha_func = *alpha_func;
|
||||
blend.alpha_src_factor = *alpha_src_factor;
|
||||
blend.alpha_dst_factor = *alpha_dst_factor;
|
||||
blend.colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].blend_enable = 1;
|
||||
blend.rt[0].rgb_func = *rgb_func;
|
||||
blend.rt[0].rgb_src_factor = *rgb_src_factor;
|
||||
blend.rt[0].rgb_dst_factor = *rgb_dst_factor;
|
||||
blend.rt[0].alpha_func = *alpha_func;
|
||||
blend.rt[0].alpha_src_factor = *alpha_src_factor;
|
||||
blend.rt[0].alpha_dst_factor = *alpha_dst_factor;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
|
||||
if(!test_one(verbose, fp, &blend, mode, *type))
|
||||
success = FALSE;
|
||||
@@ -864,14 +866,14 @@ test_some(unsigned verbose, FILE *fp, unsigned long n)
|
||||
type = &blend_types[rand() % num_types];
|
||||
|
||||
memset(&blend, 0, sizeof blend);
|
||||
blend.blend_enable = 1;
|
||||
blend.rgb_func = *rgb_func;
|
||||
blend.rgb_src_factor = *rgb_src_factor;
|
||||
blend.rgb_dst_factor = *rgb_dst_factor;
|
||||
blend.alpha_func = *alpha_func;
|
||||
blend.alpha_src_factor = *alpha_src_factor;
|
||||
blend.alpha_dst_factor = *alpha_dst_factor;
|
||||
blend.colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].blend_enable = 1;
|
||||
blend.rt[0].rgb_func = *rgb_func;
|
||||
blend.rt[0].rgb_src_factor = *rgb_src_factor;
|
||||
blend.rt[0].rgb_dst_factor = *rgb_dst_factor;
|
||||
blend.rt[0].alpha_func = *alpha_func;
|
||||
blend.rt[0].alpha_src_factor = *alpha_src_factor;
|
||||
blend.rt[0].alpha_dst_factor = *alpha_dst_factor;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
|
||||
if(!test_one(verbose, fp, &blend, mode, *type))
|
||||
success = FALSE;
|
||||
|
||||
@@ -45,6 +45,10 @@ nv04_screen_get_param(struct pipe_screen *screen, int param)
|
||||
case NOUVEAU_CAP_HW_VTXBUF:
|
||||
case NOUVEAU_CAP_HW_IDXBUF:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 0;
|
||||
default:
|
||||
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
|
||||
return 0;
|
||||
|
||||
@@ -17,11 +17,11 @@ nv04_blend_state_create(struct pipe_context *pipe,
|
||||
|
||||
cb = MALLOC(sizeof(struct nv04_blend_state));
|
||||
|
||||
cb->b_enable = cso->blend_enable ? 1 : 0;
|
||||
cb->b_src = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rgb_src_factor)));
|
||||
cb->b_dst = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rgb_dst_factor)));
|
||||
cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
|
||||
cb->b_src = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rt[0].rgb_src_factor)));
|
||||
cb->b_dst = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
|
||||
|
||||
|
||||
return (void *)cb;
|
||||
|
||||
@@ -40,6 +40,10 @@ nv10_screen_get_param(struct pipe_screen *screen, int param)
|
||||
case NOUVEAU_CAP_HW_VTXBUF:
|
||||
case NOUVEAU_CAP_HW_IDXBUF:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 0;
|
||||
default:
|
||||
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
|
||||
return 0;
|
||||
|
||||
@@ -17,16 +17,16 @@ nv10_blend_state_create(struct pipe_context *pipe,
|
||||
|
||||
cb = MALLOC(sizeof(struct nv10_blend_state));
|
||||
|
||||
cb->b_enable = cso->blend_enable ? 1 : 0;
|
||||
cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rgb_src_factor)));
|
||||
cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rgb_dst_factor)));
|
||||
cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
|
||||
cb->b_srcfunc = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rt[0].rgb_src_factor)));
|
||||
cb->b_dstfunc = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
|
||||
|
||||
cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
|
||||
((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
|
||||
((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
|
||||
((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
|
||||
cb->c_mask = (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
|
||||
|
||||
cb->d_enable = cso->dither ? 1 : 0;
|
||||
|
||||
|
||||
@@ -40,6 +40,10 @@ nv20_screen_get_param(struct pipe_screen *screen, int param)
|
||||
case NOUVEAU_CAP_HW_VTXBUF:
|
||||
case NOUVEAU_CAP_HW_IDXBUF:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 0;
|
||||
default:
|
||||
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
|
||||
return 0;
|
||||
|
||||
@@ -17,16 +17,16 @@ nv20_blend_state_create(struct pipe_context *pipe,
|
||||
|
||||
cb = MALLOC(sizeof(struct nv20_blend_state));
|
||||
|
||||
cb->b_enable = cso->blend_enable ? 1 : 0;
|
||||
cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rgb_src_factor)));
|
||||
cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rgb_dst_factor)));
|
||||
cb->b_enable = cso->rt[0].blend_enable ? 1 : 0;
|
||||
cb->b_srcfunc = ((nvgl_blend_func(cso->rt[0].alpha_src_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rt[0].rgb_src_factor)));
|
||||
cb->b_dstfunc = ((nvgl_blend_func(cso->rt[0].alpha_dst_factor)<<16) |
|
||||
(nvgl_blend_func(cso->rt[0].rgb_dst_factor)));
|
||||
|
||||
cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
|
||||
((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
|
||||
((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
|
||||
((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
|
||||
cb->c_mask = (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01<<24) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01<<16) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01<< 0) : 0));
|
||||
|
||||
cb->d_enable = cso->dither ? 1 : 0;
|
||||
|
||||
|
||||
@@ -67,6 +67,10 @@ nv30_screen_get_param(struct pipe_screen *pscreen, int param)
|
||||
case NOUVEAU_CAP_HW_VTXBUF:
|
||||
case NOUVEAU_CAP_HW_IDXBUF:
|
||||
return 1;
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 0;
|
||||
default:
|
||||
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
|
||||
return 0;
|
||||
|
||||
@@ -16,27 +16,27 @@ nv30_blend_state_create(struct pipe_context *pipe,
|
||||
struct nv30_blend_state *bso = CALLOC(1, sizeof(*bso));
|
||||
struct nouveau_stateobj *so = so_new(5, 8, 0);
|
||||
|
||||
if (cso->blend_enable) {
|
||||
if (cso->rt[0].blend_enable) {
|
||||
so_method(so, rankine, NV34TCL_BLEND_FUNC_ENABLE, 3);
|
||||
so_data (so, 1);
|
||||
so_data (so, (nvgl_blend_func(cso->alpha_src_factor) << 16) |
|
||||
nvgl_blend_func(cso->rgb_src_factor));
|
||||
so_data (so, nvgl_blend_func(cso->alpha_dst_factor) << 16 |
|
||||
nvgl_blend_func(cso->rgb_dst_factor));
|
||||
so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
|
||||
nvgl_blend_func(cso->rt[0].rgb_src_factor));
|
||||
so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
|
||||
nvgl_blend_func(cso->rt[0].rgb_dst_factor));
|
||||
/* FIXME: Gallium assumes GL_EXT_blend_func_separate.
|
||||
It is not the case for NV30 */
|
||||
so_method(so, rankine, NV34TCL_BLEND_EQUATION, 1);
|
||||
so_data (so, nvgl_blend_eqn(cso->rgb_func));
|
||||
so_data (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
|
||||
} else {
|
||||
so_method(so, rankine, NV34TCL_BLEND_FUNC_ENABLE, 1);
|
||||
so_data (so, 0);
|
||||
}
|
||||
|
||||
so_method(so, rankine, NV34TCL_COLOR_MASK, 1);
|
||||
so_data (so, (((cso->colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
|
||||
((cso->colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
|
||||
((cso->colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
|
||||
((cso->colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
|
||||
so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
|
||||
|
||||
if (cso->logicop_enable) {
|
||||
so_method(so, rankine, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2);
|
||||
|
||||
@@ -52,6 +52,10 @@ nv40_screen_get_param(struct pipe_screen *pscreen, int param)
|
||||
if (screen->curie->grclass == NV40TCL)
|
||||
return 1;
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 0;
|
||||
default:
|
||||
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
|
||||
return 0;
|
||||
|
||||
@@ -18,26 +18,26 @@ nv40_blend_state_create(struct pipe_context *pipe,
|
||||
struct nv40_blend_state *bso = CALLOC(1, sizeof(*bso));
|
||||
struct nouveau_stateobj *so = so_new(5, 8, 0);
|
||||
|
||||
if (cso->blend_enable) {
|
||||
if (cso->rt[0].blend_enable) {
|
||||
so_method(so, curie, NV40TCL_BLEND_ENABLE, 3);
|
||||
so_data (so, 1);
|
||||
so_data (so, (nvgl_blend_func(cso->alpha_src_factor) << 16) |
|
||||
nvgl_blend_func(cso->rgb_src_factor));
|
||||
so_data (so, nvgl_blend_func(cso->alpha_dst_factor) << 16 |
|
||||
nvgl_blend_func(cso->rgb_dst_factor));
|
||||
so_data (so, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
|
||||
nvgl_blend_func(cso->rt[0].rgb_src_factor));
|
||||
so_data (so, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
|
||||
nvgl_blend_func(cso->rt[0].rgb_dst_factor));
|
||||
so_method(so, curie, NV40TCL_BLEND_EQUATION, 1);
|
||||
so_data (so, nvgl_blend_eqn(cso->alpha_func) << 16 |
|
||||
nvgl_blend_eqn(cso->rgb_func));
|
||||
so_data (so, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 |
|
||||
nvgl_blend_eqn(cso->rt[0].rgb_func));
|
||||
} else {
|
||||
so_method(so, curie, NV40TCL_BLEND_ENABLE, 1);
|
||||
so_data (so, 0);
|
||||
}
|
||||
|
||||
so_method(so, curie, NV40TCL_COLOR_MASK, 1);
|
||||
so_data (so, (((cso->colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
|
||||
((cso->colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
|
||||
((cso->colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
|
||||
((cso->colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
|
||||
so_data (so, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
|
||||
((cso->rt[0].colormask & PIPE_MASK_B) ? (0x01 << 0) : 0)));
|
||||
|
||||
if (cso->logicop_enable) {
|
||||
so_method(so, curie, NV40TCL_COLOR_LOGIC_OP_ENABLE, 2);
|
||||
|
||||
@@ -135,6 +135,10 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param)
|
||||
return 1;
|
||||
case NOUVEAU_CAP_HW_IDXBUF:
|
||||
return 0;
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
return 1;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 0;
|
||||
default:
|
||||
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
|
||||
return 0;
|
||||
|
||||
@@ -31,6 +31,23 @@
|
||||
|
||||
#include "nouveau/nouveau_stateobj.h"
|
||||
|
||||
static INLINE uint32_t
|
||||
nv50_colormask(unsigned mask)
|
||||
{
|
||||
uint32_t cmask = 0;
|
||||
|
||||
if (mask & PIPE_MASK_R)
|
||||
cmask |= 0x0001;
|
||||
if (mask & PIPE_MASK_G)
|
||||
cmask |= 0x0010;
|
||||
if (mask & PIPE_MASK_B)
|
||||
cmask |= 0x0100;
|
||||
if (mask & PIPE_MASK_A)
|
||||
cmask |= 0x1000;
|
||||
|
||||
return cmask;
|
||||
}
|
||||
|
||||
static void *
|
||||
nv50_blend_state_create(struct pipe_context *pipe,
|
||||
const struct pipe_blend_state *cso)
|
||||
@@ -38,28 +55,37 @@ nv50_blend_state_create(struct pipe_context *pipe,
|
||||
struct nouveau_stateobj *so = so_new(5, 24, 0);
|
||||
struct nouveau_grobj *tesla = nv50_context(pipe)->screen->tesla;
|
||||
struct nv50_blend_stateobj *bso = CALLOC_STRUCT(nv50_blend_stateobj);
|
||||
unsigned cmask = 0, i;
|
||||
unsigned i, blend_enabled = 0;
|
||||
|
||||
/*XXX ignored:
|
||||
* - dither
|
||||
*/
|
||||
|
||||
if (cso->blend_enable == 0) {
|
||||
so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
|
||||
for (i = 0; i < 8; i++)
|
||||
so_data(so, 0);
|
||||
} else {
|
||||
so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
|
||||
so_method(so, tesla, NV50TCL_BLEND_ENABLE(0), 8);
|
||||
if (cso->independent_blend_enable) {
|
||||
for (i = 0; i < 8; ++i) {
|
||||
so_data(so, cso->rt[i].blend_enable);
|
||||
if (cso->rt[i].blend_enable)
|
||||
blend_enabled = 1;
|
||||
}
|
||||
} else
|
||||
if (cso->rt[0].blend_enable) {
|
||||
blend_enabled = 1;
|
||||
for (i = 0; i < 8; i++)
|
||||
so_data(so, 1);
|
||||
} else {
|
||||
for (i = 0; i < 8; i++)
|
||||
so_data(so, 0);
|
||||
}
|
||||
if (blend_enabled) {
|
||||
so_method(so, tesla, NV50TCL_BLEND_EQUATION_RGB, 5);
|
||||
so_data (so, nvgl_blend_eqn(cso->rgb_func));
|
||||
so_data (so, 0x4000 | nvgl_blend_func(cso->rgb_src_factor));
|
||||
so_data (so, 0x4000 | nvgl_blend_func(cso->rgb_dst_factor));
|
||||
so_data (so, nvgl_blend_eqn(cso->alpha_func));
|
||||
so_data (so, 0x4000 | nvgl_blend_func(cso->alpha_src_factor));
|
||||
so_data (so, nvgl_blend_eqn(cso->rt[0].rgb_func));
|
||||
so_data (so, 0x4000 | nvgl_blend_func(cso->rt[0].rgb_src_factor));
|
||||
so_data (so, 0x4000 | nvgl_blend_func(cso->rt[0].rgb_dst_factor));
|
||||
so_data (so, nvgl_blend_eqn(cso->rt[0].alpha_func));
|
||||
so_data (so, 0x4000 | nvgl_blend_func(cso->rt[0].alpha_src_factor));
|
||||
so_method(so, tesla, NV50TCL_BLEND_FUNC_DST_ALPHA, 1);
|
||||
so_data (so, 0x4000 | nvgl_blend_func(cso->alpha_dst_factor));
|
||||
so_data (so, 0x4000 | nvgl_blend_func(cso->rt[0].alpha_dst_factor));
|
||||
}
|
||||
|
||||
if (cso->logicop_enable == 0 ) {
|
||||
@@ -71,17 +97,15 @@ nv50_blend_state_create(struct pipe_context *pipe,
|
||||
so_data (so, nvgl_logicop_func(cso->logicop_func));
|
||||
}
|
||||
|
||||
if (cso->colormask & PIPE_MASK_R)
|
||||
cmask |= (1 << 0);
|
||||
if (cso->colormask & PIPE_MASK_G)
|
||||
cmask |= (1 << 4);
|
||||
if (cso->colormask & PIPE_MASK_B)
|
||||
cmask |= (1 << 8);
|
||||
if (cso->colormask & PIPE_MASK_A)
|
||||
cmask |= (1 << 12);
|
||||
so_method(so, tesla, NV50TCL_COLOR_MASK(0), 8);
|
||||
for (i = 0; i < 8; i++)
|
||||
so_data(so, cmask);
|
||||
if (cso->independent_blend_enable)
|
||||
for (i = 0; i < 8; ++i)
|
||||
so_data(so, nv50_colormask(cso->rt[i].colormask));
|
||||
else {
|
||||
uint32_t cmask = nv50_colormask(cso->rt[0].colormask);
|
||||
for (i = 0; i < 8; i++)
|
||||
so_data(so, cmask);
|
||||
}
|
||||
|
||||
bso->pipe = *cso;
|
||||
so_ref(so, &bso->so);
|
||||
|
||||
@@ -149,6 +149,9 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 0;
|
||||
default:
|
||||
debug_printf("r300: Implementation error: Bad param %d\n",
|
||||
param);
|
||||
|
||||
@@ -163,15 +163,15 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
|
||||
{
|
||||
struct r300_blend_state* blend = CALLOC_STRUCT(r300_blend_state);
|
||||
|
||||
if (state->blend_enable)
|
||||
if (state->rt[0].blend_enable)
|
||||
{
|
||||
unsigned eqRGB = state->rgb_func;
|
||||
unsigned srcRGB = state->rgb_src_factor;
|
||||
unsigned dstRGB = state->rgb_dst_factor;
|
||||
unsigned eqRGB = state->rt[0].rgb_func;
|
||||
unsigned srcRGB = state->rt[0].rgb_src_factor;
|
||||
unsigned dstRGB = state->rt[0].rgb_dst_factor;
|
||||
|
||||
unsigned eqA = state->alpha_func;
|
||||
unsigned srcA = state->alpha_src_factor;
|
||||
unsigned dstA = state->alpha_dst_factor;
|
||||
unsigned eqA = state->rt[0].alpha_func;
|
||||
unsigned srcA = state->rt[0].alpha_src_factor;
|
||||
unsigned dstA = state->rt[0].alpha_dst_factor;
|
||||
|
||||
/* despite the name, ALPHA_BLEND_ENABLE has nothing to do with alpha,
|
||||
* this is just the crappy D3D naming */
|
||||
@@ -289,16 +289,16 @@ static void* r300_create_blend_state(struct pipe_context* pipe,
|
||||
}
|
||||
|
||||
/* Color Channel Mask */
|
||||
if (state->colormask & PIPE_MASK_R) {
|
||||
if (state->rt[0].colormask & PIPE_MASK_R) {
|
||||
blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_RED_MASK0;
|
||||
}
|
||||
if (state->colormask & PIPE_MASK_G) {
|
||||
if (state->rt[0].colormask & PIPE_MASK_G) {
|
||||
blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_GREEN_MASK0;
|
||||
}
|
||||
if (state->colormask & PIPE_MASK_B) {
|
||||
if (state->rt[0].colormask & PIPE_MASK_B) {
|
||||
blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0;
|
||||
}
|
||||
if (state->colormask & PIPE_MASK_A) {
|
||||
if (state->rt[0].colormask & PIPE_MASK_A) {
|
||||
blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK0;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,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 };
|
||||
@@ -233,7 +234,7 @@ blend_quad(struct quad_stage *qs,
|
||||
/*
|
||||
* Compute src/first term RGB
|
||||
*/
|
||||
switch (softpipe->blend->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 */
|
||||
@@ -383,7 +384,7 @@ blend_quad(struct quad_stage *qs,
|
||||
/*
|
||||
* Compute src/first term A
|
||||
*/
|
||||
switch (softpipe->blend->alpha_src_factor) {
|
||||
switch (softpipe->blend->rt[cbuf].alpha_src_factor) {
|
||||
case PIPE_BLENDFACTOR_ONE:
|
||||
VEC4_COPY(source[3], quadColor[3]); /* A */
|
||||
break;
|
||||
@@ -452,7 +453,7 @@ blend_quad(struct quad_stage *qs,
|
||||
/*
|
||||
* Compute dest/second term RGB
|
||||
*/
|
||||
switch (softpipe->blend->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;
|
||||
@@ -592,7 +593,7 @@ blend_quad(struct quad_stage *qs,
|
||||
/*
|
||||
* Compute dest/second term A
|
||||
*/
|
||||
switch (softpipe->blend->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;
|
||||
@@ -655,7 +656,7 @@ blend_quad(struct quad_stage *qs,
|
||||
/*
|
||||
* Combine RGB terms
|
||||
*/
|
||||
switch (softpipe->blend->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 */
|
||||
@@ -688,7 +689,7 @@ blend_quad(struct quad_stage *qs,
|
||||
/*
|
||||
* Combine A terms
|
||||
*/
|
||||
switch (softpipe->blend->alpha_func) {
|
||||
switch (softpipe->blend->rt[cbuf].alpha_func) {
|
||||
case PIPE_BLEND_ADD:
|
||||
VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */
|
||||
break;
|
||||
@@ -710,26 +711,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->colormask & PIPE_MASK_R))
|
||||
if (!(colormask & PIPE_MASK_R))
|
||||
COPY_4V(quadColor[0], dest[0]);
|
||||
|
||||
/* G */
|
||||
if (!(softpipe->blend->colormask & PIPE_MASK_G))
|
||||
if (!(colormask & PIPE_MASK_G))
|
||||
COPY_4V(quadColor[1], dest[1]);
|
||||
|
||||
/* B */
|
||||
if (!(softpipe->blend->colormask & PIPE_MASK_B))
|
||||
if (!(colormask & PIPE_MASK_B))
|
||||
COPY_4V(quadColor[2], dest[2]);
|
||||
|
||||
/* A */
|
||||
if (!(softpipe->blend->colormask & PIPE_MASK_A))
|
||||
if (!(colormask & PIPE_MASK_A))
|
||||
COPY_4V(quadColor[3], dest[3]);
|
||||
}
|
||||
|
||||
@@ -772,12 +771,12 @@ blend_fallback(struct quad_stage *qs,
|
||||
if (blend->logicop_enable) {
|
||||
logicop_quad( qs, quadColor, dest );
|
||||
}
|
||||
else if (blend->blend_enable) {
|
||||
blend_quad( qs, quadColor, dest );
|
||||
else if (blend->rt[cbuf].blend_enable) {
|
||||
blend_quad( qs, quadColor, dest, cbuf );
|
||||
}
|
||||
|
||||
if (blend->colormask != 0xf)
|
||||
colormask_quad( qs, quadColor, dest );
|
||||
if (blend->rt[cbuf].colormask != 0xf)
|
||||
colormask_quad( blend->rt[cbuf].colormask, quadColor, dest);
|
||||
|
||||
/* Output color values
|
||||
*/
|
||||
@@ -953,23 +952,23 @@ choose_blend_quad(struct quad_stage *qs,
|
||||
qs->run = blend_noop;
|
||||
}
|
||||
else if (!softpipe->blend->logicop_enable &&
|
||||
softpipe->blend->colormask == 0xf &&
|
||||
softpipe->blend->rt[0].colormask == 0xf &&
|
||||
softpipe->framebuffer.nr_cbufs == 1)
|
||||
{
|
||||
if (!blend->blend_enable) {
|
||||
if (!blend->rt[0].blend_enable) {
|
||||
qs->run = single_output_color;
|
||||
}
|
||||
else if (blend->rgb_src_factor == blend->alpha_src_factor &&
|
||||
blend->rgb_dst_factor == blend->alpha_dst_factor &&
|
||||
blend->rgb_func == blend->alpha_func)
|
||||
else if (blend->rt[0].rgb_src_factor == blend->rt[0].alpha_src_factor &&
|
||||
blend->rt[0].rgb_dst_factor == blend->rt[0].alpha_dst_factor &&
|
||||
blend->rt[0].rgb_func == blend->rt[0].alpha_func)
|
||||
{
|
||||
if (blend->alpha_func == PIPE_BLEND_ADD) {
|
||||
if (blend->rgb_src_factor == PIPE_BLENDFACTOR_ONE &&
|
||||
blend->rgb_dst_factor == PIPE_BLENDFACTOR_ONE) {
|
||||
if (blend->rt[0].alpha_func == PIPE_BLEND_ADD) {
|
||||
if (blend->rt[0].rgb_src_factor == PIPE_BLENDFACTOR_ONE &&
|
||||
blend->rt[0].rgb_dst_factor == PIPE_BLENDFACTOR_ONE) {
|
||||
qs->run = blend_single_add_one_one;
|
||||
}
|
||||
else if (blend->rgb_src_factor == PIPE_BLENDFACTOR_SRC_ALPHA &&
|
||||
blend->rgb_dst_factor == PIPE_BLENDFACTOR_INV_SRC_ALPHA)
|
||||
else if (blend->rt[0].rgb_src_factor == PIPE_BLENDFACTOR_SRC_ALPHA &&
|
||||
blend->rt[0].rgb_dst_factor == PIPE_BLENDFACTOR_INV_SRC_ALPHA)
|
||||
qs->run = blend_single_add_src_alpha_inv_src_alpha;
|
||||
|
||||
}
|
||||
|
||||
@@ -95,6 +95,10 @@ softpipe_get_param(struct pipe_screen *screen, int param)
|
||||
return PIPE_MAX_CONSTANT_BUFFERS;
|
||||
case PIPE_CAP_MAX_CONST_BUFFER_SIZE:
|
||||
return 4096 * 4 * sizeof(float);
|
||||
case PIPE_CAP_INDEP_BLEND_ENABLE:
|
||||
return 1;
|
||||
case PIPE_CAP_INDEP_BLEND_FUNC:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -185,17 +185,18 @@ init_pipe_state(struct sp_mpeg12_context *ctx)
|
||||
ctx->rast = ctx->pipe->create_rasterizer_state(ctx->pipe, &rast);
|
||||
ctx->pipe->bind_rasterizer_state(ctx->pipe, ctx->rast);
|
||||
|
||||
blend.blend_enable = 0;
|
||||
blend.rgb_func = PIPE_BLEND_ADD;
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_func = PIPE_BLEND_ADD;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.independent_blend_enable = 0;
|
||||
blend.rt[0].blend_enable = 0;
|
||||
blend.rt[0].rgb_func = PIPE_BLEND_ADD;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_func = PIPE_BLEND_ADD;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.logicop_enable = 0;
|
||||
blend.logicop_func = PIPE_LOGICOP_CLEAR;
|
||||
/* Needed to allow color writes to FB, even if blending disabled */
|
||||
blend.colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
blend.dither = 0;
|
||||
ctx->blend = ctx->pipe->create_blend_state(ctx->pipe, &blend);
|
||||
ctx->pipe->bind_blend_state(ctx->pipe, ctx->blend);
|
||||
|
||||
@@ -181,15 +181,15 @@ svga_create_blend_state(struct pipe_context *pipe,
|
||||
}
|
||||
}
|
||||
else {
|
||||
blend->rt[i].blend_enable = templ->blend_enable;
|
||||
blend->rt[i].blend_enable = templ->rt[0].blend_enable;
|
||||
|
||||
if (templ->blend_enable) {
|
||||
blend->rt[i].srcblend = svga_translate_blend_factor(templ->rgb_src_factor);
|
||||
blend->rt[i].dstblend = svga_translate_blend_factor(templ->rgb_dst_factor);
|
||||
blend->rt[i].blendeq = svga_translate_blend_func(templ->rgb_func);
|
||||
blend->rt[i].srcblend_alpha = svga_translate_blend_factor(templ->alpha_src_factor);
|
||||
blend->rt[i].dstblend_alpha = svga_translate_blend_factor(templ->alpha_dst_factor);
|
||||
blend->rt[i].blendeq_alpha = svga_translate_blend_func(templ->alpha_func);
|
||||
if (templ->rt[0].blend_enable) {
|
||||
blend->rt[i].srcblend = svga_translate_blend_factor(templ->rt[0].rgb_src_factor);
|
||||
blend->rt[i].dstblend = svga_translate_blend_factor(templ->rt[0].rgb_dst_factor);
|
||||
blend->rt[i].blendeq = svga_translate_blend_func(templ->rt[0].rgb_func);
|
||||
blend->rt[i].srcblend_alpha = svga_translate_blend_factor(templ->rt[0].alpha_src_factor);
|
||||
blend->rt[i].dstblend_alpha = svga_translate_blend_factor(templ->rt[0].alpha_dst_factor);
|
||||
blend->rt[i].blendeq_alpha = svga_translate_blend_func(templ->rt[0].alpha_func);
|
||||
|
||||
if (blend->rt[i].srcblend_alpha != blend->rt[i].srcblend ||
|
||||
blend->rt[i].dstblend_alpha != blend->rt[i].dstblend ||
|
||||
@@ -200,7 +200,7 @@ svga_create_blend_state(struct pipe_context *pipe,
|
||||
}
|
||||
}
|
||||
|
||||
blend->rt[i].writemask = templ->colormask;
|
||||
blend->rt[i].writemask = templ->rt[0].colormask;
|
||||
}
|
||||
|
||||
return blend;
|
||||
|
||||
@@ -323,9 +323,23 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_
|
||||
trace_dump_struct_end();
|
||||
}
|
||||
|
||||
static void trace_dump_rt_blend_state(const struct pipe_rt_blend_state *state)
|
||||
{
|
||||
trace_dump_member(uint, state, rgb_func);
|
||||
trace_dump_member(uint, state, rgb_src_factor);
|
||||
trace_dump_member(uint, state, rgb_dst_factor);
|
||||
|
||||
trace_dump_member(uint, state, alpha_func);
|
||||
trace_dump_member(uint, state, alpha_src_factor);
|
||||
trace_dump_member(uint, state, alpha_dst_factor);
|
||||
|
||||
trace_dump_member(uint, state, colormask);
|
||||
|
||||
}
|
||||
|
||||
void trace_dump_blend_state(const struct pipe_blend_state *state)
|
||||
{
|
||||
unsigned valid_entries = 1;
|
||||
if (!trace_dumping_enabled_locked())
|
||||
return;
|
||||
|
||||
@@ -336,21 +350,17 @@ void trace_dump_blend_state(const struct pipe_blend_state *state)
|
||||
|
||||
trace_dump_struct_begin("pipe_blend_state");
|
||||
|
||||
trace_dump_member(bool, state, blend_enable);
|
||||
|
||||
trace_dump_member(uint, state, rgb_func);
|
||||
trace_dump_member(uint, state, rgb_src_factor);
|
||||
trace_dump_member(uint, state, rgb_dst_factor);
|
||||
|
||||
trace_dump_member(uint, state, alpha_func);
|
||||
trace_dump_member(uint, state, alpha_src_factor);
|
||||
trace_dump_member(uint, state, alpha_dst_factor);
|
||||
trace_dump_member(bool, state, dither);
|
||||
|
||||
trace_dump_member(bool, state, logicop_enable);
|
||||
trace_dump_member(uint, state, logicop_func);
|
||||
|
||||
trace_dump_member(uint, state, colormask);
|
||||
trace_dump_member(bool, state, dither);
|
||||
trace_dump_member(bool, state, independent_blend_enable);
|
||||
|
||||
if (state->independent_blend_enable)
|
||||
valid_entries = PIPE_MAX_COLOR_BUFS;
|
||||
|
||||
trace_dump_struct_array(rt_blend_state, state->rt, valid_entries);
|
||||
|
||||
trace_dump_struct_end();
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ enum pipe_transfer_usage {
|
||||
#define PIPE_CAP_NPOT_TEXTURES 2
|
||||
#define PIPE_CAP_TWO_SIDED_STENCIL 3
|
||||
#define PIPE_CAP_GLSL 4 /* XXX need something better */
|
||||
#define PIPE_CAP_S3TC 5 /* XXX: deprecated; cap determined via supported sampler formats */
|
||||
#define PIPE_CAP_DUAL_SOURCE_BLEND 5
|
||||
#define PIPE_CAP_ANISOTROPIC_FILTER 6
|
||||
#define PIPE_CAP_POINT_SPRITE 7
|
||||
#define PIPE_CAP_MAX_RENDER_TARGETS 8
|
||||
@@ -407,6 +407,8 @@ enum pipe_transfer_usage {
|
||||
and fragment shaders combined */
|
||||
#define PIPE_CAP_MAX_CONST_BUFFERS 32
|
||||
#define PIPE_CAP_MAX_CONST_BUFFER_SIZE 33 /*< In bytes */
|
||||
#define PIPE_CAP_INDEP_BLEND_ENABLE 34 /*< blend enables and write masks per rendertarget */
|
||||
#define PIPE_CAP_INDEP_BLEND_FUNC 35 /*< different blend funcs per rendertarget */
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -217,7 +217,7 @@ struct pipe_depth_stencil_alpha_state
|
||||
};
|
||||
|
||||
|
||||
struct pipe_blend_state
|
||||
struct pipe_rt_blend_state
|
||||
{
|
||||
unsigned blend_enable:1;
|
||||
|
||||
@@ -229,11 +229,16 @@ struct pipe_blend_state
|
||||
unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */
|
||||
unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */
|
||||
|
||||
unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */
|
||||
};
|
||||
|
||||
struct pipe_blend_state
|
||||
{
|
||||
unsigned independent_blend_enable:1;
|
||||
unsigned logicop_enable:1;
|
||||
unsigned logicop_func:4; /**< PIPE_LOGICOP_x */
|
||||
|
||||
unsigned colormask:4; /**< bitmask of PIPE_MASK_R/G/B/A */
|
||||
unsigned dither:1;
|
||||
struct pipe_rt_blend_state rt[PIPE_MAX_COLOR_BUFS];
|
||||
};
|
||||
|
||||
|
||||
@@ -269,7 +274,7 @@ struct pipe_sampler_state
|
||||
unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */
|
||||
unsigned compare_func:3; /**< PIPE_FUNC_x */
|
||||
unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */
|
||||
unsigned prefilter:4; /**< Wierd sampling state exposed by some api's */
|
||||
unsigned prefilter:4; /**< Cylindrical texcoord wrap, per coord, exposed by some api's */
|
||||
float lod_bias; /**< LOD/lambda bias */
|
||||
float min_lod, max_lod; /**< LOD clamp range, after bias */
|
||||
float border_color[4];
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#define need_GL_EXT_blend_func_separate
|
||||
#define need_GL_EXT_blend_minmax
|
||||
#define need_GL_EXT_cull_vertex
|
||||
#define need_GL_EXT_draw_buffers2
|
||||
#define need_GL_EXT_fog_coord
|
||||
#define need_GL_EXT_framebuffer_object
|
||||
#define need_GL_EXT_multi_draw_arrays
|
||||
@@ -98,6 +99,7 @@ static const struct dri_extension card_extensions[] = {
|
||||
{"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
|
||||
{"GL_EXT_blend_subtract", NULL},
|
||||
{"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions},
|
||||
{"GL_EXT_draw_buffers2", GL_EXT_draw_buffers2_functions},
|
||||
{"GL_EXT_fog_coord", GL_EXT_fog_coord_functions},
|
||||
{"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions},
|
||||
{"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
|
||||
@@ -130,6 +132,9 @@ dri_init_extensions(struct dri_context *ctx)
|
||||
/* The card_extensions list should be pruned according to the
|
||||
* capabilities of the pipe_screen. This is actually something
|
||||
* that can/should be done inside st_create_context().
|
||||
* XXX Not pruning is very bogus. Always all these extensions above
|
||||
* will be advertized, regardless what st_init_extensions
|
||||
* (which depends on the pipe cap bits) does.
|
||||
*/
|
||||
driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE);
|
||||
}
|
||||
|
||||
@@ -72,11 +72,11 @@ def test(dev):
|
||||
|
||||
# disabled blending/masking
|
||||
blend = Blend()
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.colormask = PIPE_MASK_RGBA
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA
|
||||
ctx.set_blend(blend)
|
||||
|
||||
# depth/stencil/alpha
|
||||
|
||||
@@ -72,11 +72,11 @@ def test(dev):
|
||||
|
||||
# disabled blending/masking
|
||||
blend = Blend()
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.colormask = PIPE_MASK_RGBA
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA
|
||||
ctx.set_blend(blend)
|
||||
|
||||
# depth/stencil/alpha
|
||||
|
||||
@@ -180,11 +180,11 @@ st_context_create(struct st_device *st_dev)
|
||||
{
|
||||
struct pipe_blend_state blend;
|
||||
memset(&blend, 0, sizeof(blend));
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
cso_set_blend(st_ctx->cso, &blend);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,11 +51,11 @@ def test(dev, name):
|
||||
|
||||
# disabled blending/masking
|
||||
blend = Blend()
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.colormask = PIPE_MASK_RGBA
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA
|
||||
ctx.set_blend(blend)
|
||||
|
||||
# depth/stencil/alpha
|
||||
|
||||
@@ -52,11 +52,11 @@ def test(dev, name):
|
||||
|
||||
# disabled blending/masking
|
||||
blend = Blend()
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.colormask = PIPE_MASK_RGBA
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA
|
||||
ctx.set_blend(blend)
|
||||
|
||||
# depth/stencil/alpha
|
||||
|
||||
@@ -115,11 +115,11 @@ class TextureTest(TestCase):
|
||||
|
||||
# disabled blending/masking
|
||||
blend = Blend()
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.colormask = PIPE_MASK_RGBA
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA
|
||||
ctx.set_blend(blend)
|
||||
|
||||
# no-op depth/stencil/alpha
|
||||
|
||||
@@ -140,11 +140,11 @@ class TextureColorSampleTest(TestCase):
|
||||
|
||||
# disabled blending/masking
|
||||
blend = Blend()
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.colormask = PIPE_MASK_RGBA
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA
|
||||
ctx.set_blend(blend)
|
||||
|
||||
# no-op depth/stencil/alpha
|
||||
@@ -327,11 +327,11 @@ class TextureDepthSampleTest(TestCase):
|
||||
|
||||
# disabled blending/masking
|
||||
blend = Blend()
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.colormask = PIPE_MASK_RGBA
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA
|
||||
ctx.set_blend(blend)
|
||||
|
||||
# depth/stencil/alpha
|
||||
|
||||
@@ -127,19 +127,19 @@ static void setup_blend()
|
||||
struct vg_context *ctx = vg_current_context();
|
||||
struct pipe_blend_state blend;
|
||||
memset(&blend, 0, sizeof(blend));
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
if (ctx->state.vg.filter_channel_mask & VG_RED)
|
||||
blend.colormask |= PIPE_MASK_R;
|
||||
blend.rt[0].colormask |= PIPE_MASK_R;
|
||||
if (ctx->state.vg.filter_channel_mask & VG_GREEN)
|
||||
blend.colormask |= PIPE_MASK_G;
|
||||
blend.rt[0].colormask |= PIPE_MASK_G;
|
||||
if (ctx->state.vg.filter_channel_mask & VG_BLUE)
|
||||
blend.colormask |= PIPE_MASK_B;
|
||||
blend.rt[0].colormask |= PIPE_MASK_B;
|
||||
if (ctx->state.vg.filter_channel_mask & VG_ALPHA)
|
||||
blend.colormask |= PIPE_MASK_A;
|
||||
blend.blend_enable = 1;
|
||||
blend.rt[0].colormask |= PIPE_MASK_A;
|
||||
blend.rt[0].blend_enable = 0;
|
||||
cso_set_blend(ctx->cso_context, &blend);
|
||||
}
|
||||
|
||||
|
||||
@@ -128,14 +128,11 @@ clear_with_quad(struct vg_context *st, float x0, float y0,
|
||||
{
|
||||
struct pipe_blend_state blend;
|
||||
memset(&blend, 0, sizeof(blend));
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.colormask |= PIPE_MASK_R;
|
||||
blend.colormask |= PIPE_MASK_G;
|
||||
blend.colormask |= PIPE_MASK_B;
|
||||
blend.colormask |= PIPE_MASK_A;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
cso_set_blend(st->cso_context, &blend);
|
||||
}
|
||||
|
||||
|
||||
@@ -354,15 +354,12 @@ static void setup_mask_blend()
|
||||
struct pipe_blend_state blend;
|
||||
|
||||
memset(&blend, 0, sizeof(struct pipe_blend_state));
|
||||
blend.blend_enable = 1;
|
||||
blend.colormask |= PIPE_MASK_R;
|
||||
blend.colormask |= PIPE_MASK_G;
|
||||
blend.colormask |= PIPE_MASK_B;
|
||||
blend.colormask |= PIPE_MASK_A;
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].blend_enable = 0;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
|
||||
cso_set_blend(ctx->cso_context, &blend);
|
||||
}
|
||||
|
||||
@@ -248,12 +248,12 @@ VGboolean polygon_is_closed(struct polygon *p)
|
||||
static void set_blend_for_fill(struct pipe_blend_state *blend)
|
||||
{
|
||||
memset(blend, 0, sizeof(struct pipe_blend_state));
|
||||
blend->colormask = 0; /*disable colorwrites*/
|
||||
blend->rt[0].colormask = 0; /*disable colorwrites*/
|
||||
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
|
||||
blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
|
||||
blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
|
||||
}
|
||||
|
||||
static void draw_polygon(struct vg_context *ctx,
|
||||
|
||||
@@ -317,11 +317,11 @@ void renderer_copy_texture(struct renderer *ctx,
|
||||
{
|
||||
struct pipe_blend_state blend;
|
||||
memset(&blend, 0, sizeof(blend));
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
cso_set_blend(ctx->cso, &blend);
|
||||
}
|
||||
|
||||
@@ -486,11 +486,11 @@ void renderer_copy_surface(struct renderer *ctx,
|
||||
{
|
||||
struct pipe_blend_state blend;
|
||||
memset(&blend, 0, sizeof(blend));
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
cso_set_blend(ctx->cso, &blend);
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ static void update_clip_state(struct vg_context *ctx)
|
||||
ctx->pipe->clear(ctx->pipe, PIPE_CLEAR_DEPTHSTENCIL, NULL, 1.0, 0);
|
||||
|
||||
/* disable color writes */
|
||||
blend->colormask = 0; /*disable colorwrites*/
|
||||
blend->rt[0].colormask = 0; /*disable colorwrites*/
|
||||
cso_set_blend(ctx->cso_context, blend);
|
||||
|
||||
/* enable scissoring */
|
||||
@@ -286,7 +286,6 @@ static void update_clip_state(struct vg_context *ctx)
|
||||
renderer_draw_quad(ctx->renderer, minx, miny, maxx, maxy, 0.0f);
|
||||
}
|
||||
|
||||
blend->colormask = 1; /*enable colorwrites*/
|
||||
cso_restore_blend(ctx->cso_context);
|
||||
cso_restore_fragment_shader(ctx->cso_context);
|
||||
|
||||
@@ -301,57 +300,56 @@ void vg_validate_state(struct vg_context *ctx)
|
||||
if ((ctx->state.dirty & BLEND_DIRTY)) {
|
||||
struct pipe_blend_state *blend = &ctx->state.g3d.blend;
|
||||
memset(blend, 0, sizeof(struct pipe_blend_state));
|
||||
blend->blend_enable = 1;
|
||||
blend->colormask |= PIPE_MASK_R;
|
||||
blend->colormask |= PIPE_MASK_G;
|
||||
blend->colormask |= PIPE_MASK_B;
|
||||
blend->colormask |= PIPE_MASK_A;
|
||||
blend->rt[0].blend_enable = 1;
|
||||
blend->rt[0].colormask = PIPE_MASK_RGBA;
|
||||
|
||||
switch (ctx->state.vg.blend_mode) {
|
||||
case VG_BLEND_SRC:
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].blend_enable = 0;
|
||||
break;
|
||||
case VG_BLEND_SRC_OVER:
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
|
||||
blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
|
||||
blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
|
||||
blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA;
|
||||
break;
|
||||
case VG_BLEND_DST_OVER:
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_INV_DST_ALPHA;
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_INV_DST_ALPHA;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_DST_ALPHA;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_DST_ALPHA;
|
||||
blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_INV_DST_ALPHA;
|
||||
blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_INV_DST_ALPHA;
|
||||
blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_DST_ALPHA;
|
||||
blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_DST_ALPHA;
|
||||
break;
|
||||
case VG_BLEND_SRC_IN:
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_DST_ALPHA;
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_DST_ALPHA;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_DST_ALPHA;
|
||||
blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_DST_ALPHA;
|
||||
blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
break;
|
||||
case VG_BLEND_DST_IN:
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
|
||||
blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
|
||||
blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_SRC_ALPHA;
|
||||
break;
|
||||
case VG_BLEND_MULTIPLY:
|
||||
case VG_BLEND_SCREEN:
|
||||
case VG_BLEND_DARKEN:
|
||||
case VG_BLEND_LIGHTEN:
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend->rt[0].blend_enable = 0;
|
||||
break;
|
||||
case VG_BLEND_ADDITIVE:
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
break;
|
||||
default:
|
||||
assert(!"not implemented blend mode");
|
||||
|
||||
@@ -217,13 +217,13 @@ bind_blend_state(struct exa_context *exa, int op,
|
||||
blend_for_op(&blend_opt, op, pSrcPicture, pMaskPicture, pDstPicture);
|
||||
|
||||
memset(&blend, 0, sizeof(struct pipe_blend_state));
|
||||
blend.blend_enable = 1;
|
||||
blend.colormask |= PIPE_MASK_RGBA;
|
||||
blend.rt[0].blend_enable = 1;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
|
||||
blend.rgb_src_factor = blend_opt.rgb_src;
|
||||
blend.alpha_src_factor = blend_opt.rgb_src;
|
||||
blend.rgb_dst_factor = blend_opt.rgb_dst;
|
||||
blend.alpha_dst_factor = blend_opt.rgb_dst;
|
||||
blend.rt[0].rgb_src_factor = blend_opt.rgb_src;
|
||||
blend.rt[0].alpha_src_factor = blend_opt.rgb_src;
|
||||
blend.rt[0].rgb_dst_factor = blend_opt.rgb_dst;
|
||||
blend.rt[0].alpha_dst_factor = blend_opt.rgb_dst;
|
||||
|
||||
cso_set_blend(exa->renderer->cso, &blend);
|
||||
}
|
||||
|
||||
@@ -444,11 +444,11 @@ void renderer_copy_prepare(struct xorg_renderer *r,
|
||||
{
|
||||
struct pipe_blend_state blend;
|
||||
memset(&blend, 0, sizeof(blend));
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.colormask = PIPE_MASK_RGBA;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
cso_set_blend(r->cso, &blend);
|
||||
}
|
||||
|
||||
|
||||
@@ -400,14 +400,14 @@ bind_blend_state(struct xorg_xv_port_priv *port)
|
||||
struct pipe_blend_state blend;
|
||||
|
||||
memset(&blend, 0, sizeof(struct pipe_blend_state));
|
||||
blend.blend_enable = 1;
|
||||
blend.colormask |= PIPE_MASK_RGBA;
|
||||
blend.rt[0].blend_enable = 0;
|
||||
blend.rt[0].colormask = PIPE_MASK_RGBA;
|
||||
|
||||
/* porter&duff src */
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
|
||||
cso_set_blend(port->r->cso, &blend);
|
||||
}
|
||||
|
||||
@@ -152,14 +152,54 @@ translate_logicop(GLenum logicop)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure out if colormasks are different per rt.
|
||||
*/
|
||||
static GLboolean
|
||||
colormask_per_rt(GLcontext *ctx)
|
||||
{
|
||||
/* a bit suboptimal have to compare lots of values */
|
||||
unsigned i;
|
||||
for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
|
||||
if (memcmp(ctx->Color.ColorMask[0], ctx->Color.ColorMask[i], 4)) {
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Figure out if blend enables are different per rt.
|
||||
*/
|
||||
static GLboolean
|
||||
blend_per_rt(GLcontext *ctx)
|
||||
{
|
||||
if (ctx->Color.BlendEnabled &&
|
||||
(ctx->Color.BlendEnabled != ((1 << ctx->Const.MaxDrawBuffers) - 1))) {
|
||||
return GL_TRUE;
|
||||
}
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
update_blend( struct st_context *st )
|
||||
{
|
||||
struct pipe_blend_state *blend = &st->state.blend;
|
||||
unsigned num_state = 1;
|
||||
unsigned i;
|
||||
|
||||
memset(blend, 0, sizeof(*blend));
|
||||
|
||||
if (blend_per_rt(st->ctx) || colormask_per_rt(st->ctx)) {
|
||||
num_state = st->ctx->Const.MaxDrawBuffers;
|
||||
blend->independent_blend_enable = 1;
|
||||
}
|
||||
/* Note it is impossible to correctly deal with EXT_blend_logic_op and
|
||||
EXT_draw_buffers2/EXT_blend_equation_separate at the same time.
|
||||
These combinations would require support for per-rt logicop enables
|
||||
and separate alpha/rgb logicop/blend support respectively. Neither
|
||||
possible in gallium nor most hardware. Assume these combinations
|
||||
don't happen. */
|
||||
if (st->ctx->Color.ColorLogicOpEnabled ||
|
||||
(st->ctx->Color.BlendEnabled &&
|
||||
st->ctx->Color.BlendEquationRGB == GL_LOGIC_OP)) {
|
||||
@@ -169,30 +209,33 @@ update_blend( struct st_context *st )
|
||||
}
|
||||
else if (st->ctx->Color.BlendEnabled) {
|
||||
/* blending enabled */
|
||||
blend->blend_enable = 1;
|
||||
for (i = 0; i < num_state; i++) {
|
||||
|
||||
blend->rgb_func = translate_blend(st->ctx->Color.BlendEquationRGB);
|
||||
if (st->ctx->Color.BlendEquationRGB == GL_MIN ||
|
||||
st->ctx->Color.BlendEquationRGB == GL_MAX) {
|
||||
/* Min/max are special */
|
||||
blend->rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
}
|
||||
else {
|
||||
blend->rgb_src_factor = translate_blend(st->ctx->Color.BlendSrcRGB);
|
||||
blend->rgb_dst_factor = translate_blend(st->ctx->Color.BlendDstRGB);
|
||||
}
|
||||
blend->rt[i].blend_enable = (st->ctx->Color.BlendEnabled >> i) & 0x1;
|
||||
|
||||
blend->alpha_func = translate_blend(st->ctx->Color.BlendEquationA);
|
||||
if (st->ctx->Color.BlendEquationA == GL_MIN ||
|
||||
st->ctx->Color.BlendEquationA == GL_MAX) {
|
||||
/* Min/max are special */
|
||||
blend->alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
}
|
||||
else {
|
||||
blend->alpha_src_factor = translate_blend(st->ctx->Color.BlendSrcA);
|
||||
blend->alpha_dst_factor = translate_blend(st->ctx->Color.BlendDstA);
|
||||
blend->rt[i].rgb_func = translate_blend(st->ctx->Color.BlendEquationRGB);
|
||||
if (st->ctx->Color.BlendEquationRGB == GL_MIN ||
|
||||
st->ctx->Color.BlendEquationRGB == GL_MAX) {
|
||||
/* Min/max are special */
|
||||
blend->rt[i].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[i].rgb_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
}
|
||||
else {
|
||||
blend->rt[i].rgb_src_factor = translate_blend(st->ctx->Color.BlendSrcRGB);
|
||||
blend->rt[i].rgb_dst_factor = translate_blend(st->ctx->Color.BlendDstRGB);
|
||||
}
|
||||
|
||||
blend->rt[i].alpha_func = translate_blend(st->ctx->Color.BlendEquationA);
|
||||
if (st->ctx->Color.BlendEquationA == GL_MIN ||
|
||||
st->ctx->Color.BlendEquationA == GL_MAX) {
|
||||
/* Min/max are special */
|
||||
blend->rt[i].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend->rt[i].alpha_dst_factor = PIPE_BLENDFACTOR_ONE;
|
||||
}
|
||||
else {
|
||||
blend->rt[i].alpha_src_factor = translate_blend(st->ctx->Color.BlendSrcA);
|
||||
blend->rt[i].alpha_dst_factor = translate_blend(st->ctx->Color.BlendDstA);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -200,14 +243,16 @@ update_blend( struct st_context *st )
|
||||
}
|
||||
|
||||
/* Colormask - maybe reverse these bits? */
|
||||
if (st->ctx->Color.ColorMask[0][0])
|
||||
blend->colormask |= PIPE_MASK_R;
|
||||
if (st->ctx->Color.ColorMask[0][1])
|
||||
blend->colormask |= PIPE_MASK_G;
|
||||
if (st->ctx->Color.ColorMask[0][2])
|
||||
blend->colormask |= PIPE_MASK_B;
|
||||
if (st->ctx->Color.ColorMask[0][3])
|
||||
blend->colormask |= PIPE_MASK_A;
|
||||
for (i = 0; i < num_state; i++) {
|
||||
if (st->ctx->Color.ColorMask[i][0])
|
||||
blend->rt[i].colormask |= PIPE_MASK_R;
|
||||
if (st->ctx->Color.ColorMask[i][1])
|
||||
blend->rt[i].colormask |= PIPE_MASK_G;
|
||||
if (st->ctx->Color.ColorMask[i][2])
|
||||
blend->rt[i].colormask |= PIPE_MASK_B;
|
||||
if (st->ctx->Color.ColorMask[i][3])
|
||||
blend->rt[i].colormask |= PIPE_MASK_A;
|
||||
}
|
||||
|
||||
if (st->ctx->Color.DitherFlag)
|
||||
blend->dither = 1;
|
||||
|
||||
@@ -224,19 +224,19 @@ clear_with_quad(GLcontext *ctx,
|
||||
{
|
||||
struct pipe_blend_state blend;
|
||||
memset(&blend, 0, sizeof(blend));
|
||||
blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE;
|
||||
blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
|
||||
if (color) {
|
||||
if (ctx->Color.ColorMask[0][0])
|
||||
blend.colormask |= PIPE_MASK_R;
|
||||
blend.rt[0].colormask |= PIPE_MASK_R;
|
||||
if (ctx->Color.ColorMask[0][1])
|
||||
blend.colormask |= PIPE_MASK_G;
|
||||
blend.rt[0].colormask |= PIPE_MASK_G;
|
||||
if (ctx->Color.ColorMask[0][2])
|
||||
blend.colormask |= PIPE_MASK_B;
|
||||
blend.rt[0].colormask |= PIPE_MASK_B;
|
||||
if (ctx->Color.ColorMask[0][3])
|
||||
blend.colormask |= PIPE_MASK_A;
|
||||
blend.rt[0].colormask |= PIPE_MASK_A;
|
||||
if (st->ctx->Color.DitherFlag)
|
||||
blend.dither = 1;
|
||||
}
|
||||
|
||||
@@ -314,4 +314,14 @@ void st_init_extensions(struct st_context *st)
|
||||
if (st->pipe->render_condition) {
|
||||
ctx->Extensions.NV_conditional_render = GL_TRUE;
|
||||
}
|
||||
|
||||
if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_ENABLE)) {
|
||||
ctx->Extensions.EXT_draw_buffers2 = GL_TRUE;
|
||||
}
|
||||
|
||||
#if 0 /* not yet */
|
||||
if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_FUNC)) {
|
||||
ctx->Extensions.ARB_draw_buffers_blend = GL_TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user