wined3d: Get rid of the WINED3DVIEWPORT typedef.

This commit is contained in:
Henri Verbeet 2011-11-21 18:48:40 +01:00 committed by Alexandre Julliard
parent 14cf780fde
commit be8917cd91
9 changed files with 71 additions and 71 deletions

View File

@ -1279,9 +1279,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetViewport(IDirect3DDevice8 *iface,
TRACE("iface %p, viewport %p.\n", iface, pViewport); TRACE("iface %p, viewport %p.\n", iface, pViewport);
/* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */ /* Note: D3DVIEWPORT8 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_set_viewport(This->wined3d_device, (const WINED3DVIEWPORT *)pViewport); hr = wined3d_device_set_viewport(This->wined3d_device, (const struct wined3d_viewport *)pViewport);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
@ -1295,9 +1295,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetViewport(IDirect3DDevice8 *iface,
TRACE("iface %p, viewport %p.\n", iface, pViewport); TRACE("iface %p, viewport %p.\n", iface, pViewport);
/* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */ /* Note: D3DVIEWPORT8 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_get_viewport(This->wined3d_device, (WINED3DVIEWPORT *)pViewport); hr = wined3d_device_get_viewport(This->wined3d_device, (struct wined3d_viewport *)pViewport);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;

View File

@ -1297,9 +1297,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(IDirect3DDevice9Ex *iface
TRACE("iface %p, viewport %p.\n", iface, pViewport); TRACE("iface %p, viewport %p.\n", iface, pViewport);
/* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */ /* Note: D3DVIEWPORT9 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_set_viewport(This->wined3d_device, (const WINED3DVIEWPORT *)pViewport); hr = wined3d_device_set_viewport(This->wined3d_device, (const struct wined3d_viewport *)pViewport);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
@ -1313,9 +1313,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetViewport(IDirect3DDevice9Ex *iface
TRACE("iface %p, viewport %p.\n", iface, pViewport); TRACE("iface %p, viewport %p.\n", iface, pViewport);
/* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */ /* Note: D3DVIEWPORT9 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_get_viewport(This->wined3d_device, (WINED3DVIEWPORT *)pViewport); hr = wined3d_device_get_viewport(This->wined3d_device, (struct wined3d_viewport *)pViewport);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;

View File

@ -5151,9 +5151,9 @@ IDirect3DDeviceImpl_7_SetViewport(IDirect3DDevice7 *iface,
if(!Data) if(!Data)
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
/* Note: D3DVIEWPORT7 is compatible with WINED3DVIEWPORT */ /* Note: D3DVIEWPORT7 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_set_viewport(This->wined3d_device, (WINED3DVIEWPORT *)Data); hr = wined3d_device_set_viewport(This->wined3d_device, (struct wined3d_viewport *)Data);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
@ -5208,9 +5208,9 @@ IDirect3DDeviceImpl_7_GetViewport(IDirect3DDevice7 *iface,
if(!Data) if(!Data)
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
/* Note: D3DVIEWPORT7 is compatible with WINED3DVIEWPORT */ /* Note: D3DVIEWPORT7 is compatible with struct wined3d_viewport. */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_get_viewport(This->wined3d_device, (WINED3DVIEWPORT *)Data); hr = wined3d_device_get_viewport(This->wined3d_device, (struct wined3d_viewport *)Data);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr_ddraw_from_wined3d(hr); return hr_ddraw_from_wined3d(hr);

View File

@ -2407,11 +2407,11 @@ INT CDECL wined3d_device_get_base_vertex_index(const struct wined3d_device *devi
return device->stateBlock->state.base_vertex_index; return device->stateBlock->state.base_vertex_index;
} }
HRESULT CDECL wined3d_device_set_viewport(struct wined3d_device *device, const WINED3DVIEWPORT *viewport) HRESULT CDECL wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport)
{ {
TRACE("device %p, viewport %p.\n", device, viewport); TRACE("device %p, viewport %p.\n", device, viewport);
TRACE("x %u, y %u, w %u, h %u, minz %.8e, maxz %.8e.\n", TRACE("x %u, y %u, w %u, h %u, min_z %.8e, max_z %.8e.\n",
viewport->X, viewport->Y, viewport->Width, viewport->Height, viewport->MinZ, viewport->MaxZ); viewport->x, viewport->y, viewport->width, viewport->height, viewport->min_z, viewport->max_z);
device->updateStateBlock->changed.viewport = TRUE; device->updateStateBlock->changed.viewport = TRUE;
device->updateStateBlock->state.viewport = *viewport; device->updateStateBlock->state.viewport = *viewport;
@ -2428,7 +2428,7 @@ HRESULT CDECL wined3d_device_set_viewport(struct wined3d_device *device, const W
return WINED3D_OK; return WINED3D_OK;
} }
HRESULT CDECL wined3d_device_get_viewport(const struct wined3d_device *device, WINED3DVIEWPORT *viewport) HRESULT CDECL wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport)
{ {
TRACE("device %p, viewport %p.\n", device, viewport); TRACE("device %p, viewport %p.\n", device, viewport);
@ -3202,8 +3202,8 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL; char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL;
struct wined3d_matrix mat, proj_mat, view_mat, world_mat; struct wined3d_matrix mat, proj_mat, view_mat, world_mat;
struct wined3d_viewport vp;
unsigned int i; unsigned int i;
WINED3DVIEWPORT vp;
BOOL doClip; BOOL doClip;
DWORD numTextures; DWORD numTextures;
@ -3289,8 +3289,8 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
/* Get the viewport */ /* Get the viewport */
wined3d_device_get_viewport(device, &vp); wined3d_device_get_viewport(device, &vp);
TRACE("Viewport: X=%d, Y=%d, Width=%d, Height=%d, MinZ=%f, MaxZ=%f\n", TRACE("viewport x %u, y %u, width %u, height %u, min_z %.8e, max_z %.8e.\n",
vp.X, vp.Y, vp.Width, vp.Height, vp.MinZ, vp.MaxZ); vp.x, vp.y, vp.width, vp.height, vp.min_z, vp.max_z);
multiply_matrix(&mat,&view_mat,&world_mat); multiply_matrix(&mat,&view_mat,&world_mat);
multiply_matrix(&mat,&proj_mat,&mat); multiply_matrix(&mat,&proj_mat,&mat);
@ -3359,13 +3359,13 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
y *= -1; y *= -1;
x *= vp.Width / 2; x *= vp.width / 2;
y *= vp.Height / 2; y *= vp.height / 2;
z *= vp.MaxZ - vp.MinZ; z *= vp.max_z - vp.min_z;
x += vp.Width / 2 + vp.X; x += vp.width / 2 + vp.x;
y += vp.Height / 2 + vp.Y; y += vp.height / 2 + vp.y;
z += vp.MinZ; z += vp.min_z;
rhw = 1 / rhw; rhw = 1 / rhw;
} else { } else {
@ -4912,18 +4912,18 @@ HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device,
/* Set the viewport and scissor rectangles, if requested. Tests show /* Set the viewport and scissor rectangles, if requested. Tests show
* that stateblock recording is ignored, the change goes directly * that stateblock recording is ignored, the change goes directly
* into the primary stateblock. */ * into the primary stateblock. */
device->stateBlock->state.viewport.Height = device->fb.render_targets[0]->resource.height; device->stateBlock->state.viewport.height = device->fb.render_targets[0]->resource.height;
device->stateBlock->state.viewport.Width = device->fb.render_targets[0]->resource.width; device->stateBlock->state.viewport.width = device->fb.render_targets[0]->resource.width;
device->stateBlock->state.viewport.X = 0; device->stateBlock->state.viewport.x = 0;
device->stateBlock->state.viewport.Y = 0; device->stateBlock->state.viewport.y = 0;
device->stateBlock->state.viewport.MaxZ = 1.0f; device->stateBlock->state.viewport.max_z = 1.0f;
device->stateBlock->state.viewport.MinZ = 0.0f; device->stateBlock->state.viewport.min_z = 0.0f;
device_invalidate_state(device, STATE_VIEWPORT); device_invalidate_state(device, STATE_VIEWPORT);
device->stateBlock->state.scissor_rect.top = 0; device->stateBlock->state.scissor_rect.top = 0;
device->stateBlock->state.scissor_rect.left = 0; device->stateBlock->state.scissor_rect.left = 0;
device->stateBlock->state.scissor_rect.right = device->stateBlock->state.viewport.Width; device->stateBlock->state.scissor_rect.right = device->stateBlock->state.viewport.width;
device->stateBlock->state.scissor_rect.bottom = device->stateBlock->state.viewport.Height; device->stateBlock->state.scissor_rect.bottom = device->stateBlock->state.viewport.height;
device_invalidate_state(device, STATE_SCISSORRECT); device_invalidate_state(device, STATE_SCISSORRECT);
} }

View File

@ -1444,8 +1444,8 @@ static void state_pscale(struct wined3d_context *context, const struct wined3d_s
if (state->render_states[WINED3DRS_POINTSCALEENABLE]) if (state->render_states[WINED3DRS_POINTSCALEENABLE])
{ {
DWORD h = state->viewport.height;
GLfloat scaleFactor; GLfloat scaleFactor;
DWORD h = state->viewport.Height;
if (pointSize.f < gl_info->limits.pointsize_min) if (pointSize.f < gl_info->limits.pointsize_min)
{ {
@ -3909,10 +3909,10 @@ static void transform_projection(struct wined3d_context *context, const struct w
if (context->last_was_rhw) if (context->last_was_rhw)
{ {
/* Transform D3D RHW coordinates to OpenGL clip coordinates. */ /* Transform D3D RHW coordinates to OpenGL clip coordinates. */
double x = state->viewport.X; double x = state->viewport.x;
double y = state->viewport.Y; double y = state->viewport.y;
double w = state->viewport.Width; double w = state->viewport.width;
double h = state->viewport.Height; double h = state->viewport.height;
double x_scale = 2.0 / w; double x_scale = 2.0 / w;
double x_offset = ((63.0 / 64.0) - (2.0 * x) - w) / w; double x_offset = ((63.0 / 64.0) - (2.0 * x) - w) / w;
double y_scale = context->render_offscreen ? 2.0 / h : 2.0 / -h; double y_scale = context->render_offscreen ? 2.0 / h : 2.0 / -h;
@ -3933,10 +3933,10 @@ static void transform_projection(struct wined3d_context *context, const struct w
else else
{ {
double y_scale = context->render_offscreen ? -1.0 : 1.0; double y_scale = context->render_offscreen ? -1.0 : 1.0;
double x_offset = (63.0 / 64.0) / state->viewport.Width; double x_offset = (63.0 / 64.0) / state->viewport.width;
double y_offset = context->render_offscreen double y_offset = context->render_offscreen
? (63.0 / 64.0) / state->viewport.Height ? (63.0 / 64.0) / state->viewport.height
: -(63.0 / 64.0) / state->viewport.Height; : -(63.0 / 64.0) / state->viewport.height;
const GLdouble projection[] = const GLdouble projection[] =
{ {
1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0,
@ -4590,28 +4590,28 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine
static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{ {
const struct wined3d_surface *target = state->fb->render_targets[0]; const struct wined3d_surface *target = state->fb->render_targets[0];
WINED3DVIEWPORT vp = state->viewport; struct wined3d_viewport vp = state->viewport;
if (vp.Width > target->resource.width) if (vp.width > target->resource.width)
vp.Width = target->resource.width; vp.width = target->resource.width;
if (vp.Height > target->resource.height) if (vp.height > target->resource.height)
vp.Height = target->resource.height; vp.height = target->resource.height;
glDepthRange(vp.MinZ, vp.MaxZ); glDepthRange(vp.min_z, vp.max_z);
checkGLcall("glDepthRange"); checkGLcall("glDepthRange");
/* Note: GL requires lower left, DirectX supplies upper left. This is /* Note: GL requires lower left, DirectX supplies upper left. This is
* reversed when using offscreen rendering. */ * reversed when using offscreen rendering. */
if (context->render_offscreen) if (context->render_offscreen)
{ {
glViewport(vp.X, vp.Y, vp.Width, vp.Height); glViewport(vp.x, vp.y, vp.width, vp.height);
} }
else else
{ {
UINT width, height; UINT width, height;
target->get_drawable_size(context, &width, &height); target->get_drawable_size(context, &width, &height);
glViewport(vp.X, (height - (vp.Y + vp.Height)), glViewport(vp.x, (height - (vp.y + vp.height)),
vp.Width, vp.Height); vp.width, vp.height);
} }
checkGLcall("glViewport"); checkGLcall("glViewport");

View File

@ -1304,12 +1304,12 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
} }
/* Set the default viewport */ /* Set the default viewport */
state->viewport.X = 0; state->viewport.x = 0;
state->viewport.Y = 0; state->viewport.y = 0;
state->viewport.Width = swapchain->presentParms.BackBufferWidth; state->viewport.width = swapchain->presentParms.BackBufferWidth;
state->viewport.Height = swapchain->presentParms.BackBufferHeight; state->viewport.height = swapchain->presentParms.BackBufferHeight;
state->viewport.MinZ = 0.0f; state->viewport.min_z = 0.0f;
state->viewport.MaxZ = 1.0f; state->viewport.max_z = 1.0f;
wined3d_swapchain_decref(swapchain); wined3d_swapchain_decref(swapchain);
} }

View File

@ -3374,9 +3374,9 @@ const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *g
void wined3d_get_draw_rect(const struct wined3d_state *state, RECT *rect) void wined3d_get_draw_rect(const struct wined3d_state *state, RECT *rect)
{ {
const WINED3DVIEWPORT *vp = &state->viewport; const struct wined3d_viewport *vp = &state->viewport;
SetRect(rect, vp->X, vp->Y, vp->X + vp->Width, vp->Y + vp->Height); SetRect(rect, vp->x, vp->y, vp->x + vp->width, vp->y + vp->height);
if (state->render_states[WINED3DRS_SCISSORTESTENABLE]) if (state->render_states[WINED3DRS_SCISSORTESTENABLE])
IntersectRect(rect, rect, &state->scissor_rect); IntersectRect(rect, rect, &state->scissor_rect);

View File

@ -2283,7 +2283,7 @@ struct wined3d_state
struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1]; struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1];
double clip_planes[MAX_CLIPPLANES][4]; double clip_planes[MAX_CLIPPLANES][4];
struct wined3d_material material; struct wined3d_material material;
WINED3DVIEWPORT viewport; struct wined3d_viewport viewport;
RECT scissor_rect; RECT scissor_rect;
/* Light hashmap . Collisions are handled using standard wine double linked lists */ /* Light hashmap . Collisions are handled using standard wine double linked lists */
@ -2699,8 +2699,8 @@ static inline void shader_get_position_fixup(const struct wined3d_context *conte
{ {
position_fixup[0] = 1.0f; position_fixup[0] = 1.0f;
position_fixup[1] = 1.0f; position_fixup[1] = 1.0f;
position_fixup[2] = (63.0f / 64.0f) / state->viewport.Width; position_fixup[2] = (63.0f / 64.0f) / state->viewport.width;
position_fixup[3] = -(63.0f / 64.0f) / state->viewport.Height; position_fixup[3] = -(63.0f / 64.0f) / state->viewport.height;
if (context->render_offscreen) if (context->render_offscreen)
{ {

View File

@ -1573,15 +1573,15 @@ struct wined3d_material
float power; float power;
}; };
typedef struct _WINED3DVIEWPORT struct wined3d_viewport
{ {
DWORD X; UINT x;
DWORD Y; UINT y;
DWORD Width; UINT width;
DWORD Height; UINT height;
float MinZ; float min_z;
float MaxZ; float max_z;
} WINED3DVIEWPORT; };
typedef struct _WINED3DGAMMARAMP typedef struct _WINED3DGAMMARAMP
{ {
@ -2256,7 +2256,7 @@ HRESULT __cdecl wined3d_device_get_transform(const struct wined3d_device *device
HRESULT __cdecl wined3d_device_get_vertex_declaration(const struct wined3d_device *device, HRESULT __cdecl wined3d_device_get_vertex_declaration(const struct wined3d_device *device,
struct wined3d_vertex_declaration **declaration); struct wined3d_vertex_declaration **declaration);
struct wined3d_shader * __cdecl wined3d_device_get_vertex_shader(const struct wined3d_device *device); struct wined3d_shader * __cdecl wined3d_device_get_vertex_shader(const struct wined3d_device *device);
HRESULT __cdecl wined3d_device_get_viewport(const struct wined3d_device *device, WINED3DVIEWPORT *viewport); HRESULT __cdecl wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport);
HRESULT __cdecl wined3d_device_get_vs_consts_b(const struct wined3d_device *device, HRESULT __cdecl wined3d_device_get_vs_consts_b(const struct wined3d_device *device,
UINT start_register, BOOL *constants, UINT bool_count); UINT start_register, BOOL *constants, UINT bool_count);
HRESULT __cdecl wined3d_device_get_vs_consts_f(const struct wined3d_device *device, HRESULT __cdecl wined3d_device_get_vs_consts_f(const struct wined3d_device *device,
@ -2326,7 +2326,7 @@ HRESULT __cdecl wined3d_device_set_transform(struct wined3d_device *device,
HRESULT __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device, HRESULT __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device,
struct wined3d_vertex_declaration *declaration); struct wined3d_vertex_declaration *declaration);
HRESULT __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader); HRESULT __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader);
HRESULT __cdecl wined3d_device_set_viewport(struct wined3d_device *device, const WINED3DVIEWPORT *viewport); HRESULT __cdecl wined3d_device_set_viewport(struct wined3d_device *device, const struct wined3d_viewport *viewport);
HRESULT __cdecl wined3d_device_set_vs_consts_b(struct wined3d_device *device, HRESULT __cdecl wined3d_device_set_vs_consts_b(struct wined3d_device *device,
UINT start_register, const BOOL *constants, UINT bool_count); UINT start_register, const BOOL *constants, UINT bool_count);
HRESULT __cdecl wined3d_device_set_vs_consts_f(struct wined3d_device *device, HRESULT __cdecl wined3d_device_set_vs_consts_f(struct wined3d_device *device,