[Mesa-stable] [PATCH 10.6] i965/vs: Fix matNxM vertex attributes where M != 4.
Kenneth Graunke
kenneth at whitecape.org
Thu Jul 2 01:09:00 PDT 2015
Matrix vertex attributes have their columns padded out to vec4s, which
I was failing to account for. Scalar NIR expects them to be packed,
however.
Cc: mesa-stable at lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
Here's a backport of the patch to 10.6, since the one on master won't apply
due to all the builder changes.
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 5dd8363..6d11c0d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -89,12 +89,19 @@ fs_visitor::nir_setup_inputs(nir_shader *shader)
* So, we need to copy from fs_reg(ATTR, var->location) to
* offset(nir_inputs, var->data.driver_location).
*/
- unsigned components = var->type->without_array()->components();
+ const glsl_type *const t = var->type->without_array();
+ const unsigned components = t->components();
+ const unsigned cols = t->matrix_columns;
+ const unsigned elts = t->vector_elements;
unsigned array_length = var->type->is_array() ? var->type->length : 1;
for (unsigned i = 0; i < array_length; i++) {
- for (unsigned j = 0; j < components; j++) {
- emit(MOV(retype(offset(input, components * i + j), type),
- offset(fs_reg(ATTR, var->data.location + i, type), j)));
+ for (unsigned j = 0; j < cols; j++) {
+ for (unsigned k = 0; k < elts; k++) {
+ emit(MOV(offset(retype(input, type),
+ components * i + elts * j + k),
+ offset(fs_reg(ATTR, var->data.location + i, type),
+ 4 * j + k)));
+ }
}
}
break;
--
2.4.4
More information about the mesa-stable
mailing list