mesa: Use VERT_{ATTRIB,BIT}* for ARB input validation.
authorMathias Fröhlich <Mathias.Froehlich@web.de>
Fri, 2 Dec 2011 07:08:07 +0000 (08:08 +0100)
committerMathias Fröhlich <Mathias.Froehlich@web.de>
Sat, 3 Dec 2011 07:13:49 +0000 (08:13 +0100)
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@web.de>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/mesa/program/program_parse.y
src/mesa/program/program_parser.h

index 9fdb99db33c034e3244f2afb614b260d4850063e..4f958a9938877db44428b46722b8cb7616d8d347 100644 (file)
@@ -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;
    }
index 5637598f3b37007ce09a417793a765d7b3abf0df..bc756148a202ee8152ef3d31d1a9fc152e0ab43c 100644 (file)
@@ -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,