[Mesa-dev] Mesa (master): mesa: assert that key->fragprog_inputs_read value isn' t too large

Brian Paul brianp at vmware.com
Wed Nov 7 07:33:35 PST 2012


On 11/07/2012 03:48 AM, Michel Dänzer wrote:
> On Die, 2012-11-06 at 07:11 -0800, Brian Paul wrote:
>> Module: Mesa
>> Branch: master
>> Commit: 0d61f879a1f2e6bb37368731a29d5267e1c25195
>> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d61f879a1f2e6bb37368731a29d5267e1c25195
>>
>> Author: Brian Paul<brianp at vmware.com>
>> Date:   Sun Nov  4 16:43:44 2012 -0700
>>
>> mesa: assert that key->fragprog_inputs_read value isn't too large
>>
>> fragprog_inputs_read is a 12-bit bitfield so check the assigned value.
>> MSVC warns on the assignment.  Not easy to fix but let's do a sanity check.
>>
>> Reviewed-by: Jose Fonseca<jfonseca at vmware.com>
>>
>> ---
>>
>>   src/mesa/main/ffvertex_prog.c |    2 ++
>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c
>> index efdca01..4cdec21 100644
>> --- a/src/mesa/main/ffvertex_prog.c
>> +++ b/src/mesa/main/ffvertex_prog.c
>> @@ -160,6 +160,8 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key )
>>
>>      key->need_eye_coords = ctx->_NeedEyeCoords;
>>
>> +   /* Make sure fp->Base.InputsRead fits in a 12-bit field */
>> +   assert(fp->Base.InputsRead<  (1<<  12));
>
> This assertion fails for me with the piglit/glean tests "gl_FrontFacing
> var (1)" and (2) on radeonsi. fp->Base.InputsRead contains 0x1000
> (FRAG_BIT_FACE).

Patch posted for review.

-Brian



More information about the mesa-dev mailing list