Avoid setting and resetting the same values when there are many

rectangles.
This commit is contained in:
Jason Edmeades 2003-05-22 03:35:24 +00:00 committed by Alexandre Julliard
parent f644c787ee
commit 7f53bb8f8c
1 changed files with 46 additions and 42 deletions

View File

@ -2184,20 +2184,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count
curRect = NULL;
}
for (i = 0; i < Count || i == 0; i++) {
if (curRect) {
/* Note gl uses lower left, width/height */
TRACE("(%p) %p Rect=(%ld,%ld)->(%ld,%ld) glRect=(%ld,%ld), len=%ld, hei=%ld\n", This, curRect,
curRect->x1, curRect->y1, curRect->x2, curRect->y2,
curRect->x1, (This->PresentParms.BackBufferHeight - curRect->y2),
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
glScissor(curRect->x1, (This->PresentParms.BackBufferHeight - curRect->y2),
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
checkGLcall("glScissor");
}
/* Clear the whole screen */
/* Only set the values up once, as they are not changing */
if (Flags & D3DCLEAR_STENCIL) {
glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &old_stencil_clear_value);
glClearStencil(Stencil);
@ -2225,9 +2212,29 @@ HRESULT WINAPI IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count
glMask = glMask | GL_COLOR_BUFFER_BIT;
}
/* Now process each rect in turn */
for (i = 0; i < Count || i == 0; i++) {
if (curRect) {
/* Note gl uses lower left, width/height */
TRACE("(%p) %p Rect=(%ld,%ld)->(%ld,%ld) glRect=(%ld,%ld), len=%ld, hei=%ld\n", This, curRect,
curRect->x1, curRect->y1, curRect->x2, curRect->y2,
curRect->x1, (This->PresentParms.BackBufferHeight - curRect->y2),
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
glScissor(curRect->x1, (This->PresentParms.BackBufferHeight - curRect->y2),
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
checkGLcall("glScissor");
}
/* Clear the selected rectangle (or full screen) */
glClear(glMask);
checkGLcall("glClear");
/* Step to the next rectangle */
if (curRect) curRect = curRect + sizeof(D3DRECT);
}
/* Restore the old values (why..?) */
if (Flags & D3DCLEAR_STENCIL) {
glClearStencil(old_stencil_clear_value);
}
@ -2242,9 +2249,6 @@ HRESULT WINAPI IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count
old_color_clear_value[3]);
}
if (curRect) curRect = curRect + sizeof(D3DRECT);
}
if (Count > 0 && pRects) {
glDisable(GL_SCISSOR_TEST);
checkGLcall("glDisable");