[Mesa-dev] [PATCH 4/7] i965: Generalize wm_key->compute_sample_id to wm_key->multisample_fbo.
Kenneth Graunke
kenneth at whitecape.org
Tue Apr 19 06:48:59 UTC 2016
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 at whitecape.org>
---
src/intel/vulkan/anv_pipeline.c | 2 +-
src/mesa/drivers/dri/i965/brw_compiler.h | 2 +-
src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_wm.c | 9 ++++-----
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 91fe302..1857b90 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 0a14d5d..5807305 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 41af35e..94df342 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 86e8cf4..dbc626c 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 &
--
2.8.0
More information about the mesa-dev
mailing list