From 02bb70fc3b8bdec341d4680aaba2c08531785e9b Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 20 Nov 2011 20:27:13 +0100 Subject: [PATCH] wined3d: Get rid of the WINED3DMATERIAL typedef. --- dlls/d3d8/device.c | 8 ++--- dlls/d3d9/device.c | 8 ++--- dlls/ddraw/device.c | 8 ++--- dlls/wined3d/device.c | 30 +++++++++---------- dlls/wined3d/state.c | 54 ++++++++++++++++++---------------- dlls/wined3d/wined3d_private.h | 2 +- include/wine/wined3d.h | 18 ++++++------ 7 files changed, 65 insertions(+), 63 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 1ef910e3c73..9bf350a6683 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1311,9 +1311,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetMaterial(IDirect3DDevice8 *iface, TRACE("iface %p, material %p.\n", iface, pMaterial); - /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */ + /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */ wined3d_mutex_lock(); - hr = wined3d_device_set_material(This->wined3d_device, (const WINED3DMATERIAL *)pMaterial); + hr = wined3d_device_set_material(This->wined3d_device, (const struct wined3d_material *)pMaterial); wined3d_mutex_unlock(); return hr; @@ -1327,9 +1327,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetMaterial(IDirect3DDevice8 *iface, TRACE("iface %p, material %p.\n", iface, pMaterial); - /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */ + /* Note: D3DMATERIAL8 is compatible with struct wined3d_material. */ wined3d_mutex_lock(); - hr = wined3d_device_get_material(This->wined3d_device, (WINED3DMATERIAL *)pMaterial); + hr = wined3d_device_get_material(This->wined3d_device, (struct wined3d_material *)pMaterial); wined3d_mutex_unlock(); return hr; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index c51bb239058..08c503bf4d6 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1329,9 +1329,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetMaterial(IDirect3DDevice9Ex *iface TRACE("iface %p, material %p.\n", iface, pMaterial); - /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */ + /* Note: D3DMATERIAL9 is compatible with struct wined3d_material. */ wined3d_mutex_lock(); - hr = wined3d_device_set_material(This->wined3d_device, (const WINED3DMATERIAL *)pMaterial); + hr = wined3d_device_set_material(This->wined3d_device, (const struct wined3d_material *)pMaterial); wined3d_mutex_unlock(); return hr; @@ -1345,9 +1345,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetMaterial(IDirect3DDevice9Ex *iface TRACE("iface %p, material %p.\n", iface, pMaterial); - /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */ + /* Note: D3DMATERIAL9 is compatible with struct wined3d_material. */ wined3d_mutex_lock(); - hr = wined3d_device_get_material(This->wined3d_device, (WINED3DMATERIAL *)pMaterial); + hr = wined3d_device_get_material(This->wined3d_device, (struct wined3d_material *)pMaterial); wined3d_mutex_unlock(); return hr; diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 06fa7c453da..966855e375b 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -5265,8 +5265,8 @@ IDirect3DDeviceImpl_7_SetMaterial(IDirect3DDevice7 *iface, if (!Mat) return DDERR_INVALIDPARAMS; wined3d_mutex_lock(); - /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */ - hr = wined3d_device_set_material(This->wined3d_device, (WINED3DMATERIAL *)Mat); + /* Note: D3DMATERIAL7 is compatible with struct wined3d_material. */ + hr = wined3d_device_set_material(This->wined3d_device, (struct wined3d_material *)Mat); wined3d_mutex_unlock(); return hr_ddraw_from_wined3d(hr); @@ -5319,8 +5319,8 @@ IDirect3DDeviceImpl_7_GetMaterial(IDirect3DDevice7 *iface, TRACE("iface %p, material %p.\n", iface, Mat); wined3d_mutex_lock(); - /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */ - hr = wined3d_device_get_material(This->wined3d_device, (WINED3DMATERIAL *)Mat); + /* Note: D3DMATERIAL7 is compatible with struct wined3d_material. */ + hr = wined3d_device_get_material(This->wined3d_device, (struct wined3d_material *)Mat); wined3d_mutex_unlock(); return hr_ddraw_from_wined3d(hr); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 4e765254003..29c16b5766b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -2280,7 +2280,7 @@ HRESULT CDECL wined3d_device_get_clip_status(const struct wined3d_device *device return WINED3D_OK; } -HRESULT CDECL wined3d_device_set_material(struct wined3d_device *device, const WINED3DMATERIAL *material) +HRESULT CDECL wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material) { TRACE("device %p, material %p.\n", device, material); @@ -2299,25 +2299,25 @@ HRESULT CDECL wined3d_device_set_material(struct wined3d_device *device, const W return WINED3D_OK; } -HRESULT CDECL wined3d_device_get_material(const struct wined3d_device *device, WINED3DMATERIAL *material) +HRESULT CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material) { TRACE("device %p, material %p.\n", device, material); *material = device->updateStateBlock->state.material; - TRACE("Diffuse {%.8e, %.8e, %.8e, %.8e}\n", - material->Diffuse.r, material->Diffuse.g, - material->Diffuse.b, material->Diffuse.a); - TRACE("Ambient {%.8e, %.8e, %.8e, %.8e}\n", - material->Ambient.r, material->Ambient.g, - material->Ambient.b, material->Ambient.a); - TRACE("Specular {%.8e, %.8e, %.8e, %.8e}\n", - material->Specular.r, material->Specular.g, - material->Specular.b, material->Specular.a); - TRACE("Emissive {%.8e, %.8e, %.8e, %.8e}\n", - material->Emissive.r, material->Emissive.g, - material->Emissive.b, material->Emissive.a); - TRACE("Power %.8e.\n", material->Power); + TRACE("diffuse {%.8e, %.8e, %.8e, %.8e}\n", + material->diffuse.r, material->diffuse.g, + material->diffuse.b, material->diffuse.a); + TRACE("ambient {%.8e, %.8e, %.8e, %.8e}\n", + material->ambient.r, material->ambient.g, + material->ambient.b, material->ambient.a); + TRACE("specular {%.8e, %.8e, %.8e, %.8e}\n", + material->specular.r, material->specular.g, + material->specular.b, material->specular.a); + TRACE("emissive {%.8e, %.8e, %.8e, %.8e}\n", + material->emissive.r, material->emissive.g, + material->emissive.b, material->emissive.a); + TRACE("power %.8e.\n", material->power); return WINED3D_OK; } diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 5fbb04285a5..7675cd212ce 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -656,10 +656,10 @@ static void state_specularenable(struct wined3d_context *context, const struct w TRACE("Setting specular enable state and materials\n"); if (state->render_states[WINED3DRS_SPECULARENABLE]) { - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float *)&state->material.Specular); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float *)&state->material.specular); checkGLcall("glMaterialfv"); - if (state->material.Power > gl_info->limits.shininess) + if (state->material.power > gl_info->limits.shininess) { /* glMaterialf man page says that the material says that GL_SHININESS must be between 0.0 * and 128.0, although in d3d neither -1 nor 129 produce an error. GL_NV_max_light_exponent @@ -667,12 +667,12 @@ static void state_specularenable(struct wined3d_context *context, const struct w * value reported by the extension, otherwise 128. For values > gl_info->limits.shininess clamp * them, it should be safe to do so without major visual distortions. */ - WARN("Material power = %.8e, limit %.8e\n", state->material.Power, gl_info->limits.shininess); + WARN("Material power = %.8e, limit %.8e\n", state->material.power, gl_info->limits.shininess); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, gl_info->limits.shininess); } else { - glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, state->material.Power); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, state->material.power); } checkGLcall("glMaterialf(GL_SHININESS)"); @@ -716,24 +716,24 @@ static void state_specularenable(struct wined3d_context *context, const struct w } } - TRACE("Diffuse {%.8e, %.8e, %.8e, %.8e}\n", - state->material.Diffuse.r, state->material.Diffuse.g, - state->material.Diffuse.b, state->material.Diffuse.a); - TRACE("Ambient {%.8e, %.8e, %.8e, %.8e}\n", - state->material.Ambient.r, state->material.Ambient.g, - state->material.Ambient.b, state->material.Ambient.a); - TRACE("Specular {%.8e, %.8e, %.8e, %.8e}\n", - state->material.Specular.r, state->material.Specular.g, - state->material.Specular.b, state->material.Specular.a); - TRACE("Emissive {%.8e, %.8e, %.8e, %.8e}\n", - state->material.Emissive.r, state->material.Emissive.g, - state->material.Emissive.b, state->material.Emissive.a); + TRACE("diffuse {%.8e, %.8e, %.8e, %.8e}\n", + state->material.diffuse.r, state->material.diffuse.g, + state->material.diffuse.b, state->material.diffuse.a); + TRACE("ambient {%.8e, %.8e, %.8e, %.8e}\n", + state->material.ambient.r, state->material.ambient.g, + state->material.ambient.b, state->material.ambient.a); + TRACE("specular {%.8e, %.8e, %.8e, %.8e}\n", + state->material.specular.r, state->material.specular.g, + state->material.specular.b, state->material.specular.a); + TRACE("emissive {%.8e, %.8e, %.8e, %.8e}\n", + state->material.emissive.r, state->material.emissive.g, + state->material.emissive.b, state->material.emissive.a); - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.Ambient); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient); checkGLcall("glMaterialfv(GL_AMBIENT)"); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.Diffuse); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.diffuse); checkGLcall("glMaterialfv(GL_DIFFUSE)"); - glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float *)&state->material.Emissive); + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float *)&state->material.emissive); checkGLcall("glMaterialfv(GL_EMISSION)"); } @@ -1272,23 +1272,23 @@ static void state_colormat(struct wined3d_context *context, const struct wined3d * tracking with glColorMaterial, so apply those here. */ switch (context->tracking_parm) { case GL_AMBIENT_AND_DIFFUSE: - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.Ambient); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.Diffuse); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.diffuse); checkGLcall("glMaterialfv"); break; case GL_DIFFUSE: - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.Diffuse); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float *)&state->material.diffuse); checkGLcall("glMaterialfv"); break; case GL_AMBIENT: - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.Ambient); + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient); checkGLcall("glMaterialfv"); break; case GL_EMISSION: - glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float *)&state->material.Emissive); + glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, (float *)&state->material.emissive); checkGLcall("glMaterialfv"); break; @@ -1296,9 +1296,11 @@ static void state_colormat(struct wined3d_context *context, const struct wined3d /* Only change material color if specular is enabled, otherwise it is set to black */ if (state->render_states[WINED3DRS_SPECULARENABLE]) { - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float *)&state->material.Specular); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float *)&state->material.specular); checkGLcall("glMaterialfv"); - } else { + } + else + { static const GLfloat black[] = {0.0f, 0.0f, 0.0f, 0.0f}; glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, &black[0]); checkGLcall("glMaterialfv"); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f6fb85e74a4..7a22faf2626 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2279,7 +2279,7 @@ struct wined3d_state struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1]; double clip_planes[MAX_CLIPPLANES][4]; - WINED3DMATERIAL material; + struct wined3d_material material; WINED3DVIEWPORT viewport; RECT scissor_rect; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 5b44200e28d..11b85f1066c 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1564,14 +1564,14 @@ struct wined3d_light float phi; }; -typedef struct _WINED3DMATERIAL +struct wined3d_material { - struct wined3d_color Diffuse; - struct wined3d_color Ambient; - struct wined3d_color Specular; - struct wined3d_color Emissive; - float Power; -} WINED3DMATERIAL; + struct wined3d_color diffuse; + struct wined3d_color ambient; + struct wined3d_color specular; + struct wined3d_color emissive; + float power; +}; typedef struct _WINED3DVIEWPORT { @@ -2217,7 +2217,7 @@ HRESULT __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *dev HRESULT __cdecl wined3d_device_get_light(const struct wined3d_device *device, UINT light_idx, struct wined3d_light *light); HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *device, UINT light_idx, BOOL *enable); -HRESULT __cdecl wined3d_device_get_material(const struct wined3d_device *device, WINED3DMATERIAL *material); +HRESULT __cdecl wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material); float __cdecl wined3d_device_get_npatch_mode(const struct wined3d_device *device); struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(const struct wined3d_device *device); void __cdecl wined3d_device_get_primitive_type(const struct wined3d_device *device, @@ -2296,7 +2296,7 @@ HRESULT __cdecl wined3d_device_set_index_buffer(struct wined3d_device *device, HRESULT __cdecl wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const struct wined3d_light *light); HRESULT __cdecl wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable); -HRESULT __cdecl wined3d_device_set_material(struct wined3d_device *device, const WINED3DMATERIAL *material); +HRESULT __cdecl wined3d_device_set_material(struct wined3d_device *device, const struct wined3d_material *material); void __cdecl wined3d_device_set_multithreaded(struct wined3d_device *device); HRESULT __cdecl wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments); HRESULT __cdecl wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader);