[PATCH 4/5] d3dx9_36: Implemented ID3DXConstantTable_SetMatrix and ID3DXConstantTable_SetMatrixArray

Travis Athougies iammisc at gmail.com
Thu Jan 20 23:56:24 CST 2011


Uh no. If I were to do that, matrix->m[1] would be the second row, not
the second matrix. I'm trying to get at the second matrix. To
illustrate this, suppose the matrix were at 0x8000 (not going to
happen, but just pretend). matrix->m[1] would be at 0x8010, since
floats are 4 bytes. However, the next matrix is actually at 0x8040
(since sizeof(float) * 16 [the number of elements in the matrix] =
64).

Travis.

On Thu, Jan 20, 2011 at 7:27 AM, Matteo Bruni <matteo.mystral at gmail.com> wrote:
> 2011/1/20 Travis Athougies <iammisc at gmail.com>:
>> +            /* D3DXMATRIX is a union, one of whose elements is an array, so it can be cast to a float pointer */
>> +           if (is_vertex_shader(This->desc.Version))
>> +               IDirect3DDevice9_SetVertexShaderConstantF(device, desc.RegisterIndex + i, (float *)(matrix + i),
>> +                        desc.RegisterCount);
>> +           else
>> +               IDirect3DDevice9_SetPixelShaderConstantF(device, desc.RegisterIndex + i, (float *)(matrix + i),
>> +                        desc.RegisterCount);
>
> Can't you just pass matrix->m[i] as parameter, instead of that cast?
>



-- 
Travis Athougies




More information about the wine-devel mailing list