mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 03:44:46 +00:00
wined3d: Fixed pointer casting and additions.
This commit is contained in:
parent
5c8b83c524
commit
332d14953b
|
@ -104,13 +104,20 @@ static DWORD WINAPI IWineD3DVertexBufferImpl_GetPriority(IWineD3DVertexBuffer
|
||||||
return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface);
|
return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fixup_vertices(BYTE *src, BYTE *dst, int stride, int num, BYTE *pos, BOOL haspos, BYTE *diffuse, BOOL hasdiffuse, BYTE *specular, BOOL hasspecular) {
|
static void fixup_vertices(
|
||||||
|
BYTE *src, BYTE *dst,
|
||||||
|
int stride,
|
||||||
|
int num,
|
||||||
|
int pos, BOOL haspos,
|
||||||
|
int diffuse, BOOL hasdiffuse,
|
||||||
|
int specular, BOOL hasspecular
|
||||||
|
) {
|
||||||
int i;
|
int i;
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
|
|
||||||
for(i = num - 1; i >= 0; i--) {
|
for(i = num - 1; i >= 0; i--) {
|
||||||
if(haspos) {
|
if(haspos) {
|
||||||
float *p = (float *) (((int) src + (int) pos) + i * stride);
|
float *p = (float *) ((src + pos) + i * stride);
|
||||||
|
|
||||||
/* rhw conversion like in drawStridedSlow */
|
/* rhw conversion like in drawStridedSlow */
|
||||||
if(p[3] == 1.0 || ((p[3] < eps) && (p[3] > -eps))) {
|
if(p[3] == 1.0 || ((p[3] < eps) && (p[3] > -eps))) {
|
||||||
|
@ -124,15 +131,15 @@ static void fixup_vertices(BYTE *src, BYTE *dst, int stride, int num, BYTE *pos,
|
||||||
y = p[1] * w;
|
y = p[1] * w;
|
||||||
z = p[2] * w;
|
z = p[2] * w;
|
||||||
}
|
}
|
||||||
p = (float *) ((int) dst + i * stride + (int) pos);
|
p = (float *) (dst + i * stride + pos);
|
||||||
p[0] = x;
|
p[0] = x;
|
||||||
p[1] = y;
|
p[1] = y;
|
||||||
p[2] = z;
|
p[2] = z;
|
||||||
p[3] = w;
|
p[3] = w;
|
||||||
}
|
}
|
||||||
if(hasdiffuse) {
|
if(hasdiffuse) {
|
||||||
DWORD srcColor, *dstColor = (DWORD *) (dst + i * stride + (int) diffuse);
|
DWORD srcColor, *dstColor = (DWORD *) (dst + i * stride + diffuse);
|
||||||
srcColor = * (DWORD *) ( ((int) src + (int) diffuse) + i * stride);
|
srcColor = * (DWORD *) ( (src + diffuse) + i * stride);
|
||||||
|
|
||||||
/* Color conversion like in drawStridedSlow. watch out for little endianity
|
/* Color conversion like in drawStridedSlow. watch out for little endianity
|
||||||
* If we want that stuff to work on big endian machines too we have to consider more things
|
* If we want that stuff to work on big endian machines too we have to consider more things
|
||||||
|
@ -149,8 +156,8 @@ static void fixup_vertices(BYTE *src, BYTE *dst, int stride, int num, BYTE *pos,
|
||||||
*dstColor |= (srcColor & 0x000000ff) << 16; /* Blue */
|
*dstColor |= (srcColor & 0x000000ff) << 16; /* Blue */
|
||||||
}
|
}
|
||||||
if(hasspecular) {
|
if(hasspecular) {
|
||||||
DWORD srcColor, *dstColor = (DWORD *) (dst + i * stride + (int) specular);
|
DWORD srcColor, *dstColor = (DWORD *) (dst + i * stride + specular);
|
||||||
srcColor = * (DWORD *) ( ((int) src + (int) specular) + i * stride);
|
srcColor = * (DWORD *) ( (src + specular) + i * stride);
|
||||||
|
|
||||||
/* Similar to diffuse
|
/* Similar to diffuse
|
||||||
* TODO: Write the alpha value out for fog coords
|
* TODO: Write the alpha value out for fog coords
|
||||||
|
@ -365,13 +372,13 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
|
||||||
|
|
||||||
fixup_vertices(data, data, stride, ( end - start) / stride,
|
fixup_vertices(data, data, stride, ( end - start) / stride,
|
||||||
/* Position */
|
/* Position */
|
||||||
This->strided.u.s.position.lpData, /* Data location */
|
(int)This->strided.u.s.position.lpData, /* Data location */
|
||||||
This->strided.u.s.position_transformed, /* Do convert? */
|
This->strided.u.s.position_transformed, /* Do convert? */
|
||||||
/* Diffuse color */
|
/* Diffuse color */
|
||||||
This->strided.u.s.diffuse.lpData, /* Location */
|
(int)This->strided.u.s.diffuse.lpData, /* Location */
|
||||||
This->strided.u.s.diffuse.dwType == WINED3DDECLTYPE_SHORT4 || This->strided.u.s.diffuse.dwType == WINED3DDECLTYPE_D3DCOLOR, /* Convert? */
|
This->strided.u.s.diffuse.dwType == WINED3DDECLTYPE_SHORT4 || This->strided.u.s.diffuse.dwType == WINED3DDECLTYPE_D3DCOLOR, /* Convert? */
|
||||||
/* specular color */
|
/* specular color */
|
||||||
This->strided.u.s.specular.lpData, /* location */
|
(int)This->strided.u.s.specular.lpData, /* location */
|
||||||
This->strided.u.s.specular.dwType == WINED3DDECLTYPE_SHORT4 || This->strided.u.s.specular.dwType == WINED3DDECLTYPE_D3DCOLOR);
|
This->strided.u.s.specular.dwType == WINED3DDECLTYPE_SHORT4 || This->strided.u.s.specular.dwType == WINED3DDECLTYPE_D3DCOLOR);
|
||||||
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
|
|
Loading…
Reference in a new issue