From c4815f6cd6f659acd361f1b4cf63473a46ca7de9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 26 Nov 2013 00:30:19 -0800 Subject: i965: Always reserve binding table space for at least one render target. In brw_update_renderbuffer_surfaces(), if there are no color draw buffers, we always set up a null render target at surface index 0 so we have something to use with the FB write marking the end of thread. However, when we recently began computing surface indexes dynamically, we failed to reserve space for it. This meant that the first texture would be assigned surface index 0, and our closing FB write would clobber the texture. Fixes Piglit's EXT_packed_depth_stencil/fbo-blit-d24s8 test on Gen4-5, which regressed as of commit 4e5306453da6a1c076309e543ec92d999e02f67a ("i965/fs: Dynamically set up the WM binding table offsets.") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70605 Signed-off-by: Kenneth Graunke Reviewed-by: Chris Forbes Tested-by: lu hua Cc: "10.0" mesa-stable@lists.freedesktop.org --- src/mesa/drivers/dri/i965/brw_fs.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index d1b77129d0f..eecde6271d9 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3181,8 +3181,11 @@ fs_visitor::assign_binding_table_offsets() { uint32_t next_binding_table_offset = 0; + /* If there are no color regions, we still perform an FB write to a null + * renderbuffer, which we place at surface index 0. + */ c->prog_data.binding_table.render_target_start = next_binding_table_offset; - next_binding_table_offset += c->key.nr_color_regions; + next_binding_table_offset += MAX2(c->key.nr_color_regions, 1); assign_common_binding_table_offsets(next_binding_table_offset); } -- cgit v1.2.3