New valgrind warnings in wined3d/arb_program_shader.c

Stefan Dösinger stefan at codeweavers.com
Fri Aug 1 10:50:18 CDT 2008


> It had a level of indirection mistake, but yes, the
> following patch fixes the new warnings:
I think it's gcc's fault, or the code relying on something that the C spec
doesn't guarantee. It seems to me that gcc doesn't pack the bitfields
properly as we hoped, and leaves padding bytes in between that are left
uninitialized. The hash function then treats the structure as a binary blob.

Since the bitfields did not do what we hoped they'd do(avoid hashing over
empty data), I'll dig my old manual packing patch out again.

Meanwhile, the problems should not cause any crashes or incorrect rendering,
but it has negative effects on performance.

I tried replacing the memset with this:

    for(i = 0; i < 8; i++) {
        settings->op[i].cop = 0;
        settings->op[i].aop = 0;
        /* 0x3F: set all 6 bits of the args to 1 */
        settings->op[i].carg0 = 0;
        settings->op[i].carg1 = 0;
        settings->op[i].carg2 = 0;
        settings->op[i].aarg0 = 0;
        settings->op[i].aarg1 = 0;
        settings->op[i].aarg2 = 0;
        settings->op[i].dst = 0;
        settings->op[i].tex_type = 0;
        settings->op[i].projected = 0;
        settings->op[i].color_correction = 0;
    }
    settings->fog = 0;

The code manually initializes all members of the structure, but the valgrind
warnings still remain






More information about the wine-devel mailing list