summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
AgeCommit message (Collapse)AuthorFilesLines
2017-11-21llvmpipe: fix snorm blendingRoland Scheidegger1-20/+33
The blend math gets a bit funky due to inverse blend factors being in range [0,2] rather than [-1,1], our normalized math can't really cover this. src_alpha_saturate blend factor has a similar problem too. (Note that piglit fbo-blending-formats test is mostly useless for anything but unorm formats, since not just all src/dst values are between [0,1], but the tests are crafted in a way that the results are between [0,1] too.) v2: some formatting fixes, and fix a fairly obscure (to debug) issue with alpha-only formats (not related to snorm at all), where blend optimization would think it could simplify the blend equation if the blend factors were complementary, however was using the completely unrelated rgb blend factors instead of the alpha ones... Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2017-01-06llvmpipe: use alpha from already converted color if possibleRoland Scheidegger1-7/+22
For rgbx formats, there is no point in doing alpha conversion again (and with different tranpose even, so llvm can't eliminate it). Albeit it looks like there's some minimal changes needed in the blend code (found by code inspection, no test seemed to complain) if we do this - the blend factors are already sanitized if we have no destination alpha, however for src_alpha_saturate it looks like it still might make a difference (note that we forced has_alpha to true before for some formats and nothing complained, but this seems safer). Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-04-22gallium: merge PIPE_SWIZZLE_* and UTIL_FORMAT_SWIZZLE_*Marek Olšák1-4/+4
Use PIPE_SWIZZLE_* everywhere. Use X/Y/Z/W/0/1 instead of RED, GREEN, BLUE, ALPHA, ZERO, ONE. The new enum is called pipe_swizzle. Acked-by: Jose Fonseca <jfonseca@vmware.com>
2014-03-20llvmpipe: Tighten check for alpha-only formatsRichard Sandiford1-1/+1
The AoS version of ld_build_blend_factor was assuming that if the first channel was alpha, there were no rgb components. Fixes glean/blendFunc on System z. No piglit regressions on x86_64. The shortcut is still used in tests like spec/ARB_framebuffer_object/ fbo-alpha. Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
2013-07-18llvmpipe: fix blending with SRC_ALPHA_SATURATE with some formats without alphaRoland Scheidegger1-4/+14
We were fixing up the blend factor to ZERO, however this only works correctly with fixed point render buffers where the input values are clamped to 0/1 (because src_alpha_saturate is min(As, 1-Ad) so can be negative with unclamped inputs). Haven't seen any failure anywhere due to that with fixed point SNORM buffers (which clamp inputs to -1/1) but it should apply there as well (snorm blending is rare, even opengl 4.3 doesn't require snorm rendertargets at all, d3d10 requires them but they are not blendable). Doesn't look like piglit hits this though (some internal testing hits the float case at least). (With legacy OpenGL we could theoretically still use the fixup to zero if the fragment color clamp is enabled, but we can't detect that easily since we don't support native clamping hence it gets baked into the shader.) Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
2013-02-12llvmpipe: implement dual source blendingRoland Scheidegger1-2/+11
link up the fs outputs and blend inputs, and make sure the second blend source is correctly loaded and converted (which is quite complex). There's a slight refactoring of the monster generate_unswizzled_blend() function where it makes sense to factor out alpha conversion (which needs to run twice for dual source blend). This passes piglit arb_blend_func_extended tests. v2: remove new but ultimately not used function... Reviewed-by: Brian Paul <brianp@vmware.com>
2013-02-08llvmpipe: first steps of adding dual source blend supportRoland Scheidegger1-6/+6
This adds support of the additional blending factors to the blend function itself, and also enables testing of it in lp_test_blend (which passes). Still need to add the glue code of linking fs shader outputs to blend inputs in llvmpipe, and probably need to add special handling if destination doesn't include alpha (which lp_test_blend doesn't test). Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2013-02-06llvmpipe: remove extraneous const qualifierBrian Paul1-1/+1
2013-01-18llvmpipe: fix using wrong format with MRT in blend codeRoland Scheidegger1-3/+3
We were passing in the rt index however this was always 0 for non-independent blend case. (The format was only actually used to decide if the color mask covered all channels so this went unnoticed and was discovered by accident.) Additionally, there was a second problem because we do fixups in the key based on color buffer format we cannot use non-independent blend anyway as the fixed up values would never get used. So always turn non-independent blending into independent. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
2012-11-28llvmpipe: Implement logic ops for the AoS path.José Fonseca1-1/+8
It was forgotten in the previous patch series, but it is trivial to implement, based on the SoA path. This fixes glean logicOp failures.
2012-11-28llvmpipe: Unswizzled rendering.James Benton1-28/+69
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2012-11-28gallivm: Updated lp_build_const_mask_aos to input number of channels.James Benton1-1/+4
Also updated lp_build_const_mask_aos_swizzled to reflect this. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2012-07-16llvmpipe: Unified common code between AoS and SoA blending.James Benton1-100/+52
Added a new file lp_bld_blend.c for the common code. Merged and added some simple optimisations. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2012-05-02gallivm: Added lp_build_const_mask_aos_swizzledJames Benton1-9/+1
Allows the creation of const aos masks which have the mask swizzled to match the correct format. Updated existing mask creation code to use the swizzled version where necessary (tgsi register masks and llvmpipe aos blending). Signed-off-by: José Fonseca <jfonseca@vmware.com>
2012-05-02llvmpipe: add masking support to aos blendJames Benton1-5/+33
Signed-off-by: José Fonseca <jfonseca@vmware.com>
2012-05-02llvmpipe: Added support for color masks in AoS blending.James Benton1-25/+50
Signed-off-by: José Fonseca <jfonseca@vmware.com>
2010-11-30gallivm/llvmpipe: squash merge of the llvm-context branchBrian Paul1-2/+2
This branch defines a gallivm_state structure which contains the LLVMBuilderRef, LLVMContextRef, etc. All data structures built with this object can be periodically freed during a "garbage collection" operation. The gallivm_state object has to be passed to most of the builder functions where LLVMBuilderRef used to be used. Conflicts: src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c src/gallium/drivers/llvmpipe/lp_state_setup.c
2010-09-22llvmpipe: Special case complementary and identify blend factors in SoA.José Fonseca1-3/+0
One multiplication instead of two. Also fix floating point random number generation and verification. TODO: Do the same for AoS blending.
2010-09-11gallivm: s/lp_build_broadcast_aos/lp_build_swizzle_scalar_aos/José Fonseca1-1/+1
More accurate description of this function purpose.
2010-09-05gallivm: Pass condition masks as an unsigned bitmask.José Fonseca1-3/+2
Much more convenient than boolean arrays.
2010-07-01llvmpipe: Remove lp_build_swizzle2_aos().José Fonseca1-22/+19
Unnecessary special case.
2010-05-10llvmpipe: fix up indexing of blend/colormask state for render targetsBrian Paul1-12/+12
2010-05-10llvmpipe: add, update, rewrap commentsBrian Paul1-0/+3
2010-04-16llvmpipe: remove unneeded break stmtBrian Paul1-1/+0
2010-04-16gallivm/llvmpipe: move lp_bld_blend* files to llvmpipe/ directoryBrian Paul1-0/+361
2010-02-08llvmpipe: export the tgsi translation code to a common layerZack Rusin1-360/+0
the llvmpipe tgsi translation is a lot more complete than what was in gallivm so replacing the latter with the former. this is needed since the draw llvm paths will use the same code. effectively the proven llvmpipe code becomes gallivm.
2010-02-02gallium: Make pipe_atomic a regular int32_t.José Fonseca1-0/+1
2010-01-20llvmpipe: adapt to per-rendertarget blend changesRoland Scheidegger1-8/+11
2010-01-03llvmpipe: Remove comma at end of enumerator list.Vinson Lee1-1/+1
2009-09-14llvmpipe: Make lp_type a regular union.José Fonseca1-1/+1
Union not worth the hassle of violating C99 or adding a name to the structure.
2009-08-29llvmpipe: Add a bunch of comments.José Fonseca1-1/+10
Description/rationale/to-do items, while I still remember them...
2009-08-29llvmpipe: Debug helper function to name llvm intermediate values.José Fonseca1-4/+3
2009-08-29llvmpipe: Move lp_build_select to lp_bld_logic.[ch].José Fonseca1-0/+1
2009-08-29llvmpipe: Code generate color masking.José Fonseca1-0/+3
2009-08-29llvmpipe: Handle disabled blending too.José Fonseca1-0/+3
2009-08-29llvmpipe: SoA blending.José Fonseca1-0/+341
Throughput seems to be 4x higher.