aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/loop_analysis.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-11-16 18:29:22 -0800
committerKenneth Graunke <[email protected]>2016-11-18 14:48:52 -0800
commitff0253a5ede3acb70852c224f1cf50357781ae81 (patch)
tree5caf8517956d87e3baceed1b58df05bb2f9e3c42 /src/compiler/glsl/loop_analysis.cpp
parentadb3a83c09c20babfa9f7f5b36bc61bbc36c9cb1 (diff)
i965: Disable depth writes when depth test is GL_EQUAL.
There's no point in performing depth writes when the depth test comparison function is set to GL_EQUAL - it would just write out the same value that's already there (if it is written at all). While this is harmless from a functional perspective, it hurts performance. Obviously, writing to memory is not free, but there's another more subtle impact as well: it can prevent early depth optimizations. Depth writes aren't supposed to happen for pixels that are killed by fragment shader discard statements or the alpha test. So, with depth writes enabled and either of those, the pixel shader must be invoked to determine whether or not to perform the write. This is fairly stupid in the EQUAL case - we're running a shader to decide whether to replace the existing depth value with itself. By disabling these pointless writes, we allow early depth even with discards and alpha testing, allowing the hardware to skip the pixel shader altogether if the depth test fails. Improves performance of Unigine Valley: - Skylake GT2: +17.8% - Broadwell GT3e: +11.5% - Cherrytrail: +19.4% Huge thanks to Mark Janes for building frameretrace [1], the performance analysis tool that helped us find this issue, and to Robert Bragg for providing us performance metrics on Linux. Mark also spent the time to analyze Valley performance on Windows vs. Linux and discovered a discrepancy in early depth test metrics. Once he had isolated a draw call and drawn attention to the problem, fixing it was pretty simple. [1] https://github.com/janesma/apitrace/wiki/frameretrace-branch Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/glsl/loop_analysis.cpp')
0 files changed, 0 insertions, 0 deletions