diff options
author | Chris Forbes <[email protected]> | 2012-11-22 16:23:22 +1300 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2012-11-26 16:35:00 -0800 |
commit | 352ae51efd75602de99a9ddf7c494453c7d6cb1c (patch) | |
tree | d0899d56cd022a53ab3244634d0289ca14cac231 | |
parent | c3c680950d9f7736723469ff74d0a3c9bbcaaeb1 (diff) |
i965: set attribute w/a bits for packed formats
Flag the need for various workarounds to be applied by
the vertex shader.
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index f764f526f9c..232600aece7 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -446,10 +446,32 @@ static void brw_upload_vs_prog(struct brw_context *brw) /* BRW_NEW_VERTICES */ for (i = 0; i < VERT_ATTRIB_MAX; i++) { - /* TODO: flag w/a for packed vertex formats here too */ - if (vp->program.Base.InputsRead & BITFIELD64_BIT(i) && - brw->vb.inputs[i].glarray->Type == GL_FIXED) { - key.gl_attrib_wa_flags[i] = brw->vb.inputs[i].glarray->Size; + if (vp->program.Base.InputsRead & BITFIELD64_BIT(i)) { + uint8_t wa_flags = 0; + + switch (brw->vb.inputs[i].glarray->Type) { + + case GL_FIXED: + wa_flags = brw->vb.inputs[i].glarray->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 (brw->vb.inputs[i].glarray->Format == GL_BGRA) + wa_flags |= BRW_ATTRIB_WA_BGRA; + + if (brw->vb.inputs[i].glarray->Normalized) + wa_flags |= BRW_ATTRIB_WA_NORMALIZE; + else if (!brw->vb.inputs[i].glarray->Integer) + wa_flags |= BRW_ATTRIB_WA_SCALE; + + break; + } + + key.gl_attrib_wa_flags[i] = wa_flags; } } |