Commit Graph

20 Commits

Author SHA1 Message Date
Dave Airlie 876db77bae llvmpipe/fs: handle unrestricted depth values.
It moves the explicit clamping of incoming Z from vertex stages
after interp, to the depth clamp function.

It adds support to the depth clamp function to restrict incoming
Z values to 0..1 range.

It fixes the depth test conversions to allow unrestricted depth
values.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17612>
2022-07-28 10:36:00 +10:00
Marek Olšák 912ba743b5 gallium: inline pipe_depth_state to decrease DSA state size by 4 bytes
Depth and alpha states are now packed together, interleaved somewhat.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7940>
2020-12-22 12:01:38 +00:00
Dave Airlie 5e949b16c1 llvmpipe: add per-sample depth/stencil test
The current depth stencil test code has some optimisations using
the mask when there is only one depth value, multisample requires
per-sample zstencil testing, and for that case just pass in the
mask that needs updating.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
2020-05-06 06:20:37 +00:00
Dave Airlie d297f2ecf1 llvmpipe: move getting mask value out of depth code. (v2)
In order to add per-sample support to this code, the mask
value is needed not the value from the exec mask.

v2: update comment

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
2020-05-06 06:20:37 +00:00
Roland Scheidegger ffe2a1ca3c llvmpipe: reduce alignment requirement for 1d resources from 4x4 to 4x1
For rendering to buffers, we cannot have any y alignment.
So make sure that tile clear commands only clear up to the fb width/height,
not more (do this for all resources actually as clearing more seems
pointless for other resources too). For the jit fs function, skip execution
of the lower half of the fragment shader for the 4x4 stamp completely,
for depth/stencil only load/store the values from the first row
(replace other row with undef).
For the blend function, also only load half the values from fs output,
replace the rest with undefs so that everything still operates on the
full 4x4 block to keep code the same between 4x1 and 4x4 (except for
load/store of course which also needs to skip (store) or replace these
values with undefs (load))., at the cost of slightly less optimal code
being produced in some cases.
Also reduce 1d and 1d array alignment too, because they can be handled the
same as buffers so don't need to waste memory.

v2: don't try to run special blend code for 4x1, (very) slightly less
complexity if we just use the same code as for 4x4 which may or may not
make it easier to optimize in the future (as we care a lot more about 4x4
performance than 1d).

v2: don't use undef values for unused fs src outputs with llvm 3.1 as it
apparently can trigger a bug in llvm.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-06-05 00:29:47 +02:00
Roland Scheidegger 070a9afb54 llvmpipe: handle z32s8x24 depth/stencil format
We need to split up the depth and stencil values in this case, and there's
some new logic required to handle float depth and stencil simultaneously.
Also make sure we get the 64bit zs clear values and masks propagated
correctly.
2013-05-18 00:32:33 +02:00
Roland Scheidegger ae507b6260 llvmpipe: get rid of depth swizzling.
Eliminating this we no longer need to copy between linear and swizzled layout.
This is probably not quite ideal since it's a bit more work for now, could do
some optimizations by moving depth testing outside the fragment shader loop
(but tricky for early depth test as we don't have neither the mask nor the
interpolated z in the right order handy).
The large amount of tile/untile code is no longer needed will be deleted
in next commit.
No piglit regressions.
v2: change a forgotten LAYOUT_NONE to LAYOUT_LINEAR.
v3: fix (bogus) uninitialized variable warnings, add comments, fix a bad type

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-05-03 21:36:20 +02:00
José Fonseca 0ca384fb39 llvmpipe: Support Z16_UNORM as depth-stencil format.
Simply by adjusting the vector element width after/before
reading/writing the depth-stencil values.

Ran several GL_DEPTH_COMPONENT16 piglit tests without regressions.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2013-01-29 07:06:36 +00:00
Vinson Lee c72eb72ca6 llvmpipe: Include missing headers in lp_bld_depth.h
Include p_compiler.h for boolean symbol.
Include p_state.h for pipe_stencil_state symbol.
2011-01-04 00:54:14 -08:00
Brian Paul efc82aef35 gallivm/llvmpipe: squash merge of the llvm-context branch
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-11-30 16:35:12 -07:00
José Fonseca 95c18abb03 llvmpipe: Unbreak Z32_FLOAT.
Z32_FLOAT uses <4 x float> as intermediate/destination type,
instead of <4 x i32>.

The necessary bitcasts got removed with commit
5b7eb868fd

Also use depth/stencil type and build contexts consistently, and
make the depth pointer argument a ordinary <i8 *>, to catch this
sort of issues in the future (and also to pave way for Z16 and
Z32_FLOAT_S8_X24 support).
2010-10-13 15:25:15 +01:00
Keith Whitwell 5b7eb868fd llvmpipe: clean up shader pre/postamble, try to catch more early-z
Specifically, can do early-depth-test even when alpahtest or
kill-pixel are active, providing we defer the actual z write until the
final mask is avaialable.

Improves demos/fire.c especially in the case where you get close to
the trees.
2010-10-09 11:44:45 +01:00
Keith Whitwell aa4cb5e2d8 llvmpipe: try to be sensible about whether to branch after mask updates
Don't branch more than once in quick succession.  Don't branch at the
end of the shader.
2010-10-09 11:44:45 +01:00
Qicheng Christopher Li 86afe8250e llvmpipe: implement occlusion query
OpenGL occlusion queries work now.  The Mesa demos, glean test and piglit
tests all pass.  A few enhancements are possible in the future. -Brian

Signed-off-by: Brian Paul <brianp@vmware.com>
2010-05-06 11:45:45 -06:00
Brian Paul f17d1513ac gallivm/llvmpipe: move lp_bld_depth.[ch] to llvmpipe/ directory
This is specific to the llvmpipe driver and not re-usable.
2010-04-16 10:20:32 -06:00
Zack Rusin c61bf36393 llvmpipe: export the tgsi translation code to a common layer
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-08 18:22:11 -05:00
José Fonseca b4835ea03d llvmpipe: Make lp_type a regular union.
Union not worth the hassle of violating C99 or adding a name to
the structure.
2009-09-14 11:05:38 +01:00
José Fonseca 5811ed87d7 llvmpipe: Add a bunch of comments.
Description/rationale/to-do items, while I still remember them...
2009-08-29 09:21:40 +01:00
José Fonseca 3d7a88674f llvmpipe: Early depth testing. 2009-08-29 09:21:39 +01:00
José Fonseca 343ccc8dd0 llvmpipe: Depth test to LLVM IR translation. 2009-08-29 09:21:38 +01:00