[Mesa-stable] [PATCH] anv: set input_slots_valid on brw_wm_prog_key

Lionel Landwerlin lionel.g.landwerlin at intel.com
Mon Jan 23 17:10:46 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.

v2: Use valid slots of the geometry or vertex stage (Jason)

v3: Use helper to find correct vue map (Jason)

v4: Set the valid slots off the previous stages (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Cc: 13.0 17.0 <mesa-stable at lists.freedesktop.org>
---
 src/intel/vulkan/anv_pipeline.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 2c46ef5bf9..01bb1f15a4 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -256,17 +256,22 @@ populate_gs_prog_key(const struct gen_device_info *devinfo,
 }

 static void
-populate_wm_prog_key(const struct gen_device_info *devinfo,
+populate_wm_prog_key(const struct anv_pipeline *pipeline,
                      const VkGraphicsPipelineCreateInfo *info,
                      struct brw_wm_prog_key *key)
 {
+   const struct gen_device_info *devinfo = &pipeline->device->info;
    ANV_FROM_HANDLE(anv_render_pass, render_pass, info->renderPass);

    memset(key, 0, sizeof(*key));

    populate_sampler_prog_key(devinfo, &key->tex);

-   /* TODO: Fill out key->input_slots_valid */
+   /* TODO: we could set this to 0 based on the information in nir_shader, but
+    * this function is called before spirv_to_nir. */
+   const struct brw_vue_map *vue_map =
+      anv_pipeline_get_fs_input_map(pipeline);
+   key->input_slots_valid = vue_map->slots_valid;

    /* Vulkan doesn't specify a default */
    key->high_quality_derivatives = false;
@@ -592,7 +597,7 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,
    struct anv_shader_bin *bin = NULL;
    unsigned char sha1[20];

-   populate_wm_prog_key(&pipeline->device->info, info, &key);
+   populate_wm_prog_key(pipeline, info, &key);

    if (cache) {
       anv_hash_shader(sha1, &key, sizeof(key), module, entrypoint,
--
2.11.0


More information about the mesa-stable mailing list