aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-12-11 18:45:43 +0100
committerMarge Bot <[email protected]>2020-03-10 14:28:37 +0000
commit74be835a84aaa9637c550ae4d71a2dfc66dc6990 (patch)
tree56f49f2baa87ad712b53553276df53141d19ce1a
parente62b82a693e6835dce809e924b4a2335486659d4 (diff)
i965: Use gl_vertex_format in brw_vertex_element.
State upload needs to cope with the vertex format rather than with the full attribute data. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c6
-rw-r--r--src/mesa/drivers/dri/i965/genX_state_upload.c20
3 files changed, 13 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 586f926fb18..05933af4430 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -446,7 +446,7 @@ struct brw_vertex_buffer {
GLuint step_rate;
};
struct brw_vertex_element {
- const struct gl_array_attributes *glattrib;
+ const struct gl_vertex_format *glformat;
int buffer;
bool is_dual_slot;
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index ee581fc9696..e87e0775614 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -518,7 +518,7 @@ brw_prepare_vertices(struct brw_context *brw)
vertex_range_end = MAX2(vertex_range_end, rel_end);
struct brw_vertex_element *input = &brw->vb.inputs[attr];
- input->glattrib = glattrib;
+ input->glformat = &glattrib->Format;
input->buffer = j;
input->is_dual_slot = (vp->DualSlotInputs & BITFIELD64_BIT(attr)) != 0;
input->offset = rel_offset;
@@ -607,7 +607,7 @@ brw_prepare_vertices(struct brw_context *brw)
vertex_range_end = MAX2(vertex_range_end, rel_end);
struct brw_vertex_element *input = &brw->vb.inputs[attr];
- input->glattrib = glattrib;
+ input->glformat = &glattrib->Format;
input->buffer = j;
input->is_dual_slot = (vp->DualSlotInputs & BITFIELD64_BIT(attr)) != 0;
input->offset = rel_offset;
@@ -663,7 +663,7 @@ brw_prepare_vertices(struct brw_context *brw)
memset(cursor + size, 0, alignment - size);
struct brw_vertex_element *input = &brw->vb.inputs[attr];
- input->glattrib = glattrib;
+ input->glformat = &glattrib->Format;
input->buffer = j;
input->is_dual_slot = (vp->DualSlotInputs & BITFIELD64_BIT(attr)) != 0;
input->offset = cursor - data;
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 0bd124011f4..a3738e63511 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -532,8 +532,7 @@ genX(emit_vertices)(struct brw_context *brw)
*/
for (unsigned i = 0; i < brw->vb.nr_enabled; i++) {
struct brw_vertex_element *input = brw->vb.enabled[i];
- const struct gl_array_attributes *glattrib = input->glattrib;
- uint32_t format = brw_get_vertex_surface_type(brw, &glattrib->Format);
+ uint32_t format = brw_get_vertex_surface_type(brw, input->glformat);
if (uploads_needed(format, input->is_dual_slot) > 1)
nr_elements++;
@@ -625,8 +624,8 @@ genX(emit_vertices)(struct brw_context *brw)
unsigned i;
for (i = 0; i < brw->vb.nr_enabled; i++) {
const struct brw_vertex_element *input = brw->vb.enabled[i];
- const struct gl_array_attributes *glattrib = input->glattrib;
- uint32_t format = brw_get_vertex_surface_type(brw, &glattrib->Format);
+ const struct gl_vertex_format *glformat = input->glformat;
+ uint32_t format = brw_get_vertex_surface_type(brw, glformat);
uint32_t comp0 = VFCOMP_STORE_SRC;
uint32_t comp1 = VFCOMP_STORE_SRC;
uint32_t comp2 = VFCOMP_STORE_SRC;
@@ -667,18 +666,17 @@ genX(emit_vertices)(struct brw_context *brw)
* entry. */
const unsigned offset = input->offset + c * 16;
- const struct gl_array_attributes *glattrib = input->glattrib;
const int size = (GEN_GEN < 8 && is_passthru_format(format)) ?
- upload_format_size(upload_format) : glattrib->Format.Size;
+ upload_format_size(upload_format) : glformat->Size;
switch (size) {
case 0: comp0 = VFCOMP_STORE_0;
case 1: comp1 = VFCOMP_STORE_0;
case 2: comp2 = VFCOMP_STORE_0;
case 3:
- if (GEN_GEN >= 8 && glattrib->Format.Doubles) {
+ if (GEN_GEN >= 8 && glformat->Doubles) {
comp3 = VFCOMP_STORE_0;
- } else if (glattrib->Format.Integer) {
+ } else if (glformat->Integer) {
comp3 = VFCOMP_STORE_1_INT;
} else {
comp3 = VFCOMP_STORE_1_FP;
@@ -703,7 +701,7 @@ genX(emit_vertices)(struct brw_context *brw)
* to be specified as VFCOMP_STORE_0 in order to output a 256-bit
* vertex element."
*/
- if (glattrib->Format.Doubles && !input->is_dual_slot) {
+ if (glformat->Doubles && !input->is_dual_slot) {
/* Store vertex elements which correspond to double and dvec2 vertex
* shader inputs as 128-bit vertex elements, instead of 256-bits.
*/
@@ -789,8 +787,8 @@ genX(emit_vertices)(struct brw_context *brw)
#if GEN_GEN >= 6
if (gen6_edgeflag_input) {
- const struct gl_array_attributes *glattrib = gen6_edgeflag_input->glattrib;
- const uint32_t format = brw_get_vertex_surface_type(brw, &glattrib->Format);
+ const struct gl_vertex_format *glformat = gen6_edgeflag_input->glformat;
+ const uint32_t format = brw_get_vertex_surface_type(brw, glformat);
struct GENX(VERTEX_ELEMENT_STATE) elem_state = {
.Valid = true,