lima: implement logicops
v2: - deactivate pixel kill when doing logic operations v3: - Renamed "Logic Op" - Added translating function (PIPE_LOGICOP_* to LIMA_LOGIC_OP_*) v4: - Updated CI expectations Reviewed-by: Erico Nunes <nunes.erico@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36537>
This commit is contained in:
@@ -489,21 +489,6 @@ spec@!opengl 1.0@gl-1.0-drawbuffer-modes,Fail
|
||||
spec@!opengl 1.0@gl-1.0-edgeflag-const,Fail
|
||||
spec@!opengl 1.0@gl-1.0-edgeflag,Fail
|
||||
spec@!opengl 1.0@gl-1.0-edgeflag-quads,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_AND,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_AND_INVERTED,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_AND_REVERSE,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_CLEAR,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_COPY_INVERTED,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_EQUIV,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_INVERT,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_NAND,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_NOOP,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_NOR,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_OR,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_OR_INVERTED,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_OR_REVERSE,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_SET,Fail
|
||||
spec@!opengl 1.0@gl-1.0-logicop@GL_XOR,Fail
|
||||
spec@!opengl 1.0@gl-1.0-no-op-paths,Fail
|
||||
spec@!opengl 1.0@gl-1.0-ortho-pos,Fail
|
||||
spec@!opengl 1.0@gl-1.0-rastercolor,Fail
|
||||
@@ -511,7 +496,6 @@ spec@!opengl 1.0@gl-1.0-scissor-bitmap,Fail
|
||||
spec@!opengl 1.0@gl-1.0-swapbuffers-behavior,Fail
|
||||
spec@!opengl 1.0@gl-1.0-user-clip-all-planes,Fail
|
||||
spec@!opengl 1.1@gl-1.1-xor-copypixels,Fail
|
||||
spec@!opengl 1.1@gl-1.1-xor,Fail
|
||||
spec@!opengl 1.1@line-flat-clip-color,Fail
|
||||
spec@!opengl 1.1@linestipple@Factor 2x,Fail
|
||||
spec@!opengl 1.1@linestipple@Factor 3x,Fail
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<value name="Subtract" value="0"/>
|
||||
<value name="Reverse Subtract" value="1"/>
|
||||
<value name="Add" value="2"/>
|
||||
<value name="Logicop" value="3"/>
|
||||
<value name="Min" value="4"/>
|
||||
<value name="Max" value="5"/>
|
||||
</enum>
|
||||
@@ -100,6 +101,24 @@
|
||||
<value name="One" value="11"/>
|
||||
<value name="INV SRC1 Alpha" value="13"/>
|
||||
</enum>
|
||||
<enum name="Logic Op">
|
||||
<value name="CLEAR" value="0"/>
|
||||
<value name="NOR" value="1"/>
|
||||
<value name="AND Inverted" value="2"/>
|
||||
<value name="COPY Inverted" value="3"/>
|
||||
<value name="AND Reverse" value="4"/>
|
||||
<value name="INVERT" value="5"/>
|
||||
<value name="XOR" value="6"/>
|
||||
<value name="NAND" value="7"/>
|
||||
<value name="AND" value="8"/>
|
||||
<value name="EQUIV" value="9"/>
|
||||
<value name="NOOP" value="10"/>
|
||||
<value name="OR Inverted" value="11"/>
|
||||
<value name="COPY" value="12"/>
|
||||
<value name="OR Reverse" value="13"/>
|
||||
<value name="OR" value="14"/>
|
||||
<value name="SET" value="15"/>
|
||||
</enum>
|
||||
<enum name="Draw mode">
|
||||
<value name="Points" value="0"/>
|
||||
<value name="Lines" value="1"/>
|
||||
@@ -258,8 +277,10 @@
|
||||
<field name="Blend Color A" start="1:16" size="8" type="unorm8"/>
|
||||
<field name="Blend Func RGB" start="2:0" size="3" type="Blend Func"/>
|
||||
<field name="Blend Func A" start="2:3" size="3" type="Blend Func"/>
|
||||
<field name="Logicop RGB" start="2:6" size="4" type="Logic Op"/>
|
||||
<field name="Blend Factor SRC RGB" start="2:6" size="5" type="Blend Factor Color"/>
|
||||
<field name="Blend Factor DST RGB" start="2:11" size="5" type="Blend Factor Color"/>
|
||||
<field name="Logicop A" start="2:16" size="4" type="Logic Op"/>
|
||||
<field name="Blend Factor SRC A" start="2:16" size="4" type="Blend Factor Alpha"/>
|
||||
<field name="Blend Factor DST A" start="2:20" size="4" type="Blend Factor Alpha"/>
|
||||
<!-- 0xC for normal drawcalls, 0x0 for blits -->
|
||||
|
||||
@@ -583,6 +583,46 @@ lima_calculate_depth_test(struct LIMA_RENDER_STATE* state, struct pipe_depth_ste
|
||||
state->depth_offset_units = offset_units & 0xff;
|
||||
}
|
||||
|
||||
static enum lima_logic_op
|
||||
lima_logic_op(enum pipe_logicop pipe)
|
||||
{
|
||||
switch (pipe) {
|
||||
case PIPE_LOGICOP_CLEAR:
|
||||
return LIMA_LOGIC_OP_CLEAR;
|
||||
case PIPE_LOGICOP_NOR:
|
||||
return LIMA_LOGIC_OP_NOR;
|
||||
case PIPE_LOGICOP_AND_INVERTED:
|
||||
return LIMA_LOGIC_OP_AND_INVERTED;
|
||||
case PIPE_LOGICOP_COPY_INVERTED:
|
||||
return LIMA_LOGIC_OP_COPY_INVERTED;
|
||||
case PIPE_LOGICOP_AND_REVERSE:
|
||||
return LIMA_LOGIC_OP_AND_REVERSE;
|
||||
case PIPE_LOGICOP_INVERT:
|
||||
return LIMA_LOGIC_OP_INVERT;
|
||||
case PIPE_LOGICOP_XOR:
|
||||
return LIMA_LOGIC_OP_XOR;
|
||||
case PIPE_LOGICOP_NAND:
|
||||
return LIMA_LOGIC_OP_NAND;
|
||||
case PIPE_LOGICOP_AND:
|
||||
return LIMA_LOGIC_OP_AND;
|
||||
case PIPE_LOGICOP_EQUIV:
|
||||
return LIMA_LOGIC_OP_EQUIV;
|
||||
case PIPE_LOGICOP_NOOP:
|
||||
return LIMA_LOGIC_OP_NOOP;
|
||||
case PIPE_LOGICOP_OR_INVERTED:
|
||||
return LIMA_LOGIC_OP_OR_INVERTED;
|
||||
case PIPE_LOGICOP_COPY:
|
||||
return LIMA_LOGIC_OP_COPY;
|
||||
case PIPE_LOGICOP_OR_REVERSE:
|
||||
return LIMA_LOGIC_OP_OR_REVERSE;
|
||||
case PIPE_LOGICOP_OR:
|
||||
return LIMA_LOGIC_OP_OR;
|
||||
case PIPE_LOGICOP_SET:
|
||||
return LIMA_LOGIC_OP_SET;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *info)
|
||||
{
|
||||
@@ -598,8 +638,15 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in
|
||||
state.blend_color_a = ctx->blend_color.color[3];
|
||||
|
||||
struct pipe_rt_blend_state* rt = ctx->blend->base.rt;
|
||||
struct pipe_blend_state* bs = &ctx->blend->base;
|
||||
|
||||
if (rt->blend_enable) {
|
||||
if (bs->logicop_enable) {
|
||||
state.blend_func_rgb = LIMA_BLEND_FUNC_LOGICOP;
|
||||
state.blend_func_a = LIMA_BLEND_FUNC_LOGICOP;
|
||||
state.logicop_rgb = lima_logic_op(bs->logicop_func);
|
||||
state.logicop_a = lima_logic_op(bs->logicop_func);
|
||||
}
|
||||
else if (rt->blend_enable) {
|
||||
lima_calculate_alpha_blend(&state, rt);
|
||||
}
|
||||
else {
|
||||
@@ -699,7 +746,7 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in
|
||||
state.pixel_kill = false;
|
||||
}
|
||||
|
||||
if (rt->blend_enable)
|
||||
if (rt->blend_enable || bs->logicop_enable)
|
||||
state.pixel_kill = false;
|
||||
|
||||
state.color_mask = rt->colormask & PIPE_MASK_RGBA;
|
||||
|
||||
Reference in New Issue
Block a user