From: Kenneth Graunke Date: Wed, 6 Apr 2016 02:35:46 +0000 (-0700) Subject: i965: Generalize wm_key->compute_sample_id to wm_key->multisample_fbo. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=81407531e0b8d2e6a7f9c39cb44ed6a72dc61e77;p=mesa.git i965: Generalize wm_key->compute_sample_id to wm_key->multisample_fbo. I'm going to need a key entry meaning "we have a multisample FBO, and multisampling is enabled" in an upcoming patch. This is basically wm_key->compute_sample_id, except that it also checks that the SAMPLE_ID system value is read. The only use of wm_key->compute_sample_id is in emit_sampleid_setup(), which is only called when handling the SAMPLE_ID system value. So we can just eliminate the check and generalize the field. v2: Also update the Vulkan driver. Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner --- diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 1f4e3fae9cb..ba088b6e852 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -288,7 +288,7 @@ populate_wm_prog_key(const struct brw_device_info *devinfo, */ key->persample_shading = info->pMultisampleState->sampleShadingEnable; key->compute_pos_offset = info->pMultisampleState->sampleShadingEnable; - key->compute_sample_id = info->pMultisampleState->sampleShadingEnable; + key->multisample_fbo = true; } } diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h index 0a14d5dfe63..580730589c3 100644 --- a/src/mesa/drivers/dri/i965/brw_compiler.h +++ b/src/mesa/drivers/dri/i965/brw_compiler.h @@ -248,7 +248,7 @@ struct brw_wm_prog_key { bool render_to_fbo:1; bool clamp_fragment_color:1; bool compute_pos_offset:1; - bool compute_sample_id:1; + bool multisample_fbo:1; unsigned line_aa:2; bool high_quality_derivatives:1; bool force_dual_color_blend:1; diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 748b242ad2d..58593ff5ff7 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1337,7 +1337,7 @@ fs_visitor::emit_sampleid_setup() const fs_builder abld = bld.annotate("compute sample id"); fs_reg *reg = new(this->mem_ctx) fs_reg(vgrf(glsl_type::int_type)); - if (!key->compute_sample_id) { + if (!key->multisample_fbo) { /* As per GL_ARB_sample_shading specification: * "When rendering to a non-multisample buffer, or if multisample * rasterization is disabled, gl_SampleID will always be zero." diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 86e8cf4bc76..dbc626c0933 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -260,6 +260,8 @@ brw_wm_debug_recompile(struct brw_context *brw, old_key->render_to_fbo, key->render_to_fbo); found |= key_debug(brw, "fragment color clamping", old_key->clamp_fragment_color, key->clamp_fragment_color); + found |= key_debug(brw, "multisampled FBO", + old_key->multisample_fbo, key->multisample_fbo); found |= key_debug(brw, "line smoothing", old_key->line_aa, key->line_aa); found |= key_debug(brw, "renderbuffer height", @@ -404,7 +406,6 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) GLuint lookup = 0; GLuint line_aa; bool program_uses_dfdy = fp->program.UsesDFdy; - const bool multisample_fbo = _mesa_geometric_samples(ctx->DrawBuffer) > 1; memset(key, 0, sizeof(*key)); @@ -530,10 +531,8 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) _mesa_get_min_invocations_per_fragment(ctx, &fp->program, false) > 1 && fp->program.Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_POS; - key->compute_sample_id = - multisample_fbo && - ctx->Multisample.Enabled && - (fp->program.Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_ID); + key->multisample_fbo = ctx->Multisample.Enabled && + _mesa_geometric_samples(ctx->DrawBuffer) > 1; /* BRW_NEW_VUE_MAP_GEOM_OUT */ if (brw->gen < 6 || _mesa_bitcount_64(fp->program.Base.InputsRead &