[Mesa-dev] [PATCH v2 12/15] dri/i965: dvec3/dvec4 consume twice input vertex attributes

Antia Puentes apuentes at igalia.com
Thu May 12 18:28:18 UTC 2016


From: "Juan A. Suarez Romero" <jasuarez at igalia.com>

>From the GL 4.5 core spec, section 11.1.1 (Vertex Attributes):

"A program with more than the value of MAX_VERTEX_ATTRIBS
active attribute variables may fail to link, unless
device-dependent optimizations are able to make the program
fit within available hardware resources. For the purposes
of this test, attribute variables of the type dvec3, dvec4,
dmat2x3, dmat2x4, dmat3, dmat3x4, dmat4x3, and dmat4 may
count as consuming twice as many attributes as equivalent
single-precision types. While these types use the same number
of generic attributes as their single-precision equivalents,
implementations are permitted to consume two single-precision
vectors of internal storage for each three- or four-component
double-precision vector."

This commit sets i965 driver backend to consume twice as many attributes
as equivalent single-precision types for dvec3, dvec4, dmat2x3, dmat2x4,
dmat3, dmat3x4, dmat4x3 and dmat4.

This prevents running out of registers in case we use too many
double-precision vertex input attributes.
---
 src/mesa/drivers/dri/i965/brw_context.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 26514a0..d6998b6 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -619,6 +619,8 @@ brw_initialize_context_constants(struct brw_context *brw)
    ctx->Const.NativeIntegers = true;
    ctx->Const.VertexID_is_zero_based = true;
 
+   ctx->Const.FP64Vector34Consumes2Locations = true;
+
    /* Regarding the CMP instruction, the Ivybridge PRM says:
     *
     *   "For each enabled channel 0b or 1b is assigned to the appropriate flag
-- 
2.7.4



More information about the mesa-dev mailing list