diff options
author | Erik Faye-Lund <erik.faye-lund@collabora.com> | 2023-06-23 15:49:38 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-06-28 13:42:44 +0000 |
commit | bbcda63564478533ce33a924421a75ab1d042f6e (patch) | |
tree | ede044a40e0544d7804df14bea1067be8224792d /src/gallium/drivers/i915 | |
parent | 3f7ea95bc9ed21588876ff166d4bfa94bf0c4230 (diff) |
draw/i915: move hwfmt array to i915 specific struct
There's no point in bloating the vertex_info struct everywhere with
information that's only used by i915 in a single place. Let's explicitly
store the hwinfo when needed, instead of piggy-backing on vertex_info.
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23851>
Diffstat (limited to 'src/gallium/drivers/i915')
-rw-r--r-- | src/gallium/drivers/i915/i915_context.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_prim_emit.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_prim_vbuf.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_state_derived.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_state_immediate.c | 2 |
5 files changed, 20 insertions, 17 deletions
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 436c699215d..b85a25b31e1 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -155,7 +155,10 @@ struct i915_state { unsigned texbuffer[I915_TEX_UNITS][3]; /** Describes the current hardware vertex layout */ - struct vertex_info vertex_info; + struct i915_vertex_info { + struct vertex_info draw; /** vertex_info from draw_module */ + uint32_t hwfmt[4]; /** Hardware format info */ + } vertex_info; /* static state (dst/depth buffer state) */ struct i915_winsys_buffer *cbuf_bo; diff --git a/src/gallium/drivers/i915/i915_prim_emit.c b/src/gallium/drivers/i915/i915_prim_emit.c index 9c7fc1778a0..787c38cbd9a 100644 --- a/src/gallium/drivers/i915/i915_prim_emit.c +++ b/src/gallium/drivers/i915/i915_prim_emit.c @@ -63,7 +63,7 @@ setup_stage(struct draw_stage *stage) static inline void emit_hw_vertex(struct i915_context *i915, const struct vertex_header *vertex) { - const struct vertex_info *vinfo = &i915->current.vertex_info; + const struct vertex_info *vinfo = &i915->current.vertex_info.draw; uint32_t i; uint32_t count = 0; /* for debug/sanity */ @@ -129,7 +129,7 @@ emit_prim(struct draw_stage *stage, struct prim_header *prim, unsigned hwprim, i915_emit_hardware_state(i915); /* need to do this after validation! */ - vertex_size = i915->current.vertex_info.size * 4; /* in bytes */ + vertex_size = i915->current.vertex_info.draw.size * 4; /* in bytes */ assert(vertex_size >= 12); /* never smaller than 12 bytes */ if (!BEGIN_BATCH(1 + nr * vertex_size / 4)) { diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index 1145cb7939c..af14ff49652 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -131,7 +131,7 @@ i915_vbuf_render_get_vertex_info(struct vbuf_render *render) i915_update_derived(i915); } - return &i915->current.vertex_info; + return &i915->current.vertex_info.draw; } /** diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c index 9ca0004348c..512f86c87a5 100644 --- a/src/gallium/drivers/i915/i915_state_derived.c +++ b/src/gallium/drivers/i915/i915_state_derived.c @@ -45,7 +45,7 @@ static void calculate_vertex_layout(struct i915_context *i915) { const struct i915_fragment_shader *fs = i915->fs; - struct vertex_info vinfo; + struct i915_vertex_info vinfo; bool colors[2], fog, needW, face; uint32_t i; int src; @@ -84,20 +84,20 @@ calculate_vertex_layout(struct i915_context *i915) /* pos */ src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_POSITION, 0); if (needW) { - draw_emit_vertex_attr(&vinfo, EMIT_4F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_4F, src); vinfo.hwfmt[0] |= S4_VFMT_XYZW; - vinfo.attrib[0].emit = EMIT_4F; + vinfo.draw.attrib[0].emit = EMIT_4F; } else { - draw_emit_vertex_attr(&vinfo, EMIT_3F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_3F, src); vinfo.hwfmt[0] |= S4_VFMT_XYZ; - vinfo.attrib[0].emit = EMIT_3F; + vinfo.draw.attrib[0].emit = EMIT_3F; } /* point size. if not emitted here, then point size comes from LIS4. */ if (i915->rasterizer->templ.point_size_per_vertex) { src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_PSIZE, 0); if (src != -1) { - draw_emit_vertex_attr(&vinfo, EMIT_1F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_1F, src); vinfo.hwfmt[0] |= S4_VFMT_POINT_WIDTH; } } @@ -105,21 +105,21 @@ calculate_vertex_layout(struct i915_context *i915) /* primary color */ if (colors[0]) { src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_COLOR, 0); - draw_emit_vertex_attr(&vinfo, EMIT_4UB_BGRA, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_4UB_BGRA, src); vinfo.hwfmt[0] |= S4_VFMT_COLOR; } /* secondary color */ if (colors[1]) { src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_COLOR, 1); - draw_emit_vertex_attr(&vinfo, EMIT_4UB_BGRA, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_4UB_BGRA, src); vinfo.hwfmt[0] |= S4_VFMT_SPEC_FOG; } /* fog coord, not fog blend factor */ if (fog) { src = draw_find_shader_output(i915->draw, TGSI_SEMANTIC_FOG, 0); - draw_emit_vertex_attr(&vinfo, EMIT_1F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_1F, src); vinfo.hwfmt[0] |= S4_VFMT_FOG_PARAM; } @@ -135,11 +135,11 @@ calculate_vertex_layout(struct i915_context *i915) * the draw module by adding an extra shader output. */ mesa_loge("Front/back face is broken\n"); - draw_emit_vertex_attr(&vinfo, EMIT_1F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_1F, src); hwtc = TEXCOORDFMT_1D; } else { hwtc = TEXCOORDFMT_4D; - draw_emit_vertex_attr(&vinfo, EMIT_4F, src); + draw_emit_vertex_attr(&vinfo.draw, EMIT_4F, src); } } else { hwtc = TEXCOORDFMT_NOT_PRESENT; @@ -147,7 +147,7 @@ calculate_vertex_layout(struct i915_context *i915) vinfo.hwfmt[1] |= hwtc << (i * 4); } - draw_compute_vertex_size(&vinfo); + draw_compute_vertex_size(&vinfo.draw); if (memcmp(&i915->current.vertex_info, &vinfo, sizeof(vinfo))) { /* Need to set this flag so that the LIS2/4 registers get set. diff --git a/src/gallium/drivers/i915/i915_state_immediate.c b/src/gallium/drivers/i915/i915_state_immediate.c index 886c96e80ab..2972944a077 100644 --- a/src/gallium/drivers/i915/i915_state_immediate.c +++ b/src/gallium/drivers/i915/i915_state_immediate.c @@ -70,7 +70,7 @@ upload_S0S1(struct i915_context *i915) /* I915_NEW_VERTEX_SIZE */ { - unsigned vertex_size = i915->current.vertex_info.size; + unsigned vertex_size = i915->current.vertex_info.draw.size; LIS1 = ((vertex_size << 24) | (vertex_size << 16)); } |