[virglrenderer-devel] [PATCH] vrend: Reset shader_dirty and cs_shader_dirty when emitted

Stéphane Marchesin marcheu at chromium.org
Fri Feb 15 00:43:14 UTC 2019


This results in reemitting the shaders over and over which causes a
performance hit.

Benchmarks using glbench:

Before:
@RESULT: fbofill_tex_bilinear_32                       =     942.40 mpixels_sec
@RESULT: fbofill_tex_bilinear_64                       =    3736.99 mpixels_sec

After:
@RESULT: fbofill_tex_bilinear_32                       =    1124.72 mpixels_sec
@RESULT: fbofill_tex_bilinear_64                       =    4222.07 mpixels_sec

Signed-off-by: Stéphane Marchesin <marcheu at chromium.org>
---
 src/vrend_renderer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index a325f9e..689f4b7 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -3901,6 +3901,9 @@ int vrend_draw_vbo(struct vrend_context *ctx,
       bool fs_dirty, vs_dirty, gs_dirty, tcs_dirty, tes_dirty;
       bool dual_src = util_blend_state_is_dual(&ctx->sub->blend_state, 0);
       bool same_prog;
+
+      ctx->sub->shader_dirty = false;
+
       if (!ctx->sub->shaders[PIPE_SHADER_VERTEX] || !ctx->sub->shaders[PIPE_SHADER_FRAGMENT]) {
          fprintf(stderr,"dropping rendering due to missing shaders: %s\n", ctx->debug_name);
          return 0;
@@ -4140,6 +4143,9 @@ void vrend_launch_grid(struct vrend_context *ctx,
    if (ctx->sub->cs_shader_dirty) {
       struct vrend_linked_shader_program *prog;
       bool same_prog, cs_dirty;
+
+      ctx->sub->cs_shader_dirty = false;
+
       if (!ctx->sub->shaders[PIPE_SHADER_COMPUTE]) {
          fprintf(stderr,"dropping rendering due to missing shaders: %s\n", ctx->debug_name);
          return;
-- 
2.21.0.rc0.258.g878e2cd30e-goog



More information about the virglrenderer-devel mailing list