[Mesa-dev] [PATCH v4] anv: set input_slots_valid on brw_wm_prog_key

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Jan 10 17:57:27 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>
---
 src/intel/vulkan/anv_pipeline.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 2c46ef5bf9..dbf1078e5f 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -256,17 +256,20 @@ 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 */
+   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 +595,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-dev mailing list