[Mesa-dev] [PATCH 2/5] st/mesa: don't check for ARB_draw_buffers_blend in update_blend
Roland Scheidegger
sroland at vmware.com
Wed Feb 7 23:14:19 UTC 2018
Am 07.02.2018 um 23:56 schrieb Timothy Arceri:
>
> On 01/02/18 06:55, Marek Olšák wrote> From: Marek Olšák
> <marek.olsak at amd.com>
>>
>> If the GL API is missing, different blend functions can't be set
>> through GL.
>
> Looking at the commit that added this a476ca1fd1b4e7 the commit message is:
>
> "st/mesa: Use blend equation and function of first render target for all
> render targets if ARB_draw_buffers_blend is not supported
>
> If EXT_draw_buffers2 is supported but ARB_draw_buffers_blend isn't
> _mesa_BlendFuncSeparateEXT only sets up the blend equation and
> function for the
> first render target. This patch makes sure that update_blend doesn't
> try to use
> the data from other rendertargets in such cases"
>
> So it seems to me that before this patch we should probably have a patch
> the commbines the two caps PIPE_CAP_INDEP_BLEND_ENABLE and
> PIPE_CAP_INDEP_BLEND_FUNC.
There's definitely hw supported by gallium drivers which can do the
first(including separate color write masks) but not the second, as this
matches the requirements of dx10.0 (not 10.1).
nouveau supports some such chips, I believe r600 (the chip, not the
family) should fall into that category too albeit it says no to both
currently.
Roland
> If you agree that patch and this one are:
>
> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
>
>
>> ---
>> src/mesa/state_tracker/st_atom_blend.c | 20 ++++++++------------
>> 1 file changed, 8 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/mesa/state_tracker/st_atom_blend.c
>> b/src/mesa/state_tracker/st_atom_blend.c
>> index f7327d6..8f644ba 100644
>> --- a/src/mesa/state_tracker/st_atom_blend.c
>> +++ b/src/mesa/state_tracker/st_atom_blend.c
>> @@ -138,72 +138,68 @@ blend_per_rt(const struct gl_context *ctx)
>> }
>> return GL_FALSE;
>> }
>> void
>> st_update_blend( struct st_context *st )
>> {
>> struct pipe_blend_state *blend = &st->state.blend;
>> const struct gl_context *ctx = st->ctx;
>> unsigned num_state = 1;
>> - unsigned i, j;
>> + unsigned i;
>> memset(blend, 0, sizeof(*blend));
>> if (blend_per_rt(ctx) || colormask_per_rt(ctx)) {
>> num_state = ctx->Const.MaxDrawBuffers;
>> blend->independent_blend_enable = 1;
>> }
>> if (ctx->Color.ColorLogicOpEnabled) {
>> /* logicop enabled */
>> blend->logicop_enable = 1;
>> blend->logicop_func = ctx->Color._LogicOp;
>> }
>> else if (ctx->Color.BlendEnabled &&
>> !ctx->Color._AdvancedBlendMode) {
>> /* blending enabled */
>> - for (i = 0, j = 0; i < num_state; i++) {
>> -
>> + for (i = 0; i < num_state; i++) {
>> blend->rt[i].blend_enable = (ctx->Color.BlendEnabled >> i)
>> & 0x1;
>> - if (ctx->Extensions.ARB_draw_buffers_blend)
>> - j = i;
>> -
>> blend->rt[i].rgb_func =
>> - translate_blend(ctx->Color.Blend[j].EquationRGB);
>> + translate_blend(ctx->Color.Blend[i].EquationRGB);
>> if (ctx->Color.Blend[i].EquationRGB == GL_MIN ||
>> ctx->Color.Blend[i].EquationRGB == 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(ctx->Color.Blend[j].SrcRGB);
>> + translate_blend(ctx->Color.Blend[i].SrcRGB);
>> blend->rt[i].rgb_dst_factor =
>> - translate_blend(ctx->Color.Blend[j].DstRGB);
>> + translate_blend(ctx->Color.Blend[i].DstRGB);
>> }
>> blend->rt[i].alpha_func =
>> - translate_blend(ctx->Color.Blend[j].EquationA);
>> + translate_blend(ctx->Color.Blend[i].EquationA);
>> if (ctx->Color.Blend[i].EquationA == GL_MIN ||
>> ctx->Color.Blend[i].EquationA == 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(ctx->Color.Blend[j].SrcA);
>> + translate_blend(ctx->Color.Blend[i].SrcA);
>> blend->rt[i].alpha_dst_factor =
>> - translate_blend(ctx->Color.Blend[j].DstA);
>> + translate_blend(ctx->Color.Blend[i].DstA);
>> }
>> }
>> }
>> else {
>> /* no blending / logicop */
>> }
>> for (i = 0; i < num_state; i++)
>> blend->rt[i].colormask = GET_COLORMASK(ctx->Color.ColorMask, i);
>>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=_QIjpv-UJ77xEQY8fIYoQtr5qv8wKrPJc7v7_-CYAb0&m=S-7KXCW-ZrPzkqh0QSCqGFHboh85fOwNbqY4RDww30k&s=9PQfAv2xRCD8_20H28DJc9hydhOOT_vwoXMrGls77dw&e=
>
More information about the mesa-dev
mailing list