Commit 2ac34bf2 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Add some missing float suffixes.

The compiler should be smart enough to fix most of these, but it looks sloppy.
parent 7ec911ad
......@@ -300,20 +300,20 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, con
dirty_consts[i] = 0;
j = 4 * i;
if(constants[j + 0] > 1.0) lcl_const[0] = 1.0;
else if(constants[j + 0] < -1.0) lcl_const[0] = -1.0;
if (constants[j + 0] > 1.0f) lcl_const[0] = 1.0f;
else if (constants[j + 0] < -1.0f) lcl_const[0] = -1.0f;
else lcl_const[0] = constants[j + 0];
if(constants[j + 1] > 1.0) lcl_const[1] = 1.0;
else if(constants[j + 1] < -1.0) lcl_const[1] = -1.0;
if (constants[j + 1] > 1.0f) lcl_const[1] = 1.0f;
else if (constants[j + 1] < -1.0f) lcl_const[1] = -1.0f;
else lcl_const[1] = constants[j + 1];
if(constants[j + 2] > 1.0) lcl_const[2] = 1.0;
else if(constants[j + 2] < -1.0) lcl_const[2] = -1.0;
if (constants[j + 2] > 1.0f) lcl_const[2] = 1.0f;
else if (constants[j + 2] < -1.0f) lcl_const[2] = -1.0f;
else lcl_const[2] = constants[j + 2];
if(constants[j + 3] > 1.0) lcl_const[3] = 1.0;
else if(constants[j + 3] < -1.0) lcl_const[3] = -1.0;
if (constants[j + 3] > 1.0f) lcl_const[3] = 1.0f;
else if (constants[j + 3] < -1.0f) lcl_const[3] = -1.0f;
else lcl_const[3] = constants[j + 3];
GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, i, lcl_const));
......@@ -459,10 +459,10 @@ static inline void shader_arb_ps_local_constants(IWineD3DDeviceImpl* deviceImpl)
* ycorrection.w: 0.0
*/
float val[4];
val[0] = deviceImpl->render_offscreen ? 0.0 : ((IWineD3DSurfaceImpl *) deviceImpl->render_targets[0])->currentDesc.Height;
val[1] = deviceImpl->render_offscreen ? 1.0 : -1.0;
val[2] = 1.0;
val[3] = 0.0;
val[0] = deviceImpl->render_offscreen ? 0.0f : ((IWineD3DSurfaceImpl *) deviceImpl->render_targets[0])->currentDesc.Height;
val[1] = deviceImpl->render_offscreen ? 1.0f : -1.0f;
val[2] = 1.0f;
val[3] = 0.0f;
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, gl_shader->ycorrection, val));
checkGLcall("y correction loading\n");
}
......@@ -477,7 +477,7 @@ static inline void shader_arb_ps_local_constants(IWineD3DDeviceImpl* deviceImpl)
val[0] = stateBlock->pixelShaderConstantI[4 * i];
val[1] = stateBlock->pixelShaderConstantI[4 * i + 1];
val[2] = stateBlock->pixelShaderConstantI[4 * i + 2];
val[3] = -1.0;
val[3] = -1.0f;
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, gl_shader->int_consts[i], val));
}
......@@ -509,7 +509,7 @@ static inline void shader_arb_vs_local_constants(IWineD3DDeviceImpl* deviceImpl)
val[0] = stateBlock->vertexShaderConstantI[4 * i];
val[1] = stateBlock->vertexShaderConstantI[4 * i + 1];
val[2] = stateBlock->vertexShaderConstantI[4 * i + 2];
val[3] = -1.0;
val[3] = -1.0f;
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->int_consts[i], val));
}
......@@ -4492,7 +4492,7 @@ static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *g
pCaps->PixelShaderVersion = WINED3DPS_VERSION(1,4);
TRACE_(d3d_caps)("Hardware pixel shader version 1.4 enabled (ARB_PROGRAM)\n");
}
pCaps->PixelShader1xMaxValue = 8.0;
pCaps->PixelShader1xMaxValue = 8.0f;
pCaps->MaxPixelShaderConst = GL_LIMITS(pshader_constantsF);
}
......@@ -5182,11 +5182,11 @@ static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateb
if(stateblock->renderState[WINED3DRS_SPECULARENABLE]) {
/* The specular color has no alpha */
col[0] = 1.0; col[1] = 1.0;
col[2] = 1.0; col[3] = 0.0;
col[0] = 1.0f; col[1] = 1.0f;
col[2] = 1.0f; col[3] = 0.0f;
} else {
col[0] = 0.0; col[1] = 0.0;
col[2] = 0.0; col[3] = 0.0;
col[0] = 0.0f; col[1] = 0.0f;
col[2] = 0.0f; col[3] = 0.0f;
}
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_SPECULAR_ENABLE, col));
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_SPECULAR_ENABLE, col)");
......@@ -5255,8 +5255,8 @@ static void tex_bumpenvlum_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock
param[0] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVLSCALE]);
param[1] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVLOFFSET]);
param[2] = 0.0;
param[3] = 0.0;
param[2] = 0.0f;
param[3] = 0.0f;
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_LUMINANCE(stage), param));
checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_LUMINANCE(stage), param)");
......@@ -6196,7 +6196,7 @@ static BOOL gen_yv12_read(SHADER_BUFFER *buffer, GLenum textype, char *luminance
* go from 0 to d3d_height, whereas the opengl texture height is 1.5 * d3d_height
*/
shader_addline(buffer, "PARAM yv12_coef = {%f, %f, %f, %f};\n",
2.0 / 3.0, 1.0 / 6.0, (2.0 / 3.0) + (1.0 / 6.0), 1.0 / 3.0);
2.0f / 3.0f, 1.0f / 6.0f, (2.0f / 3.0f) + (1.0f / 6.0f), 1.0f / 3.0f);
shader_addline(buffer, "MOV texcrd, fragment.texcoord[0];\n");
/* the chroma planes have only half the width */
......
......@@ -864,10 +864,10 @@ static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
* shader(it is free). This might potentially reduce precision. However, if the hardware does
* support proper floats it shouldn't, and if it doesn't we can't get anything better anyway
*/
mat[0][0] = (mat[0][0] + 1.0) * 0.5;
mat[1][0] = (mat[1][0] + 1.0) * 0.5;
mat[0][1] = (mat[0][1] + 1.0) * 0.5;
mat[1][1] = (mat[1][1] + 1.0) * 0.5;
mat[0][0] = (mat[0][0] + 1.0f) * 0.5f;
mat[1][0] = (mat[1][0] + 1.0f) * 0.5f;
mat[0][1] = (mat[0][1] + 1.0f) * 0.5f;
mat[1][1] = (mat[1][1] + 1.0f) * 0.5f;
GL_EXTCALL(glSetFragmentShaderConstantATI(ATI_FFP_CONST_BUMPMAT(stage), (float *) mat));
checkGLcall("glSetFragmentShaderConstantATI(ATI_FFP_CONST_BUMPMAT(stage), mat)");
}
......
......@@ -504,14 +504,14 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3
if (shader_version.major == 1 && shader_version.type == WINED3D_SHADER_TYPE_PIXEL)
{
float *value = (float *) lconst->value;
if(value[0] < -1.0) value[0] = -1.0;
else if(value[0] > 1.0) value[0] = 1.0;
if(value[1] < -1.0) value[1] = -1.0;
else if(value[1] > 1.0) value[1] = 1.0;
if(value[2] < -1.0) value[2] = -1.0;
else if(value[2] > 1.0) value[2] = 1.0;
if(value[3] < -1.0) value[3] = -1.0;
else if(value[3] > 1.0) value[3] = 1.0;
if (value[0] < -1.0f) value[0] = -1.0f;
else if (value[0] > 1.0f) value[0] = 1.0f;
if (value[1] < -1.0f) value[1] = -1.0f;
else if (value[1] > 1.0f) value[1] = 1.0f;
if (value[2] < -1.0f) value[2] = -1.0f;
else if (value[2] > 1.0f) value[2] = 1.0f;
if (value[3] < -1.0f) value[3] = -1.0f;
else if (value[3] > 1.0f) value[3] = 1.0f;
}
list_add_head(&This->baseShader.constantsF, &lconst->entry);
......@@ -1342,7 +1342,7 @@ static void shader_none_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *
/* Set the shader caps to 0 for the none shader backend */
pCaps->VertexShaderVersion = 0;
pCaps->PixelShaderVersion = 0;
pCaps->PixelShader1xMaxValue = 0.0;
pCaps->PixelShader1xMaxValue = 0.0f;
}
#undef GLINFO_LOCATION
static BOOL shader_none_color_fixup_supported(struct color_fixup_desc fixup)
......
......@@ -506,9 +506,9 @@ static inline void fixup_d3dcolor(DWORD *dst_color)
static inline void fixup_transformed_pos(float *p)
{
/* rhw conversion like in position_float4(). */
if (p[3] != 1.0 && p[3] != 0.0)
if (p[3] != 1.0f && p[3] != 0.0f)
{
float w = 1.0 / p[3];
float w = 1.0f / p[3];
p[0] *= w;
p[1] *= w;
p[2] *= w;
......
......@@ -1001,7 +1001,7 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
TRACE("Setting up the screen\n");
/* Clear the screen */
glClearColor(1.0, 0.0, 0.0, 0.0);
glClearColor(1.0f, 0.0f, 0.0f, 0.0f);
checkGLcall("glClearColor");
glClearIndex(0);
glClearDepth(1);
......@@ -1356,7 +1356,7 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex
if (GL_SUPPORT(EXT_TEXTURE_LOD_BIAS)) {
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT,
GL_TEXTURE_LOD_BIAS_EXT,
0.0);
0.0f);
checkGLcall("glTexEnvi GL_TEXTURE_LOD_BIAS_EXT ...");
}
......
......@@ -210,10 +210,10 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO) || (edge_length == pow2_edge_length))
{
/* Precalculated scaling for 'faked' non power of two texture coords. */
texture->baseTexture.pow2Matrix[0] = 1.0;
texture->baseTexture.pow2Matrix[5] = 1.0;
texture->baseTexture.pow2Matrix[10] = 1.0;
texture->baseTexture.pow2Matrix[15] = 1.0;
texture->baseTexture.pow2Matrix[0] = 1.0f;
texture->baseTexture.pow2Matrix[5] = 1.0f;
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
}
else
{
......@@ -221,7 +221,7 @@ HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UIN
texture->baseTexture.pow2Matrix[0] = ((float)edge_length) / ((float)pow2_edge_length);
texture->baseTexture.pow2Matrix[5] = ((float)edge_length) / ((float)pow2_edge_length);
texture->baseTexture.pow2Matrix[10] = ((float)edge_length) / ((float)pow2_edge_length);
texture->baseTexture.pow2Matrix[15] = 1.0;
texture->baseTexture.pow2Matrix[15] = 1.0f;
texture->baseTexture.pow2Matrix_identity = FALSE;
}
......
......@@ -38,23 +38,29 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/* Define the default light parameters as specified by MSDN */
const WINED3DLIGHT WINED3D_default_light = {
WINED3DLIGHT_DIRECTIONAL, /* Type */
{ 1.0, 1.0, 1.0, 0.0 }, /* Diffuse r,g,b,a */
{ 0.0, 0.0, 0.0, 0.0 }, /* Specular r,g,b,a */
{ 0.0, 0.0, 0.0, 0.0 }, /* Ambient r,g,b,a, */
{ 0.0, 0.0, 0.0 }, /* Position x,y,z */
{ 0.0, 0.0, 1.0 }, /* Direction x,y,z */
0.0, /* Range */
0.0, /* Falloff */
0.0, 0.0, 0.0, /* Attenuation 0,1,2 */
0.0, /* Theta */
0.0 /* Phi */
WINED3DLIGHT_DIRECTIONAL, /* Type */
{ 1.0f, 1.0f, 1.0f, 0.0f }, /* Diffuse r,g,b,a */
{ 0.0f, 0.0f, 0.0f, 0.0f }, /* Specular r,g,b,a */
{ 0.0f, 0.0f, 0.0f, 0.0f }, /* Ambient r,g,b,a, */
{ 0.0f, 0.0f, 0.0f }, /* Position x,y,z */
{ 0.0f, 0.0f, 1.0f }, /* Direction x,y,z */
0.0f, /* Range */
0.0f, /* Falloff */
0.0f, 0.0f, 0.0f, /* Attenuation 0,1,2 */
0.0f, /* Theta */
0.0f /* Phi */
};
/**********************************************************
* Global variable / Constants follow
**********************************************************/
const float identity[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1}; /* When needed for comparisons */
const float identity[] =
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f,
}; /* When needed for comparisons */
/* Note that except for WINED3DPT_POINTLIST and WINED3DPT_LINELIST these
* actually have the same values in GL and D3D. */
......@@ -2223,7 +2229,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
/* Clear the screen */
IWineD3DDevice_Clear((IWineD3DDevice *) This, 0, NULL,
WINED3DCLEAR_TARGET | pPresentationParameters->EnableAutoDepthStencil ? WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL : 0,
0x00, 1.0, 0);
0x00, 1.0f, 0);
This->d3d_initialized = TRUE;
......@@ -2798,7 +2804,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
/* Incorrect attenuation values can cause the gl driver to crash. Happens with Need for speed
* most wanted
*/
if(pLight->Attenuation0 < 0.0 || pLight->Attenuation1 < 0.0 || pLight->Attenuation2 < 0.0) {
if (pLight->Attenuation0 < 0.0f || pLight->Attenuation1 < 0.0f || pLight->Attenuation2 < 0.0f)
{
WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL\n");
return WINED3DERR_INVALIDCALL;
}
......@@ -2860,7 +2867,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
object->lightPosn[0] = -pLight->Direction.x;
object->lightPosn[1] = -pLight->Direction.y;
object->lightPosn[2] = -pLight->Direction.z;
object->lightPosn[3] = 0.0;
object->lightPosn[3] = 0.0f;
object->exponent = 0.0f;
object->cutoff = 180.0f;
break;
......@@ -2870,13 +2877,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
object->lightPosn[0] = pLight->Position.x;
object->lightPosn[1] = pLight->Position.y;
object->lightPosn[2] = pLight->Position.z;
object->lightPosn[3] = 1.0;
object->lightPosn[3] = 1.0f;
/* Direction */
object->lightDirn[0] = pLight->Direction.x;
object->lightDirn[1] = pLight->Direction.y;
object->lightDirn[2] = pLight->Direction.z;
object->lightDirn[3] = 1.0;
object->lightDirn[3] = 1.0f;
/*
* opengl-ish and d3d-ish spot lights use too different models for the
......@@ -2891,14 +2898,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
* will always be 1.0 for both of them, and we don't have to care for the
* rest of the rather complex calculation
*/
object->exponent = 0;
object->exponent = 0.0f;
} else {
rho = pLight->Theta + (pLight->Phi - pLight->Theta)/(2*pLight->Falloff);
if (rho < 0.0001) rho = 0.0001f;
object->exponent = -0.3/log(cos(rho/2));
if (rho < 0.0001f) rho = 0.0001f;
object->exponent = -0.3f/logf(cosf(rho/2));
}
if (object->exponent > 128.0) {
object->exponent = 128.0;
if (object->exponent > 128.0f)
{
object->exponent = 128.0f;
}
object->cutoff = pLight->Phi*90/M_PI;
......@@ -4164,10 +4172,10 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
TRACE("In: ( %06.2f %06.2f %06.2f )\n", p[0], p[1], p[2]);
/* Multiplication with world, view and projection matrix */
x = (p[0] * mat.u.s._11) + (p[1] * mat.u.s._21) + (p[2] * mat.u.s._31) + (1.0 * mat.u.s._41);
y = (p[0] * mat.u.s._12) + (p[1] * mat.u.s._22) + (p[2] * mat.u.s._32) + (1.0 * mat.u.s._42);
z = (p[0] * mat.u.s._13) + (p[1] * mat.u.s._23) + (p[2] * mat.u.s._33) + (1.0 * mat.u.s._43);
rhw = (p[0] * mat.u.s._14) + (p[1] * mat.u.s._24) + (p[2] * mat.u.s._34) + (1.0 * mat.u.s._44);
x = (p[0] * mat.u.s._11) + (p[1] * mat.u.s._21) + (p[2] * mat.u.s._31) + (1.0f * mat.u.s._41);
y = (p[0] * mat.u.s._12) + (p[1] * mat.u.s._22) + (p[2] * mat.u.s._32) + (1.0f * mat.u.s._42);
z = (p[0] * mat.u.s._13) + (p[1] * mat.u.s._23) + (p[2] * mat.u.s._33) + (1.0f * mat.u.s._43);
rhw = (p[0] * mat.u.s._14) + (p[1] * mat.u.s._24) + (p[2] * mat.u.s._34) + (1.0f * mat.u.s._44);
TRACE("x=%f y=%f z=%f rhw=%f\n", x, y, z, rhw);
......@@ -6257,10 +6265,10 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac
WARN("Converting to WINED3DCOLOR, this might give incorrect results\n");
c = ((DWORD)(color[2] * 255.0));
c |= ((DWORD)(color[1] * 255.0)) << 8;
c |= ((DWORD)(color[0] * 255.0)) << 16;
c |= ((DWORD)(color[3] * 255.0)) << 24;
c = ((DWORD)(color[2] * 255.0f));
c |= ((DWORD)(color[1] * 255.0f)) << 8;
c |= ((DWORD)(color[0] * 255.0f)) << 16;
c |= ((DWORD)(color[3] * 255.0f)) << 24;
/* Just forward this to the DirectDraw blitting engine */
memset(&BltFx, 0, sizeof(BltFx));
......
......@@ -1436,7 +1436,7 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
}
else
{
gl_info->max_shininess = 128.0;
gl_info->max_shininess = 128.0f;
}
if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
{
......@@ -3965,14 +3965,14 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
pCaps->MaxTextureRepeat = 32768;
pCaps->MaxTextureAspectRatio = GL_LIMITS(texture_size);
pCaps->MaxVertexW = 1.0;
pCaps->MaxVertexW = 1.0f;
pCaps->GuardBandLeft = 0;
pCaps->GuardBandTop = 0;
pCaps->GuardBandRight = 0;
pCaps->GuardBandBottom = 0;
pCaps->GuardBandLeft = 0.0f;
pCaps->GuardBandTop = 0.0f;
pCaps->GuardBandRight = 0.0f;
pCaps->GuardBandBottom = 0.0f;
pCaps->ExtentsAdjust = 0;
pCaps->ExtentsAdjust = 0.0f;
pCaps->StencilCaps = WINED3DSTENCILCAPS_DECRSAT |
WINED3DSTENCILCAPS_INCRSAT |
......@@ -4058,7 +4058,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
if(ps_selected_mode == SHADER_NONE) {
TRACE_(d3d_caps)("Pixel shader disabled in config, reporting version 0.0\n");
pCaps->PixelShaderVersion = WINED3DPS_VERSION(0,0);
pCaps->PixelShader1xMaxValue = 0.0;
pCaps->PixelShader1xMaxValue = 0.0f;
} else {
pCaps->PixelShaderVersion = shader_caps.PixelShaderVersion;
pCaps->PixelShader1xMaxValue = shader_caps.PixelShader1xMaxValue;
......@@ -4281,7 +4281,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
} else {
object->surface_alignment = D3D8_PITCH_ALIGNMENT;
}
object->posFixup[0] = 1.0; /* This is needed to get the x coord unmodified through a MAD */
object->posFixup[0] = 1.0f; /* This is needed to get the x coord unmodified through a MAD. */
/* Set the state up as invalid until the device is fully created */
object->state = WINED3DERR_DRIVERINTERNALERROR;
......@@ -4403,9 +4403,9 @@ static void WINE_GLAPI position_float4(const void *data)
{
const GLfloat *pos = data;
if (pos[3] != 0.0 && pos[3] != 1.0)
if (pos[3] != 0.0f && pos[3] != 1.0f)
{
float w = 1.0 / pos[3];
float w = 1.0f / pos[3];
glVertex4f(pos[0] * w, pos[1] * w, pos[2] * w, w);
}
......
......@@ -254,10 +254,10 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_stream_i
unsigned char i;
float color[4];
color[0] = D3DCOLOR_B_R(diffuseColor) / 255.0;
color[1] = D3DCOLOR_B_G(diffuseColor) / 255.0;
color[2] = D3DCOLOR_B_B(diffuseColor) / 255.0;
color[3] = D3DCOLOR_B_A(diffuseColor) / 255.0;
color[0] = D3DCOLOR_B_R(diffuseColor) / 255.0f;
color[1] = D3DCOLOR_B_G(diffuseColor) / 255.0f;
color[2] = D3DCOLOR_B_B(diffuseColor) / 255.0f;
color[3] = D3DCOLOR_B_A(diffuseColor) / 255.0f;
for (i = 0; i < num_untracked_materials; ++i)
{
......@@ -715,7 +715,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT numberOfVertice
static void normalize_normal(float *n) {
float length = n[0] * n[0] + n[1] * n[1] + n[2] * n[2];
if(length == 0.0) return;
if (length == 0.0f) return;
length = sqrt(length);
n[0] = n[0] / length;
n[1] = n[1] / length;
......@@ -747,7 +747,7 @@ static void normalize_normal(float *n) {
HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
struct WineD3DRectPatch *patch) {
unsigned int i, j, num_quads, out_vertex_size, buffer_size, d3d_out_vertex_size;
float max_x = 0.0, max_y = 0.0, max_z = 0.0, neg_z = 0.0;
float max_x = 0.0f, max_y = 0.0f, max_z = 0.0f, neg_z = 0.0f;
struct wined3d_stream_info stream_info;
struct wined3d_stream_info_element *e;
const BYTE *data;
......@@ -817,8 +817,8 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
checkGLcall("glMatrixMode(GL_PROJECTION)");
glLoadIdentity();
checkGLcall("glLoadIndentity()");
glScalef(1 / (max_x) , 1 / (max_y), max_z == 0 ? 1 : 1 / ( 2 * max_z));
glTranslatef(0, 0, 0.5);
glScalef(1.0f / (max_x), 1.0f / (max_y), max_z == 0.0f ? 1.0f : 1.0f / (2.0f * max_z));
glTranslatef(0.0f, 0.0f, 0.5f);
checkGLcall("glScalef");
glViewport(-max_x, -max_y, 2 * (max_x), 2 * (max_y));
checkGLcall("glViewport");
......@@ -830,11 +830,11 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_FILLMODE));
if(patch->has_normals) {
static const GLfloat black[] = {0, 0, 0, 0};
static const GLfloat red[] = {1, 0, 0, 0};
static const GLfloat green[] = {0, 1, 0, 0};
static const GLfloat blue[] = {0, 0, 1, 0};
static const GLfloat white[] = {1, 1, 1, 1};
static const GLfloat black[] = {0.0f, 0.0f, 0.0f, 0.0f};
static const GLfloat red[] = {1.0f, 0.0f, 0.0f, 0.0f};
static const GLfloat green[] = {0.0f, 1.0f, 0.0f, 0.0f};
static const GLfloat blue[] = {0.0f, 0.0f, 1.0f, 0.0f};
static const GLfloat white[] = {1.0f, 1.0f, 1.0f, 1.0f};
glEnable(GL_LIGHTING);
checkGLcall("glEnable(GL_LIGHTING)");
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, black);
......@@ -915,18 +915,18 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
feedbuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buffer_size * sizeof(float) * 8);
glMap2f(GL_MAP2_VERTEX_3,
0, 1, vtxStride / sizeof(float), info->Width,
0, 1, info->Stride * vtxStride / sizeof(float), info->Height,
0.0f, 1.0f, vtxStride / sizeof(float), info->Width,
0.0f, 1.0f, info->Stride * vtxStride / sizeof(float), info->Height,
(const GLfloat *)data);
checkGLcall("glMap2f");
if(patch->has_texcoords) {
glMap2f(GL_MAP2_TEXTURE_COORD_4,
0, 1, vtxStride / sizeof(float), info->Width,
0, 1, info->Stride * vtxStride / sizeof(float), info->Height,
0.0f, 1.0f, vtxStride / sizeof(float), info->Width,
0.0f, 1.0f, info->Stride * vtxStride / sizeof(float), info->Height,
(const GLfloat *)data);
checkGLcall("glMap2f");
}
glMapGrid2f(ceilf(patch->numSegs[0]), 0.0, 1.0, ceilf(patch->numSegs[1]), 0.0, 1.0);
glMapGrid2f(ceilf(patch->numSegs[0]), 0.0f, 1.0f, ceilf(patch->numSegs[1]), 0.0f, 1.0f);
checkGLcall("glMapGrid2f");
glFeedbackBuffer(buffer_size * 2, feedback_type, feedbuffer);
......@@ -968,7 +968,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
*/
patch->mem[i + 0] = feedbuffer[j + out_vertex_size * 2 + 2]; /* x, triangle 2 */
patch->mem[i + 1] = feedbuffer[j + out_vertex_size * 2 + 3]; /* y, triangle 2 */
patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 2 + 4] - 0.5) * 4 * max_z; /* z, triangle 3 */
patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 2 + 4] - 0.5f) * 4.0f * max_z; /* z, triangle 3 */
if(patch->has_normals) {
patch->mem[i + 3] = feedbuffer[j + out_vertex_size * 2 + 5];
patch->mem[i + 4] = feedbuffer[j + out_vertex_size * 2 + 6];
......@@ -978,7 +978,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
patch->mem[i + 0] = feedbuffer[j + out_vertex_size * 1 + 2]; /* x, triangle 2 */
patch->mem[i + 1] = feedbuffer[j + out_vertex_size * 1 + 3]; /* y, triangle 2 */
patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 1 + 4] - 0.5) * 4 * max_z; /* z, triangle 2 */
patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 1 + 4] - 0.5f) * 4.0f * max_z; /* z, triangle 2 */
if(patch->has_normals) {
patch->mem[i + 3] = feedbuffer[j + out_vertex_size * 1 + 5];
patch->mem[i + 4] = feedbuffer[j + out_vertex_size * 1 + 6];
......@@ -988,7 +988,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
patch->mem[i + 0] = feedbuffer[j + out_vertex_size * 0 + 2]; /* x, triangle 1 */
patch->mem[i + 1] = feedbuffer[j + out_vertex_size * 0 + 3]; /* y, triangle 1 */
patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 0 + 4] - 0.5) * 4 * max_z; /* z, triangle 1 */
patch->mem[i + 2] = (feedbuffer[j + out_vertex_size * 0 + 4] - 0.5f) * 4.0f * max_z; /* z, triangle 1 */
if(patch->has_normals) {
patch->mem[i + 3] = feedbuffer[j + out_vertex_size * 0 + 5];
patch->mem[i + 4] = feedbuffer[j + out_vertex_size * 0 + 6];
......@@ -999,9 +999,9 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
if(patch->has_normals) {
/* Now do the same with reverse light directions */
static const GLfloat x[] = {-1, 0, 0, 0};
static const GLfloat y[] = { 0, -1, 0, 0};
static const GLfloat z[] = { 0, 0, -1, 0};
static const GLfloat x[] = {-1.0f, 0.0f, 0.0f, 0.0f};
static const GLfloat y[] = { 0.0f, -1.0f, 0.0f, 0.0f};
static const GLfloat z[] = { 0.0f, 0.0f, -1.0f, 0.0f};
glLightfv(GL_LIGHT0, GL_POSITION, x);
glLightfv(GL_LIGHT1, GL_POSITION, y);
glLightfv(GL_LIGHT2, GL_POSITION, z);
......@@ -1024,29 +1024,29 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
ERR("Unexpected polygon: %f corners\n", feedbuffer[j + 1]);
continue;
}
if(patch->mem[i + 3] == 0.0)
if(patch->mem[i + 3] == 0.0f)
patch->mem[i + 3] = -feedbuffer[j + out_vertex_size * 2 + 5];
if(patch->mem[i + 4] == 0.0)
if(patch->mem[i + 4] == 0.0f)
patch->mem[i + 4] = -feedbuffer[j + out_vertex_size * 2 + 6];
if(patch->mem[i + 5] == 0.0)
if(patch->mem[i + 5] == 0.0f)
patch->mem[i + 5] = -feedbuffer[j + out_vertex_size * 2 + 7];
normalize_normal(patch->mem + i + 3);
i += d3d_out_vertex_size;
if(patch->mem[i + 3] == 0.0)
if(patch->mem[i + 3] == 0.0f)
patch->mem[i + 3] = -feedbuffer[j + out_vertex_size * 1 + 5];
if(patch->mem[i + 4] == 0.0)
if(patch->mem[i + 4] == 0.0f)
patch->mem[i + 4] = -feedbuffer[j + out_vertex_size * 1 + 6];
if(patch->mem[i + 5] == 0.0)
if(patch->mem[i + 5] == 0.0f)
patch->mem[i + 5] = -feedbuffer[j + out_vertex_size * 1 + 7];
normalize_normal(patch->mem + i + 3);
i += d3d_out_vertex_size;
if(patch->mem[i + 3] == 0.0)
if(patch->mem[i + 3] == 0.0f)
patch->mem[i + 3] = -feedbuffer[j + out_vertex_size * 0 + 5];
if(patch->mem[i + 4] == 0.0)
if(patch->mem[i + 4] == 0.0f)
patch->mem[i + 4] = -feedbuffer[j + out_vertex_size * 0 + 6];
if(patch->mem[i + 5] == 0.0)
if(patch->mem[i + 5] == 0.0f)
patch->mem[i + 5] = -feedbuffer[j + out_vertex_size * 0 + 7];
normalize_normal(patch->mem + i + 3);
i += d3d_out_vertex_size;
......
......@@ -133,7 +133,7 @@ static void WINE_GLAPI wine_glGetIntegerv(GLenum pname, GLint* params) {
static void (WINE_GLAPI *old_multitex_glGetFloatv) (GLenum pname, GLfloat* params) = NULL;
static void WINE_GLAPI wine_glGetFloatv(GLenum pname, GLfloat* params) {
if(pname == GL_ACTIVE_TEXTURE) *params = 0.0;
if (pname == GL_ACTIVE_TEXTURE) *params = 0.0f;
else old_multitex_glGetFloatv(pname, params);
}
......@@ -275,9 +275,9 @@ static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat
GLfloat i;
i = (ctx->fogend - ctx->fog_coord_value) / (ctx->fogend - ctx->fogstart);
c[0] = i * c[0] + (1.0 - i) * ctx->fogcolor[0];
c[1] = i * c[1] + (1.0 - i) * ctx->fogcolor[1];
c[2] = i * c[2] + (1.0 - i) * ctx->fogcolor[2];
c[0] = i * c[0] + (1.0f - i) * ctx->fogcolor[0];
c[1] = i * c[1] + (1.0f - i) * ctx->fogcolor[1];
c[2] = i * c[2] + (1.0f - i) * ctx->fogcolor[2];
old_fogcoord_glColor4f(c[0], c[1], c[2], c[3]);
old_fogcoord_glVertex4f(x, y, z, w);
......@@ -291,11 +291,11 @@ static void WINE_GLAPI wine_glVertex4fv(const GLfloat *pos) {
}
static void WINE_GLAPI wine_glVertex3f(GLfloat x, GLfloat y, GLfloat z) {
wine_glVertex4f(x, y, z, 1.0);
wine_glVertex4f(x, y, z, 1.0f);
}
static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) {
wine_glVertex4f(pos[0], pos[1], pos[2], 1.0);
wine_glVertex4f(pos[0], pos[1], pos[2], 1.0f);
}
static void wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
......@@ -312,15 +312,15 @@ static void wine_glColor4fv(const GLfloat *c) {
}
static void wine_glColor3f(GLfloat r, GLfloat g, GLfloat b) {
wine_glColor4f(r, g, b, 1.0);
wine_glColor4f(r, g, b, 1.0f);
}
static void wine_glColor3fv(const GLfloat *c) {
wine_glColor4f(c[0], c[1], c[2], 1.0);
wine_glColor4f(c[0], c[1], c[2], 1.0f);
}
static void wine_glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) {
wine_glColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0);
wine_glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
}
/* In D3D the fog coord is a UBYTE, so there's no problem with using the single
......
......@@ -357,10 +357,10 @@ static inline void apply_clamped_constant(const WineD3D_GL_Info *gl_info, GLint
if (location == -1) return;
clamped_constant[0] = data[0] < -1.0f ? -1.0f : data[0] > 1.0 ? 1.0 : data[0];
clamped_constant[1] = data[1] < -1.0f ? -1.0f : data[1] > 1.0 ? 1.0 : data[1];
clamped_constant[2] = data[2] < -1.0f ? -1.0f : data[2] > 1.0 ? 1.0 : data[2];
clamped_constant[3] = data[3] < -1.0f ? -1.0f : data[3] > 1.0 ? 1.0 : data[3];
clamped_constant[0] = data[0] < -1.0f ? -1.0f : data[0] > 1.0f ? 1.0f : data[0];
clamped_constant[1] = data[1] < -1.0f ? -1.0f : data[1] > 1.0f ? 1.0f : data[1];
clamped_constant[2] = data[2] < -1.0f ? -1.0f : data[2] > 1.0f ? 1.0f : data[2];
clamped_constant[3] = data[3] < -1.0f ? -1.0f : data[3] > 1.0f ? 1.0f : data[3];
GL_EXTCALL(glUniform4fvARB(location, 1, clamped_constant));
}
......@@ -691,12 +691,12 @@ static void shader_glsl_load_constants(
if(((IWineD3DPixelShaderImpl *) pshader)->vpos_uniform) {
float correction_params[4];
if(deviceImpl->render_offscreen) {
correction_params[0] = 0.0;
correction_params[1] = 1.0;
correction_params[0] = 0.0f;
correction_params[1] = 1.0f;
} else {
/* position is window relative, not viewport relative */
correction_params[0] = ((IWineD3DSurfaceImpl *) deviceImpl->render_targets[0])->currentDesc.Height;
correction_params[1] = -1.0;
correction_params[1] = -1.0f;
}
GL_EXTCALL(glUniform4fvARB(prog->ycorrection_location, 1, correction_params));
}
......@@ -907,8 +907,8 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s
*/
FIXME("Cannot find a free uniform for vpos correction params\n");
shader_addline(buffer, "const vec4 ycorrection = vec4(%f, %f, 0.0, 0.0);\n",
device->render_offscreen ? 0.0 : ((IWineD3DSurfaceImpl *) device->render_targets[0])->currentDesc.Height,
device->render_offscreen ? 1.0 : -1.0);
device->render_offscreen ? 0.0f : ((IWineD3DSurfaceImpl *)device->render_targets[0])->currentDesc.Height,
device->render_offscreen ? 1.0f : -1.0f);
}
shader_addline(buffer, "vec4 vpos;\n");
}
......
......@@ -510,7 +510,7 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && enable_ckey) {
glParm = GL_NOTEQUAL;
ref = 0.0;
ref = 0.0f;
} else {
ref = ((float) stateblock->renderState[WINED3DRS_ALPHAREF]) / 255.0f;
glParm = CompareFunc(stateblock->renderState[WINED3DRS_ALPHAFUNC]);
......@@ -935,13 +935,13 @@ void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
switch(context->fog_source) {
case FOGSOURCE_VS:
fogstart = 1.0;
fogend = 0.0;
fogstart = 1.0f;
fogend = 0.0f;
break;
case FOGSOURCE_COORD:
fogstart = 255.0;
fogend = 0.0;
fogstart = 255.0f;
fogend = 0.0f;
break;
case FOGSOURCE_FFP:
......@@ -951,8 +951,8 @@ void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
fogend = tmpvalue.f;
/* In GL, fogstart == fogend disables fog, in D3D everything's fogged.*/
if(fogstart == fogend) {
fogstart = -1.0 / 0.0;
fogend = 0.0;
fogstart = -1.0f / 0.0f;
fogend = 0.0f;
}
break;
......@@ -961,8 +961,8 @@ void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DC
* Still this is needed to make the compiler happy
*/
ERR("Unexpected fog coordinate source\n");
fogstart = 0.0;
fogend = 0.0;
fogstart = 0.0f;
fogend = 0.0f;
}
glFogf(GL_FOG_START, fogstart);
......@@ -1335,11 +1335,13 @@ static void state_psizemin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, Wi
} tmpvalue;
tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MIN];
if(tmpvalue.f != 1.0) {
if (tmpvalue.f != 1.0f)
{
FIXME("WINED3DRS_POINTSIZE_MIN not supported on this opengl, value is %f\n", tmpvalue.f);
}
tmpvalue.d = stateblock->renderState[WINED3DRS_POINTSIZE_MAX];
if(tmpvalue.f != 64.0) {
if (tmpvalue.f != 64.0f)
{
FIXME("WINED3DRS_POINTSIZE_MAX not supported on this opengl, value is %f\n", tmpvalue.f);
}
......@@ -3103,10 +3105,10 @@ static void loadTexCoords(IWineD3DStateBlockImpl *stateblock, const struct wined
static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
static const GLfloat s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
static const GLfloat t_plane[] = { 0.0, 1.0, 0.0, 0.0 };
static const GLfloat r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
static const GLfloat q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
static const GLfloat s_plane[] = { 1.0f, 0.0f, 0.0f, 0.0f };
static const GLfloat t_plane[] = { 0.0f, 1.0f, 0.0f, 0.0f };
static const GLfloat r_plane[] = { 0.0f, 0.0f, 1.0f, 0.0f };
static const GLfloat q_plane[] = { 0.0f, 0.0f, 0.0f, 1.0f };
if (mapped_stage == WINED3D_UNMAPPED_STAGE)
{
......@@ -3508,7 +3510,7 @@ static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo
glPushMatrix();
glLoadIdentity();
if(stateblock->wineD3DDevice->render_offscreen) {
glScalef(1.0, -1.0, 1.0);
glScalef(1.0f, -1.0f, 1.0f);
}
}
......@@ -3742,12 +3744,12 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
checkGLcall("glOrtho");
/* Window Coord 0 is the middle of the first pixel, so translate by 1/2 pixels */
glTranslatef(0.5, 0.5, 0);
checkGLcall("glTranslatef(0.5, 0.5, 0)");
glTranslatef(0.5f, 0.5f, 0.0f);
checkGLcall("glTranslatef(0.5f, 0.5f, 0.0f)");
/* D3D texture coordinates are flipped compared to OpenGL ones, so
* render everything upside down when rendering offscreen. */
if (stateblock->wineD3DDevice->render_offscreen) {
glScalef(1.0, -1.0, 1.0);
glScalef(1.0f, -1.0f, 1.0f);
checkGLcall("glScalef");
}
} else {
......@@ -3791,13 +3793,13 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
if (stateblock->wineD3DDevice->render_offscreen) {
/* D3D texture coordinates are flipped compared to OpenGL ones, so
* render everything upside down when rendering offscreen. */
glTranslatef(1.0 / stateblock->viewport.Width, 1.0 / stateblock->viewport.Height, -1.0);
checkGLcall("glTranslatef(1.0 / width, 1.0 / height, -1.0)");
glScalef(1.0, -1.0, 2.0);
glTranslatef(1.0f / stateblock->viewport.Width, 1.0f / stateblock->viewport.Height, -1.0f);
checkGLcall("glTranslatef(1.0f / width, 1.0f / height, -1.0f)");
glScalef(1.0f, -1.0f, 2.0f);
} else {
glTranslatef(1.0 / stateblock->viewport.Width, -1.0 / stateblock->viewport.Height, -1.0);
checkGLcall("glTranslatef(1.0 / width, -1.0 / height, -1.0)");
glScalef(1.0, 1.0, 2.0);
glTranslatef(1.0f / stateblock->viewport.Width, -1.0f / stateblock->viewport.Height, -1.0f);
checkGLcall("glTranslatef(1.0f / width, -1.0f / height, -1.0f)");
glScalef(1.0f, 1.0f, 2.0f);
}
checkGLcall("glScalef");
......@@ -4368,7 +4370,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W
* TODO: Move to the viewport state
*/
if (useVertexShaderFunction) {
device->posFixup[1] = device->render_offscreen ? -1.0 : 1.0;
device->posFixup[1] = device->render_offscreen ? -1.0f : 1.0f;
device->posFixup[3] = -device->posFixup[1] / stateblock->viewport.Height;
}
}
......@@ -4511,7 +4513,7 @@ static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, W
}
static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
stateblock->wineD3DDevice->posFixup[2] = 1.0 / stateblock->viewport.Width;
stateblock->wineD3DDevice->posFixup[2] = 1.0f / stateblock->viewport.Width;
stateblock->wineD3DDevice->posFixup[3] = -stateblock->wineD3DDevice->posFixup[1] / stateblock->viewport.Height;
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) {
transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context);
......@@ -4530,7 +4532,7 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContex
checkGLcall("glDisable(GL_LIGHT0 + Index)");
} else {
float quad_att;
float colRGBA[] = {0.0, 0.0, 0.0, 0.0};
float colRGBA[] = {0.0f, 0.0f, 0.0f, 0.0f};
/* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/
glMatrixMode(GL_MODELVIEW);
......@@ -4562,9 +4564,9 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContex
checkGLcall("glLightfv");
if ((lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range) >= FLT_MIN) {
quad_att = 1.4/(lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range);
quad_att = 1.4f/(lightInfo->OriginalParms.Range *lightInfo->OriginalParms.Range);
} else {
quad_att = 0; /* 0 or MAX? (0 seems to be ok) */
quad_att = 0.0f; /* 0 or MAX? (0 seems to be ok) */
}
/* Do not assign attenuation values for lights that do not use them. D3D apps are free to pass any junk,
......
......@@ -114,7 +114,7 @@ UINT surface_calculate_size(const struct GlPixelFormatDesc *format_desc, UINT al
size = height * (((width * format_desc->byte_count) + alignment - 1) & ~(alignment - 1));
}
if (format_desc->heightscale != 0.0) size *= format_desc->heightscale;
if (format_desc->heightscale != 0.0f) size *= format_desc->heightscale;
return size;
}
......@@ -502,7 +502,7 @@ static void surface_download_data(IWineD3DSurfaceImpl *This) {
static void surface_upload_data(IWineD3DSurfaceImpl *This, GLenum internal, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *data) {
const struct GlPixelFormatDesc *format_desc = This->resource.format_desc;
if (format_desc->heightscale != 1.0 && format_desc->heightscale != 0.0) height *= format_desc->heightscale;
if (format_desc->heightscale != 1.0f && format_desc->heightscale != 0.0f) height *= format_desc->heightscale;
if (format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
{
......@@ -572,7 +572,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, GLenum internal,
BOOL enable_client_storage = FALSE;
const BYTE *mem = NULL;
if (format_desc->heightscale != 1.0 && format_desc->heightscale != 0.0) height *= format_desc->heightscale;
if (format_desc->heightscale != 1.0f && format_desc->heightscale != 0.0f) height *= format_desc->heightscale;
TRACE("(%p) : Creating surface (target %#x) level %d, d3d format %s, internal format %#x, width %d, height %d, gl format %#x, gl type=%#x\n",
This, This->glDescription.target, This->glDescription.level, debug_d3dformat(format_desc->format),
......@@ -1428,7 +1428,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
checkGLcall("glIntegerv");
glGetIntegerv(GL_CURRENT_RASTER_POSITION, &prev_rasterpos[0]);
checkGLcall("glIntegerv");
glPixelZoom(1.0, -1.0);
glPixelZoom(1.0f, -1.0f);
checkGLcall("glPixelZoom");
/* If not fullscreen, we need to skip a number of bytes to find the next row of data */
......@@ -1478,7 +1478,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
checkGLcall("glBindBufferARB");
}
glPixelZoom(1.0,1.0);
glPixelZoom(1.0f, 1.0f);
checkGLcall("glPixelZoom");
glRasterPos3iv(&prev_rasterpos[0]);
......@@ -2401,7 +2401,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
float red = (*Source++);
Dest[0] = green;
Dest[1] = red;
Dest[2] = 1.0;
Dest[2] = 1.0f;
Dest += 3;
}
}
......@@ -3080,19 +3080,24 @@ static inline void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3D
xrel = (float) (srect->x2 - srect->x1) / (float) (drect->x2 - drect->x1);
yrel = (float) (srect->y2 - srect->y1) / (float) (drect->y2 - drect->y1);
if( (xrel - 1.0 < -eps) || (xrel - 1.0 > eps)) {
if ((xrel - 1.0f < -eps) || (xrel - 1.0f > eps))
{
FIXME("Doing a pixel by pixel copy from the framebuffer to a texture, expect major performance issues\n");
if(Filter != WINED3DTEXF_NONE && Filter != WINED3DTEXF_POINT) {
ERR("Texture filtering not supported in direct blit\n");
}
} else if((Filter != WINED3DTEXF_NONE && Filter != WINED3DTEXF_POINT) && ((yrel - 1.0 < -eps) || (yrel - 1.0 > eps))) {
}
else if ((Filter != WINED3DTEXF_NONE && Filter != WINED3DTEXF_POINT)
&& ((yrel - 1.0f < -eps) || (yrel - 1.0f > eps)))
{
ERR("Texture filtering not supported in direct blit\n");
}
if(upsidedown &&
!((xrel - 1.0 < -eps) || (xrel - 1.0 > eps)) &&
!((yrel - 1.0 < -eps) || (yrel - 1.0 > eps))) {
if (upsidedown
&& !((xrel - 1.0f < -eps) || (xrel - 1.0f > eps))
&& !((yrel - 1.0f < -eps) || (yrel - 1.0f > eps)))
{
/* Upside down copy without stretching is nice, one glCopyTexSubImage call will do */
glCopyTexSubImage2D(This->glDescription.target,
......@@ -3109,7 +3114,8 @@ static inline void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *This, IWineD3D
* However, stretching in x direction can be avoided if not necessary
*/
for(row = drect->y1; row < drect->y2; row++) {
if( (xrel - 1.0 < -eps) || (xrel - 1.0 > eps)) {
if ((xrel - 1.0f < -eps) || (xrel - 1.0f > eps))
{
/* Well, that stuff works, but it's very slow.
* find a better way instead
*/
......@@ -3340,15 +3346,15 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
glBegin(GL_QUADS);
/* top left */
glTexCoord2f(0.0, (float) fbheight / (float) Src->pow2Height);
glTexCoord2f(0.0f, (float)fbheight / (float)Src->pow2Height);
glVertex2i(0, 0);
/* bottom left */
glTexCoord2f(0.0, 0.0);
glTexCoord2f(0.0f, 0.0f);
glVertex2i(0, fbheight);
/* bottom right */
glTexCoord2f((float) fbwidth / (float) Src->pow2Width, 0.0);
glTexCoord2f((float)fbwidth / (float)Src->pow2Width, 0.0f);
glVertex2i(fbwidth, Src->currentDesc.Height);
/* top right */
......@@ -3792,9 +3798,9 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
* Which means that the colorkey is one of the palette entries. In other cases pixels that
* should be masked away have alpha set to 0. */
if(primary_render_target_is_p8(myDevice))
glAlphaFunc(GL_NOTEQUAL, (float)Src->SrcBltCKey.dwColorSpaceLowValue / 256.0);
glAlphaFunc(GL_NOTEQUAL, (float)Src->SrcBltCKey.dwColorSpaceLowValue / 256.0f);
else
glAlphaFunc(GL_NOTEQUAL, 0.0);
glAlphaFunc(GL_NOTEQUAL, 0.0f);
checkGLcall("glAlphaFunc\n");
} else {
glDisable(GL_ALPHA_TEST);
......@@ -3805,24 +3811,19 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
*/
glBegin(GL_QUADS);
glColor3d(1.0f, 1.0f, 1.0f);
glColor3f(1.0f, 1.0f, 1.0f);
glTexCoord2f(glTexCoord[0], glTexCoord[2]);
glVertex3f(rect.x1,
rect.y1,
0.0);
glVertex3f(rect.x1, rect.y1, 0.0f);
glTexCoord2f(glTexCoord[0], glTexCoord[3]);
glVertex3f(rect.x1, rect.y2, 0.0);
glVertex3f(rect.x1, rect.y2, 0.0f);
glTexCoord2f(glTexCoord[1], glTexCoord[3]);
glVertex3f(rect.x2,
rect.y2,
0.0);
glVertex3f(rect.x2, rect.y2, 0.0f);
glTexCoord2f(glTexCoord[1], glTexCoord[2]);
glVertex3f(rect.x2,
rect.y1,
0.0);
glVertex3f(rect.x2, rect.y1, 0.0f);
glEnd();
checkGLcall("glEnd");
......@@ -3920,11 +3921,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, const
}
TRACE("(%p) executing Render Target override, color = %x\n", This, color);
IWineD3DDeviceImpl_ClearSurface(myDevice, This,
1, /* Number of rectangles */
&rect, WINED3DCLEAR_TARGET, color,
0.0 /* Z */,
0 /* Stencil */);
IWineD3DDeviceImpl_ClearSurface(myDevice, This, 1 /* Number of rectangles */,
&rect, WINED3DCLEAR_TARGET, color, 0.0f /* Z */, 0 /* Stencil */);
return WINED3D_OK;
}
}
......@@ -3957,7 +3955,7 @@ static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *D
depth = (float) DDBltFx->u5.dwFillDepth / (float) 0xffffffff;
break;
default:
depth = 0.0;
depth = 0.0f;
ERR("Unexpected format for depth fill: %s\n", debug_d3dformat(This->resource.format_desc->format));
}
......
......@@ -41,26 +41,26 @@ static inline unsigned short float_32_to_16(const float *in)
unsigned short ret;
/* Deal with special numbers */
if(*in == 0.0) return 0x0000;
if (*in == 0.0f) return 0x0000;
if(isnan(*in)) return 0x7C01;
if(isinf(*in)) return (*in < 0.0 ? 0xFC00 : 0x7c00);
if (isinf(*in)) return (*in < 0.0f ? 0xFC00 : 0x7c00);
if(tmp < pow(2, 10)) {
do
{
tmp = tmp * 2.0;
tmp = tmp * 2.0f;
exp--;
}while(tmp < pow(2, 10));
} else if(tmp >= pow(2, 11)) {
do
{
tmp /= 2.0;
tmp /= 2.0f;
exp++;
}while(tmp >= pow(2, 11));
}
mantissa = (unsigned int) tmp;
if(tmp - mantissa >= 0.5) mantissa++; /* round to nearest, away from zero */
if(tmp - mantissa >= 0.5f) mantissa++; /* round to nearest, away from zero */
exp += 10; /* Normalize the mantissa */
exp += 15; /* Exponent is encoded with excess 15 */
......@@ -78,7 +78,7 @@ static inline unsigned short float_32_to_16(const float *in)
ret = (exp << 10) | (mantissa & 0x3ff);
}
ret |= ((*in < 0.0 ? 1 : 0) << 15); /* Add the sign */
ret |= ((*in < 0.0f ? 1 : 0) << 15); /* Add the sign */
return ret;
}
......
......@@ -223,7 +223,7 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
TRACE("Clearing the color buffer with cyan color\n");
IWineD3DDevice_Clear((IWineD3DDevice*)This->wineD3DDevice, 0, NULL,
WINED3DCLEAR_TARGET, 0xff00ffff, 1.0, 0);
WINED3DCLEAR_TARGET, 0xff00ffff, 1.0f, 0);
}
if(((IWineD3DSurfaceImpl *) This->frontBuffer)->Flags & SFLAG_INSYSMEM ||
......
......@@ -214,10 +214,10 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
* doesn't work in combination with ARB_TEXTURE_RECTANGLE. */
if (GL_SUPPORT(WINE_NORMALIZED_TEXRECT) && (width != pow2_width || height != pow2_height))
{
texture->baseTexture.pow2Matrix[0] = 1.0;
texture->baseTexture.pow2Matrix[5] = 1.0;
texture->baseTexture.pow2Matrix[10] = 1.0;
texture->baseTexture.pow2Matrix[15] = 1.0;
texture->baseTexture.pow2Matrix[0] = 1.0f;
texture->baseTexture.pow2Matrix[5] = 1.0f;
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
texture->target = GL_TEXTURE_2D;
texture->cond_np2 = TRUE;
texture->baseTexture.minMipLookup = minMipLookup_noFilter;
......@@ -231,8 +231,8 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
texture->baseTexture.pow2Matrix[0] = (float)width;
texture->baseTexture.pow2Matrix[5] = (float)height;
texture->baseTexture.pow2Matrix[10] = 1.0;
texture->baseTexture.pow2Matrix[15] = 1.0;
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
texture->target = GL_TEXTURE_RECTANGLE_ARB;
texture->cond_np2 = TRUE;
texture->baseTexture.minMipLookup = minMipLookup_noFilter;
......@@ -247,12 +247,12 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT
}
else
{
texture->baseTexture.pow2Matrix[0] = 1.0;
texture->baseTexture.pow2Matrix[5] = 1.0;
texture->baseTexture.pow2Matrix[0] = 1.0f;
texture->baseTexture.pow2Matrix[5] = 1.0f;
}
texture->baseTexture.pow2Matrix[10] = 1.0;
texture->baseTexture.pow2Matrix[15] = 1.0;
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
texture->target = GL_TEXTURE_2D;
texture->cond_np2 = FALSE;
}
......
......@@ -764,7 +764,7 @@ static BOOL init_format_texture_info(WineD3D_GL_Info *gl_info)
desc->glType = gl_formats_template[i].glType;
desc->color_fixup = COLOR_FIXUP_IDENTITY;
desc->Flags |= gl_formats_template[i].Flags;
desc->heightscale = 1.0;
desc->heightscale = 1.0f;
}
return TRUE;
......@@ -869,7 +869,7 @@ static void apply_format_fixups(WineD3D_GL_Info *gl_info)
}
idx = getFmtIdx(WINED3DFMT_YV12);
gl_info->gl_formats[idx].heightscale = 1.5;
gl_info->gl_formats[idx].heightscale = 1.5f;
gl_info->gl_formats[idx].color_fixup = create_yuv_fixup_desc(YUV_FIXUP_YV12);
if (GL_SUPPORT(EXT_VERTEX_ARRAY_BGRA))
......
......@@ -162,10 +162,10 @@ HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT
}
/* Is NP2 support for volumes needed? */
texture->baseTexture.pow2Matrix[0] = 1.0;
texture->baseTexture.pow2Matrix[5] = 1.0;
texture->baseTexture.pow2Matrix[10] = 1.0;
texture->baseTexture.pow2Matrix[15] = 1.0;
texture->baseTexture.pow2Matrix[0] = 1.0f;
texture->baseTexture.pow2Matrix[5] = 1.0f;
texture->baseTexture.pow2Matrix[10] = 1.0f;
texture->baseTexture.pow2Matrix[15] = 1.0f;
/* Generate all the surfaces. */
tmp_w = width;
......
......@@ -197,16 +197,16 @@ static inline float float_16_to_32(const unsigned short *in) {
const unsigned short s = ((*in) & 0x8000);
const unsigned short e = ((*in) & 0x7C00) >> 10;
const unsigned short m = (*in) & 0x3FF;
const float sgn = (s ? -1.0 : 1.0);
const float sgn = (s ? -1.0f : 1.0f);
if(e == 0) {
if(m == 0) return sgn * 0.0; /* +0.0 or -0.0 */
else return sgn * pow(2, -14.0) * ( (float) m / 1024.0);
if(m == 0) return sgn * 0.0f; /* +0.0 or -0.0 */
else return sgn * pow(2, -14.0f) * ((float)m / 1024.0f);
} else if(e < 31) {
return sgn * pow(2, (float) e-15.0) * (1.0 + ((float) m / 1024.0));
return sgn * pow(2, (float)e - 15.0f) * (1.0f + ((float)m / 1024.0f));
} else {
if(m == 0) return sgn / 0.0; /* +INF / -INF */
else return 0.0 / 0.0; /* NAN */
if(m == 0) return sgn / 0.0f; /* +INF / -INF */
else return 0.0f / 0.0f; /* NAN */
}
}
......@@ -227,8 +227,8 @@ static inline float float_24_to_32(DWORD in)
}
else
{
if (m == 0) return sgn / 0.0; /* +INF / -INF */
else return 0.0 / 0.0; /* NAN */
if (m == 0) return sgn / 0.0f; /* +INF / -INF */
else return 0.0f / 0.0f; /* NAN */
}
}
......@@ -2765,11 +2765,11 @@ void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseT
void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImpl *stateblock, struct ps_compile_args *args);
/* sRGB correction constants */
static const float srgb_cmp = 0.0031308;
static const float srgb_mul_low = 12.92;
static const float srgb_pow = 0.41666;
static const float srgb_mul_high = 1.055;
static const float srgb_sub_high = 0.055;
static const float srgb_cmp = 0.0031308f;
static const float srgb_mul_low = 12.92f;
static const float srgb_pow = 0.41666f;
static const float srgb_mul_high = 1.055f;
static const float srgb_sub_high = 0.055f;
/*****************************************************************************
* IWineD3DPalette implementation structure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment