i965/fs: calculate first non-payload GRF using attrib slots
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Mon, 4 Apr 2016 10:47:57 +0000 (12:47 +0200)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Tue, 17 May 2016 07:05:55 +0000 (09:05 +0200)
When computing where the first non-payload GRF starts, we can't rely on
the number of attributes, as each attribute can be using 1 or 2 slots
depending on whether they are a dvec3/4 or other.

Instead, we need to use the number of slots used by the attributes.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_compiler.h
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_vec4.cpp

index a2148ae2656d7c34f7d6fe285184d5c0091ff06c..0db1d0d3561d991dadf9a773b945835aa1a5778b 100644 (file)
@@ -611,6 +611,7 @@ struct brw_vs_prog_data {
    GLbitfield64 inputs_read;
 
    unsigned nr_attributes;
+   unsigned nr_attribute_slots;
 
    bool uses_vertexid;
    bool uses_instanceid;
index e8baf6c0706effe106c59ca2ce0c85e52142e9c5..bf3a46736465d76c58ad8b9828a61a96607300fb 100644 (file)
@@ -1768,7 +1768,7 @@ fs_visitor::assign_vs_urb_setup()
    assert(stage == MESA_SHADER_VERTEX);
 
    /* Each attribute is 4 regs. */
-   this->first_non_payload_grf += 4 * vs_prog_data->nr_attributes;
+   this->first_non_payload_grf += 4 * vs_prog_data->nr_attribute_slots;
 
    assert(vs_prog_data->base.urb_read_length <= 15);
 
index ac8dd6f9762abdaad6c35fc251b52f94b1d7f961..162b481573d6a7d20f55879fc88dd6a77ba06d54 100644 (file)
@@ -2120,6 +2120,7 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
          DIV_ROUND_UP(MAX2(nr_attribute_slots, 1), 2);
 
    prog_data->nr_attributes = nr_attributes;
+   prog_data->nr_attribute_slots = nr_attribute_slots;
 
    /* Since vertex shaders reuse the same VUE entry for inputs and outputs
     * (overwriting the original contents), we need to make sure the size is