aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2019-04-20 07:28:19 +0200
committerMarge Bot <[email protected]>2020-03-10 14:28:37 +0000
commit38db4f17200cb5bfeb550bb732ccace5052afb04 (patch)
tree952907ba12e9871688f058bfce95f751a006202d
parente53fd073beabfa36338fa349dedfa83e0d0a4d92 (diff)
i965: Reorder workaround flags computation.
Vertex processing workaround flags can be split into array and current vertex attributes. By that we can use specific access functions for these different vertex attribute kinds. This finally obsoletes some access functions that I introduced last winter for a smooth transition. v2: Style fixes. Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c75
1 files changed, 49 insertions, 26 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 0952687fd06..3b1c95aedb8 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -301,6 +301,35 @@ brw_clear_buffers(struct brw_context *brw)
}
+static uint8_t get_wa_flags(const struct gl_vertex_format *glformat)
+{
+ uint8_t wa_flags = 0;
+
+ switch (glformat->Type) {
+ case GL_FIXED:
+ wa_flags = glformat->Size;
+ break;
+
+ case GL_INT_2_10_10_10_REV:
+ wa_flags |= BRW_ATTRIB_WA_SIGN;
+ /* fallthough */
+
+ case GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (glformat->Format == GL_BGRA)
+ wa_flags |= BRW_ATTRIB_WA_BGRA;
+
+ if (glformat->Normalized)
+ wa_flags |= BRW_ATTRIB_WA_NORMALIZE;
+ else if (!glformat->Integer)
+ wa_flags |= BRW_ATTRIB_WA_SCALE;
+
+ break;
+ }
+
+ return wa_flags;
+}
+
+
static void
brw_merge_inputs(struct brw_context *brw)
{
@@ -314,38 +343,32 @@ brw_merge_inputs(struct brw_context *brw)
}
if (devinfo->gen < 8 && !devinfo->is_haswell) {
- uint64_t mask = ctx->VertexProgram._Current->info.inputs_read;
/* Prior to Haswell, the hardware can't natively support GL_FIXED or
* 2_10_10_10_REV vertex formats. Set appropriate workaround flags.
*/
- while (mask) {
- const struct gl_vertex_format *glformat;
- uint8_t wa_flags = 0;
- const gl_vert_attrib i = u_bit_scan64(&mask);
+ const struct gl_vertex_array_object *vao = ctx->Array._DrawVAO;
+ const uint64_t vs_inputs = ctx->VertexProgram._Current->info.inputs_read;
+ assert((vs_inputs & ~((uint64_t)VERT_BIT_ALL)) == 0);
- glformat = &brw->vb.inputs[i].glattrib->Format;
+ unsigned vaomask = vs_inputs & _mesa_draw_array_bits(ctx);
+ while (vaomask) {
+ const gl_vert_attrib i = u_bit_scan(&vaomask);
+ const struct gl_array_attributes *glattrib =
+ _mesa_draw_array_attrib(vao, i);
+ const uint8_t wa_flags = get_wa_flags(&glattrib->Format);
- switch (glformat->Type) {
-
- case GL_FIXED:
- wa_flags = glformat->Size;
- break;
-
- case GL_INT_2_10_10_10_REV:
- wa_flags |= BRW_ATTRIB_WA_SIGN;
- /* fallthough */
-
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- if (glformat->Format == GL_BGRA)
- wa_flags |= BRW_ATTRIB_WA_BGRA;
-
- if (glformat->Normalized)
- wa_flags |= BRW_ATTRIB_WA_NORMALIZE;
- else if (!glformat->Integer)
- wa_flags |= BRW_ATTRIB_WA_SCALE;
-
- break;
+ if (brw->vb.attrib_wa_flags[i] != wa_flags) {
+ brw->vb.attrib_wa_flags[i] = wa_flags;
+ brw->ctx.NewDriverState |= BRW_NEW_VS_ATTRIB_WORKAROUNDS;
}
+ }
+
+ unsigned currmask = vs_inputs & _mesa_draw_current_bits(ctx);
+ while (currmask) {
+ const gl_vert_attrib i = u_bit_scan(&currmask);
+ const struct gl_array_attributes *glattrib =
+ _mesa_draw_current_attrib(ctx, i);
+ const uint8_t wa_flags = get_wa_flags(&glattrib->Format);
if (brw->vb.attrib_wa_flags[i] != wa_flags) {
brw->vb.attrib_wa_flags[i] = wa_flags;