Mesa (master): mesa: Use VERT_{ATTRIB, BIT}* for ARB input validation.

Mathias Fröhlich frohlich at kemper.freedesktop.org
Sat Dec 3 07:18:53 UTC 2011


Module: Mesa
Branch: master
Commit: b14c06e10d570edcb4dcbea173d71751563616e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b14c06e10d570edcb4dcbea173d71751563616e7

Author: Mathias Fröhlich <Mathias.Froehlich at web.de>
Date:   Fri Dec  2 08:08:07 2011 +0100

mesa: Use VERT_{ATTRIB,BIT}* for ARB input validation.

For validating ARB program inputs replace hard
coded bitfield and attribute number with the appropriate
VERT_{ATTRIB,BIT}* variant.

This should fix:

https://bugs.freedesktop.org/show_bug.cgi?id=43407

Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/mesa/program/program_parse.y  |    6 +++---
 src/mesa/program/program_parser.h |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index 9fdb99d..4f958a9 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -1110,7 +1110,7 @@ ATTRIB_statement: ATTRIB IDENTIFIER '=' attribBinding
 	      YYERROR;
 	   } else {
 	      s->attrib_binding = $4;
-	      state->InputsBound |= (1U << s->attrib_binding);
+	      state->InputsBound |= BITFIELD64_BIT(s->attrib_binding);
 
 	      if (!validate_inputs(& @4, state)) {
 		 YYERROR;
@@ -2403,9 +2403,9 @@ set_src_reg_swz(struct asm_src_register *r, gl_register_file file, GLint index,
 int
 validate_inputs(struct YYLTYPE *locp, struct asm_parser_state *state)
 {
-   const int inputs = state->prog->InputsRead | state->InputsBound;
+   const GLbitfield64 inputs = state->prog->InputsRead | state->InputsBound;
 
-   if (((inputs & 0x0ffff) & (inputs >> 16)) != 0) {
+   if (((inputs & VERT_BIT_FF_ALL) & (inputs >> VERT_ATTRIB_GENERIC0)) != 0) {
       yyerror(locp, state, "illegal use of generic attribute and name attribute");
       return 0;
    }
diff --git a/src/mesa/program/program_parser.h b/src/mesa/program/program_parser.h
index 5637598..bc75614 100644
--- a/src/mesa/program/program_parser.h
+++ b/src/mesa/program/program_parser.h
@@ -191,7 +191,7 @@ struct asm_parser_state {
     * multiple ATTRIB statements bind illegal combinations of vertex
     * attributes.
     */
-   unsigned InputsBound;
+   GLbitfield64 InputsBound;
 
    enum {
       invalid_mode = 0,




More information about the mesa-commit mailing list