wine/dlls/d3d8 vshaderdeclaration.c drawprim.c ...
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Nov 3 03:54:31 CST 2005
ChangeSet ID: 21070
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/03 03:54:31
Modified files:
dlls/d3d8 : vshaderdeclaration.c drawprim.c device.c
d3d8_private.h
Log message:
Raphael Junqueira <fenix at club-internet.fr>
- defined D3DCOLOR_B macros to access byte values of D3DCOLOR
- use D3DCOLOR macros instead of using shift + masks
- fix a bug where diffuse.lpData checked instead of specular.lpData
- implement color fixup on ARB VShader compilation code:
-> on input parameters using swizzle
-> add is_color parameter on vshader_program_add_param
Patch: http://cvs.winehq.org/patch.py?id=21070
Old revision New revision Changes Path
1.12 1.13 +8 -9 wine/dlls/d3d8/vshaderdeclaration.c
1.29 1.30 +17 -17 wine/dlls/d3d8/drawprim.c
1.131 1.132 +4 -4 wine/dlls/d3d8/device.c
1.68 1.69 +4 -0 wine/dlls/d3d8/d3d8_private.h
Index: wine/dlls/d3d8/vshaderdeclaration.c
diff -u -p wine/dlls/d3d8/vshaderdeclaration.c:1.12 wine/dlls/d3d8/vshaderdeclaration.c:1.13
--- wine/dlls/d3d8/vshaderdeclaration.c:1.12 3 Nov 2005 9:54:31 -0000
+++ wine/dlls/d3d8/vshaderdeclaration.c 3 Nov 2005 9:54:31 -0000
@@ -511,10 +511,10 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillV
dw = *(const DWORD*) curPos;
curPos = curPos + sizeof(DWORD);
/**/
- vshader->input.V[reg].x = (float) (((dw >> 16) & 0xFF) / 255.0f);
- vshader->input.V[reg].y = (float) (((dw >> 8) & 0xFF) / 255.0f);
- vshader->input.V[reg].z = (float) (((dw >> 0) & 0xFF) / 255.0f);
- vshader->input.V[reg].w = (float) (((dw >> 24) & 0xFF) / 255.0f);
+ vshader->input.V[reg].x = D3DCOLOR_R(dw);
+ vshader->input.V[reg].y = D3DCOLOR_G(dw);
+ vshader->input.V[reg].z = D3DCOLOR_B(dw);
+ vshader->input.V[reg].w = D3DCOLOR_A(dw);
break;
case D3DVSDT_SHORT2:
@@ -549,11 +549,10 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillV
dw = *(const DWORD*) curPos;
curPos = curPos + sizeof(DWORD);
/**/
- vshader->input.V[reg].x = (float) ((dw & 0x000F) >> 0);
- vshader->input.V[reg].y = (float) ((dw & 0x00F0) >> 8);
- vshader->input.V[reg].z = (float) ((dw & 0x0F00) >> 16);
- vshader->input.V[reg].w = (float) ((dw & 0xF000) >> 24);
-
+ vshader->input.V[reg].x = (float) ((dw & 0x000000FF) >> 0);
+ vshader->input.V[reg].y = (float) ((dw & 0x0000FF00) >> 8);
+ vshader->input.V[reg].z = (float) ((dw & 0x00FF0000) >> 16);
+ vshader->input.V[reg].w = (float) ((dw & 0xFF000000) >> 24);
break;
default: /** errooooorr what to do ? */
Index: wine/dlls/d3d8/drawprim.c
diff -u -p wine/dlls/d3d8/drawprim.c:1.29 wine/dlls/d3d8/drawprim.c:1.30
--- wine/dlls/d3d8/drawprim.c:1.29 3 Nov 2005 9:54:31 -0000
+++ wine/dlls/d3d8/drawprim.c 3 Nov 2005 9:54:31 -0000
@@ -1159,30 +1159,30 @@ static void drawStridedSlow(LPDIRECT3DDE
/* Diffuse -------------------------------- */
if (sd->u.s.diffuse.lpData != NULL) {
- glColor4ub((diffuseColor >> 16) & 0xFF,
- (diffuseColor >> 8) & 0xFF,
- (diffuseColor >> 0) & 0xFF,
- (diffuseColor >> 24) & 0xFF);
- VTRACE(("glColor4f: r,g,b,a=%f,%f,%f,%f\n",
- ((diffuseColor >> 16) & 0xFF) / 255.0f,
- ((diffuseColor >> 8) & 0xFF) / 255.0f,
- ((diffuseColor >> 0) & 0xFF) / 255.0f,
- ((diffuseColor >> 24) & 0xFF) / 255.0f));
+ glColor4ub(D3DCOLOR_B_R(diffuseColor),
+ D3DCOLOR_B_G(diffuseColor),
+ D3DCOLOR_B_B(diffuseColor),
+ D3DCOLOR_B_A(diffuseColor));
+ VTRACE(("glColor4ub: r,g,b,a=%u,%u,%u,%u\n",
+ D3DCOLOR_B_R(diffuseColor),
+ D3DCOLOR_B_G(diffuseColor),
+ D3DCOLOR_B_B(diffuseColor),
+ D3DCOLOR_B_A(diffuseColor)));
} else {
if (vx_index == 0) glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
/* Specular ------------------------------- */
- if (sd->u.s.diffuse.lpData != NULL) {
- VTRACE(("glSecondaryColor4ub: r,g,b=%f,%f,%f\n",
- ((specularColor >> 16) & 0xFF) / 255.0f,
- ((specularColor >> 8) & 0xFF) / 255.0f,
- ((specularColor >> 0) & 0xFF) / 255.0f));
+ if (sd->u.s.specular.lpData != NULL) {
+ VTRACE(("glSecondaryColor4ub: r,g,b=%u,%u,%u\n",
+ D3DCOLOR_B_R(specularColor),
+ D3DCOLOR_B_G(specularColor),
+ D3DCOLOR_B_B(specularColor)));
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
GL_EXTCALL(glSecondaryColor3ubEXT)(
- (specularColor >> 16) & 0xFF,
- (specularColor >> 8) & 0xFF,
- (specularColor >> 0) & 0xFF);
+ D3DCOLOR_B_R(specularColor),
+ D3DCOLOR_B_G(specularColor),
+ D3DCOLOR_B_B(specularColor));
} else {
/* Do not worry if specular colour missing and disable request */
VTRACE(("Specular color extensions not supplied\n"));
Index: wine/dlls/d3d8/device.c
diff -u -p wine/dlls/d3d8/device.c:1.131 wine/dlls/d3d8/device.c:1.132
--- wine/dlls/d3d8/device.c:1.131 3 Nov 2005 9:54:31 -0000
+++ wine/dlls/d3d8/device.c 3 Nov 2005 9:54:31 -0000
@@ -1411,10 +1411,10 @@ HRESULT WINAPI IDirect3DDevice8Impl_Cl
if (Flags & D3DCLEAR_TARGET) {
TRACE("Clearing screen with glClear to color %lx\n", Color);
glGetFloatv(GL_COLOR_CLEAR_VALUE, old_color_clear_value);
- glClearColor(((Color >> 16) & 0xFF) / 255.0f,
- ((Color >> 8) & 0xFF) / 255.0f,
- ((Color >> 0) & 0xFF) / 255.0f,
- ((Color >> 24) & 0xFF) / 255.0f);
+ glClearColor(D3DCOLOR_R(Color),
+ D3DCOLOR_G(Color),
+ D3DCOLOR_B(Color),
+ D3DCOLOR_A(Color));
checkGLcall("glClearColor");
/* Clear ALL colors! */
Index: wine/dlls/d3d8/d3d8_private.h
diff -u -p wine/dlls/d3d8/d3d8_private.h:1.68 wine/dlls/d3d8/d3d8_private.h:1.69
--- wine/dlls/d3d8/d3d8_private.h:1.68 3 Nov 2005 9:54:31 -0000
+++ wine/dlls/d3d8/d3d8_private.h 3 Nov 2005 9:54:31 -0000
@@ -299,6 +299,10 @@ struct PLIGHTINFOEL {
#define GL_EXTCALL(FuncName) (This->direct3d8->gl_info.FuncName)
#define GL_EXTCALL_DEV(FuncName, dev) ((dev)->direct3d8->gl_info.FuncName)
+#define D3DCOLOR_B_R(dw) (((dw) >> 16) & 0xFF)
+#define D3DCOLOR_B_G(dw) (((dw) >> 8) & 0xFF)
+#define D3DCOLOR_B_B(dw) (((dw) >> 0) & 0xFF)
+#define D3DCOLOR_B_A(dw) (((dw) >> 24) & 0xFF)
#define D3DCOLOR_R(dw) (((float) (((dw) >> 16) & 0xFF)) / 255.0f)
#define D3DCOLOR_G(dw) (((float) (((dw) >> 8) & 0xFF)) / 255.0f)
More information about the wine-cvs
mailing list