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 <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Kenneth Graunke
2016-04-05 19:35:46 -07:00
parent de0a46a040
commit 81407531e0
4 changed files with 7 additions and 8 deletions

View File

@@ -288,7 +288,7 @@ populate_wm_prog_key(const struct brw_device_info *devinfo,
*/ */
key->persample_shading = info->pMultisampleState->sampleShadingEnable; key->persample_shading = info->pMultisampleState->sampleShadingEnable;
key->compute_pos_offset = info->pMultisampleState->sampleShadingEnable; key->compute_pos_offset = info->pMultisampleState->sampleShadingEnable;
key->compute_sample_id = info->pMultisampleState->sampleShadingEnable; key->multisample_fbo = true;
} }
} }

View File

@@ -248,7 +248,7 @@ struct brw_wm_prog_key {
bool render_to_fbo:1; bool render_to_fbo:1;
bool clamp_fragment_color:1; bool clamp_fragment_color:1;
bool compute_pos_offset:1; bool compute_pos_offset:1;
bool compute_sample_id:1; bool multisample_fbo:1;
unsigned line_aa:2; unsigned line_aa:2;
bool high_quality_derivatives:1; bool high_quality_derivatives:1;
bool force_dual_color_blend:1; bool force_dual_color_blend:1;

View File

@@ -1337,7 +1337,7 @@ fs_visitor::emit_sampleid_setup()
const fs_builder abld = bld.annotate("compute sample id"); const fs_builder abld = bld.annotate("compute sample id");
fs_reg *reg = new(this->mem_ctx) fs_reg(vgrf(glsl_type::int_type)); 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: /* As per GL_ARB_sample_shading specification:
* "When rendering to a non-multisample buffer, or if multisample * "When rendering to a non-multisample buffer, or if multisample
* rasterization is disabled, gl_SampleID will always be zero." * rasterization is disabled, gl_SampleID will always be zero."

View File

@@ -260,6 +260,8 @@ brw_wm_debug_recompile(struct brw_context *brw,
old_key->render_to_fbo, key->render_to_fbo); old_key->render_to_fbo, key->render_to_fbo);
found |= key_debug(brw, "fragment color clamping", found |= key_debug(brw, "fragment color clamping",
old_key->clamp_fragment_color, key->clamp_fragment_color); 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", found |= key_debug(brw, "line smoothing",
old_key->line_aa, key->line_aa); old_key->line_aa, key->line_aa);
found |= key_debug(brw, "renderbuffer height", 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 lookup = 0;
GLuint line_aa; GLuint line_aa;
bool program_uses_dfdy = fp->program.UsesDFdy; bool program_uses_dfdy = fp->program.UsesDFdy;
const bool multisample_fbo = _mesa_geometric_samples(ctx->DrawBuffer) > 1;
memset(key, 0, sizeof(*key)); 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 && _mesa_get_min_invocations_per_fragment(ctx, &fp->program, false) > 1 &&
fp->program.Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_POS; fp->program.Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_POS;
key->compute_sample_id = key->multisample_fbo = ctx->Multisample.Enabled &&
multisample_fbo && _mesa_geometric_samples(ctx->DrawBuffer) > 1;
ctx->Multisample.Enabled &&
(fp->program.Base.SystemValuesRead & SYSTEM_BIT_SAMPLE_ID);
/* BRW_NEW_VUE_MAP_GEOM_OUT */ /* BRW_NEW_VUE_MAP_GEOM_OUT */
if (brw->gen < 6 || _mesa_bitcount_64(fp->program.Base.InputsRead & if (brw->gen < 6 || _mesa_bitcount_64(fp->program.Base.InputsRead &