diff options
author | Roland Scheidegger <[email protected]> | 2014-04-23 20:23:07 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2014-04-25 19:29:30 +0200 |
commit | a7a03d84fc1a7a1721b4a0338258b3b8687743e8 (patch) | |
tree | 8bc467cb6e41c865f6a0039cc954db347ec6c750 /src/gallium/drivers/llvmpipe/lp_rast.h | |
parent | fa4082320acaf0a1a22ae56144eef94b2997818d (diff) |
llvmpipe: fix clearing of individual color buffers in a fb
GL (3.0) allows you to clear individual color buffers in a fb. In fact
for fbs containing both int and float/normalized color buffers this is
required (because the clearing values are otherwise undefined if applied
to all buffers). The gallium interface was changed a while ago, but llvmpipe
ignored it (hence doing such individual clears always resulted in clearing
all buffers, plus some assorted asserts due to the mixed fbs).
So change the clear command to indicate the buffer to be cleared. Also, because
indicating the buffer to be cleared would have made lp_rast_arg_cmd larger
which is unacceptable (we're trying to shrink it some day) allocate the clear
value in the scene and just pass a pointer.
There's several advantages and disadvantages here:
+ clearing individual buffers works (we could also actually bin such clears now
if they'd come through clear_render_target() if the surface is in the current
fb, though we didn't do this before for the single rb case and still don't try).
+ since there's one clear per rb, we do the format conversion in setup rather
than per bin. Aside from the (drop in the ocean...) performance advantage this
means that clearing to very small values (that is, denormal when converted to
the format) should work for small float (fp16 etc.) formats, as the util code
couldn't handle it correctly before (because cpu denorms are disabled when
executing the bin commands, screwing up the magic conversion and flushing
the values to 0, though this was not verified).
- there's some overhead for traditional old-style clear-all MRT cases, since
there's one rast clear command per rb instead of one for all rbs.
This fixes https://bugs.freedesktop.org/show_bug.cgi?id=76976.
v2: get rid of the ugly manual memcpy stuff and just use union util_color.
This is 32 bytes instead of 16 but as the allocation is per scene we can live
with those additional 16 bytes (and the additional 128 bytes in the setup
context), which makes the code much more obvious. Suggested by Brian.
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_rast.h')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_rast.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index e2a9ec20892..6bd917d962f 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -38,6 +38,7 @@ #define LP_RAST_H #include "pipe/p_compiler.h" +#include "util/u_pack_color.h" #include "lp_jit.h" @@ -136,6 +137,12 @@ struct lp_rast_triangle { }; +struct lp_rast_clear_rb { + union util_color color_val; + unsigned cbuf; +}; + + #define GET_A0(inputs) ((float (*)[4])((inputs)+1)) #define GET_DADX(inputs) ((float (*)[4])((char *)((inputs) + 1) + (inputs)->stride)) #define GET_DADY(inputs) ((float (*)[4])((char *)((inputs) + 1) + 2 * (inputs)->stride)) @@ -164,7 +171,7 @@ union lp_rast_cmd_arg { unsigned plane_mask; } triangle; const struct lp_rast_state *set_state; - union pipe_color_union clear_color; + const struct lp_rast_clear_rb *clear_rb; struct { uint64_t value; uint64_t mask; |