1*61046927SAndroid Build Coastguard Worker.. _blend: 2*61046927SAndroid Build Coastguard Worker 3*61046927SAndroid Build Coastguard WorkerBlend 4*61046927SAndroid Build Coastguard Worker===== 5*61046927SAndroid Build Coastguard Worker 6*61046927SAndroid Build Coastguard WorkerThis state controls blending of the final fragments into the target rendering 7*61046927SAndroid Build Coastguard Workerbuffers. 8*61046927SAndroid Build Coastguard Worker 9*61046927SAndroid Build Coastguard WorkerBlend Factors 10*61046927SAndroid Build Coastguard Worker------------- 11*61046927SAndroid Build Coastguard Worker 12*61046927SAndroid Build Coastguard WorkerThe blend factors largely follow the same pattern as their counterparts 13*61046927SAndroid Build Coastguard Workerin other modern and legacy drawing APIs. 14*61046927SAndroid Build Coastguard Worker 15*61046927SAndroid Build Coastguard WorkerDual source blend factors are supported for up to 1 MRT, although 16*61046927SAndroid Build Coastguard Workeryou can advertise > 1 MRT, the stack cannot handle them for a few reasons. 17*61046927SAndroid Build Coastguard WorkerThere is no definition on how the 1D array of shader outputs should be mapped 18*61046927SAndroid Build Coastguard Workerto something that would be a 2D array (location, index). No current hardware 19*61046927SAndroid Build Coastguard Workerexposes > 1 MRT, and we should revisit this issue if anyone ever does. 20*61046927SAndroid Build Coastguard Worker 21*61046927SAndroid Build Coastguard WorkerLogical Operations 22*61046927SAndroid Build Coastguard Worker------------------ 23*61046927SAndroid Build Coastguard Worker 24*61046927SAndroid Build Coastguard WorkerLogical operations, also known as logicops, LOPs, or ROPs, are supported. 25*61046927SAndroid Build Coastguard WorkerOnly two-operand logicops are available. When logicops are enabled, all other 26*61046927SAndroid Build Coastguard Workerblend state is ignored, including per-render-target state, so logicops are 27*61046927SAndroid Build Coastguard Workerperformed on all render targets. 28*61046927SAndroid Build Coastguard Worker 29*61046927SAndroid Build Coastguard Worker.. warning:: 30*61046927SAndroid Build Coastguard Worker The blend_enable flag is ignored for all render targets when logical 31*61046927SAndroid Build Coastguard Worker operations are enabled. 32*61046927SAndroid Build Coastguard Worker 33*61046927SAndroid Build Coastguard WorkerFor a source component ``s`` and destination component ``d``, the logical 34*61046927SAndroid Build Coastguard Workeroperations are defined as taking the bits of each channel of each component, 35*61046927SAndroid Build Coastguard Workerand performing one of the following operations per-channel: 36*61046927SAndroid Build Coastguard Worker 37*61046927SAndroid Build Coastguard Worker================== ========================= 38*61046927SAndroid Build Coastguard WorkerOperation Equation 39*61046927SAndroid Build Coastguard Worker================== ========================= 40*61046927SAndroid Build Coastguard Worker``CLEAR`` :math:`0` 41*61046927SAndroid Build Coastguard Worker``NOR`` :math:`\lnot(s \lor d)` 42*61046927SAndroid Build Coastguard Worker``AND_INVERTED`` :math:`\lnot s \land d` 43*61046927SAndroid Build Coastguard Worker``COPY_INVERTED`` :math:`\lnot s` 44*61046927SAndroid Build Coastguard Worker``AND_REVERSE`` :math:`s \land \lnot d` 45*61046927SAndroid Build Coastguard Worker``INVERT`` :math:`\lnot d` 46*61046927SAndroid Build Coastguard Worker``XOR`` :math:`s \oplus d` 47*61046927SAndroid Build Coastguard Worker``NAND`` :math:`\lnot(s \land d)` 48*61046927SAndroid Build Coastguard Worker``AND`` :math:`s \land d` 49*61046927SAndroid Build Coastguard Worker``EQUIV`` :math:`\lnot(s \oplus d)` 50*61046927SAndroid Build Coastguard Worker``NOOP`` :math:`d` 51*61046927SAndroid Build Coastguard Worker``OR_INVERTED`` :math:`\lnot s \lor d` 52*61046927SAndroid Build Coastguard Worker``COPY`` :math:`s` 53*61046927SAndroid Build Coastguard Worker``OR_REVERSE`` :math:`s \lor \lnot d` 54*61046927SAndroid Build Coastguard Worker``OR`` :math:`s \lor d` 55*61046927SAndroid Build Coastguard Worker``SET`` :math:`1` 56*61046927SAndroid Build Coastguard Worker================== ========================= 57*61046927SAndroid Build Coastguard Worker 58*61046927SAndroid Build Coastguard Worker.. note:: 59*61046927SAndroid Build Coastguard Worker The logical operation names and definitions match those of the OpenGL API, 60*61046927SAndroid Build Coastguard Worker and are similar to the ROP2 and ROP3 definitions of GDI. This is 61*61046927SAndroid Build Coastguard Worker intentional, to ease transitions to Gallium. 62*61046927SAndroid Build Coastguard Worker 63*61046927SAndroid Build Coastguard WorkerMembers 64*61046927SAndroid Build Coastguard Worker------- 65*61046927SAndroid Build Coastguard Worker 66*61046927SAndroid Build Coastguard WorkerThese members affect all render targets. 67*61046927SAndroid Build Coastguard Worker 68*61046927SAndroid Build Coastguard Workerdither 69*61046927SAndroid Build Coastguard Worker Whether dithering is enabled. 70*61046927SAndroid Build Coastguard Worker 71*61046927SAndroid Build Coastguard Worker .. note:: 72*61046927SAndroid Build Coastguard Worker Dithering is completely implementation-dependent. It may be ignored by 73*61046927SAndroid Build Coastguard Worker drivers for any reason, and some render targets may always or never be 74*61046927SAndroid Build Coastguard Worker dithered depending on their format or usage flags. 75*61046927SAndroid Build Coastguard Worker 76*61046927SAndroid Build Coastguard Workerlogicop_enable 77*61046927SAndroid Build Coastguard Worker Whether the blender should perform a logicop instead of blending. 78*61046927SAndroid Build Coastguard Workerlogicop_func 79*61046927SAndroid Build Coastguard Worker The logicop to use. One of ``PIPE_LOGICOP``. 80*61046927SAndroid Build Coastguard Workerindependent_blend_enable 81*61046927SAndroid Build Coastguard Worker If enabled, blend state is different for each render target, and 82*61046927SAndroid Build Coastguard Worker for each render target set in the respective member of the rt array. 83*61046927SAndroid Build Coastguard Worker If disabled, blend state is the same for all render targets, and only 84*61046927SAndroid Build Coastguard Worker the first member of the rt array contains valid data. 85*61046927SAndroid Build Coastguard Workerrt 86*61046927SAndroid Build Coastguard Worker Contains the per-rendertarget blend state. 87*61046927SAndroid Build Coastguard Workeralpha_to_coverage 88*61046927SAndroid Build Coastguard Worker If enabled, the fragment's alpha value is used to override the fragment's 89*61046927SAndroid Build Coastguard Worker coverage mask. The coverage mask will be all zeros if the alpha value is 90*61046927SAndroid Build Coastguard Worker zero. The coverage mask will be all ones if the alpha value is one. 91*61046927SAndroid Build Coastguard Worker Otherwise, the number of bits set in the coverage mask will be proportional 92*61046927SAndroid Build Coastguard Worker to the alpha value. Note that this step happens regardless of whether 93*61046927SAndroid Build Coastguard Worker multisample is enabled or the destination buffer is multisampled. 94*61046927SAndroid Build Coastguard Workeralpha_to_one 95*61046927SAndroid Build Coastguard Worker If enabled, the fragment's alpha value will be set to one. As with 96*61046927SAndroid Build Coastguard Worker alpha_to_coverage, this step happens regardless of whether multisample 97*61046927SAndroid Build Coastguard Worker is enabled or the destination buffer is multisampled. 98*61046927SAndroid Build Coastguard Workermax_rt 99*61046927SAndroid Build Coastguard Worker The index of the max render target (irrespective of whether independent 100*61046927SAndroid Build Coastguard Worker blend is enabled), i.e. the number of MRTs minus one. This is provided 101*61046927SAndroid Build Coastguard Worker so that the driver can avoid the overhead of programming unused MRTs. 102*61046927SAndroid Build Coastguard Worker 103*61046927SAndroid Build Coastguard Worker 104*61046927SAndroid Build Coastguard WorkerPer-rendertarget Members 105*61046927SAndroid Build Coastguard Worker------------------------ 106*61046927SAndroid Build Coastguard Worker 107*61046927SAndroid Build Coastguard Workerblend_enable 108*61046927SAndroid Build Coastguard Worker If blending is enabled, perform a blend calculation according to blend 109*61046927SAndroid Build Coastguard Worker functions and source/destination factors. Otherwise, the incoming fragment 110*61046927SAndroid Build Coastguard Worker color gets passed unmodified (but colormask still applies). 111*61046927SAndroid Build Coastguard Workerrgb_func 112*61046927SAndroid Build Coastguard Worker The blend function to use for RGB channels. One of PIPE_BLEND. 113*61046927SAndroid Build Coastguard Workerrgb_src_factor 114*61046927SAndroid Build Coastguard Worker The blend source factor to use for RGB channels. One of PIPE_BLENDFACTOR. 115*61046927SAndroid Build Coastguard Workerrgb_dst_factor 116*61046927SAndroid Build Coastguard Worker The blend destination factor to use for RGB channels. One of PIPE_BLENDFACTOR. 117*61046927SAndroid Build Coastguard Workeralpha_func 118*61046927SAndroid Build Coastguard Worker The blend function to use for the alpha channel. One of PIPE_BLEND. 119*61046927SAndroid Build Coastguard Workeralpha_src_factor 120*61046927SAndroid Build Coastguard Worker The blend source factor to use for the alpha channel. One of PIPE_BLENDFACTOR. 121*61046927SAndroid Build Coastguard Workeralpha_dst_factor 122*61046927SAndroid Build Coastguard Worker The blend destination factor to use for alpha channel. One of PIPE_BLENDFACTOR. 123*61046927SAndroid Build Coastguard Workercolormask 124*61046927SAndroid Build Coastguard Worker Bitmask of which channels to write. Combination of PIPE_MASK bits. 125