summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-01-27 16:07:22 +0100
committerMathias Fröhlich <[email protected]>2018-02-01 22:39:06 +0100
commit186f03cfb021223f0a6f238da036517fbf240d26 (patch)
treee308ff5b580813d04e7d0794a80bee2a26fe1159 /src/mesa
parent38b41fd718cfffd11dab637d9d0cbd6c2a30b2c2 (diff)
mesa: Put materials at the end of the generic block.
The materials are now moved to the end of the generic attributes block to the range 4-15. Before, the way the position and generic 0 attribute is handled was dependent on the presence and kind of the currently attached vertex program. With this change the way the position attribute and the generic 0 attribute is treated only depends on the enabled flag of those two arrays. This will later help to untangle the update dependencies between enabled arrays and shader inputs. v2: s,VERT_ATTRIB_MAT_OFFSET,VERT_ATTRIB_MAT0,g Signed-off-by: Mathias Fröhlich <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/tnl/t_context.h4
-rw-r--r--src/mesa/vbo/vbo_exec_array.c14
-rw-r--r--src/mesa/vbo/vbo_exec_draw.c10
-rw-r--r--src/mesa/vbo/vbo_save_draw.c8
4 files changed, 18 insertions, 18 deletions
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 48d7ced791f..082110c6070 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -158,8 +158,8 @@ enum {
#define _TNL_FIRST_GENERIC _TNL_ATTRIB_GENERIC0
#define _TNL_LAST_GENERIC _TNL_ATTRIB_GENERIC15
-#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT /* GENERIC0 */
-#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES /* GENERIC11 */
+#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT /* GENERIC4 */
+#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES /* GENERIC15 */
/* Number of available texture attributes */
#define _TNL_NUM_TEX 8
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index d1f4da0c0e7..98eb6466ba3 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -335,20 +335,20 @@ recalculate_input_bindings(struct gl_context *ctx)
}
}
- for (i = 0; i < VERT_ATTRIB_MAT_MAX; i++) {
- inputs[VERT_ATTRIB_MAT(i)] =
- &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT + i];
- const_inputs |= VERT_BIT_MAT(i);
- }
-
/* Could use just about anything, just to fill in the empty
* slots:
*/
- for (i = VERT_ATTRIB_MAT_MAX; i < VERT_ATTRIB_GENERIC_MAX; i++) {
+ for (i = 0; i < VERT_ATTRIB_MAT0; i++) {
inputs[VERT_ATTRIB_GENERIC(i)] =
&vbo->currval[VBO_ATTRIB_GENERIC0 + i];
const_inputs |= VERT_BIT_GENERIC(i);
}
+
+ for (i = 0; i < VERT_ATTRIB_MAT_MAX; i++) {
+ inputs[VERT_ATTRIB_MAT(i)] =
+ &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT + i];
+ const_inputs |= VERT_BIT_MAT(i);
+ }
break;
case VP_SHADER:
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 2b7784694f7..bd82825b517 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -187,16 +187,16 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
/* Overlay other active attributes */
switch (get_vp_mode(exec->ctx)) {
case VP_FF:
+ for (attr = 0; attr < VERT_ATTRIB_MAT0; attr++) {
+ assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
+ exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
+ &vbo->currval[VBO_ATTRIB_GENERIC0+attr];
+ }
for (attr = 0; attr < VERT_ATTRIB_MAT_MAX; attr++) {
assert(VERT_ATTRIB_MAT(attr) < ARRAY_SIZE(exec->vtx.inputs));
exec->vtx.inputs[VERT_ATTRIB_MAT(attr)] =
&vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
}
- for (attr = VERT_ATTRIB_MAT_MAX; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
- assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
- exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
- &vbo->currval[VBO_ATTRIB_GENERIC0+attr];
- }
map = vbo->map_vp_none;
break;
case VP_SHADER:
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index bbc2d0dfedf..a9e0890ebe0 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -151,14 +151,14 @@ bind_vertex_list(struct gl_context *ctx,
/* Overlay other active attributes */
switch (get_vp_mode(ctx)) {
case VP_FF:
+ for (attr = 0; attr < VERT_ATTRIB_MAT0; attr++) {
+ save->inputs[VERT_ATTRIB_GENERIC(attr)] =
+ &vbo->currval[VBO_ATTRIB_GENERIC0+attr];
+ }
for (attr = 0; attr < VERT_ATTRIB_MAT_MAX; attr++) {
save->inputs[VERT_ATTRIB_MAT(attr)] =
&vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
}
- for (attr = VERT_ATTRIB_MAT_MAX; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
- save->inputs[VERT_ATTRIB_GENERIC(attr)] =
- &vbo->currval[VBO_ATTRIB_GENERIC0+attr];
- }
map = vbo->map_vp_none;
break;
case VP_SHADER: