wined3d: Where possible, avoid using D3DCOLORTOGLFLOAT4.

This commit is contained in:
H. Verbeet 2006-12-28 03:12:43 +01:00 committed by Alexandre Julliard
parent fd21610ca9
commit 045975b1f4
4 changed files with 23 additions and 17 deletions

View file

@ -363,11 +363,11 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
break;
case WINED3DSAMP_BORDERCOLOR:
{
float col[4];
GLint col[4];
*state = samplerStates[textureObjectSamplerStates[i].state];
D3DCOLORTOGLFLOAT4(*state, col);
D3DCOLORTOGLINT4(*state, col);
TRACE("Setting border color for %u to %x\n", textureDimensions, *state);
glTexParameterfv(textureDimensions, GL_TEXTURE_BORDER_COLOR, &col[0]);
glTexParameteriv(textureDimensions, GL_TEXTURE_BORDER_COLOR, &col[0]);
checkGLcall("glTexParameteri(..., GL_TEXTURE_BORDER_COLOR, ...)");
}
break;

View file

@ -438,7 +438,7 @@ static void delete_glsl_shader_list(IWineD3DDevice* iface) {
/* Apply the current values to the specified texture stage */
static void WINAPI IWineD3DDeviceImpl_SetupTextureStates(IWineD3DDevice *iface, DWORD Sampler, DWORD texture_idx, DWORD Flags) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
float col[4];
GLint col[4];
union {
float f;
@ -503,8 +503,8 @@ static void WINAPI IWineD3DDeviceImpl_SetupTextureStates(IWineD3DDevice *iface,
checkGLcall("glTexEnvi GL_TEXTURE_LOD_BIAS_EXT ...");
}
D3DCOLORTOGLFLOAT4(This->stateBlock->renderState[WINED3DRS_TEXTUREFACTOR], col);
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
D3DCOLORTOGLINT4(This->stateBlock->renderState[WINED3DRS_TEXTUREFACTOR], col);
glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
/* TODO: NV_POINT_SPRITE */

View file

@ -197,11 +197,11 @@ static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock) {
float col[4];
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_AMBIENT], col);
GLint col[4];
D3DCOLORTOGLINT4(stateblock->renderState[WINED3DRS_AMBIENT], col);
TRACE("Setting ambient to (%f,%f,%f,%f)\n", col[0], col[1], col[2], col[3]);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
TRACE("Setting ambient to (%d,%d,%d,%d)\n", col[0], col[1], col[2], col[3]);
glLightModeliv(GL_LIGHT_MODEL_AMBIENT, col);
checkGLcall("glLightModel for MODEL_AMBIENT");
}
@ -499,8 +499,8 @@ static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
/* Note the texture color applies to all textures whereas
* GL_TEXTURE_ENV_COLOR applies to active only
*/
float col[4];
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
GLint col[4];
D3DCOLORTOGLINT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
if (!GL_SUPPORT(NV_REGISTER_COMBINERS)) {
/* And now the default texture color as well */
@ -515,11 +515,11 @@ static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
}
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
glTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
}
} else {
GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &col[0]));
GL_EXTCALL(glCombinerParameterivNV(GL_CONSTANT_COLOR0_NV, &col[0]));
}
}
@ -786,10 +786,10 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
static void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
float col[4];
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_FOGCOLOR], col);
GLint col[4];
D3DCOLORTOGLINT4(stateblock->renderState[WINED3DRS_FOGCOLOR], col);
/* Set the default alpha blend color */
glFogfv(GL_FOG_COLOR, &col[0]);
glFogiv(GL_FOG_COLOR, &col[0]);
checkGLcall("glFog GL_FOG_COLOR");
}

View file

@ -228,6 +228,12 @@ extern int num_lock;
(vec)[2] = D3DCOLOR_B(dw); \
(vec)[3] = D3DCOLOR_A(dw);
#define D3DCOLORTOGLINT4(src, dst) \
(dst)[0] = D3DCOLOR_B_R(src); \
(dst)[1] = D3DCOLOR_B_G(src); \
(dst)[2] = D3DCOLOR_B_B(src); \
(dst)[3] = D3DCOLOR_B_A(src);
/* DirectX Device Limits */
/* --------------------- */
#define MAX_LEVELS 256 /* Maximum number of mipmap levels. Guessed at 256 */