vrend: Reset shader_dirty and cs_shader_dirty when emitted

Submitted by Stéphane Marchesin on Feb. 15, 2019, 12:43 a.m.

Details

Message ID 20190215004314.173987-1-marcheu@chromium.org
State New
Headers show
Series "vrend: Reset shader_dirty and cs_shader_dirty when emitted" ( rev: 1 ) in Virgil 3D

Not browsing as part of any series.

Commit Message

Stéphane Marchesin Feb. 15, 2019, 12:43 a.m.
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@chromium.org>
---
 src/vrend_renderer.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

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;

Comments

Hi Stéphane,
 
we are now actually using merge requests in virglrenderer

Best, 
Gert


Am Donnerstag, den 14.02.2019, 16:43 -0800 schrieb Stéphane Marchesin:
> 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@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;