i965: Add a brw_wm_prog_data::has_render_target_reads field.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 16 Aug 2017 23:47:07 +0000 (16:47 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 23 Aug 2017 18:55:17 +0000 (11:55 -0700)
State upload code should use prog_data rather than poking at shader_info
directly.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/compiler/brw_compiler.h
src/intel/compiler/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index 66d6a6f5ee877d61f86ad00fe8287bda63b8ebc1..6753a8daf083ecf79c249b338248595e09c2651d 100644 (file)
@@ -614,6 +614,7 @@ struct brw_wm_prog_data {
    bool uses_src_depth;
    bool uses_src_w;
    bool uses_sample_mask;
+   bool has_render_target_reads;
    bool has_side_effects;
    bool pulls_bary;
 
index b48dc4167e7b909e01b8ad3ec9cc4870271df3bd..f2596e388617675d06025a6b0d5949f0fcb9b5bf 100644 (file)
@@ -6544,6 +6544,8 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
        shader->info.fs.uses_sample_qualifier ||
        shader->info.outputs_read);
 
+   prog_data->has_render_target_reads = shader->info.outputs_read != 0ull;
+
    prog_data->early_fragment_tests = shader->info.fs.early_fragment_tests;
    prog_data->post_depth_coverage = shader->info.fs.post_depth_coverage;
    prog_data->inner_coverage = shader->info.fs.inner_coverage;
index f33fc70e6f6d34829a086018c1dd285ec64e8f96..ee4917fa7cee8bd6fdeb5c9482a61620d4295ffd 100644 (file)
@@ -1049,9 +1049,8 @@ update_renderbuffer_read_surfaces(struct brw_context *brw)
    const struct brw_wm_prog_data *wm_prog_data =
       brw_wm_prog_data(brw->wm.base.prog_data);
 
-   /* BRW_NEW_FRAGMENT_PROGRAM */
-   if (!ctx->Extensions.MESA_shader_framebuffer_fetch &&
-       brw->fragment_program && brw->fragment_program->info.outputs_read) {
+   if (wm_prog_data->has_render_target_reads &&
+       !ctx->Extensions.MESA_shader_framebuffer_fetch) {
       /* _NEW_BUFFERS */
       const struct gl_framebuffer *fb = ctx->DrawBuffer;
 
@@ -1117,7 +1116,6 @@ const struct brw_tracked_state brw_renderbuffer_read_surfaces = {
       .mesa = _NEW_BUFFERS,
       .brw = BRW_NEW_BATCH |
              BRW_NEW_FAST_CLEAR_COLOR |
-             BRW_NEW_FRAGMENT_PROGRAM |
              BRW_NEW_FS_PROG_DATA,
    },
    .emit = update_renderbuffer_read_surfaces,