Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/wined3d/state.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index c869b63b11..1305ea9034 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -4046,13 +4046,21 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
if (gl_info->supported[ARB_VIEWPORT_ARRAY]) { + GLdouble depth_ranges[2 * WINED3D_MAX_VIEWPORTS]; + GLfloat viewports[4 * WINED3D_MAX_VIEWPORTS]; + unsigned int i, reset_count = 0;
get_viewports(context, state, state->viewport_count, vp); for (i = 0; i < state->viewport_count; ++i) { - GL_EXTCALL(glDepthRangeIndexed(i, vp[i].min_z, vp[i].max_z)); - GL_EXTCALL(glViewportIndexedf(i, vp[i].x, vp[i].y, vp[i].width, vp[i].height)); + depth_ranges[i * 2] = vp[i].min_z; + depth_ranges[i * 2 + 1] = vp[i].max_z; + + viewports[i * 4] = vp[i].x; + viewports[i * 4 + 1] = vp[i].y; + viewports[i * 4 + 2] = vp[i].width; + viewports[i * 4 + 3] = vp[i].height; }
if (context->viewport_count > state->viewport_count) @@ -4060,12 +4068,12 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wine
if (reset_count) { - static const GLfloat reset[4 * WINED3D_MAX_VIEWPORTS]; - static const GLdouble resetd[2 * WINED3D_MAX_VIEWPORTS]; - - GL_EXTCALL(glDepthRangeArrayv(state->viewport_count, reset_count, resetd)); - GL_EXTCALL(glViewportArrayv(state->viewport_count, reset_count, reset)); + memset(&depth_ranges[state->viewport_count * 2], 0, reset_count * 2 * sizeof(*depth_ranges)); + memset(&viewports[state->viewport_count * 4], 0, reset_count * 4 * sizeof(*viewports)); } + + GL_EXTCALL(glDepthRangeArrayv(0, state->viewport_count + reset_count, depth_ranges)); + GL_EXTCALL(glViewportArrayv(0, state->viewport_count + reset_count, viewports)); context->viewport_count = state->viewport_count; } else @@ -4085,6 +4093,8 @@ static void viewport_miscpart_cc(struct wined3d_context *context, & WINED3D_PIXEL_CENTER_INTEGER ? 63.0f / 128.0f : -1.0f / 128.0f; const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp[WINED3D_MAX_VIEWPORTS]; + GLdouble depth_ranges[2 * WINED3D_MAX_VIEWPORTS]; + GLfloat viewports[4 * WINED3D_MAX_VIEWPORTS]; unsigned int i, reset_count = 0;
get_viewports(context, state, state->viewport_count, vp); @@ -4095,8 +4105,14 @@ static void viewport_miscpart_cc(struct wined3d_context *context, { vp[i].x += pixel_center_offset; vp[i].y += pixel_center_offset; - GL_EXTCALL(glDepthRangeIndexed(i, vp[i].min_z, vp[i].max_z)); - GL_EXTCALL(glViewportIndexedf(i, vp[i].x, vp[i].y, vp[i].width, vp[i].height)); + + depth_ranges[i * 2] = vp[i].min_z; + depth_ranges[i * 2 + 1] = vp[i].max_z; + + viewports[i * 4 ] = vp[i].x + pixel_center_offset; + viewports[i * 4 + 1] = vp[i].y + pixel_center_offset; + viewports[i * 4 + 2] = vp[i].width; + viewports[i * 4 + 3] = vp[i].height; }
if (context->viewport_count > state->viewport_count) @@ -4104,12 +4120,12 @@ static void viewport_miscpart_cc(struct wined3d_context *context,
if (reset_count) { - static const GLfloat reset[4 * WINED3D_MAX_VIEWPORTS]; - static const GLdouble resetd[2 * WINED3D_MAX_VIEWPORTS]; - - GL_EXTCALL(glDepthRangeArrayv(state->viewport_count, reset_count, resetd)); - GL_EXTCALL(glViewportArrayv(state->viewport_count, reset_count, reset)); + memset(&depth_ranges[state->viewport_count * 2], 0, reset_count * 2 * sizeof(*depth_ranges)); + memset(&viewports[state->viewport_count * 4], 0, reset_count * 4 * sizeof(*viewports)); } + + GL_EXTCALL(glDepthRangeArrayv(0, state->viewport_count + reset_count, depth_ranges)); + GL_EXTCALL(glViewportArrayv(0, state->viewport_count + reset_count, viewports)); context->viewport_count = state->viewport_count;
checkGLcall("setting clip space and viewport");