[Mesa-dev] [PATCH] anv: set input_slots_valid on brw_wm_prog_key
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Tue Jan 10 14:35:21 UTC 2017
With shaders using a lot of inputs/outputs, like this (from Gtk+) :
layout(location = 0) in vec2 inPos;
layout(location = 1) in float inGradientPos;
layout(location = 2) in flat int inRepeating;
layout(location = 3) in flat int inStopCount;
layout(location = 4) in flat vec4 inClipBounds;
layout(location = 5) in flat vec4 inClipWidths;
layout(location = 6) in flat ColorStop inStops[8];
layout(location = 0) out vec4 outColor;
we're missing the programming of the input_slots_valid field leading
to an assert further down the backend code.
Note that we need the shader to be translated from spirv before we can
get the number of inputs/outputs so we set this in a post function and
leave the field at 0 for hashing.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: Jason Ekstrand <jason at jlekstrand.net>
Cc: Kenneth Graunke <kenneth at whitecape.org>
---
src/intel/vulkan/anv_pipeline.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 2c46ef5bf9..297d7fecc3 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -266,8 +266,6 @@ populate_wm_prog_key(const struct gen_device_info *devinfo,
populate_sampler_prog_key(devinfo, &key->tex);
- /* TODO: Fill out key->input_slots_valid */
-
/* Vulkan doesn't specify a default */
key->high_quality_derivatives = false;
@@ -293,6 +291,16 @@ populate_wm_prog_key(const struct gen_device_info *devinfo,
}
static void
+post_populate_wm_prog_key(const nir_shader *nir,
+ struct brw_wm_prog_key *key)
+{
+ if (_mesa_bitcount_64(nir->info->inputs_read &
+ BRW_FS_VARYING_INPUT_MASK) > 16) {
+ key->input_slots_valid = nir->info->inputs_read | VARYING_BIT_POS;
+ }
+}
+
+static void
populate_cs_prog_key(const struct gen_device_info *devinfo,
struct brw_cs_prog_key *key)
{
@@ -616,6 +624,8 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,
if (nir == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ post_populate_wm_prog_key(nir, &key);
+
unsigned num_rts = 0;
struct anv_pipeline_binding rt_bindings[8];
nir_function_impl *impl = nir_shader_get_entrypoint(nir);
--
2.11.0
More information about the mesa-dev
mailing list