The SIMD16 replicated FB write message only works if we don't need the
color calculator to mask our framebuffer writes.  Previously, we bailed
on it if color_mask wasn't <true, true, true, true>.  However, this was
needlessly strict for formats with fewer than four components - only the
components that actually exist matter.

WebGL Aquarium attempts to clear a BGRX texture with the ColorMask set
to <true, true, true, false>.  This will work perfectly fine with the
replicated data message; we just bailed unnecessarily.

Improves performance of WebGL Aquarium on Iris Pro (at 1920x1080) and
Bay Trail (at 2048x1152) by about 40% (using Chrome 24).

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
Cc: Dylan Baker <baker.dyla...@gmail.com>
Cc: Keith Packard <kei...@keithp.com>
Cc: Eric Anholt <e...@anholt.net>
---
 src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 45b9fa0..7e19c2c 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -231,7 +231,7 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct 
brw_context *brw,
    /* Constant color writes ignore everyting in blend and color calculator
     * state.  This is not documented.
     */
-   for (int i = 0; i < 4; i++) {
+   for (int i = 0; i < _mesa_format_num_components(irb->mt->format); i++) {
       if (!color_mask[i]) {
          color_write_disable[i] = true;
          wm_prog_key.use_simd16_replicated_data = false;
-- 
1.9.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to